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

57 Коммитов

Автор SHA1 Сообщение Дата
Sylvestre Ledru bb324b9dad Bug 1514755 - lint hooks: Use local path instead of absolute r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D14745

--HG--
extra : moz-landing-system : lando
2018-12-17 14:54:11 +00:00
Andrew Halberstadt 9d5e499a90 Bug 1448417 - [mozlint] Remove ability to specify globs in an 'include' directive, r=egao
There is only a single linter (test-disable.yml) that uses a glob in any
include path, and that usage is easily replaced by using the 'extensions' key
instead.

Since globs in include directives aren't very useful, let's disallow them. This
will allow us to simplify the 'filterpaths' logic quite substantially and make
future refactorings in this area easier.

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

--HG--
extra : moz-landing-system : lando
2018-09-25 18:30:23 +00:00
Andrew Halberstadt bbd3ba0a18 Bug 1460856 - [mozlint] Encapsulate all result state in a ResultSummary class r=sylvestre
Currently there are 3 things that can impact the result of a lint run:

1. The list of lint issues found
2. The set of failures that happened during the setup phase
3. The set of failures that happened during the execution phase

All three of these things are stored as instance variables on the LintRoller
object, and then passed into a formatter when it comes time to print the
results. I'd like to add even more things that can impact the result, and it
became clear that the current scenario does not scale well.

This patch moves all data that could impact the end result of a lint run off of
the LintRoller object and onto a new 'result.ResultSummary' class. To avoid
confusion, this patch also renames the 'result.ResultContainer' class to
'result.Issue'.

With this new nomenclature:

result  -> overall state of an entire lint run (can comprise multiple linters)
issue   -> one specific lint infraction (at either 'warning' or 'error' level)
failure -> a non-recoverable error in the linter implementation itself

A "result" is comprised of 0 or more "issues" and 0 or more "failures".

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

--HG--
extra : moz-landing-system : lando
2018-08-28 13:51:04 +00:00
Andrew Halberstadt 84797ec831 Bug 1373368 - [mozlint] Lint whole tree if using --workdir/--outgoing and support-file was modified, r=standard8
Previously, using --workdir or --outgoing could miss errors when modifying a
support file since those could affect unmodified files.

This patch allows linters to define support-files in their .yml configuration.
If using --outgoing or --workdir and a file matching one of those patterns was
modified, we'll lint the entire tree.

MozReview-Commit-ID: CuGLYwQwiWr

--HG--
extra : rebase_source : 00d4107c41404f5e6ab05e0106d5cd377e25652f
2018-02-16 17:46:04 -05:00
Kris Maglione 313b707b2e Bug 1443964: Part 3 - Remove no-cpows-in-tests rule. r=mconley
The shims that this rule tests for no longer exist.

MozReview-Commit-ID: DMgP7Hczavc

--HG--
extra : rebase_source : 765ddd5c62c9449c07ed050e44d86a3bd5c0ae64
extra : amend_source : 627a7694ac07182200f876901ded7a34721cd228
2018-03-07 19:31:28 -08:00
Brendan Dahl 8a6f97c45c Bug 1442302 - Remove placesOverlay.xul. r=Gijs,mak,standard8
The overlay was responsible for script loading and defining three elements
(bhTooltip, placesCommands, placesContext). In the majority of places where
the overlay was included only part of it was used. To remove the overlay, the
elements were each split into include files and moved into where they
were used. For the scripts, a JS file was added that defines all the lazy
modules and then this script, globalOverlay.js and utilityOverlay.js were
inlined to everywhere that would have included them from the overlay.

MozReview-Commit-ID: 8T5D46oYWLn

--HG--
rename : browser/components/places/content/placesOverlay.xul => browser/components/places/content/placesCommands.inc.xul
rename : browser/components/places/content/placesOverlay.xul => browser/components/places/content/placesContextMenu.inc.xul
extra : rebase_source : c1071af4ea264a95183cbc65caae98feb23d58e5
2018-03-12 10:43:35 -07:00
Jared Wein 1225eda729 Bug 1436575 - Prevent ==/!= comparisons with booleans as they aren't necessary. r=standard8
MozReview-Commit-ID: 25oVDVNzDyF

--HG--
rename : tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-includes-instead-of-indexOf.js => tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-compare-against-boolean-literals.js
rename : tools/lint/eslint/eslint-plugin-mozilla/tests/use-chromeutils-import.js => tools/lint/eslint/eslint-plugin-mozilla/tests/no-compare-against-boolean-literals.js
extra : rebase_source : 46b7159f659ae0182408d5f11ac2ebafb08fe2df
2018-02-08 11:51:17 -05:00
Mark Banner 54c4111311 Bug 1230369 - Add ESLint rules to disallow defining Cc/Ci etc and to prefer the use of Cc/Ci rather than the Components.* equivalents. r=florian
MozReview-Commit-ID: 9eAgUO3iIJW

--HG--
extra : rebase_source : 3208d5f74477733e4c81206613f74d7c7821ac0d
2018-02-06 22:40:12 +00:00
Andrew Halberstadt eb84bf741c Bug 1429457 - [mozlint] Create formal 'setup' mechanism for bootstrapping lint dependencies, r=gbrown
This allows linters to define a 'setup' method which will automatically be
called by |mach lint| before running the linter. Users can also explicitly run
these methods (without doing any actual linting) by running |mach lint --setup|.

MozReview-Commit-ID: 74aY1pfsaX1

