Esempio n. 1
0
def pylint(dsc, analysis):
    run_command(["dpkg-source", "-x", dsc, "source-pylint"])
    with cd('source-pylint'):
        sources = find_python_files('.')
        failed = False
        output = ""

        for source in sources:
            out, _, ret = run_command([
                'pylint', '-rn',
                '--msg-template="[{C}]{path}:{line},{column}:({msg_id})[{symbol}]{msg}"',
                source
            ])
            failed = ret != 0

            if out is not None:
                output += out

                for issue in parse_pylint(out.splitlines()):
                    analysis.results.append(issue)

        return (analysis, output, failed, None, None)
Esempio n. 2
0
def test_pylint_wrappers():
    pylint_analysis = test_pylint_common()
    issues = parse_pylint(pylint_analysis[1].splitlines())
    i = 0
    for issue in issues:
        if issue.location.file.givenpath == \
                "tests/parsers/test_clanganalyzer_parser.py" and \
           issue.location.point.line==22 and issue.location.point.column==0:
            found = issue
        i += 1
    print found
    assert found.testid == "W0611"
    assert found.location.file.givenpath == \
            "tests/parsers/test_clanganalyzer_parser.py"
    assert found.location.point.line == 22
    assert found.location.point.column == 0
    assert found.severity == "warning"
    assert found.notes is None
    assert found.customfields is None
    assert "[unused-import]Unused Analysis imported from firehose.model" \
            in found.message.text
    assert i > 500
Esempio n. 3
0
 def test_pylint_wrappers(self):
     pylint_analysis = pylint(self.filepath, self.firehose_results)
     issues = parse_pylint(pylint_analysis[1].splitlines())
     i = 0
     for issue in issues:
         if issue.location.file.givenpath == \
                 "tests/parsers/test_clanganalyzer_parser.py" and \
         issue.location.point.line==22 and issue.location.point.column==0:
             found = issue
         i += 1
     print found
     self.assertEquals(found.testid, "W0611")
     self.assertEquals(found.location.file.givenpath,
                       "tests/parsers/test_clanganalyzer_parser.py")
     self.assertEquals(found.location.point.line, 22)
     self.assertEquals(found.location.point.column, 0)
     self.assertEquals(found.severity, "warning")
     self.assertIsNone(found.notes)
     self.assertIsNone(found.customfields)
     self.assertTrue(
         "[unused-import]Unused Analysis imported from firehose.model" in
         found.message.text)
     self.assertTrue(i > 500)
Esempio n. 4
0
 def test_pylint_wrappers(self):
     pylint_analysis = pylint(self.filepath, self.firehose_results)
     issues = parse_pylint(pylint_analysis[1].splitlines())
     i = 0
     for issue in issues:
         if issue.location.file.givenpath == \
                 "tests/parsers/test_clanganalyzer_parser.py" and \
         issue.location.point.line==22 and issue.location.point.column==0:
             found = issue
         i += 1
     print found
     self.assertEquals(found.testid, "W0611")
     self.assertEquals(found.location.file.givenpath,
             "tests/parsers/test_clanganalyzer_parser.py")
     self.assertEquals(found.location.point.line, 22)
     self.assertEquals(found.location.point.column, 0)
     self.assertEquals(found.severity, "warning")
     self.assertIsNone(found.notes)
     self.assertIsNone(found.customfields)
     self.assertTrue(
             "[unused-import]Unused Analysis imported from firehose.model"
             in found.message.text)
     self.assertTrue(i > 500)