Skip to content

Commit

Permalink
STY: migrate linting to ruff, add basic pre-commit hooks, cleanup .pr…
Browse files Browse the repository at this point in the history
…e-commit-config.yaml
  • Loading branch information
neutrinoceros committed Feb 16, 2023
1 parent a498393 commit 362de7a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 66 deletions.
10 changes: 0 additions & 10 deletions .flake8

This file was deleted.

81 changes: 33 additions & 48 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,36 @@
# pre-commit 1.1.0 is required for `exclude`
# however `minimum_pre_commit_version` itself requires 1.15.0
minimum_pre_commit_version: "1.15.0"

ci:
autofix_prs: true
autoupdate_schedule: quarterly
autofix_prs: true
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: no-commit-to-branch
- id: check-yaml
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- repo: https://github.com/PyCQA/flake8
rev: '6.0.0'
hooks:
- id: flake8
additional_dependencies: [
flake8-bugbear==23.1.20,
flake8-logging-format==0.9.0,
flake8-2020==1.7.0,
]
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.1.0]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: no-commit-to-branch
- id: debug-statements
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-toml

- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black

- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.1.0]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.239
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

[![yt-project](https://img.shields.io/static/v1?label="works%20with"&message="yt"&color="blueviolet")](https://yt-project.org)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)

This is yt_astro_analysis, the [yt](https://github.com/yt-project/yt) extension
package for astrophysical analysis. This package contains
Expand Down
25 changes: 18 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,24 @@ exclude = '''
)/
'''

[tool.ruff]
target-version = "py38" # https://github.com/charliermarsh/ruff/issues/2039
exclude = ["*__init__.py", "*api.py"]
ignore = ["E501"]
select = [
"E",
"F",
"W",
"B",
"G",
"YTT",
"I",
"UP",
]

[tool.isort]
profile = "black"
combine_as_imports = true
skip = ["venv", "benchmarks"]
known_third_party = [
[tool.ruff.isort]
combine-as-imports = true
known-third-party = [
"IPython",
"nose",
"numpy",
Expand All @@ -98,5 +110,4 @@ known_third_party = [
"pyx",
"glue",
]
known_first_party = ["yt", "yt_astro_analysis"]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
known-first-party = ["yt", "yt_astro_analysis"]

0 comments on commit 362de7a

Please sign in to comment.