Example #1
0
def scan_for_checkers(request):
    parser, options_hooks = get_parser()
    args_marker = request.node.get_closest_marker('flake8_args')
    if args_marker is None:
        args = []
    else:
        args = list(args_marker.args)
    opts, args = parser.parse_args(args)
    opts.ignore = tuple(opts.ignore)
    EbbLint.parse_options(opts)
Example #2
0
def scan_for_checkers(request):
    parser, options_hooks = get_parser()
    args_marker = request.node.get_marker("flake8_args")
    if args_marker is None:
        args = []
    else:
        args = list(args_marker.args)
    opts, args = parser.parse_args(args)
    opts.ignore = tuple(opts.ignore)
    EbbLint.parse_options(opts)
Example #3
0
 def check(source, sourcefile, no_errors=False):
     # Strip trailing spaces, since the most comfortable triple-quoted
     # string format will have extra spaces on the last line. If this isn't
     # removed, it'll throw off the trailing newline checker.
     source = source.rstrip(' ')
     source, error_locations = find_error_locations(source)
     if no_errors:
         error_locations = []
     sourcefile.write_text(source, encoding='utf-8')
     lint = EbbLint(ast.parse(source), sourcefile.strpath)
     actual = [
         (line, col, message[:4]) for line, col, message, _ in lint.run()]
     assert actual == error_locations
Example #4
0
def assert_ebb_lint(source_text, source_path, error_locations):
    lint = EbbLint(ast.parse(source_text), source_path)
    return [(line, col, message[:4]) for line, col, message, _ in lint.run()]
Example #5
0
 def get_parser():
     parser = manager.OptionManager(prog='ebb_lint_test', version='1')
     options.register_default_options(parser)
     EbbLint.add_options(parser)
     return parser, None
Example #6
0
def assert_ebb_lint(source_text, source_path, error_locations):
    lint = EbbLint(ast.parse(source_text), source_path)
    actual = {
        (line, col, message[:4]) for line, col, message, _ in lint.run()}
    assert actual == set(error_locations)
Example #7
0
def assert_ebb_lint(source_text, source_path, error_locations):
    lint = EbbLint(ast.parse(source_text), source_path)
    return [(line, col, message[:4]) for line, col, message, _ in lint.run()]