Skip to content

Commit

Permalink
Merge pull request #91 from plone/jensens/cleanup
Browse files Browse the repository at this point in the history
Cleanup code analysis errors
  • Loading branch information
jensens authored May 17, 2018
2 parents e12b682 + 8ea0418 commit a712134
Show file tree
Hide file tree
Showing 10 changed files with 198 additions and 153 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ New features:

Bug fixes:

- Cleanup code analysis problems.
[jensens]

- Fix SingleCheckBoxBoolWidget description to render structure
[allusa]

Expand Down
2 changes: 1 addition & 1 deletion plone/app/z3cform/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def toWidgetValue(self, value):
'internal': u'',
'external': u'',
'email': u'',
'email_subject': u''
'email_subject': u'',
}
if not value:
return result
Expand Down
2 changes: 1 addition & 1 deletion plone/app/z3cform/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def path(filepart):
return os.path.join(
os.path.dirname(plone.app.z3cform.__file__),
'templates',
filepart
filepart,
)

# Override the layout wrapper view default template with a more Plone-looking
Expand Down
2 changes: 1 addition & 1 deletion plone/app/z3cform/tests/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ def setUpPloneSite(self, portal):
PAZ3CForm_FIXTURE = PAZ3CFormLayer()
PAZ3CForm_INTEGRATION_TESTING = IntegrationTesting(
bases=(PAZ3CForm_FIXTURE,),
name='plone.app.z3cform:Integration'
name='plone.app.z3cform:Integration',
)
28 changes: 15 additions & 13 deletions plone/app/z3cform/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ def test_simple(self):
test_compare = 1
test_out = call_callables(
test_in,
'funny return value'
'funny return value',
)
self.assertEqual(test_out, test_compare)

def test_simple_function(self):
from plone.app.z3cform.utils import call_callables

def test_in(x): return x
def test_in(x):
return x

test_compare = 'funny return value'
test_out = call_callables(
test_in,
'funny return value'
'funny return value',
)
self.assertEqual(test_out, test_compare)

Expand All @@ -33,7 +35,7 @@ def test_list(self):
test_compare = [1, 2, 3, 'funny return value']
test_out = call_callables(
test_in,
'funny return value'
'funny return value',
)
self.assertEqual(test_out, test_compare)

Expand All @@ -44,7 +46,7 @@ def test_tuple(self):
test_compare = (1, 2, 3, 'funny return value')
test_out = call_callables(
test_in,
'funny return value'
'funny return value',
)
self.assertEqual(test_out, test_compare)

Expand All @@ -63,8 +65,8 @@ def test_complex(self):
'subsubnormal': 789,
'subsublist': [7, 8, 9, lambda x: x],
'subsubtuple': (7, 8, 9, lambda x: x),
}
}
},
},
}

test_compare = {
Expand All @@ -79,13 +81,13 @@ def test_complex(self):
'subsubnormal': 789,
'subsublist': [7, 8, 9, 'funny return value'],
'subsubtuple': (7, 8, 9, 'funny return value'),
}
}
},
},
}

test_out = call_callables(
test_in,
'funny return value'
'funny return value',
)

self.assertEqual(test_out, test_compare)
Expand All @@ -108,17 +110,17 @@ def test_is_same_domain(self):
# Those use the same protocol and are on the same domaain
self.assertTrue(is_same_domain(
'https://plone.org/doc1',
'https://plone.org/doc2/doc3'
'https://plone.org/doc2/doc3',
))

# These are two completly different URLs
self.assertTrue(not is_same_domain(
'https://domain1.com',
'https://anotherdomain.com'
'https://anotherdomain.com',
))

# Here, different transport protocols are used. Returning False.
self.assertTrue(not is_same_domain(
'https://plone.org',
'http://plone.org'
'http://plone.org',
))
Loading

1 comment on commit a712134

@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.

@jensens Jenkins CI reporting about code analysis
See the full report here: https://jenkins.plone.org/job/package-plone.app.z3cform/104/violations

plone/app/z3cform/inline_validation.py:15:5: C901 'InlineValidationView.__call__' is too complex (15)
plone/app/z3cform/widget.py:660:19: T000 Todo note found.
plone/app/z3cform/widget.py:674:47: T000 Todo note found.
plone/app/z3cform/converters.py:106:11: T000 Todo note found.

Follow these instructions to reproduce it locally.

Please sign in to comment.