--HG--
extra : rebase_source : e6a7d769ba14c996c7a77316928063fa46358c5a
2018-01-25 13:40:02 -05:00
Florian Quèze fcd9a3a0c8 Bug 1339461 - add an eslint rule to detect when indexOf should be replaced with includes, r=Standard8. 2018-02-01 20:47:23 +01:00
arthur.iakab c4dd80eca3 Merge mozilla-central to autoland 2018-01-31 00:41:58 +02:00
Mark Banner 15e66f33ed Bug 1434332 - Add a checklist for adding new linters to the tree. r=ahal
MozReview-Commit-ID: FnYIXS5oZvW

--HG--
extra : rebase_source : 2eba61a24a4ca313f3c1d65adef454e34c57bdb5
2018-01-30 16:55:20 +00:00
Kris Maglione 6425ff4f8d Bug 1431533: Part 4 - Add ESLint support for ChromeUtils import methods. r=florian
This adds support for detecting globals created by these helpers, as well as a
rule to enforce their use over the older XPConnect variants.

The latter rule also supports fixing code to use the newer variants, and will
be used in the next part to rewrite in-tree ESLint-enabled code that fails it.

MozReview-Commit-ID: 6Bgo6ohQA5j

--HG--
extra : source : fbef09c3e8af1653f270db589f73f2786c23ddc2
extra : intermediate-source : e2674287e57fbf6835729f42b8491359c2c4bfd5
2018-01-18 12:53:01 -08:00
Andrew Halberstadt a8b5fc493f Bug 1433912 - [lint] Only run codespell linter on python/mozlint and tools/lint for now, r=sylvestre
This is a bustage fix that needs to get out quickly. Once landed we can take
the time to enable it on more directories, or preferably change it to a
blacklist.

MozReview-Commit-ID: Gbf7q2L0tg3

--HG--
extra : rebase_source : a58ae64c655b24e686710a663d4538b4cfe020f7
2018-01-29 10:25:54 -05:00
Sylvestre Ledru 3a35e750f3 Bug 1433417 - Fix a bunch of typo in the doc r=ahal
MozReview-Commit-ID: LRgL0CMJdDP

--HG--
extra : rebase_source : b99364bb96c1501a674a1726a3b5fdf0664a8e4f
2018-01-26 12:50:07 +01:00
Mark Banner a501264a60 Bug 1431452 - Fix formatting of ESLint's docs. r=mossop
MozReview-Commit-ID: KUFa9ncqaxV

--HG--
extra : rebase_source : 4444037e785ca91d20179a1cf6ec1f936b65ad0d
2018-01-18 16:33:28 +00:00
Mark Banner 30935fa314 Bug 1369722 - Disable ESLint browser environment for jsm files. r=mossop
MozReview-Commit-ID: IVAyPmTqtCB

--HG--
extra : rebase_source : 7db82ead3e0ca7fcbf909021c8eafc79f7cd2a9a
2017-11-07 22:59:09 +00:00
Nicholas Nethercote f4dd5e2636 Bug 1414096 (attempt 2) - Remove support for nsISupportsString values in nsPrefBranch::{get,set}ComplexValue(). r=florian.
Bug 1345294 introduced nsPrefBranch::{get,set}StringPref(), which allowed the
getting of utf8 strings from prefs, which previously required using
nsISupportsString with {get,set}ComplexValue. That bug also converted most
uses.

This patch finishes the job.

- It removes the nsISupportsString support.

- It converts existing code that relied on the nsISupportsString.

- It removes the lint that was set up to detect such uses of nsISupportsString.

--HG--
extra : rebase_source : b885ee784704819e181430200af5ef762e269d14
2017-11-10 09:07:48 +11:00
Narcis Beleuzu 57d9eb5fb1 Backed out 1 changesets (bug 1414096) for dt1 failures "devtools/client/commandline/test/browser_cmd_pref3.js" r=backout on a CLOSED TREE
Backed out changeset e843de356b7e (bug 1414096)
2017-11-08 18:04:01 +02:00
Nicholas Nethercote 8b3d03c666 Bug 1414096 - Remove support for nsISupportsString values in nsPrefBranch::{get,set}ComplexValue(). r=florian.
Bug 1345294 introduced nsPrefBranch::{get,set}StringPref(), which allowed the
getting of utf8 strings from prefs, which previously required using
nsISupportsString with {get,set}ComplexValue. That bug also converted most
uses.

This patch finishes the job.

- It removes the nsISupportsString support.

- It converts existing code that relied on the nsISupportsString.

- It removes the lint that was set up to detect such uses of nsISupportsString.

--HG--
extra : rebase_source : fb7af066adfa0491a79fae6282a62b08661553c8
2017-10-31 16:34:35 +11:00
Mark Banner 8340eb52c8 Bug 1230373 - Add an ESLint rule to prefer using Services.jsm rather than getService. r=mossop
MozReview-Commit-ID: G9dp4PxcyT7

--HG--
extra : rebase_source : 957b5ead56c8c778b1ba812343c132b34030135f
2017-10-06 17:03:38 +01:00
Mark Banner a9005029b6 Bug 1392098 - Add an ESLint rule to avoid unnecessary run_test() functions. r=mossop
MozReview-Commit-ID: pbXjamX4bk

--HG--
extra : rebase_source : cc506d08e7d47e75464ca7f07bd3ef323184270d
2017-08-18 21:49:44 +01:00
Andrew Halberstadt 411adfbc83 Bug 1387555 - [mozlint] Make use of quickfix when using --edit with vim/nvim, r=dylan
MozReview-Commit-ID: BlJbWVv1CeO

--HG--
extra : rebase_source : 005f72d9f74ccd86ae73a298acde6b0b3fd6a550
2017-08-09 10:03:02 -04:00
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