-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
208 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Delete empty bear directories | ||
set -e | ||
|
||
dirs=$(find bears -depth -type d -and -not -name '__pycache__') | ||
|
||
for dir in $dirs; do | ||
bears=$(ls $dir/*Bear.py 2>/dev/null || true) | ||
subdirs=$(ls -d $dir/*/ 2>/dev/null || true) | ||
if [[ -z "$bears""$subdirs" ]]; then | ||
echo Removing $dir | ||
rm -rf $dir | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Delete bears | ||
set -e | ||
|
||
if [[ "$BEARS" == "all" ]]; then | ||
echo "No bears pruned." | ||
exit 0 | ||
fi | ||
|
||
bears=$(find bears -type f -and -name '*Bear.py' | sort) | ||
|
||
yield_result_bears=$(grep -m 1 -l 'yield Result' $bears) | ||
|
||
non_yield_result_bears=$(comm -23 <(ls $bears) <(ls $yield_result_bears)) | ||
|
||
requirement_bears=$(grep -m 1 -l 'Requirement(' $bears) | ||
|
||
cabal_requirement_bears=$(grep -m 1 -l CabalRequirement $requirement_bears) | ||
gem_requirement_bears=$(grep -m 1 -l GemRequirement $requirement_bears) | ||
go_requirement_bears=$(grep -m 1 -l GoRequirement $requirement_bears) | ||
npm_requirement_bears=$(grep -m 1 -l NpmRequirement $requirement_bears) | ||
rscript_requirement_bears=$(grep -m 1 -l RscriptRequirement $requirement_bears) | ||
|
||
pip_requirement_bears=$(grep -m 1 -l PipRequirement $requirement_bears) | ||
|
||
non_pip_runtime_requirement_bears="$cabal_requirement_bears $gem_requirement_bears $go_requirement_bears $npm_requirement_bears $rscript_requirement_bears" | ||
|
||
other_requirement_bears=$(comm -23 <(ls $requirement_bears) <(ls $non_pip_runtime_requirement_bears $pip_requirement_bears)) | ||
|
||
distribution_only_bears=$(grep -Pl 'DistributionRequirement\(' $other_requirement_bears) | ||
|
||
# Verify that DistributionRequirement is the only other Requirement subclass used | ||
unknown_requirement_bears=$(grep -Pl '(?<!Distribution)Requirement\(' $other_requirement_bears || true) | ||
|
||
if [[ -n "$unknown_requirement_bears" ]]; then | ||
echo "Unknown requirements for $unknown_requirement_bears" | ||
exit 1 | ||
fi | ||
|
||
pip_only_requirement_bears=$(comm -23 <(ls $pip_requirement_bears) <(ls $non_pip_runtime_requirement_bears)) | ||
pip_plus_requirement_bears=$(comm -23 <(ls $pip_requirement_bears) <(ls $pip_only_requirement_bears)) | ||
|
||
no_requirement_bears=$(comm -23 <(ls $bears) <(ls $requirement_bears)) | ||
|
||
clang_bears='' | ||
other_bears='' | ||
for bear in $no_requirement_bears; do | ||
if [[ ${bear/Clang/} != $bear ]]; then | ||
clang_bears="$clang_bears $bear" | ||
else | ||
other_bears="$other_bears $bear" | ||
fi | ||
done | ||
|
||
executable_linter_bears=$(grep -m 1 -l '@linter(executable=' $other_bears) | ||
executable_other_bears=$(grep -m 1 -l 'run_shell_command' $other_bears) | ||
|
||
other_bears=$(comm -23 <(ls $other_bears) <(ls $executable_linter_bears $executable_other_bears)) | ||
|
||
non_yield_result_other_bears=$(comm -23 <(ls $other_bears) <(ls $yield_result_bears)) | ||
|
||
if [[ -n "$non_yield_result_other_bears" ]]; then | ||
echo "Unknown bear type $non_yield_result_other_bears" | ||
exit 1 | ||
fi | ||
|
||
python_bears="$pip_only_requirement_bears $clang_bears $other_bears" | ||
|
||
non_python_bears=$(comm -23 <(ls $bears) <(ls $python_bears)) | ||
|
||
remove_bears='' | ||
|
||
if [[ $BEARS == "python" ]]; then | ||
# The test for generate_package depends on non-Python bears | ||
remove_bears="$non_python_bears" | ||
elif [[ $BEARS == "npm" ]]; then | ||
remove_bears=$(comm -23 <(ls $bears) <(ls $npm_requirement_bears)) | ||
elif [[ $BEARS == "gem" ]]; then | ||
remove_bears=$(comm -23 <(ls $bears) <(ls $gem_requirement_bears)) | ||
fi | ||
|
||
if [[ -n "$remove_bears" ]]; then | ||
# generate_package.py only needs testing with BEARS=all | ||
remove_bears="bears/generate_package.py $remove_bears" | ||
fi | ||
|
||
for bear in $remove_bears; do | ||
echo Removing $bear | ||
rm $bear | ||
done | ||
|
||
source .ci/bears.dirs.prune.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Delete tests for bears that have been removed | ||
set -e | ||
|
||
bear_tests=$(find tests -type f -and -name '*Test.py') | ||
|
||
for test in tests/generate_packageTest.py $bear_tests; do | ||
bear=${test/Test.py/.py} | ||
bear=${bear/tests/bears} | ||
dir=$(dirname $bear) | ||
if [[ ! -d $dir ]]; then | ||
echo Removing $test | ||
rm -f $test | ||
elif [[ ! -f $bear ]]; then | ||
echo Removing $test | ||
rm -f $test | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,7 @@ class PerlCriticBear: | |
""" | ||
|
||
LANGUAGES = {'Perl'} | ||
REQUIREMENTS = {DistributionRequirement(apt_get='perl'), | ||
DistributionRequirement(apt_get='libperl-critic-perl')} | ||
REQUIREMENTS = {DistributionRequirement(apt_get='libperl-critic-perl')} | ||
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
|