diff --git a/CHANGES.rst b/CHANGES.rst index 03126fa..a3547c4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -23,6 +23,9 @@ Change history - Fix code analysis errors. [gforcada] +- Add 'find-untranslated-no-summary' option for i18ndude. + [tmassman] + 2.2 (2016-02-20) ---------------- diff --git a/README.rst b/README.rst index 094495f..af4a9d3 100644 --- a/README.rst +++ b/README.rst @@ -430,6 +430,10 @@ system: Allows you to specify directories and/or files which you don't want to be checked. Default is none. +**find-untranslated-no-summary** + The report will contain only the errors for each file. + Default is ``False``. + **i18ndude-bin** Set the path to a custom version of `i18ndude`_. Default is none. diff --git a/plone/recipe/codeanalysis/i18ndude.py b/plone/recipe/codeanalysis/i18ndude.py index ea4706f..ac90106 100644 --- a/plone/recipe/codeanalysis/i18ndude.py +++ b/plone/recipe/codeanalysis/i18ndude.py @@ -16,10 +16,19 @@ def cmd(self): if files: cmd.append(self.options.get('i18ndude-bin') or '') cmd.append('find-untranslated') + if self.nosummary: + cmd.append('--nosummary') cmd.extend(files) return cmd + @property + def nosummary(self): + """The report will contain only the errors for each file.""" + return I18NDude.normalize_boolean( + self.get_prefixed_option('no-summary') + ) + def console_script(options): console_factory(I18NDude, options) diff --git a/plone/recipe/codeanalysis/tests/test_i18ndude.py b/plone/recipe/codeanalysis/tests/test_i18ndude.py index af72906..6bb6211 100644 --- a/plone/recipe/codeanalysis/tests/test_i18ndude.py +++ b/plone/recipe/codeanalysis/tests/test_i18ndude.py @@ -42,6 +42,22 @@ def setUp(self): # noqa if os.path.isfile('../../bin/i18ndude'): # when cwd is parts/test self.options['i18ndude-bin'] = '../../bin/i18ndude' + def test_nosummary_option(self): + i18ndude = I18NDude(self.options) + self.assertFalse(i18ndude.nosummary) + self.options['find-untranslated-no-summary'] = 'True' + i18ndude = I18NDude(self.options) + self.assertTrue(i18ndude.nosummary) + + @unittest.skipIf(not I18NDUDE_INSTALLED, I18NDUDE_NOT_INSTALLED_MSG) + def test_nosummary_cmd(self): + self.given_a_file_in_test_dir('invalid.pt', INVALID_CODE) + i18ndude = I18NDude(self.options) + self.assertNotIn('--nosummary', i18ndude.cmd) + self.options['find-untranslated-no-summary'] = 'True' + i18ndude = I18NDude(self.options) + self.assertIn('--nosummary', i18ndude.cmd) + @unittest.skipIf(not I18NDUDE_INSTALLED, I18NDUDE_NOT_INSTALLED_MSG) def test_analysis_should_return_false_when_error_found(self): self.given_a_file_in_test_dir('invalid.pt', INVALID_CODE)