Commit Graph
138 Commits
Author SHA1 Message Date
Arnaud Bienner e2d9241a0b Bug 2039187 - linters: fix race condition when --fix option is specified r=linter-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D300236
2026-06-11 08:11:04 +00:00
Alex Hochheiden 02333707ab Bug 2006716 - Reformat entire repo with ruff-format (black replacement) r=ahal,sylvestre,linter-reviewers,perftest-reviewers,mozperftest-reviewers,geckoview-reviewers,extension-reviewers,media-playback-reviewers,webrtc-reviewers,releng-reviewers,sessionstore-reviewers,win-reviewers,dom-storage-reviewers,translations-reviewers,omc-reviewers,android-reviewers,home-newtab-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,geckodriver-reviewers,Sasha,emz,fchasen,sthompson,dholbert,sparky,padenot,emilio,Gijs,mconley,tcampbell,mjf,emcminn,willdurand,gstoll,jgraham,asuth
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D276894
2026-01-08 21:15:53 +00:00
Atila Butkovits ce6aff66e2 Revert "Bug 2006716 - Remove unused default_bindir() from ruff.py r=ahal,linter-reviewers" for causing failures at tp5n-pageset.manifest.
This reverts commit a198379dd7.

Revert "Bug 2006716 - Add `ruff-format` linter r=ahal,linter-reviewers"

This reverts commit 8e2f1e924b.

Revert "Bug 2006716 - Remove `black` linter r=ahal,linter-reviewers"

This reverts commit 857218c417.

Revert "Bug 2006716 - Fix `ruff` linter `stderr` callback broken in D190696 r=ahal,linter-reviewers"

This reverts commit da4a569cfb.

Revert "Bug 2006716 - Update `ruff` to version `0.14.9` and use consistent versions in `lint.txt` and `python-test.txt` r=ahal,linter-reviewers"

This reverts commit 0781186b2e.

Revert "Bug 2006716 - Reformat entire repo with `ruff-format` (`black` replacement) r=ahal,sylvestre,linter-reviewers,perftest-reviewers,mozperftest-reviewers,geckoview-reviewers,extension-reviewers,media-playback-reviewers,webrtc-reviewers,releng-reviewers,sessionstore-reviewers,win-reviewers,dom-storage-reviewers,translations-reviewers,omc-reviewers,android-reviewers,home-newtab-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,geckodriver-reviewers,Sasha,emz,fchasen,sthompson,dholbert,sparky,padenot,emilio,Gijs,mconley,tcampbell,mjf,emcminn,willdurand,gstoll,jgraham,asuth"

This reverts commit b2b8db2859.
2026-01-07 21:34:31 +00:00
Alex Hochheiden b2b8db2859 Bug 2006716 - Reformat entire repo with ruff-format (black replacement) r=ahal,sylvestre,linter-reviewers,perftest-reviewers,mozperftest-reviewers,geckoview-reviewers,extension-reviewers,media-playback-reviewers,webrtc-reviewers,releng-reviewers,sessionstore-reviewers,win-reviewers,dom-storage-reviewers,translations-reviewers,omc-reviewers,android-reviewers,home-newtab-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,geckodriver-reviewers,Sasha,emz,fchasen,sthompson,dholbert,sparky,padenot,emilio,Gijs,mconley,tcampbell,mjf,emcminn,willdurand,gstoll,jgraham,asuth
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D276894
2026-01-07 18:08:27 +00:00
Alexandru Marc d296caccba Revert "Bug 2006716 - Remove unused default_bindir() from ruff.py r=ahal,linter-reviewers" for causing toolchain bustages
This reverts commit 76033c983e.

Revert "Bug 2006716 - Add `ruff-format` linter r=ahal,linter-reviewers"

This reverts commit 19fd8c23ca.

Revert "Bug 2006716 - Remove `black` linter r=ahal,linter-reviewers"

This reverts commit 0b01c783a6.

Revert "Bug 2006716 - Fix `ruff` linter `stderr` callback broken in D190696 r=ahal,linter-reviewers"

This reverts commit 72cab75517.

Revert "Bug 2006716 - Update `ruff` to version `0.14.9` and use consistent versions in `lint.txt` and `python-test.txt` r=ahal,linter-reviewers"

This reverts commit a434d066ce.

