diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 768b339..0000000 --- a/.flake8 +++ /dev/null @@ -1,7 +0,0 @@ -[flake8] -extend-ignore = F403, E501, B950, E266, B902 -max-line-length = 100 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 -per-file-ignores= - pydavinci/wrappers/settings/components.py:E303,E302, W293 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ecac9f..1fd39a4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,21 +18,19 @@ repos: hooks: - id: black # By default, this ignores pyi files, though black supports them -# Flake8 also supports pre-commit natively (same author) -- repo: https://github.com/pycqa/isort - rev: 5.10.1 +# Ruff supports flake8, bugbear rules +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.254' hooks: - - id: isort - name: isort (python) - args: ["--profile", "black"] -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 - hooks: - - id: flake8 - args: ['--ignore=F403,E501,B950,E266'] - additional_dependencies: [flake8-bugbear, pep8-naming] - exclude: ^(docs/.*|tools/.*|tests/.*)$ + - id: ruff + - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.940 # Use the sha / tag you want to point at hooks: - id: mypy + exclude: ^tests/ + +- repo: https://github.com/asottile/pyupgrade + rev: v3.3.1 + hooks: + - id: pyupgrade diff --git a/pyproject.toml b/pyproject.toml index b15e42b..49e32b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,13 @@ dependencies = [ "typing_extensions>=4.1.1", ] +[project.optional-dependencies] +dev = [ + "mypy", + "black", + "flake8", + "pre-commit", +] [project.urls] Homepage = "https://github.com/pedrolabonia/pydavinci" Source = "https://github.com/pedrolabonia/pydavinci" diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..4c1acd2 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,34 @@ + +# Enable flake8-bugbear (`B`) rules. +select = [ + "B", + "C", + "F", + "W", + "TCH", + "B9", +] + +# Never enforce `E501` (line length violations). +ignore = [ + "E501", + "F403", + "E501", + "F403", + "E501", + "N805", + "N804", + "W293", +] + +src = ["src"] + +# Avoid trying to fix flake8-bugbear (`B`) violations. +unfixable = ["B"] + +[mccabe] +max-complexity = 18 + +# Ignore `E402` (import violations) in all `__init__.py` files. +[per-file-ignores] +"__init__.py" = ["E402"]