Skip to content

Commit

Permalink
Path Configuration / Profile
Browse files Browse the repository at this point in the history
Check-lint will now check for config file
avocado_static_checks.conf one directory above
as the submodule is placed into the root of the
directory. If the file is not present it will return
back to the old method.

Reference:      #5
Signed-off-by:  <[email protected]>
  • Loading branch information
harvey0100 committed Aug 2, 2024
1 parent 02ad522 commit 39d7c1a
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions check-lint
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
#!/bin/sh -e

TOOL_CMD=pylint
PATH=$(basename $0)/utils:$PATH
CONFIG_FILE="../.avocado_static_checks.conf"
DEFAULT_CONFIG_PATH="default_configs/pylintrc"
CONFIG_PATH="$(dirname $0)/default_configs/pylintrc"

get_config() {
local file_path="$1"
if [ -f "$CONFIG_FILE" ]; then
while IFS=':' read -r pattern config; do
if [[ "$file_path" == $pattern* ]]; then
echo "$config"
return
fi
done < "$CONFIG_FILE"
fi
echo "$DEFAULT_CONFIG_PATH"
}

FILES=$(git ls-files '*.py')

echo "** Running $TOOL_CMD (using config from $CONFIG_PATH)..."
python3 -m pylint --rcfile=$CONFIG_PATH $FILES
for file in $FILES; do
CONFIG_PATH=$(get_config "$file")
echo "** Running pylint (using config from $CONFIG_PATH) on $file..."
python3 -m pylint --rcfile="$CONFIG_PATH" "$file"
done

0 comments on commit 39d7c1a

Please sign in to comment.