Revert "Bug 2006716 - Reformat entire repo with `ruff-format` (`black` replacement) r=ahal,sylvestre,linter-reviewers,perftest-reviewers,mozperftest-reviewers,geckoview-reviewers,extension-reviewers,media-playback-reviewers,webrtc-reviewers,releng-reviewers,sessionstore-reviewers,win-reviewers,dom-storage-reviewers,translations-reviewers,omc-reviewers,android-reviewers,home-newtab-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,geckodriver-reviewers,Sasha,emz,fchasen,sthompson,dholbert,sparky,padenot,emilio,Gijs,mconley,tcampbell,mjf,emcminn,willdurand,gstoll,jgraham,asuth"

This reverts commit 3ed06912eb.
2026-01-07 00:54:28 +00:00
Alex Hochheiden 3ed06912eb Bug 2006716 - Reformat entire repo with ruff-format (black replacement) r=ahal,sylvestre,linter-reviewers,perftest-reviewers,mozperftest-reviewers,geckoview-reviewers,extension-reviewers,media-playback-reviewers,webrtc-reviewers,releng-reviewers,sessionstore-reviewers,win-reviewers,dom-storage-reviewers,translations-reviewers,omc-reviewers,android-reviewers,home-newtab-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,layout-reviewers,dom-worker-reviewers,geckodriver-reviewers,Sasha,emz,fchasen,sthompson,dholbert,sparky,padenot,emilio,Gijs,mconley,tcampbell,mjf,emcminn,willdurand,gstoll,jgraham,asuth
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D276894
2026-01-07 00:32:15 +00:00
Andrew Halberstadt 8c28078763 Bug 1977636 - [lint] Display source context in default formatter, r=linter-reviewers,sylvestre
Some linters include source code as context, often with little ascii
arrows that point at the problem. This can be invaluable for figuring
out where the problem is.

We have an attribute to store this information in the `Issue` class, but
unfortunately none of the mozlint formatters display it!

This gets the default formatter to attempt displaying the source, with
some basic colorization. The colorization is dependent on the format of
each linter, so it may need to be adjusted as we add different linters.

Differential Revision: https://phabricator.services.mozilla.com/D257531
2025-07-30 22:55:55 +00:00
Andrew Halberstadt 8171cde538 Bug 1972466 - [mozlint] Error out without traceback if all linters were skipped due to setup, r=linter-reviewers,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D254229
2025-06-19 19:22:28 +00:00
Ben Dean-Kawamura a4d7085661 Bug 1960928 - ./mach lint clippy updates, r=ahal,taskgraph-reviewers
Make clippy a global linter.  This means it only runs once per
workspace, which is good because `cargo` handles parallelization
internally.  There's no reason to split things out into multiple commands.

Updated the global linter config handling to pass a list of files.  This
is needed for clippy and we can just ignore them for the android lints.

Updated the clippy linter to work with crates outside of `gkrust`.  For
these crates, we call `cargo clippy` directly and does not filter by
path name.  These crates need to be listed in `tools/lint/clippy.yml`,
currently this is only `uniffi-bindgen-gecko-js`, but it's easy to add
more.

Fixed some lint warnings in the `mozlint` package itself.

Differential Revision: https://phabricator.services.mozilla.com/D246488
2025-04-29 20:33:42 +00:00
Beth Rennie 78f943689e Bug 1948069 - Fix pipelint on Windows r=ahal
The pipelint tool was not working correctly on Windows for three reasons:

