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

check-lint: add support for subdirectories from config file #9

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

clebergnu
Copy link
Contributor

Currently, when using the "avocado-static-checks.conf" configuration file to specify the pylint configuration for a specific directory, only the files on the immediate directory are used.

This is a problem with complex projects, such as Avocado itself, that have many subdirectories.

With this change, all the Python files in subdirectories starting from the directory given in the "avocado-static-checks.conf" file will be used. The side effect of this change is that, if one intends to use different configurations for different subdirectories, then the base directory must not be given, but all subdirectories starting from where the configuration diverges must be entered in the "avocado-static-checks.conf" file.


Reference: avocado-framework/avocado#5989

@clebergnu clebergnu self-assigned this Sep 11, 2024
@@ -66,15 +66,19 @@ if [ -f "$CONFIG_FILE" ]; then
exit 1
fi

# Get all Python files in the specified directory
FILES=$(git ls-files "$DIRECTORY_PATH/*.py")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @clebergnu, this solution works, but I would prefer a simpler solution git ls-files $DIRECTORY_PATH/ | grep .py what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @clebergnu, this solution works, but I would prefer a simpler solution git ls-files $DIRECTORY_PATH/ | grep .py what do you think?

Works for me as well.

Currently, when using the "avocado-static-checks.conf" configuration
file to specify the pylint configuration for a specific directory,
only the files on the immediate directory are used.

This is a problem with complex projects, such as Avocado itself, that
have many subdirectories.

With this change, all the Python files in subdirectories starting from
the directory given in the "avocado-static-checks.conf" file will be
used.  The side effect of this change is that, if one intends to use
different configurations for different subdirectories, then the base
directory must not be given, but all subdirectories starting from
where the configuration diverges must be entered in the
"avocado-static-checks.conf" file.

Signed-off-by: Cleber Rosa <[email protected]>
Copy link
Contributor

@richtja richtja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants