From e7d210a1275cd46faece3201dabe52fdda656f41 Mon Sep 17 00:00:00 2001 From: Hamza Sardar Date: Tue, 17 Mar 2026 13:59:38 +0000 Subject: [PATCH 1/2] Move tool configs to pyproject.toml (#157) --- .pre-commit-config.yaml | 10 ++-- bandit.yaml | 1 - mypy.ini | 4 -- pyproject.toml | 102 ++++++++++++++++++++++++++++++++++++++++ ruff.toml | 71 ---------------------------- typos.toml | 22 --------- 6 files changed, 107 insertions(+), 103 deletions(-) delete mode 100644 bandit.yaml delete mode 100644 mypy.ini delete mode 100644 ruff.toml delete mode 100644 typos.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04e54c19..fa63cfd7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,10 +24,10 @@ repos: hooks: # Run the linter. - id: ruff-check - args: [--fix, --config=ruff.toml] + args: [--fix, --config=pyproject.toml] # Run the formatter. - id: ruff-format - args: [--config=ruff.toml] + args: [--config=pyproject.toml] - repo: local hooks: @@ -36,20 +36,20 @@ repos: entry: mypy language: system types: [python] - args: ["--config-file=mypy.ini"] + args: ["--config-file=pyproject.toml"] - repo: https://github.com/crate-ci/typos rev: v1.42.1 hooks: - id: typos - args: [--config=typos.toml] + args: [--config=pyproject.toml] pass_filenames: false - repo: https://github.com/PyCQA/bandit rev: 1.9.3 hooks: - id: bandit - args: ["-c", "bandit.yaml"] + args: ["-c", "pyproject.toml"] - repo: local hooks: diff --git a/bandit.yaml b/bandit.yaml deleted file mode 100644 index d651dca6..00000000 --- a/bandit.yaml +++ /dev/null @@ -1 +0,0 @@ -exclude_dirs: ['tests'] diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 9b38021b..00000000 --- a/mypy.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mypy] -exclude = ["legacy/", "docs/", "tests/", "LICENSE"] -strict = true -ignore_missing_imports = true diff --git a/pyproject.toml b/pyproject.toml index 501470cb..187b74e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,3 +41,105 @@ packages = ["src/sre_agent"] [tool.pytest.ini_options] testpaths = ["tests"] + +[tool.ruff] +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", + "legacy", +] + +# same as Black +line-length = 100 +indent-width = 4 + +target-version = "py312" +force-exclude = true + +[tool.ruff.lint] +select = [ + "C4", # flake8-comprehensions + "SIM", # flake8-simplify + "Q", # flake8-quotes + "ISC", # flake8-implicit-str-concat + "F", # pyflakes + "D", # pydocstyle + "E", # pycodestyle error + "W", # pycodestyle warning + "N", # pep8-naming + "I", # isort + "PL", # pylint rules from categories "Convention", "Error", and "Warning" + "PLE", # ruff currently implements only a subset of pylint's rules + "PLW", # pylint warning + "PLR", # pylint refactor + "UP", # pyupgrade + "C", # Complexity (mccabe+) & comprehensions +] +ignore = [ + "UP006", # See https://github.com/bokeh/bokeh/issues/13143 + "UP007", # See https://github.com/bokeh/bokeh/pull/13144 + "PLC0415", # Allow imports inside functions (useful for optional deps) + "PLR2004", # Allow magic values in comparisons (array indices etc.) +] + +[tool.ruff.format] +# Like Black, use double quotes for strings. +quote-style = "double" + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.mypy] +exclude = ["legacy/", "docs/", "tests/", "LICENSE"] +strict = true +ignore_missing_imports = true + +[tool.typos.files] +extend-exclude = [ + ".gitignore", + "LICENSE", + "legacy", + "*.csv" +] +ignore-hidden = true +ignore-dot = true + +[tool.typos.default] +locale = "en-gb" +extend-ignore-re = [ + # Ignore lines that end with `# spellchecker:disable-line` + "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", + # Ignore lines with HTML `` + "(?Rm)^.*.*$", + # Ignore the line after `# spellchecker:ignore-next-line`: + "(#|//)\\s*spellchecker:ignore-next-line\\n.*", + # Ignore blocks between `# spellchecker:off` and `# spellchecker:on` + "(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on", +] + +[tool.bandit] +exclude_dirs = ["tests"] diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index d9e7842f..00000000 --- a/ruff.toml +++ /dev/null @@ -1,71 +0,0 @@ -# Exclude a variety of commonly ignored directories. -exclude = [ - ".bzr", - ".direnv", - ".eggs", - ".git", - ".git-rewrite", - ".hg", - ".ipynb_checkpoints", - ".mypy_cache", - ".nox", - ".pants.d", - ".pyenv", - ".pytest_cache", - ".pytype", - ".ruff_cache", - ".svn", - ".tox", - ".venv", - ".vscode", - "__pypackages__", - "_build", - "buck-out", - "build", - "dist", - "node_modules", - "site-packages", - "venv", - "legacy", -] - -# Same as Black. -line-length = 100 -indent-width = 4 - -target-version = "py312" -force-exclude = true - -[lint] -select = [ - "C4", # flake8-comprehensions - "SIM", # flake8-simplify - "Q", # flake8-quotes - "ISC", # flake8-implicit-str-concat - "F", # pyflakes - "D", # pydocstyle - "E", # pycodestyle error - "W", # pycodestyle warning - "N", # pep8-naming - "I", # isort - "PL", # pylint rules from categories "Convention", "Error", and "Warning" - "PLE", # ruff currently implements only a subset of pylint's rules - "PLW", # pylint warning - "PLR", # pylint refactor - "UP", # pyupgrade - "C", # Complexity (mccabe+) & comprehensions -] -ignore = [ - "UP006", # See https://github.com/bokeh/bokeh/issues/13143 - "UP007", # See https://github.com/bokeh/bokeh/pull/13144 - "PLC0415", # Allow imports inside functions (useful for optional deps) - "PLR2004", # Allow magic values in comparisons (array indices etc.) -] - -[format] -# Like Black, use double quotes for strings. -quote-style = "double" - -[lint.pydocstyle] -# Use Google-style docstrings. -convention = "google" diff --git a/typos.toml b/typos.toml deleted file mode 100644 index 4fcc7e83..00000000 --- a/typos.toml +++ /dev/null @@ -1,22 +0,0 @@ -[files] -extend-exclude = [ - ".gitignore", - "LICENSE", - "legacy", - "*.csv" -] -ignore-hidden = true -ignore-dot = true - -[default] -locale = "en-gb" -extend-ignore-re = [ - # Ignore lines that end with `# spellchecker:disable-line` - "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", - # Ignore lines with HTML `` - "(?Rm)^.*.*$", - # Ignore the line after `# spellchecker:ignore-next-line`: - "(#|//)\\s*spellchecker:ignore-next-line\\n.*", - # Ignore blocks between `# spellchecker:off` and `# spellchecker:on` - "(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on", -] From 86712a05bfa2cb20b19b9acc1c832d6a01e5d9be Mon Sep 17 00:00:00 2001 From: Hamza Sardar Date: Tue, 17 Mar 2026 14:48:03 +0000 Subject: [PATCH 2/2] Update mypy section of pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 187b74e1..63fb1c08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,7 @@ quote-style = "double" convention = "google" [tool.mypy] -exclude = ["legacy/", "docs/", "tests/", "LICENSE"] +exclude = ["docs/", "tests/", "LICENSE"] strict = true ignore_missing_imports = true