Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable check for 'return' outside function (F706) #2098

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bika/lims/adapters/widgetvisibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def isVisible(self, field, mode="view", default="visible"):
# If object has been already created, get SWF statues from it.
swf_enabled = False
if hasattr(self.context, 'getSamplingWorkflowEnabled') and \
self.context.getSamplingWorkflowEnabled() is not '':
self.context.getSamplingWorkflowEnabled() != '':
swf_enabled = self.context.getSamplingWorkflowEnabled()
else:
swf_enabled = self.context.bika_setup.getSamplingWorkflowEnabled()
Expand Down
4 changes: 2 additions & 2 deletions src/senaite/core/exportimport/instruments/resultsimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ def process(self):
for acode in rawacodes:
if acode in exclude or not acode:
continue
service = self.bsc(getKeyword=acode)
if not service:
analysis_service = self.bsc(getKeyword=acode)
if not analysis_service:
self.warn('Service keyword ${analysis_keyword} not found',
mapping={"analysis_keyword": acode})
else:
Expand Down
6 changes: 2 additions & 4 deletions src/senaite/core/tests/test_duplicate-analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ def test_LIMS2001(self):
# Add analyses into the worksheet
self.request['context_uid'] = ws.UID()
for analysis in ar.getAnalyses():
an = analysis.getObject()
ws.addAnalysis(an)
ws.addAnalysis(analysis.getObject())
self.assertEquals(len(ws.getAnalyses()), 3)

# Add a duplicate for slot 1 (there's only one slot)
Expand Down Expand Up @@ -137,8 +136,7 @@ def test_LIMS2001(self):
wf.doActionFor(ar, 'receive')
# Add analyses into the worksheet
for analysis in ar.getAnalyses():
an = analysis.getObject()
ws.addAnalysis(an)
ws.addAnalysis(analysis.getObject())
ans = ws.getAnalyses()
reg = [an for an in ans if an.portal_type == 'Analysis']
regkeys = [an.getKeyword() for an in reg]
Expand Down
10 changes: 3 additions & 7 deletions travis_ci_flake8.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ extend-ignore =
E502,
# E722: do not use bare 'except'
E722,
# F632: use ==/!= to compare constant literals (str, bytes, int, float, tuple)
F632,
# F706: 'return' outside function
F706,
# F812: list comprehension redefines 'service' from line 446
F812,
# F821: undefined name 'Report'
F821,
# F841: local variable 'icon' is assigned to but never used
Expand All @@ -97,7 +91,6 @@ extend-ignore =
W605,
per-file-ignores =
# ignore unused imports (F401) in meta packages
src/bika/lims/skins/bika/guard_handler.py:F401
src/bika/lims/browser/worksheet/views/__init__.py:F401
src/bika/lims/browser/analyses/__init__.py:F401
src/bika/lims/browser/client/__init__.py:F401
Expand All @@ -110,3 +103,6 @@ per-file-ignores =
src/senaite/core/behaviors/__init__.py:F401
# ignore "import *" (F403, F405) in Archetypes models
src/bika/lims/content/*.py:F403,F405
# Zope scripts are only function bodies (see https://zope.readthedocs.io/en/latest/zopebook/BasicScripting.html)
src/bika/lims/skins/bika/guard_handler.py:F401,F706
src/senaite/core/skins/senaite_scripts/*.py:F706