Skip to content

Commit

Permalink
Add 'find-untranslated-no-summary' option for i18ndude.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmassmann committed Jan 3, 2018
1 parent 8731f5e commit d821b16
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
----------------

Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions plone/recipe/codeanalysis/i18ndude.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
16 changes: 16 additions & 0 deletions plone/recipe/codeanalysis/tests/test_i18ndude.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

1 comment on commit d821b16

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmassman Jenkins CI reporting about code analysis
See the full report here: http://jenkins.plone.org/job/package-plone.recipe.codeanalysis/44/violations

plone/recipe/codeanalysis/__init__.py:147:57: C815 missing trailing comma in Python 3.5+
plone/recipe/codeanalysis/__init__.py:182:61: C813 missing trailing comma in Python 3
plone/recipe/codeanalysis/i18ndude.py:29:51: C812 missing trailing comma

Follow these instructions to reproduce it locally.

Please sign in to comment.