зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1510458 - Ride along: simplify the declaration (else after a return) r=ahal
Depends on D13709 Differential Revision: https://phabricator.services.mozilla.com/D13710 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1d186ac794
Коммит
d2ca9ab951
|
@ -565,9 +565,8 @@ class Warnings(MachCommandBase):
|
|||
joined_path = mozpath.join(dir1, dir2)
|
||||
if os.path.isdir(joined_path):
|
||||
return joined_path
|
||||
else:
|
||||
print('Specified directory not found.')
|
||||
return None
|
||||
print('Specified directory not found.')
|
||||
return None
|
||||
|
||||
@CommandProvider
|
||||
class GTestCommands(MachCommandBase):
|
||||
|
@ -1931,13 +1930,13 @@ class StaticAnalysis(MachCommandBase):
|
|||
infer_args + [gradle] + args,
|
||||
env=dict(os.environ, **extra_env),
|
||||
cwd=cwd, stdout=devnull, stderr=subprocess.STDOUT, close_fds=True)
|
||||
else:
|
||||
return self.run_process(
|
||||
infer_args + [gradle] + args,
|
||||
append_env=extra_env,
|
||||
pass_thru=True, # Allow user to run gradle interactively.
|
||||
ensure_exit_code=False, # Don't throw on non-zero exit code.
|
||||
cwd=cwd)
|
||||
|
||||
return self.run_process(
|
||||
infer_args + [gradle] + args,
|
||||
append_env=extra_env,
|
||||
pass_thru=True, # Allow user to run gradle interactively.
|
||||
ensure_exit_code=False, # Don't throw on non-zero exit code.
|
||||
cwd=cwd)
|
||||
|
||||
@StaticAnalysisSubCommand('static-analysis', 'autotest',
|
||||
'Run the auto-test suite in order to determine that'
|
||||
|
@ -2365,9 +2364,9 @@ class StaticAnalysis(MachCommandBase):
|
|||
if path is None:
|
||||
return self._run_clang_format_diff(self._clang_format_diff,
|
||||
self._clang_format_path, show)
|
||||
else:
|
||||
if assume_filename:
|
||||
return self._run_clang_format_in_console(self._clang_format_path, path, assume_filename)
|
||||
|
||||
if assume_filename:
|
||||
return self._run_clang_format_in_console(self._clang_format_path, path, assume_filename)
|
||||
|
||||
return self._run_clang_format_path(self._clang_format_path, show, path)
|
||||
|
||||
|
@ -2522,26 +2521,26 @@ class StaticAnalysis(MachCommandBase):
|
|||
self._compile_db = mozpath.join(self.topobjdir, 'compile_commands.json')
|
||||
if os.path.exists(self._compile_db):
|
||||
return 0
|
||||
else:
|
||||
rc, config, ran_configure = self._get_config_environment()
|
||||
|
||||
rc, config, ran_configure = self._get_config_environment()
|
||||
if rc != 0:
|
||||
return rc
|
||||
|
||||
if ran_configure:
|
||||
# Configure may have created the compilation database if the
|
||||
# mozconfig enables building the CompileDB backend by default,
|
||||
# So we recurse to see if the file exists once again.
|
||||
return self._build_compile_db(verbose=verbose)
|
||||
|
||||
if config:
|
||||
print('Looks like a clang compilation database has not been '
|
||||
'created yet, creating it now...')
|
||||
builder = Build(self._mach_context)
|
||||
rc = builder.build_backend(['CompileDB'], verbose=verbose)
|
||||
if rc != 0:
|
||||
return rc
|
||||
|
||||
if ran_configure:
|
||||
# Configure may have created the compilation database if the
|
||||
# mozconfig enables building the CompileDB backend by default,
|
||||
# So we recurse to see if the file exists once again.
|
||||
return self._build_compile_db(verbose=verbose)
|
||||
|
||||
if config:
|
||||
print('Looks like a clang compilation database has not been '
|
||||
'created yet, creating it now...')
|
||||
builder = Build(self._mach_context)
|
||||
rc = builder.build_backend(['CompileDB'], verbose=verbose)
|
||||
if rc != 0:
|
||||
return rc
|
||||
assert os.path.exists(self._compile_db)
|
||||
return 0
|
||||
assert os.path.exists(self._compile_db)
|
||||
return 0
|
||||
|
||||
def _build_export(self, jobs, verbose=False):
|
||||
def on_line(line):
|
||||
|
@ -2631,8 +2630,8 @@ class StaticAnalysis(MachCommandBase):
|
|||
raise Exception('The current platform isn\'t supported. '
|
||||
'Currently only the following platforms are '
|
||||
'supported: win32/win64, linux64 and macosx64.')
|
||||
else:
|
||||
job += '-clang-tidy'
|
||||
|
||||
job += '-clang-tidy'
|
||||
|
||||
# We want to unpack data in the clang-tidy mozbuild folder
|
||||
currentWorkingDir = os.getcwd()
|
||||
|
@ -2711,34 +2710,34 @@ class StaticAnalysis(MachCommandBase):
|
|||
return not os.path.exists(self._infer_path)
|
||||
if os.path.exists(self._infer_path) and not force:
|
||||
return 0
|
||||
|
||||
if os.path.isdir(infer_path) and download_if_needed:
|
||||
# The directory exists, perhaps it's corrupted? Delete it
|
||||
# and start from scratch.
|
||||
shutil.rmtree(infer_path)
|
||||
return self._get_infer(force=force, skip_cache=skip_cache,
|
||||
verbose=verbose,
|
||||
download_if_needed=download_if_needed)
|
||||
os.mkdir(infer_path)
|
||||
self._artifact_manager = PackageFrontend(self._mach_context)
|
||||
if not download_if_needed:
|
||||
return 0
|
||||
job, _ = self.platform
|
||||
if job != 'linux64':
|
||||
return -1
|
||||
else:
|
||||
if os.path.isdir(infer_path) and download_if_needed:
|
||||
# The directory exists, perhaps it's corrupted? Delete it
|
||||
# and start from scratch.
|
||||
shutil.rmtree(infer_path)
|
||||
return self._get_infer(force=force, skip_cache=skip_cache,
|
||||
verbose=verbose,
|
||||
download_if_needed=download_if_needed)
|
||||
os.mkdir(infer_path)
|
||||
self._artifact_manager = PackageFrontend(self._mach_context)
|
||||
if not download_if_needed:
|
||||
return 0
|
||||
job, _ = self.platform
|
||||
if job != 'linux64':
|
||||
return -1
|
||||
else:
|
||||
job += '-infer'
|
||||
# We want to unpack data in the infer mozbuild folder
|
||||
currentWorkingDir = os.getcwd()
|
||||
os.chdir(infer_path)
|
||||
rc = self._artifact_manager.artifact_toolchain(verbose=verbose,
|
||||
skip_cache=skip_cache,
|
||||
from_build=[job],
|
||||
no_unpack=False,
|
||||
retry=0)
|
||||
# Change back the cwd
|
||||
os.chdir(currentWorkingDir)
|
||||
return rc
|
||||
job += '-infer'
|
||||
# We want to unpack data in the infer mozbuild folder
|
||||
currentWorkingDir = os.getcwd()
|
||||
os.chdir(infer_path)
|
||||
rc = self._artifact_manager.artifact_toolchain(verbose=verbose,
|
||||
skip_cache=skip_cache,
|
||||
from_build=[job],
|
||||
no_unpack=False,
|
||||
retry=0)
|
||||
# Change back the cwd
|
||||
os.chdir(currentWorkingDir)
|
||||
return rc
|
||||
|
||||
def _run_clang_format_diff(self, clang_format_diff, clang_format, show):
|
||||
# Run clang-format on the diff
|
||||
|
|
Загрузка…
Ссылка в новой задаче