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 5, 2024
1 parent 301bc2f commit 174484d
Show file tree
Hide file tree
Showing 10 changed files with 506 additions and 595 deletions.
14 changes: 0 additions & 14 deletions .flake8

This file was deleted.

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

- name: Lint Checks
run: |
pip install poetry
poetry install
poetry run flake8
poetry run isort --check nac_collector
poetry run black --check nac_collector
# poetry run mypy nac_collector
- name: Pre-commit Checks
uses: pre-commit/[email protected]

# - name: Type Checks
# run: |
# pip install poetry
# poetry install
# poetry run mypy nac_collector

test:
name: Tests
Expand All @@ -37,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 @@ -74,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: 24.4.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
hooks:
- id: black
args:
- --safe
- --quiet
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
- repo: https://github.com/timothycrosley/isort
rev: 5.13.2
hooks:
- id: isort
- id: ruff
- id: ruff-format
1 change: 0 additions & 1 deletion nac_collector/cisco_client_ise.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def get_from_endpoints(self, endpoints_yaml_file):
)
# Pagination for ERS API results
elif data.get("SearchResult"):

ers_data = self.process_ers_api_results(data)

for i in ers_data:
Expand Down
2 changes: 0 additions & 2 deletions nac_collector/cisco_client_ndo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class CiscoClientNDO(CiscoClient):

NDO_AUTH_ENDPOINT = "/login"
SOLUTION = "ndo"

Expand All @@ -30,7 +29,6 @@ def __init__(
)

def authenticate(self):

auth_url = f"{self.base_url}{self.NDO_AUTH_ENDPOINT}"

data = {
Expand Down
1 change: 0 additions & 1 deletion nac_collector/github_repo_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def get_definitions(self):
files, label="Processing terraform provider definitions"
) as files_bar:
for file in files_bar:

if file.endswith(".yaml"):
with open(os.path.join(root, file), "r", encoding="utf-8") as f:
data = self.yaml.load(f)
Expand Down
968 changes: 464 additions & 504 deletions poetry.lock

Large diffs are not rendered by default.

49 changes: 23 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
[tool.poetry]
name = "nac-collector"
version = "0.1.0"
description = ""
authors = ["Kuba Mazurkiewicz <[email protected]>"]
description = ""
name = "nac-collector"
readme = "README.md"
version = "0.1.0"

[tool.poetry.dependencies]
python = "^3.8"
requests = "^2.31.0"
click = "^8.1.7"
gitpython = "^3.1.42"
python = "^3.8"
requests = "^2.31.0"
ruamel-yaml = "^0.18.6"

[tool.poetry.scripts]
nac-collector = "nac_collector.main:cli"

[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
flake8 = "^5.0.4"
isort = "^5.13.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"

[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 = ["nac_collector", "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

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

[tool.pytest.ini_options]
markers = ["unit", "integration"]
1 change: 0 additions & 1 deletion tests/ise/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def cisco_client():


def test_cisco_client_ise_with_integration(cisco_client, tmpdir):

def mock_get_request(url):
# Mock responses for specific API endpoints
mock_responses = {
Expand Down

0 comments on commit 174484d

Please sign in to comment.