fune/docs/code-quality/index.rst
Andrew Halberstadt 8a4d48a70d Bug 1811850 - [lint] Replace flake8 linter with ruff, r=linter-reviewers,sylvestre
Ruff is a very fast linter implemented in Rust and it can act as a drop-in
replacement for flake8. When running the same set of rules across all files
in mozilla-central (without mozlint), flake8 takes 900 seconds whereas ruff
takes 0.9 seconds.

Ruff also implements rules from other popular Python linters such as pylint,
isort and pyupgrade. There are even plans to implement feature parity with
black in the future. Ultimately, it can become our one stop shop for all Python
linting and formatting.

This stack will swap out all our Python lint tools for ruff (excluding black
for now).

Differential Revision: https://phabricator.services.mozilla.com/D172313
2023-03-17 01:53:58 +00:00

177 lines
4 KiB
ReStructuredText

Code quality
============
Because Firefox is a complex piece of software, a lot of tools are
executed to identify issues at development phase.
In this document, we try to list these all tools.
.. toctree::
:maxdepth: 1
:glob:
static-analysis/index.rst
lint/index.rst
coding-style/index.rst
.. list-table:: C/C++
:header-rows: 1
:widths: 20 20 20 20 20
* - Tools
- Has autofixes
- Meta bug
- More info
- Upstream
* - Custom clang checker
-
-
- `Source <https://searchfox.org/mozilla-central/source/build/clang-plugin>`_
-
* - Clang-Tidy
- Yes
- `bug 712350 <https://bugzilla.mozilla.org/show_bug.cgi?id=712350>`__
- :ref:`Static analysis <Static Analysis>`
- https://clang.llvm.org/extra/clang-tidy/checks/list.html
* - Clang analyzer
-
- `bug 712350 <https://bugzilla.mozilla.org/show_bug.cgi?id=712350>`__
-
- https://clang-analyzer.llvm.org/
* - cpp virtual final
-
-
- :ref:`cpp virtual final`
-
* - Semmle/LGTM
-
- `bug 1458117 <https://bugzilla.mozilla.org/show_bug.cgi?id=1458117>`__
-
-
* - clang-format
- Yes
- `bug 1188202 <https://bugzilla.mozilla.org/show_bug.cgi?id=1188202>`__
- :ref:`Formatting C++ Code With clang-format`
- https://clang.llvm.org/docs/ClangFormat.html
.. list-table:: JavaScript
:widths: 20 20 20 20 20
:header-rows: 1
* - Tools
- Has autofixes
- Meta bug
- More info
- Upstream
* - Eslint
- Yes
- `bug 1229856 <https://bugzilla.mozilla.org/show_bug.cgi?id=1229856>`__
- :ref:`ESLint`
- https://eslint.org/
* - Mozilla ESLint
-
- `bug 1229856 <https://bugzilla.mozilla.org/show_bug.cgi?id=1229856>`__
- :ref:`Mozilla ESLint Plugin`
-
* - Prettier
- Yes
- `bug 1558517 <https://bugzilla.mozilla.org/show_bug.cgi?id=1558517>`__
- :ref:`JavaScript Coding style`
- https://prettier.io/
.. list-table:: Python
:widths: 20 20 20 20 20
:header-rows: 1
* - Tools
- Has autofixes
- Meta bug
- More info
- Upstream
* - ruff
- Yes
- `bug 1811850 <https://bugzilla.mozilla.org/show_bug.cgi?id=1811850>`__
- :ref:`ruff`
- https://github.com/charliermarsh/ruff
* - black
- Yes
- `bug 1555560 <https://bugzilla.mozilla.org/show_bug.cgi?id=1555560>`__
- :ref:`black`
- https://black.readthedocs.io/en/stable
* - pylint
-
- `bug 1623024 <https://bugzilla.mozilla.org/show_bug.cgi?id=1623024>`__
- :ref:`pylint`
- https://www.pylint.org/
.. list-table:: Rust
:widths: 20 20 20 20 20
:header-rows: 1
* - Tools
- Has autofixes
- Meta bug
- More info
- Upstream
* - Rustfmt
- Yes
- `bug 1454764 <https://bugzilla.mozilla.org/show_bug.cgi?id=1454764>`__
- :ref:`Rustfmt`
- https://github.com/rust-lang/rustfmt
* - Clippy
-
- `bug 1361342 <https://bugzilla.mozilla.org/show_bug.cgi?id=1361342>`__
- :ref:`clippy`
- https://github.com/rust-lang/rust-clippy
.. list-table:: Java/Kotlin
:widths: 20 20 20 20 20
:header-rows: 1
* - Tools
- Has autofixes
- Meta bug
- More info
- Upstream
* - Spotless
- Yes
- `bug 1571899 <https://bugzilla.mozilla.org/show_bug.cgi?id=1571899>`__
- :ref:`Spotless`
- https://github.com/diffplug/spotless
.. list-table:: Others
:widths: 20 20 20 20 20
:header-rows: 1
* - Tools
- Has autofixes
- Meta bug
- More info
- Upstream
* - shellcheck
-
-
-
- https://www.shellcheck.net/
* - rstchecker
-
-
- :ref:`RST Linter`
- https://github.com/myint/rstcheck
* - Typo detection
- Yes
-
- :ref:`Codespell`
- https://github.com/codespell-project/codespell
* - Fluent Lint
- No
-
- :ref:`Fluent Lint`
-
* - YAML linter
- No
-
- :ref:`yamllint`
- https://github.com/adrienverge/yamllint