nautobot / cookiecutter-nautobot-app

Cookiecutter template for creating new Nautobot Apps.
https://docs.nautobot.com/projects/cookiecutter-nautobot-app/en/latest/
Apache License 2.0
16 stars 5 forks source link

Sync pyproject.toml settings with Nautobot core #141

Open gsnider2195 opened 2 months ago

gsnider2195 commented 2 months ago

Example -- nautobot core ruff settings:

[tool.ruff.lint]
select = [
    "DJ",  # flake8-django
    "E",  # pycodestyle
    "F",  # pyflakes
    "I",  # isort
    "PIE",  # flake8-pie
    "RUF",  # ruff itself
    "S",  # flake8-bandit
    "W",  # pycodestyle
]
ignore = [
    "E501",  # pycodestyle: line-too-long
    "PIE808",  # unnecessary-range-start
    "RUF012",  # mutable-class-default - see https://github.com/astral-sh/ruff/issues/5243
]

[tool.ruff.lint.isort]
combine-as-imports = true
force-sort-within-sections = true
known-local-folder = ["example_app"]
order-by-type = false

Cookie ruff settings:

[tool.ruff.lint]
select = [
    "D",  # pydocstyle
    "F", "E", "W",  # flake8
    "PL",  # pylint
    "S",  # bandit
    "I",  # isort
]
ignore = [
    # warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible.
    "D203",  # 1 blank line required before class docstring

    # D212 is enabled by default in google convention, and complains if we have a docstring like:
    # """
    # My docstring is on the line after the opening quotes instead of on the same line as them.
    # """
    # We've discussed and concluded that we consider this to be a valid style choice.
    "D212",  # Multi-line docstring summary should start at the first line
    "D213",  # Multi-line docstring summary should start at the second line

    # Produces a lot of issues in the current codebase.
    "D401",  # First line of docstring should be in imperative mood
    "D407",  # Missing dashed underline after section
    "D416",  # Section name ends in colon
    "E501",  # Line too long
]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.per-file-ignores]
"{{ cookiecutter.app_name }}/migrations/*" = [
    "D",
]
"{{ cookiecutter.app_name }}/tests/*" = [
    "D",
    "S"
]
glennmatthews commented 2 months ago

Perhaps the example_app ruff settings in core are also relevant - https://github.com/nautobot/nautobot/blob/develop/examples/example_app/pyproject.toml