Граф коммитов

34 Коммитов

Автор SHA1 Сообщение Дата
Andrew Halberstadt f771b816de Bug 1380003 - Create avoid-Date-timing eslint rule, r=standard8
MozReview-Commit-ID: 6b6GtBUpZUZ

--HG--
extra : rebase_source : df9766d3b202c68bc97f2d4e79fd3a1a84c689cb
2017-07-11 12:34:20 -04:00
Mark Banner 397425a083 Bug 1379119 - Expand test documentation for eslint-plugin-mozilla. r=ahal
MozReview-Commit-ID: KeFpp671uar

--HG--
extra : rebase_source : f36e05a66f19d5ba65feda304225be65f1e80fb0
2017-07-10 18:32:37 +01:00
Andrew Halberstadt fbede0d83d Bug 1361972 - Add a pre-push and pre-commit mozlint hooks r=standard8
This adds pre-push and pre-commit hooks for both hg and git. All
four possibilities are implemented in the same file.

To enable a pre-push hg hook, add the following to hgrc:

    [hooks]
    pre-push.lint = python:/path/to/gecko/tools/lint/hooks.py:hg


To enable a pre-commit hg hook, add the following to hgrc:

    [hooks]
    pretxncommit.lint = python:/path/to/gecko/tools/lint/hooks.py:hg


To enable a pre-push git hook, run the following command:

    $ ln -s /path/to/gecko/tools/lint/hooks.py .git/hooks/pre-push


To enable a pre-commit git hook, run the following command:

    $ ln -s /path/to/gecko/tools/lint/hooks.py .git/hooks/pre-commit


MozReview-Commit-ID: DUxCKN2fiag

--HG--
extra : rebase_source : 67c97a3fd8adc50d6bb3c488345077065b63de7d
2017-06-30 18:29:42 -07:00
Andrew Halberstadt 91efad9d6d Bug 1369787 - [mozlint] Remove 'rev' option from |mach lint|, r=bc
The rev option is inherently broken. It does let you lint files touched by any
revision, but it doesn't update those files to that revision first.  Instead,
they get linted at whatever the working directory is and their results are
bogus. Even if we did some magic to update the files to the proper revision
with in-memory version control magic, the config files would still be out of
date.

Plus, the new --outgoing option does pretty much the only thing --rev was good
for. Rather than cause confusion, I think it's better to just remove the
option.

MozReview-Commit-ID: 2y2UnfIkvsR

--HG--
extra : rebase_source : 9b5c142270c98905d71ebb89d1620e91914c0b47
2017-06-08 22:54:00 -04:00
Andrew Halberstadt 9a082a086c Bug 1288432 - [mozlint] Use yaml for lint definitions and separate implementation of external linters, r=bc
Rather than using .lint.py files that contain a LINTER object, linter definitions are now in
standalone .yml files. In the case of external linters that need to run python code, the payload
is now of the form:
<module path>:<object path>

The <module path> is the import path to the module, and <object path> is the callable object to
use within that module. It is up to the consumer of mozlint to ensure the <module path> lives on
sys.path. For example, if an external lint's function lives in package 'foo', file 'bar.py' and
function 'lint', the payload would read:
foo.bar:lint

This mechanism was borrowed from taskcluster.

MozReview-Commit-ID: AIsfbVmozy4

--HG--
rename : python/mozlint/test/linters/badreturncode.lint.py => python/mozlint/test/linters/badreturncode.yml
rename : python/mozlint/test/linters/explicit_path.lint.py => python/mozlint/test/linters/explicit_path.yml
rename : python/mozlint/test/linters/external.lint.py => python/mozlint/test/linters/external.yml
rename : python/mozlint/test/linters/invalid_exclude.lint.py => python/mozlint/test/linters/invalid_exclude.yml
rename : python/mozlint/test/linters/invalid_extension.lnt => python/mozlint/test/linters/invalid_extension.ym
rename : python/mozlint/test/linters/invalid_include.lint.py => python/mozlint/test/linters/invalid_include.yml
rename : python/mozlint/test/linters/invalid_type.lint.py => python/mozlint/test/linters/invalid_type.yml
rename : python/mozlint/test/linters/missing_attrs.lint.py => python/mozlint/test/linters/missing_attrs.yml
rename : python/mozlint/test/linters/missing_definition.lint.py => python/mozlint/test/linters/missing_definition.yml
rename : python/mozlint/test/linters/raises.lint.py => python/mozlint/test/linters/raises.yml
rename : python/mozlint/test/linters/regex.lint.py => python/mozlint/test/linters/regex.yml
rename : python/mozlint/test/linters/string.lint.py => python/mozlint/test/linters/string.yml
rename : python/mozlint/test/linters/structured.lint.py => python/mozlint/test/linters/structured.yml
extra : rebase_source : bda3926712234123355c5af71c6453ce869b19fc
2017-06-02 09:49:26 -04:00
Mark Banner 580ed9c407 Bug 1358484 - Add an autofix option to ESLint's no-useless-parameters. r=florian
MozReview-Commit-ID: B8mQteJ1CzF

