コード例 #1
0
def result(scope="module"):
    result = ResultSummary('/fake/root')
    containers = (
        Issue(linter="foo", path="a/b/c.txt", message="oh no foo", lineno=1),
        Issue(
            linter="bar",
            path="d/e/f.txt",
            message="oh no bar",
            hint="try baz instead",
            level="warning",
            lineno="4",
            column="2",
            rule="bar-not-allowed",
        ),
        Issue(
            linter="baz",
            path="a/b/c.txt",
            message="oh no baz",
            lineno=4,
            column=10,
            source="if baz:",
        ),
        Issue(
            linter="foo-diff",
            path="a/b/c.txt",
            message="oh no foo-diff",
            lineno=5,
            source="if baz:",
            diff="diff 1\n- hello\n+ hello2",
        ),
    )
    result = ResultSummary('/fake/root')
    for c in containers:
        result.issues[c.path].append(c)
    return result
コード例 #2
0
def result(scope='module'):
    containers = (
        Issue(
            linter='foo',
            path='a/b/c.txt',
            message="oh no foo",
            lineno=1,
        ),
        Issue(
            linter='bar',
            path='d/e/f.txt',
            message="oh no bar",
            hint="try baz instead",
            level='warning',
            lineno=4,
            column=2,
            rule="bar-not-allowed",
        ),
        Issue(
            linter='baz',
            path='a/b/c.txt',
            message="oh no baz",
            lineno=4,
            column=10,
            source="if baz:",
        ),
    )
    result = ResultSummary()
    for c in containers:
        result.issues[c.path].append(c)
    return result
コード例 #3
0
ファイル: test_result.py プロジェクト: shashank100/gecko-dev
def test_issue_defaults():
    issue = Issue('linter', 'path', 'message', None)
    assert issue.lineno == 0
    assert issue.column is None
    assert issue.level == 'error'

    issue = Issue('linter', 'path', 'message', '1', column='2')
    assert issue.lineno == 1
    assert issue.column == 2
コード例 #4
0
def test_issue_defaults():
    ResultSummary.root = '/fake/root'

    issue = Issue('linter', 'path', 'message', None)
    assert issue.lineno == 0
    assert issue.column is None
    assert issue.level == 'error'

    issue = Issue('linter', 'path', 'message', '1', column='2')
    assert issue.lineno == 1
    assert issue.column == 2
コード例 #5
0
ファイル: test_result.py プロジェクト: Floflis/gecko-b2g
def test_issue_defaults():
    ResultSummary.root = "/fake/root"

    issue = Issue(linter="linter", path="path", message="message", lineno=None)
    assert issue.lineno == 0
    assert issue.column is None
    assert issue.level == "error"

    issue = Issue(linter="linter",
                  path="path",
                  message="message",
                  lineno="1",
                  column="2")
    assert issue.lineno == 1
    assert issue.column == 2
コード例 #6
0
def result():
    result = ResultSummary()
    result.issues['foo.py'].extend([
        Issue(
            linter='no-foobar',
            path='foo.py',
            lineno=1,
            message="Oh no!",
        ),
        Issue(
            linter='no-foobar',
            path='foo.py',
            lineno=3,
            column=10,
            message="To Yuma!",
        ),
    ])
    return result
コード例 #7
0
ファイル: test_editor.py プロジェクト: Floflis/gecko-b2g
def result():
    result = ResultSummary("/fake/root")
    result.issues["foo.py"].extend([
        Issue(
            linter="no-foobar",
            path="foo.py",
            lineno=1,
            message="Oh no!",
        ),
        Issue(
            linter="no-foobar",
            path="foo.py",
            lineno=3,
            column=10,
            message="To Yuma!",
        ),
    ])
    return result