Backed out changeset c41cb5ac4dbd (bug 1806098) for causing lint failures on lints.py, isort.py CLOSED TREE

This commit is contained in:
Norisz Fay 2022-12-16 18:13:59 +02:00
parent 08d4a8b04f
commit 081bdcdf0c
9 changed files with 16 additions and 19 deletions

View File

@ -14,6 +14,7 @@ import sys
import xml.etree.ElementTree as ET
import mozpack.path as mozpath
import six
from mozlint import result
from mozpack.files import FileFinder
@ -59,7 +60,7 @@ def gradle(log, topsrcdir=None, topobjdir=None, tasks=[], extra_args=[], verbose
+ extra_args
)
cmd = " ".join(arg for arg in cmd_args)
cmd = " ".join(six.moves.shlex_quote(arg) for arg in cmd_args)
log.debug(cmd)
# Gradle and mozprocess do not get along well, so we use subprocess

View File

@ -42,8 +42,7 @@ def run_mozlint(hooktype, args):
# don't prevent commits, just display the lint results
run_process(cmd + ["--workdir=staged"])
return False
if "push" in hooktype:
elif "push" in hooktype:
return run_process(cmd + ["--outgoing"] + args)
print("warning: '{}' is not a valid mozlint hooktype".format(hooktype))

View File

@ -97,7 +97,7 @@ def evaluate_pref(value):
bools = {"true": True, "false": False}
if value in bools:
return bools[value]
if value.isdigit():
elif value.isdigit():
return int(value)
return value

View File

@ -60,9 +60,9 @@ class Gatherer(object):
"""
if self._perfdocs_tree:
return self._perfdocs_tree
self.fetch_perfdocs_tree()
return self._perfdocs_tree
else:
self.fetch_perfdocs_tree()
return self._perfdocs_tree
def fetch_perfdocs_tree(self):
"""

View File

@ -11,13 +11,10 @@ pylint:
- dom/websocket/
- mozglue/
- toolkit/components/telemetry/
- tools/lint/
- tools/moztreedocs/
exclude:
- dom/bindings/Codegen.py
- security/manager/ssl/tests/unit/test_content_signing/pysign.py
- security/ct/tests/gtest/createSTHTestData.py
- tools/lint/test/
extensions: ['py']
support-files:
- '**/.pylint'

View File

@ -34,8 +34,8 @@ def default_bindir():
# virtualenv's activate_this.py, whereas sys.executable doesn't.
if platform.system() == "Windows":
return os.path.join(sys.prefix, "Scripts")
return os.path.join(sys.prefix, "bin")
else:
return os.path.join(sys.prefix, "bin")
def get_black_version(binary):
@ -135,7 +135,8 @@ def setup(root, **lintargs):
if ["black=={}".format(version)] == versions:
log.debug("Black is present with expected version {}".format(version))
return 0
log.debug("Black is present but unexpected version {}".format(version))
else:
log.debug("Black is present but unexpected version {}".format(version))
log.debug("Black needs to be installed or updated")
virtualenv_manager = lintargs["virtualenv_manager"]

View File

@ -63,8 +63,8 @@ def default_bindir():
# virtualenv's activate_this.py, whereas sys.executable doesn't.
if platform.system() == "Windows":
return os.path.join(sys.prefix, "Scripts")
return os.path.join(sys.prefix, "bin")
else:
return os.path.join(sys.prefix, "bin")
class NothingToLint(Exception):

View File

@ -24,7 +24,7 @@ class YAMLLintProcess(LintProcess):
def process_line(self, line):
try:
match = YAMLLINT_FORMAT_REGEX.match(line)
abspath, line, col, _, message, code = match.groups()
abspath, line, col, level, message, code = match.groups()
except AttributeError:
print("Unable to match yaml regex against output: {}".format(line))
return

View File

@ -172,7 +172,8 @@ def build_docs(
"failed to generate documentation:\n"
"%s: sphinx return code %d" % (path, status)
)
print("\nGenerated documentation:\n%s" % savedir)
else:
print("\nGenerated documentation:\n%s" % savedir)
if enable_fatal_warnings:
fatal_warnings = _check_sphinx_warnings(warnings)
@ -269,8 +270,6 @@ def _run_sphinx(docdir, savedir, config=None, fmt="html", jobs=None, verbose=Non
# When running sphinx with sentry, it adds significant overhead
# and makes the build generation very very very slow
# So, disable it to generate the doc faster
# pylint: disable=abstract-class-instantiated
# See https://github.com/getsentry/sentry-python/issues/1081
sentry_sdk.init(None)
warn_fd, warn_path = tempfile.mkstemp()
os.close(warn_fd)