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

Switch from pylint+black to ruff #4

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ author_name: LINCC Frameworks
create_example_module: true
custom_install: true
enforce_style:
- pylint
- black
- ruff_lint
- ruff_format
failure_notification: []
include_benchmarks: true
include_docs: true
Expand All @@ -21,3 +21,4 @@ python_versions:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
2 changes: 1 addition & 1 deletion .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
53 changes: 13 additions & 40 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,48 +43,21 @@ repos:
hooks:
- id: check-github-workflows
args: ["--verbose"]
# Analyze the src code style and report code that doesn't adhere.
- repo: local
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
hooks:
- id: pylint
name: pylint (python files in src/)
entry: pylint
language: system
types: [python]
files: ^src/
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=src/.pylintrc",
]
# Analyze the tests code style and report code that doesn't adhere.
- repo: local
hooks:
- id: pylint
name: pylint (python files in tests/ and benchmarks/)
entry: pylint
language: system
types: [python]
files: ^(tests|benchmarks)/
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=tests/.pylintrc",
]
# Analyze the code style and report code that doesn't adhere.
- repo: https://github.com/psf/black
rev: 23.7.0
- id: ruff
name: Lint code using ruff; sort and organize imports
types_or: [ python, pyi ]
args: ["--fix"]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
hooks:
- id: black-jupyter
name: Format code using black
types_or: [python, pyi, jupyter]
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.10
- id: ruff-format
name: Format code using ruff
types_or: [ python, pyi, jupyter ]
# Analyze type hints and report errors.
- repo: local
hooks:
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ dependencies = [
[project.optional-dependencies]
dev = [
"asv==0.6.1", # Used to compute performance benchmarks
"black", # Used for static linting of files
"jupyter", # Clears output from Jupyter notebooks
"mypy", # Used for static type checking of files
"pre-commit", # Used to run checks before finalizing a git commit
"pylint", # Used for static linting of files
"pytest",
"pytest-cov", # Used to report total code coverage
"ruff", # Used for static linting of files
]

[build-system]
Expand Down
Loading
Loading