Skip to content

Commit

Permalink
Rip out flake8,bandit and ruff it all up
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsirbu committed Aug 19, 2024
1 parent 3119099 commit b713b7c
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 372 deletions.
9 changes: 0 additions & 9 deletions .flake8

This file was deleted.

35 changes: 6 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
APP_NAME: "pylint-nautobot"

jobs:
black:
ruff-format:
runs-on: "ubuntu-latest"
env:
INVOKE_PYLINT_NAUTOBOT_LOCAL: "True"
Expand All @@ -25,20 +25,9 @@ jobs:
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Linting: black"
run: "poetry run invoke black"
bandit:
runs-on: "ubuntu-latest"
env:
INVOKE_PYLINT_NAUTOBOT_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Linting: bandit"
run: "poetry run invoke bandit"
ruff:
- name: "Linting: ruff format"
run: "poetry run invoke ruff --action format"
ruff-lint:
runs-on: "ubuntu-latest"
env:
INVOKE_PYLINT_NAUTOBOT_LOCAL: "True"
Expand All @@ -60,17 +49,6 @@ jobs:
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Check Docs Build"
run: "poetry run invoke build-and-check-docs"
flake8:
runs-on: "ubuntu-latest"
env:
INVOKE_PYLINT_NAUTOBOT_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Linting: flake8"
run: "poetry run invoke flake8"
poetry:
runs-on: "ubuntu-latest"
env:
Expand All @@ -95,12 +73,11 @@ jobs:
run: "poetry run invoke yamllint"
pylint:
needs:
- "bandit"
- "ruff"
- "flake8"
- "poetry"
- "yamllint"
- "black"
- "ruff-format"
- "ruff-lint"
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
Expand Down
2 changes: 1 addition & 1 deletion development/nautobot_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Nautobot development configuration file."""

SECRET_KEY = "NOTASECRET" # nosec
SECRET_KEY = "NOTASECRET" # noqa: S105
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The project is packaged with a light development environment using `invoke` task

The project is following Network to Code software development guidelines and is leveraging the following:

- Python linting and formatting: `black`, `pylint`, `bandit`, `flake8`, and `pydocstyle`.
- Python linting and formatting: `black`, `pylint`, `ruff` (which includes rules from `bandit`, `flake8`, and `pydocstyle`).
- YAML linting is done with `yamllint`.
- Python unit tests to ensure the rules are working properly.

Expand Down
200 changes: 1 addition & 199 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pylint_nautobot/incorrect_base_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from astroid import ClassDef
from pylint.checkers import BaseChecker

from .utils import is_abstract_class
from .utils import is_version_compatible
from .utils import is_abstract_class, is_version_compatible

# Sorted from most specific to least specific
_CLASS_MAPPING = (
Expand Down
7 changes: 1 addition & 6 deletions pylint_nautobot/model_label.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
"""Check model label construction in f-strings."""

from astroid import Attribute
from astroid import Const
from astroid import FormattedValue
from astroid import JoinedStr
from astroid import Name
from astroid import NodeNG
from astroid import Attribute, Const, FormattedValue, JoinedStr, Name, NodeNG
from pylint.checkers import BaseChecker
from pylint.interfaces import HIGH

Expand Down
4 changes: 1 addition & 3 deletions pylint_nautobot/string_field_blank_null.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Check for CharField's or TextField's on models where null=True and blank=True."""

from astroid import Assign
from astroid import Call
from astroid import ClassDef
from astroid import Assign, Call, ClassDef
from pylint.checkers import BaseChecker


Expand Down
Loading

0 comments on commit b713b7c

Please sign in to comment.