Skip to content
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

Adding basic pylint #546

Merged
merged 11 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
bin/gencode check
pubber/bin/build check
validator/bin/build check
bin/test_pylint
- name: Schema conformance tests
if: ${{ always() }}
run: |
Expand Down
32 changes: 32 additions & 0 deletions bin/test_pylint
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash -e
#
# Run pylint on all the detected python files and compare against the expected list.
# This is far from perfect, but the goal is just to prevent horrible things and to get
# people to at least think about the style of python code. Adding a new python file will
# require people to add another line in the test_pylint.out golden file.
grafnu marked this conversation as resolved.
Show resolved Hide resolved
#

dirs="bin/ etc/ misc/"
files1=$(fgrep -l /python3 -r $dirs)
files2=$(fgrep -l "env python3" -r $dirs)
files3=$(find $dirs -name \*.py)
files=$(ls $files1 $files2 $files3 | sort | uniq | fgrep -v \~)

echo scanning: $files

source venv/bin/activate

LINT_OUT=out/test_pylint.out
LINT_GOLDEN=etc/${LINT_OUT#out/}
RCFILE=etc/pylintrc

rm -f $LINT_OUT
mkdir -p out

for file in $files; do
linty=$(pylint --rcfile=$RCFILE $file | fgrep "rated at" | awk '{print $7}' | sed -e 's/\..*//')
echo $file $linty | tee -a $LINT_OUT
done

echo diff $LINT_OUT $LINT_GOLDEN
diff $LINT_OUT $LINT_GOLDEN
Loading