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
--- a/python/mozlint/mozlint/formatters/stylish.py
+++ b/python/mozlint/mozlint/formatters/stylish.py
@@ -85,17 +85,17 @@ class StylishFormatter(object):
rule='{} '.format(err.rule) if err.rule else '',
linter=err.linter.lower(),
))
message.append('') # newline
# If there were failures, make it clear which linters failed
for fail in failed:
- message.append("{c}A failure occured in the {name} linter.".format(
+ message.append("{c}A failure occurred in the {name} linter.".format(
c=self.color('brightred'),
name=fail,
))
# Print a summary
message.append(self.fmt_summary.format(
t=self.term,
c=self.color('brightred') if num_errors or failed else self.color('brightyellow'),
--- a/tools/lint/codespell.yml
+++ b/tools/lint/codespell.yml
@@ -1,12 +1,14 @@
---
codespell:
description: Check code for common misspellings
- include: ['.']
+ include:
+ - tools/lint
+ - python/mozlint
exclude:
- third_party
# List of extensions coming from:
# tools/lint/{flake8,eslint}.yml
# tools/mach_commands.py (clang-format)
# + documentation
# + localization files
extensions:
--- a/tools/lint/docs/linters/flake8.rst
+++ b/tools/lint/docs/linters/flake8.rst
@@ -26,17 +26,17 @@ Configuration
-------------
Only directories explicitly whitelisted will have flake8 run against them. To enable flake8 linting
in a source directory, it must be added to the ``include`` directive in ```tools/lint/flake8.lint``.
If you wish to exclude a subdirectory of an included one, you can add it to the ``exclude``
directive.
The default configuration file lives in ``topsrcdir/.flake8``. The default configuration can be
-overriden for a given subdirectory by creating a new ``.flake8`` file in the subdirectory. Be warned
+overridden for a given subdirectory by creating a new ``.flake8`` file in the subdirectory. Be warned
that ``.flake8`` files cannot inherit from one another, so all configuration you wish to keep must
be re-defined.
.. warning::
Only ``.flake8`` files that live in a directory that is explicitly included in the ``include``
directive will be considered. See `bug 1277851`_ for more details.
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -240,17 +240,17 @@ module.exports = {
"no-extra-semi": "error",
// No overwriting defined functions
"no-func-assign": "error",
// Disallow eval and setInteral/setTimeout with strings
"no-implied-eval": "error",
- // No invalid regular expresions
+ // No invalid regular expressions
"no-invalid-regexp": "error",
// No odd whitespace characters
"no-irregular-whitespace": "error",
// Disallow the use of the __iterator__ property
"no-iterator": "error",
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/processors/xbl-bindings.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/processors/xbl-bindings.js
@@ -131,17 +131,17 @@ function addNodeLines(node, reindent) {
let lines = node.textContent.split("\n");
let startLine = node.textLine;
let startColumn = node.textColumn;
// The case where there are no whitespace lines before the first text is
// treated differently for indentation
let indentFirst = false;
- // Strip off any preceeding whitespace only lines. These are often used to
+ // Strip off any preceding whitespace only lines. These are often used to
// format the XML and CDATA blocks.
while (lines.length && lines[0].trim() == "") {
indentFirst = true;
startLine++;
lines.shift();
}
// Remember the indent of the last blank line, which is the closing part of
@@ -167,17 +167,17 @@ function addNodeLines(node, reindent) {
if (!indentFirst) {
let firstLine = lines.shift();
// ESLint counts columns starting at 1 rather than 0
lineMap[scriptLines.length] = { line: startLine, offset: startColumn - 1 };
scriptLines.push(firstLine);
startLine++;
}
- // Find the preceeding whitespace for all lines that aren't entirely
+ // Find the preceding whitespace for all lines that aren't entirely
// whitespace.
let indents = lines.filter(s => s.trim().length > 0)
.map(s => s.length - s.trimLeft().length);
// Find the smallest indent level in use
let minIndent = Math.min.apply(null, indents);
let indent = Math.max(2, minIndent - lastIndent);
for (let line of lines) {
--- a/tools/lint/shell/__init__.py
+++ b/tools/lint/shell/__init__.py
@@ -36,17 +36,17 @@ class ShellcheckProcess(ProcessHandlerMi
self.config = config
kwargs['processOutputLine'] = [self.process_line]
ProcessHandlerMixin.__init__(self, *args, **kwargs)
def process_line(self, line):
try:
data = json.loads(line)
except JSONDecodeError as e:
- print('Unable to load shellcheck output: {}'.format(e))
+ print('Unable to load shellcheck output ({}): {}'.format(e, line))
return
for entry in data:
res = {
'path': entry['file'],
'message': entry['message'],
'level': 'error' if entry['level'] == 'error' else 'warning',
'lineno': entry['line'],