-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented test for ir feature #259
Changes from 14 commits
496eb87
6a3ee7f
8b4d117
74946aa
49f6a9f
89efb8d
6eac3e3
f338328
6042687
c30cd7c
a2442c6
211ea6f
e4d7b4d
e272ec5
4a4db78
d88c731
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2021-2024 Yegor Bugayenko | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
set -e | ||
set -o pipefail | ||
|
||
output=$(realpath "$2") | ||
|
||
# TODO: #259 REPLACE WITH ACTUAL METRIC CODE | ||
echo "IR 0.000 " >"${output}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2317 | ||
# TODO: #259 REMOVE SHELLCHECK DISABLE RIGHT AFTER IMPLEMENTING ir.sh | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2021-2024 Yegor Bugayenko | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
set -e | ||
set -o pipefail | ||
|
||
# TODO: #259 ENABLE THIS TESTS RIGHT AFTER IMPLEMENTING ir.sh VIA REMOVING `exit 0` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zaqbez39me if you use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Thanks, will follow it |
||
exit 0 | ||
|
||
temp=$1 | ||
stdout=$2 | ||
|
||
{ | ||
tmp=$(mktemp -d /tmp/XXXX) | ||
cd "${tmp}" | ||
mkdir -p "${LOCAL}/${temp}" | ||
if ! "${LOCAL}/metrics/ir.sh" ./ "${LOCAL}/${temp}/stdout" | ||
then | ||
exit 1 | ||
fi | ||
} > "${stdout}" 2>&1 | ||
echo "👍🏻 Failed in non-git directory" | ||
|
||
{ | ||
tmp=$(mktemp -d /tmp/XXXX) | ||
cd "${tmp}" | ||
rm -rf ./* | ||
rm -rf .git | ||
git init --quiet . | ||
git config user.email 'foo@example.com' | ||
git config user.name 'Foo' | ||
if ! "${LOCAL}/metrics/ir.sh" ./ "t0" | ||
then | ||
exit 1 | ||
fi | ||
file1="one.java" | ||
file2="two.java" | ||
touch "${file1}" | ||
git add "${file1}" | ||
git config commit.gpgsign false | ||
git commit --quiet -m "first file" | ||
"${LOCAL}/metrics/ir.sh" ./ "t1" | ||
touch "${file2}" | ||
git add "${file2}" | ||
git commit --quiet -m "second file" | ||
"${LOCAL}/metrics/ir.sh" ./ "t2" | ||
grep "IR 1" "t1" # Single file in repo | ||
grep "IR 0.5 " "t2" # Two files in repo | ||
} > "${stdout}" 2>&1 | ||
echo "👍🏻 Correctly calculated the IR (Impact Ratio)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zaqbez39me remove this TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yegor256 removed it