Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a4e1894
refactor(config): extract out coverage, isort, and mypy configuration…
Apr 14, 2025
dd9f91f
fix(config): change .isort.cfg contents to match the new file type sy…
Apr 14, 2025
dae742c
chore(config): add .ruff.toml file
Apr 14, 2025
b221fc2
chore(dependencies): add ruff as a dev dependency
Apr 14, 2025
c32f3f2
chore(pre-commit): update pre-commit-config.yaml to use ruff
Apr 14, 2025
eadc28f
chore(config): add missing settings to .ruff.toml to replace function…
Apr 14, 2025
1da67c2
chore(pre-commit): update .pre-commit-config.yaml to use rust
Apr 14, 2025
eaeca40
chore(config): remove no longer used .isort.cfg
Apr 14, 2025
fc4b431
chore(config): move sections in .ruff.toml underneath the lint subsec…
Apr 14, 2025
8fec6d8
chore(config): add per-file-ignore of S101 for noxfile.py in .ruff.toml
Apr 14, 2025
7eede6e
chore(noxfile): replace flake8 and isort with ruff in noxfile.py
Apr 14, 2025
f0ff2ee
chore(config): add flake8-quotes setting to .ruff.toml
Apr 14, 2025
8c5c7e1
chore(config): add some extra rulesets from dbadden5's fork of the co…
Apr 14, 2025
7f90fdc
chore(config): remove UP from the ruff linting selection to better al…
Apr 14, 2025
e9557a4
fix(cicd): update upload-artifact@v3 to upload-artifact@v4 in tests.yml
Apr 14, 2025
f65092f
refactor(lint): run pre-commit hooks using new ruff settings
Apr 14, 2025
cac2689
chore(config): add per-file-ignore of ARG001 to all test files in .ru…
Apr 14, 2025
d50751f
chore(config): add per-file-ignore of C408 for all test files in .ruf…
Apr 14, 2025
ecbcad8
fix(cicd): add os and arch to coverage-data id due to upload-artifac…
Apr 14, 2025
3698a1e
fix(cicd): replace download-artifact@v3 with download-artifact@v4 to …
Apr 14, 2025
7d3a1d8
fix(cicd): add overwrite: "true" to upload-artifact@v4 steps
Apr 14, 2025
15bd870
fix(cicd): add intermediary merge-artifacts step to account for uploa…
Apr 14, 2025
cd50f35
fix(cicd): move artifact merging into coverage job
Apr 14, 2025
e55d1bd
refactor: run unsafe ruff check fixes
Apr 18, 2025
a1a19ef
chore(config): add per file ignore for SLF001 in all test files
Apr 18, 2025
7b96cd5
refactor: move TypeHandlerRegistry.get and __getitem__ to just be ins…
Apr 18, 2025
a152a36
refactor: replace a bunch of unused arguments with _ and **__ as need…
Apr 18, 2025
e486de7
chore: add noqa for A001 in sphinx config
Apr 18, 2025
ca75ede
chore: add noqa for RUF001 in type_sets.py due to intentional use of …
Apr 18, 2025
ff50c0a
fix: change get and __getitem__ to be done on the class instead of th…
Apr 18, 2025
a57ad40
fix: convert back to just methods manually being redefined
Apr 18, 2025
fd9ec8f
chore: add missing type annotation
Apr 18, 2025
ba692a9
chore: fix a couple small mypy errors
Apr 18, 2025
9419f7f
chore: remove get and __getitem__ direct method assignments
Apr 19, 2025
bc07948
chore: fix mypy errors surrounding product type handlers
Apr 19, 2025
52bc9cf
fix(cicd): remove merge step in favor of just downloading artifacts b…
Apr 19, 2025
0169278
chore: run poetry lock
Apr 19, 2025
aa0459b
chore: remove bandit.yml and bandit dependency
Apr 19, 2025
fde1e0f
chore: replace safety check with safety scan
Apr 19, 2025
80f2a67
chore(dependencies): replace safety with pip-audit due to safety bein…
Apr 19, 2025
5a9b726
chore: remove any remaining references to coverage[toml] and replace …
Apr 19, 2025
5f23281
chore: fix .coveragerc syntax
Apr 19, 2025
fc2a5d2
chore(config): add a coverage exclusion for if TYPE_CHECKING blocks
Apr 19, 2025
0126e0a
fix(cicd): add merge_multiple as true to tests cicd for downloading c…
Apr 19, 2025
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
19 changes: 19 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[paths]
source =
src
*/site-packages
tests =
tests
*/tests

[run]
branch = true
source =
pytest_static
tests

[report]
exclude_also =
if TYPE_CHECKING:
show_missing = true
fail_under = 100
13 changes: 8 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,20 @@ jobs:

