Skip to content

Commit

Permalink
Merge pull request #138 from RupeshMangalam21/linting-workflow
Browse files Browse the repository at this point in the history
Add automated style/linting checks with Ruff
  • Loading branch information
peterdudfield authored Feb 7, 2025
2 parents e6e77fa + 35bf0bc commit e05d96b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff linting
run: ruff check --output-format=github .
- name: Run Ruff formatting
run: ruff format --check .
40 changes: 18 additions & 22 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["B", "E", "F", "D", "I"]
ignore = ["D200","D202","D210","D212","D415","D105",]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "I"]
unfixable = []
# Project configuration
line-length = 100
target-version = "py311"
output-format = "github" # Add GitHub-specific output formatting
fix = true

# Exclude a variety of commonly ignored directories.
exclude = [
Expand All @@ -31,27 +29,25 @@ exclude = [
"tests",
]

# Same as Black.
line-length = 100
[lint]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["B", "E", "F", "D", "I"]
ignore = ["D200", "D202", "D210", "D212", "D415", "D105"]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "I"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.10.
target-version = "py310"
fix = false
# Per-file ignore rules
per-file-ignores = { "__init__.py" = ["F401", "E402"] }

# Group violations by containing file.
format = "github"
ignore-init-module-imports = true

[mccabe]
[lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[pydocstyle]
[lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"

[per-file-ignores]
"__init__.py" = ["F401", "E402"]
convention = "google"

0 comments on commit e05d96b

Please sign in to comment.