evrone / evrone-django-template

Simple and ready to go Django Template.
MIT License
17 stars 2 forks source link

Discussion about linters and formatters #5

Open nifadyev opened 2 months ago

nifadyev commented 2 months ago

Let's discuss improvements and changes related to linters and formatters. If you have any tool, package, config, or script to share, feel free to suggest it into this discussion.

nifadyev commented 2 months ago

Current flake8 config is irrelevant - there are WPS rules in ignore block. But these rules are for wemake-python-styleguide which is not listed in dev dependencies.

Another issue is huge pylint config inside pyproject.toml. I suppose pylint related rules should be moved to .pylintrc and checked for relevance.

In general, It is worth taking ruff into consideration as a replacement for flake8 + plugins, black and isort. Most of the rules from evrone config are supported by ruff but it is easier to maintain, faster to run and install.

batazor commented 2 months ago

And proof for ruff:

Shows a bar chart with benchmark results.

Linting the CPython codebase from scratch.

- ⚡️ 10-100x faster than existing linters (like Flake8) and formatters (like Black) - 🐍 Installable via `pip` - 🛠️ `pyproject.toml` support - 🤝 Python 3.13 compatibility - ⚖️ Drop-in parity with [Flake8](https://docs.astral.sh/ruff/faq/#how-does-ruffs-linter-compare-to-flake8), isort, and [Black](https://docs.astral.sh/ruff/faq/#how-does-ruffs-formatter-compare-to-black) - 📦 Built-in caching, to avoid re-analyzing unchanged files - 🔧 Fix support, for automatic error correction (e.g., automatically remove unused imports) - 📏 Over [800 built-in rules](https://docs.astral.sh/ruff/rules/), with native re-implementations of popular Flake8 plugins, like flake8-bugbear - ⌨️ First-party [editor integrations](https://docs.astral.sh/ruff/integrations/) for [VS Code](https://github.com/astral-sh/ruff-vscode) and [more](https://docs.astral.sh/ruff/editors/setup) - 🌎 Monorepo-friendly, with [hierarchical and cascading configuration](https://docs.astral.sh/ruff/configuration/#config-file-discovery)
nifadyev commented 2 months ago

I suppose we should wait some time, let's say 2 weeks. Maybe there are some other opinions and options to consider. If no, then we shall migrate current linter config to ruff and then validate linter checks

grigoryvp commented 1 month ago

+1 for ruff, it's hightly recommended by core devs I personally know

nifadyev commented 1 month ago

Above is PR with ability to choose linter on project initialization. Probably it is suitable option. Please review and share your opinions