Skip to content

Commit

Permalink
Update linting (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Franklin <[email protected]>
  • Loading branch information
illusional and illusional authored Oct 22, 2024
1 parent ad69973 commit aee3c3b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 48 deletions.
18 changes: 6 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -20,22 +18,18 @@ repos:
hooks:
- id: markdownlint

- repo: https://github.com/pycqa/isort
rev: 5.13.2
- repo: https://github.com/populationgenomics/pre-commits
rev: "v0.1.3"
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/ambv/black
rev: 23.12.1
hooks:
- id: black
- id: cpg-id-checker

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.11
rev: v0.6.2
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
Expand Down
60 changes: 24 additions & 36 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
[tool.black]
line-length = 88
skip-string-normalization = true

[tool.isort]
py_version = 311
profile = "black"
line_length = 88
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "HAIL", "CPG", "FIRSTPARTY", "LOCALFOLDER"]
known_hail = [
"hail",
"hailtop",
]
# Adjust these for each repository, e.g., removing those that should be
# local rather than CPG. Also fill in extend_skip below if there are any
# subdirectories that should be ignored.
known_cpg = [
"analysis_runner",
"cpg_infra",
"cpg_utils",
"cpg_workflows",
"gnomad",
"hail_scripts",
"metamist",
]
# extend_skip = ["list", "submodules", "etc", here"]

[tool.ruff]
line-length = 88
line-length = 120

[tool.ruff.format]
quote-style = "single"

[tool.ruff.lint]
# ignore pydocstyle, flake8-boolean-trap (FBT)
select = ["A", "B", "C", "E", "F", "G", "I", "N", "Q", "S", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "ERA", "EXE", "ICN", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "UP", "YTT"]

Expand All @@ -36,17 +13,28 @@ fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN
ignore = [
"ANN101", # Missing type annotation for self in method
"ANN201", # Missing return type annotation for public function
"E501", # Line length too long
"E731", # Do not assign a lambda expression, use a def
"E741", # Ambiguous variable name
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`
"G004", # Logging statement uses f-string
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments to function call
"PLR0915", # Too many statements
"PLW0603", # Using the global statement to update `<VAR>` is discouraged
"PT018", # Assertion should be broken down into multiple parts
"Q000", # Single quotes found but double quotes preferred
"S101", # Use of assert detected
"I001", # Import block is un-sorted (we use isort directly as ruff sort isn't fully supported)
]

[tool.ruff.lint.isort]
section-order = ["future", "standard-library", "third-party", "hail", "cpg", "first-party", "local-folder"]

[tool.ruff.lint.isort.sections]
hail = ["hail", "hailtop"]

# Adjust these for each repository, e.g., removing those that should be
# local rather than CPG. Also fill in extend_skip below if there are any
# subdirectories that should be ignored.
cpg = [
"analysis_runner",
"cpg_infra",
"cpg_utils",
"cpg_workflows",
"gnomad",
"metamist",
]

0 comments on commit aee3c3b

Please sign in to comment.