--HG--
extra : rebase_source : 7fa31b6c0a73529693f0a936d66f55651f0fd3b7
2017-04-21 14:34:37 +01:00
Mark Banner 92c422a2d6 Bug 1342459 - Add a rule to automatically detect ContentTask.spawn and inject the relevant globals. r=mossop
This reduces the amount of places where we need to specify the mozilla/frame-script environment. It does have
the side effect of allowing those globals in the whole file, but that is what specifying the environment would
do, and this is also for mochitest test files only.

MozReview-Commit-ID: 1LLFbn6fFJR

--HG--
extra : rebase_source : 82a6934d90bbbbd25f91b7b06bf4f9354e38865a
2017-04-05 10:00:25 +01:00
Mark Banner 9f564cd9e1 Bug 1352969 - Improve ESLint environment browser-window globals list, and automatically inject it into browser-window scripts. r=mossop
MozReview-Commit-ID: 3lv0K1unAc

--HG--
extra : rebase_source : 4e4ef0f40f377298013dc17ca0f077890d32669c
2017-03-09 17:17:26 +00:00
Mark Banner 644825e657 Bug 1344932 - Separate out the ESLint spidermonkey preprocessor to avoid breaking './mach eslint --fix' on the whole tree.' r=jryans
This doesn't allow --fix to run on the whole tree in one go, but does allow it to be run on individual directories. This
is due to an ESLint issue, where once the processor is loaded, it applies to the rest of the files.

MozReview-Commit-ID: Fqg5yK22Dhu

--HG--
rename : tools/lint/eslint/eslint-plugin-mozilla/.eslintrc.js => tools/lint/eslint/.eslintrc.js
rename : tools/lint/eslint/eslint-plugin-mozilla/lib/processors/self-hosted.js => tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/processors/self-hosted.js
extra : rebase_source : 9913f929985016f4a22ff78641051dc025df14f2
2017-03-19 18:35:17 +00:00
Florian Quèze be00c3b9e8 Bug 1345294 - add an eslint rule to reject usage of {get,set}ComplexValue for nsISupportsString and suggest {get,set}StringPref instead, and make it pass, r=Mossop. 2017-03-16 19:26:02 +01:00
Mark Banner 5420828c24 Bug 1314405 - Provide a readme for eslint-plugin-mozilla, and add some more details to its package.json. r=mossop
MozReview-Commit-ID: DdzWwWEFvf6

--HG--
extra : rebase_source : 6d1825b1007b56cd99567b46e735740ac0414757
2017-03-09 11:45:04 +00:00
Florian Quèze e2b53c13ce Bug 1344711 - Add an eslint rule to report an error when a get*Pref call is the only instruction in a try block, r=jaws.
--HG--
extra : rebase_source : b98fc9c75089c3eeb2f1317623b08ee9cd4d1541
2017-03-07 15:29:47 +01:00
Mark Banner 8796160b00 Bug 1344027 - Add a places-overlay environment for ESLint for when placesOverlay.xul is included. r=mossop
MozReview-Commit-ID: 3uoneyJdEmx

--HG--
extra : rebase_source : 4c09327246e3c490c0fa30fd792c04b53d6b142e
2017-03-03 09:25:31 +00:00
Mark Banner 09889d3184 Bug 1343519 - Change the ESLint rule 'import-browserjs-globals' to be an environment (mozilla/browser-window) to better describe the purpose of it. r=mossop
MozReview-Commit-ID: FTDV8BcMGeF

