Skip to content

Commit

Permalink
Switch to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Aug 7, 2024
1 parent 7486e09 commit f2e123a
Show file tree
Hide file tree
Showing 7 changed files with 480 additions and 573 deletions.
14 changes: 0 additions & 14 deletions .flake8

This file was deleted.

22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: "3.11"

- name: Lint Checks
- name: Pre-commit Checks
uses: pre-commit/action@v3.0.1

- name: Type Checks
run: |
pip install poetry
poetry install
poetry run flake8
poetry run isort --check nexus_pcv
poetry run black --check nexus_pcv
poetry run mypy nexus_pcv
test:
Expand All @@ -36,11 +36,11 @@ jobs:
strategy:
matrix:
python:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
echo "jobSuccess=fail" >> $GITHUB_ENV
fi
id: print_status

- name: Webex Notification
if: always()
uses: qsnyder/action-wxt@master
Expand Down
16 changes: 0 additions & 16 deletions .mypy.ini

This file was deleted.

18 changes: 4 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
hooks:
- id: black
args:
- --safe
- --quiet
- repo: https://gitlab.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
hooks:
- id: isort
- id: ruff
- id: ruff-format
7 changes: 2 additions & 5 deletions nexus_pcv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

# Copyright: (c) 2022, Daniel Schmidt <danischm@cisco.com>

from importlib.metadata import PackageNotFoundError, version # type: ignore
from importlib.metadata import version # type: ignore

try:
__version__ = version(__name__)
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"
__version__ = version(__name__)
922 changes: 438 additions & 484 deletions poetry.lock

Large diffs are not rendered by default.

54 changes: 25 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ pyyaml = "^6.0"
requests = "^2.28.1"

[tool.poetry.group.dev.dependencies]
black = "^24.4.0"
flake8 = "^5.0.4"
isort = "^5.10.1"
mypy = "^0.982"
pre-commit = "^2.20.0"
pytest = "^7.2.0"
pytest-cov = "^4.0.0"
pytest-mock = "^3.10.0"
toml = "^0.10.2"
types-pyyaml = "^6.0.12.1"
types-requests = "^2.28.11.2"
mypy = "^1.10.0"
pre-commit = "^3.5"
pytest = "^8.2.0"
pytest-cov = "^5.0.0"
pytest-mock = "^3.14.0"
ruff = "^0.5.6"
types-pyyaml = "^6.0.12.20240724"
types-requests = "^2.32.0.20240712"

[tool.coverage.run]
source = ["nexus_pcv"]
Expand All @@ -40,27 +37,26 @@ source = ["nexus_pcv"]
exclude_lines = ["pragma: no cover", "@abstract", "except ImportError:"]
omit = ["*/__main__.py"]

[tool.isort]
# https://github.com/timothycrosley/isort
# https://github.com/timothycrosley/isort/wiki/isort-Settings
# splits long import on multiple lines indented by 4 spaces
force_grid_wrap = 0
include_trailing_comma = true
indent = " "
line_length = 88
multi_line_output = 3
use_parentheses = true
# will group `import x` and `from x import` of the same module.
combine_as_imports = true
default_section = "THIRDPARTY"
force_sort_within_sections = true
forced_separate = "tests"
known_first_party = ["nexus_pcv", "tests"]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
[tool.mypy]
# The mypy configurations: http://bit.ly/2zEl9WI
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_calls = true
disallow_untyped_decorators = false
disallow_untyped_defs = true
ignore_errors = false
ignore_missing_imports = true
python_version = 3.8
strict_optional = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_configs = true
warn_unused_ignores = false

[tool.pytest.ini_options]
markers = ["unit", "integration"]

[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry_core>=1.0.0"]
requires = ["poetry_core"]

0 comments on commit f2e123a

Please sign in to comment.