Skip to content

Commit

Permalink
🔧 Enable ALL ruff rules (with some exceptions)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgraaf committed Oct 17, 2023
1 parent dc54416 commit 6e5ef0c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 24 deletions.
4 changes: 2 additions & 2 deletions {{cookiecutter.project_name}}/docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Sphinx configuration."""
import os
import sys
from pathlib import Path

sys.path.insert(0, os.path.abspath("../src"))
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import {{ cookiecutter.package_name }} # noqa: E402

# -- Project information -----------------------------------------------------
Expand Down
60 changes: 40 additions & 20 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Typing :: Typed",
]
requires-python = "~=3.8"
dependencies = []
dynamic = ["version", "description"]

[project.optional-dependencies]
dev = [
"black",
"mypy",
"pre-commit",
"ruff",
tests = [
"pytest"
]
docs = [
"furo",
Expand All @@ -53,39 +51,61 @@ docs = [
"sphinx-copybutton",
"sphinxext-opengraph",
]
tests = [
"pytest"
dev = [
"{{ cookiecutter.project_name }}[tests,docs]",
"black",
"mypy",
"pre-commit",
"ruff",
]

[project.urls]
Documentation = "https://{{ cookiecutter.project_name }}.readthedocs.io/en/stable/"
Changelog = "https://{{ cookiecutter.project_name }}.readthedocs.io/en/stable/changelog.html"
"Source code" = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_name }}"
Issues = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_name }}/issues"
"Source Code" = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_name }}"
"Issue Tracker" = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_name }}/issues"

{% if cookiecutter.package_name != cookiecutter.project_name.replace('-', '_') -%}
[tool.flit.module]
name = "{{ cookiecutter.package_name }}"
{% endif -%}

[tool.ruff]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"B", # flake8-bugbear
"F", # pyflakes
"I", # isort
"C90", # mccabe
"UP", # pyupgrade
"RUF100", # unused noqa
]
select = ["ALL"]
ignore = [
"E501", # line too long, handled by black
"COM", # flake8-commas, handled by black
"CPY", # flake8-copyright
"INP", # flake8-no-pep420
]
src = ["src"]
src = ["src", "tests", "docs"]
target-version = "py38" # the minimum Python version supported, used by pyupgrade

[tool.ruff.per-file-ignores]
"__init__.py" = [
"F401", # unused import
]
"tests/**/test_*.py" = [
"D", # pydocstyle
"ANN201", # missing-return-type-undocumented-public-function
"S101", # assert
"SIM300", # yoda-conditions
"PLR2004", # magic-value-comparison
]
"docs/conf.py" = [
"A001", # builtin-variable-shadowing
]
"noxfile.py" = [
"D100", # undocumented-public-module
"ERA001", # commented-out-code
]

[tool.ruff.isort]
known-first-party = [
"{{ cookiecutter.project_name }}",
"tests",
]
lines-between-types = 0

[tool.ruff.pydocstyle]
convention = "google"
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def add_one(x: int) -> int:
"""Add one to the input.
Args:
x (int): The input.
x: The input.
Returns:
int: The input plus one.
The input plus one.
"""
return x + 1

1 comment on commit 6e5ef0c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.