- name: Upload coverage data
if: always() && matrix.session == 'tests'
uses: "actions/upload-artifact@v3"
uses: "actions/upload-artifact@v4"
with:
name: coverage-data
name: coverage-data-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python }}
path: ".coverage.*"
include-hidden-files: true
overwrite: "true"

- name: Upload documentation
if: matrix.session == 'docs-build'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build
overwrite: "true"

coverage:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -139,9 +141,10 @@ jobs:
nox --version

- name: Download coverage data
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: coverage-data
pattern: coverage-data-*
merge-multiple: "true"

- name: Combine coverage data and display human readable report
run: |
Expand Down
6 changes: 6 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[mypy]
strict = true
warn_unreachable = true
pretty = true
show_column_numbers = true
show_error_context = true
31 changes: 8 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
repos:
- repo: local
hooks:
- id: bandit
name: bandit
entry: bandit
language: system
types: [python]
require_serial: true
args: ["-c", "bandit.yml"]
- id: black
name: black
entry: black
Expand Down Expand Up @@ -40,27 +33,19 @@ repos:
language: system
types: [text]
stages: [commit, push, manual]
- id: flake8
name: flake8
entry: flake8
- id: ruff-lint
name: Ruff Lint
entry: ruff check
language: system
types: [python]
require_serial: true
args: [--darglint-ignore-regex, .*]
- id: isort
name: isort
entry: isort
require_serial: true
language: system
types_or: [cython, pyi, python]
args: ["--filter-files"]
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
entry: pyupgrade
args: [--fix]
- id: ruff-format
name: Ruff Format
entry: ruff format
language: system
types: [python]
args: [--py37-plus]
require_serial: true
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
Expand Down
130 changes: 130 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@

# 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",
]

# Same as Black.
line-length = 120
indent-width = 4

# Assume Python 3.9
target-version = "py39"

[lint]
# https://docs.astral.sh/ruff/rules
select = [
"A",
"ARG",
"B",
"B9",
"BLE",
"C",
"C4",
"D",
"DTZ",
"E",
"F",
"I",
"N",
"PT",
"PTH",
"Q",
"RET",
"RUF",
"S",
"SIM",
"SLF",
"T10",
"TC",
"W"
]
ignore = ["E203", "E501"]


# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

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

[lint.flake8-quotes]
inline-quotes = "double"

[lint.isort]
force-single-line = true
lines-after-imports = 2

[lint.mccabe]
max-complexity = 10

[lint.per-file-ignores]
"tests/*" = [
"S101",
"D100",
"D101",
"D102",
"D103",
"D104",
"ARG001",
"C408",
"SLF001"
]
"exceptions.py" = ["D107"]
"noxfile.py" = ["S101"]

[lint.pydocstyle]
convention = "google"

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
2 changes: 0 additions & 2 deletions bandit.yml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

project = "pytest-static"
author = "Kyle Oliver"
copyright = "2023, Kyle Oliver"
copyright = "2023, Kyle Oliver" # noqa: A001
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
Expand Down
16 changes: 6 additions & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:

text = hook.read_text()

if not any(Path("A") == Path("a") and bindir.lower() in text.lower() or bindir in text for bindir in bindirs):
if not any((Path("A") == Path("a") and bindir.lower() in text.lower()) or bindir in text for bindir in bindirs):
continue

lines = text.splitlines()
Expand All @@ -120,11 +120,7 @@ def precommit(session: Session) -> None:
"bandit",
"black",
"darglint",
"flake8",
"flake8-bugbear",
"flake8-docstrings",
"flake8-rst-docstrings",
"isort",
"ruff",
"pep8-naming",
"pre-commit",
"pre-commit-hooks",
Expand All @@ -139,8 +135,8 @@ def precommit(session: Session) -> None:
def safety(session: Session) -> None:
"""Scan dependencies for insecure packages."""
requirements = session.poetry.export_requirements()
session.install("safety")
session.run("safety", "check", "--full-report", f"--file={requirements}")
session.install("pip-audit")
session.run("pip-audit", "-r", requirements)


@session(python=python_versions)
Expand All @@ -158,7 +154,7 @@ def mypy(session: Session) -> None:
def tests(session: Session) -> None:
"""Run the test suite."""
session.install(".")
session.install("coverage[toml]", "pytest", "pygments")
session.install("coverage", "pytest", "pygments")
try:
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
finally:
Expand All @@ -171,7 +167,7 @@ def coverage(session: Session) -> None:
"""Produce the coverage report."""
args = session.posargs or ["report"]

session.install("coverage[toml]")
session.install("coverage")

if not session.posargs and any(Path().glob(".coverage.*")):
session.run("coverage", "combine")
Expand Down
Loading
Loading