File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
doc/user_guide/features/formatting_code
project-template/{{cookiecutter.repo_name}} Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ For autoformatting, the following tools are used:
2727 packages, third party packages, and local application imports).
2828* `pyupgrade <https://pypi.org/project/pyupgrade/ >`__ - upgrades syntax for newer
2929 versions of the Python language.
30+ * `ruff <https://docs.astral.sh/ruff/ >`__ - checks and fixes code per its configuration.
31+ Currently, the PTB only supports removing unused imports.
3032
3133In the PTB, these tools are bundled into nox sessions to ensure that they are run in a
3234deterministic manner.
@@ -81,3 +83,16 @@ and is defined in the :meth:`exasol.toolbox.config.BaseConfig.pyupgrade_argument
8183
8284For further configuration options, see the
8385`pyupgrade documentation <https://pypi.org/project/pyupgrade/ >`__.
86+
87+ ruff
88+ ^^^^
89+
90+ Ensure ``ruff `` is configured like so:
91+
92+ .. literalinclude :: ../../../../project-template/{{cookiecutter.repo_name}}/pyproject.toml
93+ :language: toml
94+ :start-at: [tool.ruff]
95+ :end-before: [tool.mypy.overrides]
96+
97+ For further configuration options, see
98+ `ruff options <https://docs.astral.sh/ruff/configuration >`__.
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ might want to ignore automatically applied formatting.
3838| | | |
3939| | <line-to-ignore> # isort:skip| # isort:skip_file |
4040+-----------------------+--------------------------------+-----------------------+
41+ | formatting from ruff | .. code-block:: python | .. code-block:: python|
42+ | | | |
43+ | | <line-to-ignore> # noqa: F401| # ruff: noqa F401 |
44+ +-----------------------+--------------------------------+-----------------------+
4145
4246
4347In the ``checks.yml ``, ``project:format `` wants me to reformat code I did not modify
Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ ignore = []
5757max-line-length = 88
5858max-module-lines = 800
5959
60+ [tool .ruff .lint ]
61+ extend-ignore = [
62+ " E" , # Syntax errors
63+ " F" , # Pyflakes rules (excluding F401)
64+ " UP" , # pyupgrade rules
65+ " D" , # Docstring rules
66+ ]
67+ extend-select = [" F401" ]
68+ unfixable = []
69+
6070[[tool .mypy .overrides ]]
6171module = [
6272 " test.*" ,
You can’t perform that action at this time.
0 commit comments