Verified Commit 9f535e47 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Update code checks

parent 003fbb3c
Loading
Loading
Loading
Loading
+17 −21
Changes for .pre-commit-config.yaml: 17 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@ repos:
  - id: check-case-conflict
  - id: check-merge-conflict
  - id: check-toml
    stages: [pre-commit, manual]
  - id: check-yaml
    stages: [pre-commit, manual]
  - id: debug-statements
  - id: destroyed-symlinks
  - id: end-of-file-fixer
@@ -58,18 +60,8 @@ repos:
  hooks:
  - id: pyupgrade

- repo: https://github.com/hakancelikdev/unimport
  rev: 1.3.1
  hooks:
  - id: unimport
    args: [--remove]
    types: []
    types_or: [python, pyi]
    additional_dependencies: [libcst >=0.4.0]
    stages: [pre-commit, manual]

- repo: https://github.com/pycqa/isort
  rev: 8.0.1
  rev: 9.0.0a3
  hooks:
  - id: isort
    stages: [pre-commit, manual]
@@ -79,20 +71,24 @@ repos:
  hooks:
  - id: pytest
    types_or: [python, markdown]
    stages: [pre-commit, manual]
    args: [--doctest-modules, --doctest-continue-on-failure]
  - id: pytest
    args: [test.py]
    stages: [pre-commit, pre-push, manual]
    args: [--doctest-modules, --doctest-continue-on-failure, test.py]

- repo: https://github.com/astral-sh/ruff-pre-commit
  rev: v0.15.10
  rev: v0.15.15
  hooks:
  - id: ruff
  - id: ruff-check
    args: [--fix, --unsafe-fixes]
  - id: ruff-format
    stages: [pre-commit, manual]

- repo: https://github.com/pre-commit/mirrors-mypy
  rev: v1.20.1
- repo: https://github.com/RobertCraigie/pyright-python
  rev: v1.1.409
  hooks:
  - id: mypy
    args: [--follow-imports=silent, kodo]
  - id: pyright
    additional_dependencies: &deps
    - pytest
  - id: pyright
    stages: ["pre-push", "manual"]
    additional_dependencies: *deps
    pass_filenames: false
+17 −8
Changes for .ruff.toml: 17 added lines, 8 removed lines.
Original line number Diff line number Diff line
line-length = 92
indent-width = 1  # Used for line length violations

[format]
indent-style = "tab"
skip-magic-trailing-comma = false

[lint]
select = [
	# pyflakes
	# --------

	# ENABLE "%s imported but unused; ..."
	# Replace unimport with this due to unimport's Python parsing lagging
	# severely behind.
	"F401",

	# ENABLE "Undefined name %s in __all__"
	"F822",

@@ -57,11 +66,18 @@ select = [
	# The bulk of bugbear's checks are useful
	"B0",

	# flake8-commas
	# -------------

	# ENABLE: Trailing comma on bare tuple
	"COM818",

	# Various others
	# --------------

	"UP", "BLE", "FBT", "A", "COM", "C4", "DTZ", "ISC", "LOG", "G", "PIE", "T",
	"UP", "BLE", "FBT", "A", "C4", "DTZ", "ISC", "LOG", "G", "PIE", "T",
	"Q", "RSE", "RET", "SLF", "SLOT", "SIM", "TD", "ANN", #"FA",
	"RUF",

	# Nice to have, needs fixing in several places though...
	# "EM", "TCH", "PTH", "PGH",
@@ -152,10 +168,6 @@ ignore = [
	# block, leading to false-positives.
	"RET503",

	# DISABLE "Missing type annotation for `%` in {method|classmethod}"
	# Don't type 'self' or 'cls'
	"ANN101", "ANN102",

	# DISABLE "Boolean positional value in function call"
	# Too many stdlib functions take a single positional-only boolean. ruff
	# can't interpret function signatures to ignore these and doesn't understand
@@ -166,9 +178,6 @@ ignore = [
	# It sometimes looks better to do this than introduce unecessary
	# parentheses.
	"ISC002",

	# Unfortunately a lot of single quotes strings used in this project already
	"Q000",
]

[lint.per-file-ignores]
+2
Changes for kodo/quantities/__init__.py: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ U = TypeVar("U", bound="QuantityUnit")


if TYPE_CHECKING:

	class Quantity(Generic[U]):
		"""
		A physical quantity of a given unit type 'U'
@@ -263,6 +264,7 @@ class QuantityUnit(enum.Enum):
	"""

	if TYPE_CHECKING:

		@property
		def value(self) -> int: ...  # noqa: D102

+1 −1
Changes for test.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ from kodo.quantities import QuantityUnit


class Time(QuantityUnit):

	MS = 10
	S = 1000 * MS

@@ -57,6 +56,7 @@ def test_new_operators() -> None:


if TYPE_CHECKING:

	def type_checks() -> None:
		# Checks for type checker false negatives
		#