Example #1
0
def check_all(files, style):
    '''Run flake8 on all paths.'''
    from flake8 import main
    # loadDir = g.os_path_finalize_join(g.__file__, '..', '..')
    # paths = []
    # for fn in files:
        # if dir_:
            # fn = g.os_path_join(loadDir, dir_, fn)
        # else:
            # fn = g.os_path_join(loadDir, fn)
        # fn = g.os_path_abspath(fn)
        # if not fn.endswith('.py'):
            # fn = fn+'.py'
        # if g.os_path_exists(fn):
            # # Make *sure* that we check files only once.
            # if fn in seen:
                # g.trace('already seen:', fn)
            # else:
                # seen.add(fn)
                # paths.append(fn)
        # else:
            # print('does not exist: %s' % (fn))

    # Set statistics here, instead of from the command line.
    # options = style.options
    # options.statistics = True
    # options.total_errors = True
    # options.benchmark = True
    report = style.check_files(paths=files)
    main.print_report(report, style)
Example #2
0
def check_all(files, style):
    """Run flake8 on all paths."""
    # pylint: disable=import-error
    from flake8 import main

    report = style.check_files(paths=files)
    main.print_report(report, style)
Example #3
0
def check_all(files, style):
    '''Run flake8 on all paths.'''
    from flake8 import main
    # loadDir = g.os_path_finalize_join(g.__file__, '..', '..')
    # paths = []
    # for fn in files:
    # if dir_:
    # fn = g.os_path_join(loadDir, dir_, fn)
    # else:
    # fn = g.os_path_join(loadDir, fn)
    # fn = g.os_path_abspath(fn)
    # if not fn.endswith('.py'):
    # fn = fn+'.py'
    # if g.os_path_exists(fn):
    # # Make *sure* that we check files only once.
    # if fn in seen:
    # g.trace('already seen:', fn)
    # else:
    # seen.add(fn)
    # paths.append(fn)
    # else:
    # print('does not exist: %s' % (fn))

    # Set statistics here, instead of from the command line.
    # options = style.options
    # options.statistics = True
    # options.total_errors = True
    # options.benchmark = True
    report = style.check_files(paths=files)
    main.print_report(report, style)
Example #4
0
def flake8():
    flake8_style = get_style_guide(exclude=','.join(
        [l.strip() for l in open(GIT_IGNORE).readlines()]),
                                   config_file=DEFAULT_CONFIG)
    report = flake8_style.check_files('./')
    if report.total_errors > 0:
        print_report(report, flake8_style)
        sys.exit(1)
Example #5
0
def flake8():
    flake8_style = get_style_guide(
        exclude=','.join([
            l.strip() for l in
            open(GIT_IGNORE).readlines()
        ]), config_file=DEFAULT_CONFIG
    )
    report = flake8_style.check_files('./')
    if report.total_errors > 0:
        print_report(report, flake8_style)
        sys.exit(1)
Example #6
0
 def check_all(self, paths):
     """Run flake8 on all paths."""
     config_file = self.get_flake8_config()
     if config_file:
         style = engine.get_style_guide(parse_argv=False,
                                        config_file=config_file)
         report = style.check_files(paths=paths)
         # Set statistics here, instead of from the command line.
         options = style.options
         options.statistics = True
         options.total_errors = True
         # options.benchmark = True
         main.print_report(report, style)
 def check_all(self, paths):
     '''Run flake8 on all paths.'''
     from flake8 import engine, main
     config_file = self.get_flake8_config()
     if config_file:
         style = engine.get_style_guide(
             parse_argv=False,
             config_file=config_file,
         )
         report = style.check_files(paths=paths)
         # Set statistics here, instead of from the command line.
         options = style.options
         options.statistics = True
         options.total_errors = True
         # options.benchmark = True
         main.print_report(report, style)
Example #8
0
def main():
    # flake8
    flake8 = get_style_guide(exclude=['.tox', 'build'])
    report = flake8.check_files([BASE_DIR])

    # TODO integration test creating a directory to be git-ified
    return print_report(report, flake8)
Example #9
0
 def check_all(self, paths):
     """Run flake8 on all paths."""
     try:
         # pylint: disable=import-error
         # We can't assume the user has this.
         from flake8 import engine, main
     except Exception:
         return
     config_file = self.get_flake8_config()
     if config_file:
         style = engine.get_style_guide(parse_argv=False,
                                        config_file=config_file)
         report = style.check_files(paths=paths)
         # Set statistics here, instead of from the command line.
         options = style.options
         options.statistics = True
         options.total_errors = True
         # options.benchmark = True
         main.print_report(report, style)
Example #10
0
 def flake8_report(self):
     """
     Outputs flake8 report.
     """
     log.info("\n\nFlake8 Report:")
     base = get_path([BASEDIR, 'tribus'])
     pys = find_files(path=base, pattern='*.py')
     flake8_style = get_style_guide()
     report = flake8_style.check_files(pys)
     exit_code = print_report(report, flake8_style)
Example #11
0
def main():
    # flake8
    flake8 = get_style_guide(exclude=['.tox', 'build'])
    report = flake8.check_files([BASE_DIR])

    exit_code = print_report(report, flake8)
    if exit_code > 0:
        return exit_code

    # unit tests
    suite = TestLoader().discover(CODE_DIR, top_level_dir=BASE_DIR)
    result = TextTestRunner().run(suite)
    if result.wasSuccessful():
        return 0
    else:
        return 1
Example #12
0
def main():
    # flake8
    flake8 = get_style_guide(exclude=['.tox', 'build'])
    report = flake8.check_files([BASE_DIR])

    exit_code = print_report(report, flake8)
    if exit_code > 0:
        return exit_code

    # unit tests
    suite = TestLoader().discover(CODE_DIR, top_level_dir=BASE_DIR)
    result = TextTestRunner().run(suite)
    if result.wasSuccessful():
        return 0
    else:
        return 1
Example #13
0
def run_flake8():
    flake8 = get_style_guide(exclude=['.tox', 'build'])
    report = flake8.check_files([BASE_DIR])

    return print_report(report, flake8)
Example #14
0
def run_flake8():
    flake8 = get_style_guide(exclude=['.tox', 'build'])
    report = flake8.check_files([BASE_DIR])

    return print_report(report, flake8)
Example #15
0
def flake8():
    flake8_style = get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG)
    report = flake8_style.check_files()
    if report.total_errors > 0:
        print_report(report, flake8_style)
    return report.total_errors
Example #16
0
def run_flake8():
    print('Running flake8...')
    flake8 = get_style_guide(exclude=['.tox', 'build'], max_complexity=10)
    report = flake8.check_files([BASE_DIR])

    return print_report(report, flake8)
Example #17
0
def check_all(files, style):
    '''Run flake8 on all paths.'''
    from flake8 import main
    report = style.check_files(paths=files)
    main.print_report(report, style)
Example #18
0
def run_flake8():
    # flake8
    flake8 = get_style_guide(exclude=['.tox', 'build'], max_complexity=10)
    report = flake8.check_files([BASE_DIR])

    return print_report(report, flake8)