From 476396bf421bea3556645b5b0795011daddeb9bf Mon Sep 17 00:00:00 2001 From: cpopa Date: Mon, 25 Aug 2014 00:59:08 +0300 Subject: Generate html output for missing files. Closes issue #320. --- ChangeLog | 2 ++ lint.py | 5 +++++ test/unittest_lint.py | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d6c1e26..3375a71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -86,6 +86,8 @@ ChangeLog for Pylint * Fix a crash which ocurred while checking for 'method-hidden', when the parent frame was something different than a function. + * Generate html output for missing files. Closes issue #320. + 2014-07-26 -- 1.3.0 diff --git a/lint.py b/lint.py index e20e5df..b258c29 100644 --- a/lint.py +++ b/lint.py @@ -717,6 +717,11 @@ class PyLinter(OptionsManagerMixIn, MessagesHandlerMixIn, ReportsHandlerMixIn, if self.config.persistent: config.save_results(self.stats, self.file_state.base_name) else: + if self.config.output_format == 'html': + # No output will be emitted for the html + # reporter if the file doesn't exist, so emit + # the results here. + self.reporter.display_results(Section()) self.reporter.on_close(self.stats, {}) # specific reports ######################################################## diff --git a/test/unittest_lint.py b/test/unittest_lint.py index 7dc7090..91525e3 100644 --- a/test/unittest_lint.py +++ b/test/unittest_lint.py @@ -30,7 +30,7 @@ from pylint.utils import MSG_STATE_SCOPE_CONFIG, MSG_STATE_SCOPE_MODULE, MSG_STA MessagesStore, PyLintASTWalker, MessageDefinition, FileState, \ build_message_def, tokenize_module from pylint.testutils import TestReporter -from pylint.reporters import text +from pylint.reporters import text, html from pylint import checkers from pylint import interfaces @@ -367,6 +367,15 @@ class PyLinterTC(unittest.TestCase): ['C: 2: Line too long (175/80)'], self.linter.reporter.messages) + def test_html_reporter_missing_files(self): + output = cStringIO.StringIO() + self.linter.set_reporter(html.HTMLReporter(output)) + self.linter.set_option('output-format', 'html') + self.linter.check('troppoptop.py') + value = output.getvalue() + self.assertIn('troppoptop.py', value) + self.assertIn('fatal', value) + class ConfigTC(unittest.TestCase): -- cgit v1.2.1