Skip to content

feat(ci): improve pylint workflow configuration#91

Merged
talltechy merged 3 commits intomainfrom
feature/improve-pylint-workflow
Oct 10, 2025
Merged

feat(ci): improve pylint workflow configuration#91
talltechy merged 3 commits intomainfrom
feature/improve-pylint-workflow

Conversation

@talltechy
Copy link
Owner

Description

This PR improves the pylint GitHub workflow with several critical fixes and enhancements to make it more effective for the project.

Changes Made

Workflow Improvements:

  • ✅ Updated to latest GitHub Actions versions (checkout@v4, setup-python@v5)
  • ✅ Added pip caching for faster CI builds
  • ✅ Changed trigger to only run on main/develop branches and pull requests (reduces unnecessary runs)
  • ✅ Added Python 3.9 and 3.12 to test matrix for complete version coverage
  • ✅ Set minimum pylint score threshold of 8.0/10.0 (enforces quality gate)
  • ✅ Excluded tests directory from main linting (tests need different rules)
  • ✅ Renamed job from 'build' to 'lint' for better clarity

New Configuration:

  • ✅ Created .pylintrc with project-appropriate settings
  • ✅ Disabled overly strict rules (missing-docstring, too-many-*, etc.)
  • ✅ Set max line length to 100 characters
  • ✅ Configured reasonable limits for code complexity
  • ✅ Added common good variable names (i, j, k, df, ui, etc.)

Issues Fixed

  1. Missing configuration: Previously ran with default pylint settings which were too strict
  2. Incomplete Python version coverage: Was missing 3.9 and 3.10 in the matrix
  3. No quality gates: Workflow didn't enforce minimum quality standards
  4. Inefficient CI: No dependency caching, ran on every push to every branch
  5. Outdated actions: Using v3 instead of latest versions

Testing

  • Workflow will run automatically on this PR
  • Tests Python 3.8, 3.9, 3.10, 3.11, and 3.12
  • Enforces minimum pylint score of 8.0

Breaking Changes

None - these are CI/CD improvements only.

Checklist

  • Updated workflow file
  • Created .pylintrc configuration
  • Tested locally
  • Updated documentation (if needed)
  • Follows conventional commit format

- Updated to latest GitHub Actions versions (v4/v5)
- Added pip caching for faster builds
- Changed trigger to only run on main/develop branches and PRs
- Added Python 3.9 and 3.12 to test matrix for complete coverage
- Set minimum pylint score threshold (8.0/10.0)
- Excluded tests directory from linting
- Renamed job from 'build' to 'lint' for clarity
- Created .pylintrc with sensible defaults for the project
- Disabled overly strict pylint rules
- Set max line length to 100 characters
- Configured appropriate limits for code complexity
Copilot AI review requested due to automatic review settings October 10, 2025 16:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the pylint GitHub workflow configuration by adding comprehensive linting rules and improving CI/CD efficiency. The changes establish quality gates and modernize the workflow infrastructure.

  • Added comprehensive .pylintrc configuration with appropriate rules for code quality enforcement
  • Updated GitHub Actions to latest versions and improved CI efficiency with caching
  • Enhanced workflow triggers and Python version matrix coverage

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.pylintrc New pylint configuration file with project-specific rules, quality thresholds, and formatting standards
.github/workflows/pylint.yml Updated workflow with modern actions, improved triggers, caching, and quality gate enforcement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

run: |
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

Installing requirements.txt without checking if it exists could cause the workflow to fail if the file is missing. Consider adding a conditional check or using pip install -r requirements.txt || true to handle cases where requirements.txt doesn't exist.

Suggested change
pip install -r requirements.txt
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

Copilot uses AI. Check for mistakes.
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
pylint --fail-under=8.0 --ignore=tests $(git ls-files '*.py')
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

The --fail-under=8.0 flag is redundant since it's already configured in .pylintrc (line 9). This duplication could lead to confusion if the values differ. Remove the flag from the command line to rely on the configuration file.

Suggested change
pylint --fail-under=8.0 --ignore=tests $(git ls-files '*.py')
pylint --ignore=tests $(git ls-files '*.py')

Copilot uses AI. Check for mistakes.
- Add conditional check for requirements.txt existence
- Remove redundant --fail-under flag (already in .pylintrc)

Addresses Copilot comments on PR #91
@talltechy
Copy link
Owner Author

Addressed Copilot Review Comments

Both Copilot suggestions have been implemented in commit c673b8d:

Comment 1: requirements.txt check

  • Added conditional check: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  • This prevents workflow failure if requirements.txt is missing

Comment 2: Redundant --fail-under flag

  • Removed --fail-under=8.0 from command line
  • The flag is already configured in .pylintrc (line 9)
  • Now relies solely on configuration file to avoid duplication

The workflow file now follows best practices with proper error handling and no configuration duplication.

@talltechy talltechy requested a review from Copilot October 10, 2025 16:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

.pylintrc Outdated
max-module-lines=1000

# String used as indentation unit
indent-string=' '
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

The indent-string should use double quotes instead of single quotes for consistency with other string values in configuration files and to avoid potential parsing issues.

Suggested change
indent-string=' '
indent-string=" "

Copilot uses AI. Check for mistakes.
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

The conditional installation of requirements.txt could fail silently. Consider adding error handling or at least echoing when requirements.txt is not found for better CI transparency.

Suggested change
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements.txt ]; then
echo "requirements.txt found. Installing dependencies..."
pip install -r requirements.txt
else
echo "requirements.txt not found. Skipping dependency installation."
fi

Copilot uses AI. Check for mistakes.
- Changed indent-string to use double quotes in .pylintrc
- Added echo statements for CI transparency when installing dependencies

Addresses new Copilot comments on PR #91
@talltechy
Copy link
Owner Author

Addressed Latest Copilot Review Comments

Two new Copilot suggestions have been implemented in commit 499e8cf:

Comment 3: .pylintrc quote consistency

  • Changed indent-string from single quotes to double quotes
  • Now consistent with standard configuration file conventions
  • Avoids potential parsing issues

Comment 4: CI transparency

  • Added echo statements when installing dependencies
  • Now explicitly logs whether requirements.txt is found or skipped
  • Improves CI log readability and debugging

All Copilot feedback has been addressed. The workflow now has:

  • ✅ Proper error handling
  • ✅ No configuration duplication
  • ✅ Consistent formatting
  • ✅ Better CI transparency

Ready for final review and merge!

@talltechy talltechy merged commit 6d305ab into main Oct 10, 2025
10 of 15 checks passed
@talltechy talltechy deleted the feature/improve-pylint-workflow branch October 10, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant