Skip to content

Commit

Permalink
Update CI and pre-commit configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-spencer committed Mar 25, 2024
1 parent 8dfefd3 commit 78496e3
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Configurtion file for Markdown lint. Add exceptions here.
default: true

# heading levels.
MD002: false
85 changes: 55 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,55 @@
repos:
- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
args: [--safe, --quiet]
language_version: python3
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
language_version: python3
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: python
language_version: python3
args:
[
"-rn", # Only display messages.
"-sn", # Don't display the pylint score.
"--rcfile=.pylintrc"
]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: check-json
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
language_version: python3
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.270
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
hooks:
- id: markdownlint
args: [--config=.markdownlint.yaml]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--ignore-regex=.*noqa"]
exclude: >
(?x)^(
.*test_main.py
)$
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: python
language_version: python3
args:
[
"-rn", # Only display messages.
"-sn", # Don't display the pylint score.
"--rcfile=.pylintrc"
]
exclude: |
(?x) (
^html/
)
4 changes: 1 addition & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ignore-patterns=
^(.+).toml$,
^(.+).txt$,
^(.+).service$,
^(.+).yaml$,

ignore-paths=
requirements/*,
Expand All @@ -38,6 +39,3 @@ disable =
R0915, # Too many statements (71/50) (too-many-statements). TODO: Immediate priority.
R0903, # Too few public methods (1/2) (too-few-public-methods).
R0801, # Similar lines in multiple files. We're seeing this in the unit tests.



47 changes: 47 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]
ignore = [
"E501", # line-length too long, set via black.
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]

# Same as Black.
line-length = 88

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

# Assume Python 3.10.
target-version = "py310"

[mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
21 changes: 16 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.rulers": [
79
],
"editor.detectIndentation": false,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
Expand All @@ -13,18 +16,26 @@
"[git-commit]": {
"editor.rulers": [
50,
72,
]},
72
]
},
"[python]": {
"editor.rulers": [
72,
79,
120,
120
],
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter"
},
"[go]": {
"editor.rulers": [
72,
79
]
},
"[markdown]": {
"editor.rulers": [80],
"editor.rulers": [80]
},
"files.eol": "\n",
"files.eol": "\n"
}

0 comments on commit 78496e3

Please sign in to comment.