--HG--
rename : tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-browserjs-globals.js => tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
extra : rebase_source : f0e89f2ce3cfdf343213f66a007f74a80a785c19
2017-03-01 21:29:52 +00:00
Mark Banner 733f0b7c97 Bug 1338195 - Define a `frame-script` environment for eslint and use it to clear no-undef issues for known frame script globals. r=mossop
MozReview-Commit-ID: Fcin4InbLK2

--HG--
extra : rebase_source : f94dbb2e5af83bb4d32c51a55702e6f58cc25323
2017-02-07 10:52:06 +00:00
Mark Banner d28d6df424 Bug 1338249 - Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports. r=mossop
MozReview-Commit-ID: 7UdgstbYNlB

--HG--
extra : rebase_source : 63005f09ce96135ea239db2de7bcffa924ae03ef
2017-02-07 11:14:49 +00:00
Carsten "Tomcat" Book 433f1f5ec7 Backed out changeset 03bfb1ccd33f (bug 1338249) for test failures in test_loading.xul 2017-02-15 15:24:32 +01:00
Mark Banner cd234e0642 Bug 1338249 - Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports. r=mossop
MozReview-Commit-ID: 7UdgstbYNlB

--HG--
extra : rebase_source : e8eb9718da9bf378b293aca5211c53dd063d4f7a
2017-02-07 11:14:49 +00:00
Florian Quèze 535b5bcde6 Bug 1338585 - Add an eslint rule to require using .ownerGlobal instead of .ownerDocument.defaultView, r=jaws. 2017-02-13 13:01:32 +01:00
Florian Quèze 77bac28360 Bug 1334831 - add an eslint rule to report usage of .parentNode.removeChild when .remove() could be used instead, r=jaws. 2017-01-30 08:10:18 +01:00
Florian Quèze 03d00b4c13 Bug 1331599 - add an eslint rule to reject removeEventListener calls when the once option can be used instead, r=jaws. 2017-01-25 07:03:50 +01:00
Florian Quèze 02daed043c Bug 1330147 - add eslint rule to reject newURI(uri, null, null) and removeObserver(notificationName, observer, false), r=jaws. 2017-01-11 22:27:42 +01:00
Mark Banner 1b9c7c6e5c Bug 1330071 - Add a couple of basic unit tests for our custom eslint rules. Currently these are not automatic. r=mossop
MozReview-Commit-ID: AUMmPQ5qDgb

--HG--
extra : rebase_source : ef05e88ea1de93de54c9e5ed8828b69e0220a2d3
2017-01-10 20:48:52 +00:00
Mark Banner 46ee297329 Bug 1328565 - Prevent cases of Cu.import importing into variables and global scope at the same time. r=mossop
MozReview-Commit-ID: CXly2RhNpRP

--HG--
extra : rebase_source : 9b9a8542bbd437aa0160c122b1b826e08de03009
2017-01-04 19:37:43 +00:00
Mark Banner f7fca8642f Bug 1240165 - Expand the eslint rule 'mark-test-function-used' to cover xpcshell tests as well as gecko tests and apply to the whole tree. r=miker
MozReview-Commit-ID: FlbJ8yzWXlw

--HG--
extra : rebase_source : 3f9a2997b36ef8f019e38e4af61a0c44e0e7283c
2016-10-26 09:46:40 +01:00
James Graham bba975bca2 Bug 1302796 - Add integration between structured logging and lints, r=ahal
MozReview-Commit-ID: K3tu0Zdg5go

--HG--
extra : rebase_source : 2b78059908c3a297b8ce7d134af20733fc082df5
2016-09-13 14:18:41 +01:00
Andrew Halberstadt c40eeb57dc Bug 1258341 - Merge eslint-plugin-mozilla docs with the main linting docs, r=miker
This does 3 things:

1) Moves all the long descriptions for the rules into the main index.rst
   document. This just makes it simpler, and there didn't seem to be much
   point in having a separate document for each rule.
2) Moves index.rst to tools/lint/docs/eslint-plugin-mozilla.rst
3) Creates a new eslint.rst landing page, and includes it.

MozReview-Commit-ID: 1e3QBkMFOBe