1. The module was being imported into every child process spawned by the
   lint roller's multiprocessing executor. Because the import of
   pipelint has side-effects (the actual running of mach lint on the
   input), each child process would end up recursively triggering these
   side-effects and causing exponential process growth until they all
   eventually crashed.

   To address this we now have the logic of the pipelint script behind a
   `if __name__ == "__main__" guard.

2. We were keeping the file handle open before we called into mach,
   which resulted in a permissions error trying to read from the file
   handle after mach had finished.

   To address this we now immediately close the file before invoking
   `mach lint` and re-open it for reading after.

3. We were using default newline handling inside `pipelint` and
   `mozlint`, which resulted in LFs being translated to CRLFs
   automatically in all the intermediate temporary files.

   To address this, we open files for reading and writing in binary mode
   so that we deal directly with the underlying bytes instead of
   particular interpretations of bytes (e.g., newlines, CP252 vs UTF-8),
   including `stdin` (when reading file input from `jj`) and `stdout`
   (when outputting the final formatted files).

Differential Revision: https://phabricator.services.mozilla.com/D244513
2025-04-23 18:04:21 +00:00
Alex Hochheiden 9e91a1f021 Bug 1715287 - [lint] Enable remaining pyupgrade rules and lint tree r=linter-reviewers,webdriver-reviewers,translations-reviewers,whimboo,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D245320
2025-04-13 17:48:23 +00:00
Andrew Halberstadt 629c3f0c5a Bug 1944916 - [mozlint] Add ability to lint files from stdin to mozlint, r=linter-reviewers,sylvestre
This allows `./mach lint` to be used with integrations that expect to
pass in file contents on stdin and get a fixed version of the file on
stdout.

Differential Revision: https://phabricator.services.mozilla.com/D236224
2025-02-06 19:54:47 +00:00
Andrew Halberstadt 5a57d31223 Bug 1944916 - [mozlint] Run all console output through the logger, r=linter-reviewers,sylvestre
This ensures consistency in output between the parent and subprocess. It
also adjusts the formatting by log level, so we only get the more
detailed format when `--verbose` is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D236252
2025-02-06 19:54:46 +00:00
Andrew Halberstadt e6bfcad702 Bug 1944916 - [mozlint] Fix path filtering edge case, r=linter-reviewers,sylvestre
Under the old logic, if a linter has a file directly in its include config, e.g:

```
include: [path/to/some/file.py]
```

Then it would always get linted, even if the user never specified it on
the cli. This is a bug.

Differential Revision: https://phabricator.services.mozilla.com/D236251
2025-02-06 15:19:07 +00:00
Tooru Fujisawa 94bba12a39 Bug 1936051 - Part 15: Remove JSM handling from eslint config. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D233741
2025-01-23 12:09:37 +00:00
ahochheiden d0a30e9392 Bug 1898817 - Replace distutils.spawn.find_executable with shutil.which within mozlint r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D211630
2024-06-21 17:30:03 +00:00
Noemi Erli 35f162af9c Backed out 8 changesets (bug 1899681, bug 1888570, bug 1898817) as requested by the dev CLOSED TREE
Backed out changeset 5be4d65a269f (bug 1899681)
Backed out changeset 4b2b91958615 (bug 1898817)
Backed out changeset 91cfbbe6cacd (bug 1898817)
Backed out changeset 689cadd510e1 (bug 1888570)
Backed out changeset dee593604635 (bug 1888570)
Backed out changeset 2fc073aab920 (bug 1898817)
Backed out changeset c68493490b5c (bug 1898817)
Backed out changeset eb50a220de69 (bug 1898817)
2024-06-12 21:19:10 +03:00
ahochheiden a7f90e7ba4 Bug 1898817 - Replace distutils.spawn.find_executable with shutil.which within mozlint r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D211630
2024-06-12 16:10:34 +00:00
Gijs Kruitbosch 2b6df36c8c Bug 1856535 - allow linters to work by excluding extensions instead of including them, r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D202635
2024-03-13 09:40:27 +00:00
Joel Maher 93a74ef1b8 Bug 1869430 - Batch 19.2 convert python unittest .ini -> .toml. r=gbrown,taskgraph-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D196124
2023-12-12 17:40:03 +00:00
Sylvestre Ledru 3608dc8457 Bug 1860157 - Fix typos found by codespell 2.2.6 r=webdriver-reviewers,zeid,search-reviewers,perftest-reviewers,devtools-reviewers,releng-reviewers,gbrown,sparky,jteow
Differential Revision: https://phabricator.services.mozilla.com/D191480
2023-10-19 20:52:10 +00:00
Logan Rosen 45be05a920 Bug 1786490 - reformat the tree using black 23.3.0 r=sylvestre,webdriver-reviewers,taskgraph-reviewers,whimboo,jmaher,ahal,perftest-reviewers,geckoview-reviewers,afinder,m_kato
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D186092
2023-09-06 16:14:30 +00:00
Marco Castelluccio f2004b2001 Bug 1801836 - Remove no longer necessary 'from __future__' imports under python/. r=linter-reviewers,glandium,ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D165398
2022-12-23 01:26:15 +00:00
Marco Castelluccio 9905632fd2 Bug 1790816 - Reformat python/ with isort. r=#linter-reviewers CLOSED TREE
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D162656
2022-12-21 09:56:15 +00:00
Connor Sheehan a3b7423102 Bug 1805804: avoid linting the tree for support-files changes if --fix is passed r=marco
Changing a linter's `support-files` causes that linter to
run against the entire tree. This is to avoid introducing
a regression in files that weren't touched, which would
be confusing for developers who trusted `--outgoing` to
catch their regressions.

Turn this behaviour off when `--fix` is passed as a linter
argument so these regressions aren't also fixed tree-wide.
Move the logic for tree-wide linting into a function
`should_lint_entire_tree` and add tests for the behaviour
in `test_roller.py`.

Differential Revision: https://phabricator.services.mozilla.com/D164761
2022-12-15 16:40:09 +00:00
Valentin Rigal 1791a4abca Bug 1793948 - Softly report mozlint warnings on autoland. r=bastien,linter-reviewers,sylvestre,ahal
Differential Revision: https://phabricator.services.mozilla.com/D158769
2022-11-22 16:23:12 +00:00
Ryan VanderMeulen 90fec6ac70 Bug 1738054 - Remove obsolete "skip-if = python == 2" keys from testing manifests and re-enable some skipped tests which now pass. r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D149573
2022-06-21 01:46:44 +00:00
Mitchell Hentges b22b52b997 Bug 1753769: "runcli.py" in tests should use explicit paths r=ahal
The new `mozlint` behaviour will always lean on the VCS
to only lint changed files.

However, in tests, the VCS is going to be slow and also provide
inconsistent data between tests. Additionally, in some contexts,
the VCS won't be available.

Resolve this by hardcoding a file to lint for each case.

Differential Revision: https://phabricator.services.mozilla.com/D138033
2022-02-08 22:06:59 +00:00
Marco Castelluccio 5ba5f185ea Bug 1703664 - Enable showing all warnings from mozlint-based linters in reviewbot. r=ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D111166
2021-04-09 15:08:57 +00:00
nisarg 4d5b8dac4a Bug 1646161 - Add command to run linters for the exclude list r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D105115
2021-03-09 20:07:00 +00:00
Akshat Dixit 7c9ee4705c Bug 1591991 Add lint Fixed count support to linters r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D102082
2021-02-08 19:00:10 +00:00
Akshat Dixit 76cce5b703 Bug 1646433 ./mach lint -l foobar handles the error correctly r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D102806
2021-02-04 22:04:11 +00:00
Ricky Stewart 31b8ca9716 Bug 1654103: Standardize on Black for Python code in mozilla-central.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-26 18:34:53 +00:00
Bogdan Tara 612312a64c Backed out 10 changesets (bug 1654103, bug 1672023, bug 1518999) for PanZoomControllerTest.touchEventForResult gv-junit failures CLOSED TREE
Backed out changeset ff3fb0b4a512 (bug 1672023)
Backed out changeset e7834b600201 (bug 1654103)
Backed out changeset 807893ca8069 (bug 1518999)
Backed out changeset 13e6b92440e9 (bug 1518999)
Backed out changeset 8b2ac5a6c98a (bug 1518999)
Backed out changeset 575748295752 (bug 1518999)
Backed out changeset 65f07ce7b39b (bug 1518999)
Backed out changeset 4bb80556158d (bug 1518999)
Backed out changeset 8ac8461d7bd7 (bug 1518999)
Backed out changeset e8ba13ee17f5 (bug 1518999)
2020-10-24 03:36:18 +03:00
Ricky Stewart 065d2eb893 Bug 1654103: Standardize on Black for Python code in mozilla-central. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-23 20:40:42 +00:00
Dorel Luca 95b44c982f Backed out changeset 7558c8821a07 (bug 1654103) for multiple failures. CLOSED TREE 2020-10-22 03:51:06 +03:00
Ricky Stewart 43baed3c18 Bug 1654103: Standardize on Black for Python code in mozilla-central. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-21 21:27:27 +00:00
Andrew Halberstadt dc11742bbe Bug 1657604 - [mozlint] Support multiple linters per yaml file, r=linter-reviewers,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D86206
2020-08-07 07:12:41 +00:00
Tom Prince e5e1148caa Bug 1652503: [mozlint] Use attrs for mozlint.result.Issue; r=ahal
This gives sorting on `Issue` for free, which makes it easier to write tests
for linters.

Differential Revision: https://phabricator.services.mozilla.com/D84643
2020-07-23 14:55:45 +00:00
Steve Fink d3913d9ab7 Bug 1621322 - Implement mach lint --revset=REV r=ahal
In the process, fixed a few bugs:
 - the template eg `{file_adds % "\n{file}"}` produced a leading blank line,
   which led to everything being linted.
 - 'd' was replaced with 'r' in diff_filters, but the replacement was discarded.
 - as a result of the above, `hg status -d` was being used ("show only deleted (but tracked) files") and now it is `hg status -r` ("show only removed files"). I *think* this is what was intended?

Differential Revision: https://phabricator.services.mozilla.com/D66714
2020-03-22 22:12:18 +00:00
Rob Lemley 4472423dc4 Bug 1622974 - Add mozlint parameter to set additional config file path. r=ahal
Adds --config-paths parameter to mach mozlint where test configuration
files (.yml) can be located. The default path "tools/lint" is set automatically
and additional paths have preference over the default.
This allows Thunderbird to run mozlint-based tests in Taskcluster with a
different configuration.

Differential Revision: https://phabricator.services.mozilla.com/D67077
2020-03-20 17:12:27 +00:00
Andrew Halberstadt 8cde637a6c Bug 1570654 - [mozlint] Filter out non-existent paths in filterpaths, r=linter-reviewers,sylvestre
While we validate user specified paths early and only consider the 'AM' (added
+ modified) diff filter from versioncontrol, it's still possible to get
non-existent files when using --outgoing. This situation can happen when you
have a commit series that first modifies a file in an earlier commit, and then
moves/deletes it in a later commit.

To get around this, just silently filter out any file paths that don't exist.

Differential Revision: https://phabricator.services.mozilla.com/D67411
2020-03-19 18:06:41 +00:00
Andrew Halberstadt 29ec66bfed Bug 1623339 - [mozlint] Add a test for pathutils.expand_exclusions, r=linter-reviewers,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D67334
2020-03-18 17:02:27 +00:00
Mark Banner d399306825 Bug 1612077 - Use parallel directory processing for Lint when no path is specified or a support file is touched. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D61219
2020-03-02 21:51:58 +00:00
Narcis Beleuzu bd51452638 Backed out changeset 8b2c3a0fa051 (bug 1612077) lint failures on test_support_files.py. CLOSED TREE 2020-03-02 19:38:08 +02:00
Mark Banner 4849e3d725 Bug 1612077 - Use parallel directory processing for Lint when no path is specified or a support file is touched. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D61219
2020-03-02 15:02:23 +00:00
Andrew Halberstadt d57a917cc4 Bug 1612115 - [mozlint] Fix an error in the path filtering logic, r=linter-reviewers,sylvestre CLOSED TREE
Essentially:

  FilterPath("docs").contains("docshell")

was returning True because "docshell" startswith "docs".

Differential Revision: https://phabricator.services.mozilla.com/D64661
2020-02-27 21:52:50 +00:00
shindli 215df75e24 Backed out 2 changesets (bug 1612115) for causing a mozlint failure in /builds/worker/checkouts/gecko/tools/lint/test/test_yaml.py CLOSED TREE
Backed out changeset 8b3bb998c3c2 (bug 1612115)
Backed out changeset 10f69335c6f5 (bug 1612115)
2020-02-28 00:07:04 +02:00
Andrew Halberstadt 8673ae01b2 Bug 1612115 - [mozlint] Fix an error in the path filtering logic, r=linter-reviewers,sylvestre
Essentially:

  FilterPath("docs").contains("docshell")

was returning True because "docshell" startswith "docs".

Differential Revision: https://phabricator.services.mozilla.com/D64661
2020-02-27 21:52:50 +00:00
Andrew Halberstadt 2c7344707d Bug 1608783 - [mozlint] Fix bug in 'collapse' when two paths are a prefix of one another, r=Standard8
This was happening because we had two exclude paths that were run through the 'collapse' algorithm:
editor/libeditor/tests/browserscope/lib/richtext
editor/libeditor/tests/browserscope/lib/richtext2

The problem was that in order to determine the base directory, the algorithm called
'os.path.commonprefix'. This function just returns the common string prefix, which
is the '.../lib/richtext' path. Even though in the above, the base *should* have
been '.../lib'.

To fix the problem, we add a check to ensure the computed base doesn't have any
sibling directories with the same prefix. If there are, it means 'commonprefix' was
too greedy.

Differential Revision: https://phabricator.services.mozilla.com/D60173
2020-01-17 16:18:59 +00:00