Bug 1588523 - Provide doc for the codespell, file-perm, file-whitespace, etc linters r=ahal

Depends on D49160

Differential Revision: https://phabricator.services.mozilla.com/D49161

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2019-10-16 07:49:47 +00:00
parent 7491daaf08
commit 0e8bbb9060
6 changed files with 173 additions and 0 deletions

View File

@ -0,0 +1,30 @@
Codespell
=========
`codespell`_ is a popular tool to look for typical typos in the source code.
It is enabled mostly for the documentation and English locale files.
Run Locally
-----------
The mozlint integration of codespell can be run using mach:
.. parsed-literal::
$ mach lint --linter codespell <file paths>
Configuration
-------------
To enable codespell on new directory, add the path to the include
section in the `codespell.yaml <https://searchfox.org/mozilla-central/source/tools/lint/codespell.yml>`_ file.
Autofix
-------
Codespell provides a ``--fix`` option. It is based on the ``-w`` option provided by upstream.
.. _codespell: https://github.com/codespell-project/codespell/

View File

@ -0,0 +1,24 @@
cpp virtual final
=================
This linter detects the virtual function declarations with multiple specifiers.
It matches our coding style:
Method declarations must use at most one of the following keywords: virtual, override, or final.
As this linter uses some simple regular expression, it can miss some declarations.
Run Locally
-----------
This linter can be run using mach:
.. parsed-literal::
$ mach lint --linter cpp-virtual-final <file paths>
Configuration
-------------
This linter is enabled on all C family files.

View File

@ -0,0 +1,32 @@
File permission
===============
This linter verifies if a file has unnecessary permissions.
If a file has execution permissions (+x), file-perm will
generate a warning.
It will ignore files starting with ``#!`` (Python or node scripts).
This linter does not have any affect on Windows.
Run Locally
-----------
This mozlint linter can be run using mach:
.. parsed-literal::
$ mach lint --linter file-perm <file paths>
Configuration
-------------
This linter is enabled on the whole code base.
Autofix
-------
This linter provides a ``--fix`` option. The python script is doing the change itself.

View File

@ -0,0 +1,26 @@
Trailing whitespaces
====================
This linter verifies if a file has unnecessary trailing whitespaces or Windows
carriage return.
Run Locally
-----------
This mozlint linter can be run using mach:
.. parsed-literal::
$ mach lint --linter file-whitespace <file paths>
Configuration
-------------
This linter is enabled on most of the code base.
Autofix
-------
This linter provides a ``--fix`` option. The python script is doing the change itself.

View File

@ -0,0 +1,39 @@
License
=======
This linter verifies if a file has a known license header.
By default, Firefox uses MPL-2 license with the `appropriate headers <https://www.mozilla.org/en-US/MPL/headers/>`_.
In some cases (thirdpardy code), a file might have a different header file.
If this is the case, one of the significant line of the header should be listed in the list `of valid licenses
<https://searchfox.org/mozilla-central/source/tools/lint/license/valid-licenses.txt>`_.
Run Locally
-----------
This mozlint linter can be run using mach:
.. parsed-literal::
$ mach lint --linter license <file paths>
Configuration
-------------
This linter is enabled on most of the whole code base.
Autofix
-------
This linter provides a ``--fix`` option. The python script is doing the change itself
and will use the right header MPL-2 header depending on the language.
It will add the license at the right place in case the file is a script (ie starting with ``!#``
or a XML file ``<?xml>``).
Sources
-------
* `Configuration <https://searchfox.org/mozilla-central/source/tools/lint/license.yml>`_
* `Source <https://searchfox.org/mozilla-central/source/tools/lint/license/__init__.py>`_

View File

@ -0,0 +1,22 @@
MinGW capitalization
====================
This linter verifies that Windows include file are lowercase.
It might break the mingw build otherwise.
Run Locally
-----------
This mozlint linter can be run using mach:
.. parsed-literal::
$ mach lint --linter mingw-capitalization <file paths>
Configuration
-------------
This linter is enabled on the whole code base except WebRTC