--HG--
rename : tools/lint/eslint/eslint-plugin-mozilla/docs/index.rst => tools/lint/docs/linters/eslint-plugin-mozilla.rst
extra : rebase_source : ab2c5c89bfa77da994f20fbecffed25e9f475ce8
2016-08-25 11:58:32 -04:00
Andrew Halberstadt ed73940aa9 Bug 1288425 - Make sure we skip invalid extensions when linting with --rev or --workdir, r=smacleod
Some linters, such as flake8, will lint invalid file extensions if you explicitly pass them in. E.g,
|flake8 foobar.js| will result in flake8 attempting to lint a JS file. This is a problem because passing
in files explicitly is exactly what the --rev/--workdir options do. If a developer modifies a JS file
then runs |mach lint -l flake8 -w|, that JS file will get linted.

To prevent this, mozlint needs to handle file extensions instead of relying on the underlying linter to
do it. This patch adds an "extensions" config option to the LINTER dict, and will filter these files out
as part of the 'filterpaths' steps.

MozReview-Commit-ID: KYhC6SEySC3

--HG--
extra : rebase_source : 6fea2942b2db1bea7deca1d6738546362b6ebd65
2016-08-09 16:24:04 -04:00
Iris Hsiao bb2d612158 Backed out changeset 2141360b4137 (bug 1288425) for build bustage 2016-07-27 10:59:10 +08:00
Andrew Halberstadt 18f9c226a5 Bug 1288425 - Make sure we skip invalid extensions when linting with --rev or --workdir, r=smacleod
Some linters, such as flake8, will lint invalid file extensions if you explicitly pass them in. E.g,
|flake8 foobar.js| will result in flake8 attempting to lint a JS file. This is a problem because passing
in files explicitly is exactly what the --rev/--workdir options do. If a developer modifies a JS file
then runs |mach lint -l flake8 -w|, that JS file will get linted.

To prevent this, mozlint needs to handle file extensions instead of relying on the underlying linter to
do it. This patch adds an "extensions" config option to the LINTER dict, and will filter these files out
as part of the 'filterpaths' steps.

MozReview-Commit-ID: KYhC6SEySC3

--HG--
extra : rebase_source : 46807a4913660f33e691b864c2c59c448902dfa5
2016-07-19 13:50:25 -04:00
Andrew Halberstadt 3c8be23f37 Bug 1281899 - [mozlint] Add ability to lint files touched by revisions and/or the working directory, r=smacleod
This adds two parameters, --rev and --workdir. Each works both with mercurial and git (though the syntax for
specifying revisions is different between them). The value is simply forwarded to either |hg log| or |git diff|
so syntax like |mach lint -r .~4::.| or |mach lint -r "HEAD~4 HEAD"| will work as expected.

MozReview-Commit-ID: aOGp2Yrncs

--HG--
extra : rebase_source : d2cb834d4cc1a083171a3551af4e72c8a7d14021
2016-06-24 14:09:58 -04:00
Andrew Halberstadt 7c3487a2d7 Bug 1277851 - [mozlint] Run flake8 directories that contain a .flake8 file separately, r=maja_zf
This is a crude workaround to get subdirectory .flake8 files working. Hopefully
this is temporary until flake8 3.0 is released with support for multiple config
files.

Note that .flake8 files that live outside of a directory that is explicitly
listed in the 'include' directive, will not be considered.

MozReview-Commit-ID: GtpUZHJKq52

--HG--
extra : rebase_source : 0294e135673a3b580316a46ec13e37749422edba
2016-06-03 10:39:32 -04:00
Andrew Halberstadt b1445349ea Bug 1270506 - [mozlint] Add python flake8 linter, r=smacleod
For now, only the following two directories will be linted:
python/mozlint
tools/lint

New directories can be added by adding them to the 'include'
directive in tools/lint/flake8.lint. They all default to the
configuration specified in topsrcdir/.flake8. Subdirectories
can override this configuration by creating their own .flake8
file.

MozReview-Commit-ID: Eag48Lnkp3l

--HG--
extra : rebase_source : 6d98c9fef80055a48cc2622848aa04c3045b747e
2016-05-05 17:21:12 -04:00
Andrew Halberstadt 0484cb2aa7 Bug 1230962 - Create mach/build system integration for mozlint, r=smacleod
MozReview-Commit-ID: 74ma5uMOphe

--HG--
extra : rebase_source : 3b0594650a364ad598fc12cc38f3e4fd916ca26b
2016-03-18 13:54:07 -04:00