-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
192 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ FROM python:3.12.7-alpine | |
LABEL maintainer="[email protected]" | ||
LABEL vendor="wemake.services" | ||
|
||
ENV WPS_VERSION='0.19.2' | ||
ENV WPS_VERSION='1.0.0' | ||
ENV REVIEWDOG_VERSION='v0.20.3' | ||
|
||
RUN apk add --no-cache bash git wget | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,28 @@ | ||
Auto-formatters | ||
--------------- | ||
|
||
Autoformatters are very simple tools to do just a one thing: | ||
reformat some basic stuff in your code like quotes, commas, and line length. | ||
List of supported tools. | ||
|
||
The difference between a linter and auto-formatter is huge: | ||
|
||
- auto-formatters pretties your code a little bit | ||
- linters force you to write beautiful and correct code | ||
ruff | ||
~~~~ | ||
|
||
For example, auto-formatters won't tell you that your code is too complex. | ||
When your linter will (in case it is a good linter). | ||
Fully supported. | ||
You can run ``ruff check && ruff format`` and there | ||
should be no conflicts with ``WPS`` at all. | ||
|
||
Autoformatters are also useless | ||
when dealing with rewriting actually bad code. | ||
Like code with bad variable names, unreachable branches, | ||
statements that have no effect. | ||
But, ``wemake-python-styleguide`` can and will find additional | ||
problems that ``ruff`` missed. | ||
|
||
We in ``wemake.services`` believe that these kind of tools are not required, | ||
because a good linter will just not let your badly formatted code pass the CI, | ||
so there would be no junk to reformat! | ||
All code is perfectly formatted all the time. | ||
|
||
Rely on strict linters, not auto-formatters. | ||
|
||
However, if you still want to use some autoformatter | ||
together with ``wemake-python-styleguide`` | ||
we have made some research to help you! | ||
|
||
isort | ||
~~~~~ | ||
|
||
``isort`` is a great tool to sort your imports. | ||
We already use it to validate that your imports are correct. | ||
We recommend to use ``isort`` and officially | ||
and support it in a way that all | ||
valid ``wemake-python-styleguide`` code is valid ``isort`` code. | ||
But, **not the other way around**. | ||
|
||
You might be required to refactor your code manually after ``isort`` | ||
reformat to make ``wemake-python-styleguide`` happy. | ||
|
||
``isort`` can also `be invoked <https://github.com/timothycrosley/isort#using-isort>`_ | ||
as a command line tool to fix all your import problems for you. | ||
|
||
We recommend to run ``isort``. They are also compatible. | ||
We support ``isort``, but we recommend to use ``ruff`` instead. | ||
See https://docs.astral.sh/ruff/rules/#isort-i | ||
|
||
There are also plugins for IDEs to run ``isort`` on safe: | ||
|
||
- https://github.com/timothycrosley/isort/wiki/isort-Plugins | ||
- https://code.visualstudio.com/docs/python/editing | ||
|
||
You can find the configuration we use in ``setup.cfg`` in this repository. | ||
|
||
black | ||
~~~~~ | ||
|
||
``wemake-python-styleguide`` is not compatible with ``black``. | ||
Let's go deeper and see why. | ||
|
||
``black`` itself is actually not compatible with ``PEP8`` and ``flake8`` | ||
(`docs <https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=flake8>`_), | ||
that's why it is not compatible with ``wemake-python-styleguide`` either. | ||
Here are the violations that ``black`` produces: | ||
|
||
- Quotes: for some reasons ``black`` uses ``"`` | ||
that almost no one uses in the ``python`` world | ||
- Trailing commas: ``black`` strips trailing commas and this makes | ||
adding new code harder to review, since your ``git diff`` is polluted | ||
by a comma change, the sad thing that trailing commas as a best-practice | ||
are quite popular in ``python`` code | ||
- Line length. Violating rules by 10%-15% is not ok. | ||
You either violate them or not. ``black`` violates line-length rules. | ||
|
||
And there's no configuration to fix it! | ||
Shame, that official ``python-org`` product violates the community standards | ||
and not enforcing them. | ||
Is supported since ``1.0.0``, but we recommend to use ``ruff format`` instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,5 @@ | |
github-actions.rst | ||
ci.rst | ||
stubs.rst | ||
pylint.rst | ||
extras.rst | ||
jupyter_notebooks.rst |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.