def lint(paths, config, fix=None, **lintargs): if not pip.reinstall_program(CODESPELL_REQUIREMENTS_PATH): print(CODESPELL_INSTALL_ERROR) return 1 binary = get_codespell_binary() if not binary: print(CODESPELL_NOT_FOUND) if 'MOZ_AUTOMATION' in os.environ: return 1 return [] config['root'] = lintargs['root'] exclude_list = os.path.join(here, 'exclude-list.txt') cmd_args = [ binary, '--disable-colors', # Silence some warnings: # 1: disable warnings about wrong encoding # 2: disable warnings about binary file # 4: shut down warnings about automatic fixes # that were disabled in dictionary. '--quiet-level=7', '--ignore-words=' + exclude_list, # Ignore dictonnaries '--skip=*.dic', ] if fix: cmd_args.append('--write-changes') base_command = cmd_args + paths run_process(config, base_command) return results
def lint(paths, config, **lintargs): if not pip.reinstall_program(FLAKE8_REQUIREMENTS_PATH): print(FLAKE8_INSTALL_ERROR) return 1 binary = get_flake8_binary() cmdargs = [ binary, '--format', '{"path":"%(path)s","lineno":%(row)s,' '"column":%(col)s,"rule":"%(code)s","message":"%(text)s"}', ] # Run any paths with a .flake8 file in the directory separately so # it gets picked up. This means only .flake8 files that live in # directories that are explicitly included will be considered. # See bug 1277851 paths_by_config = defaultdict(list) for path in paths: configs = get_ancestors_by_name('.flake8', path, lintargs['root']) paths_by_config[os.pathsep. join(configs) if configs else 'default'].append(path) for configs, paths in paths_by_config.items(): cmd = cmdargs[:] if configs != 'default': configs = reversed(configs.split(os.pathsep)) cmd.extend(['--append-config={}'.format(c) for c in configs]) cmd.extend(paths) run_process(config, cmd) return results
def setup(root, **lintargs): if not pip.reinstall_program(FLAKE8_REQUIREMENTS_PATH): print(FLAKE8_INSTALL_ERROR) return 1
def setup(root, **lintargs): if not pip.reinstall_program(rstcheck_requirements_file): print(RSTCHECK_INSTALL_ERROR) return 1
def setup(root, **lintargs): if not pip.reinstall_program(PERFDOCS_REQUIREMENTS_PATH): print("Cannot install requirements.") return 1