diff options
| author | cpopa <devnull@localhost> | 2014-08-25 00:59:08 +0300 |
|---|---|---|
| committer | cpopa <devnull@localhost> | 2014-08-25 00:59:08 +0300 |
| commit | 476396bf421bea3556645b5b0795011daddeb9bf (patch) | |
| tree | 43f205405e948a4145cc472583ff54e9c6a9aece | |
| parent | 51c5fda58cbe5d90fbfefcb1f9f994f7d1685c68 (diff) | |
| download | pylint-476396bf421bea3556645b5b0795011daddeb9bf.tar.gz | |
Generate html output for missing files. Closes issue #320.
| -rw-r--r-- | ChangeLog | 2 | ||||
| -rw-r--r-- | lint.py | 5 | ||||
| -rw-r--r-- | test/unittest_lint.py | 11 |
3 files changed, 17 insertions, 1 deletions
@@ -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 @@ -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): |
