Skip to content

Commit

Permalink
Enable checks for mismatching format arguments (F523, F524) (senaite#…
Browse files Browse the repository at this point in the history
…2084)

* Enable checks for mismatching format arguments (F523, F524)

* Remove unnecessary format argument from analysisrequest.py

* Fix format argument index in exportimport.setupdata
  • Loading branch information
winniehell authored Aug 1, 2022
1 parent b2122d5 commit c716c8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/bika/lims/utils/analysisrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ def create_retest(ar):

if not ar.isInvalid():
# Analysis Request must be in 'invalid' state
raise ValueError("Cannot do a retest from an invalid Analysis Request"
.format(repr(ar)))
raise ValueError("Cannot do a retest from an invalid Analysis Request")

# Open the actions pool
actions_pool = ActionHandlerPool.get_instance()
Expand Down
5 changes: 3 additions & 2 deletions src/senaite/core/exportimport/setupdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,10 @@ def Import(self):
username = safe_unicode(row['Username']).encode('utf-8')
passw = row['Password']
if not passw:
warn = "Lab Contact: No password defined for user '{0}' in row {1}. Password established automatically to '{3}'".format(username, str(rownum), username)
logger.warning(warn)
passw = username
warn = ("Lab Contact: No password defined for user '{0}' in row {1}."
" Password established automatically to '{2}'").format(username, str(rownum), passw)
logger.warning(warn)

try:
member = portal_registration.addMember(
Expand Down
4 changes: 0 additions & 4 deletions travis_ci_flake8.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ ignore =
F403,
# F405: 'AddAnalysisProfile' may be undefined, or defined from star imports: bika.lims.permissions
F405,
# F523: '...'.format(...) has unused arguments at position(s): 0
F523,
# F524: '...'.format(...) is missing argument(s) for placeholder(s): 3
F524,
# F632: use ==/!= to compare constant literals (str, bytes, int, float, tuple)
F632,
# F706: 'return' outside function
Expand Down

0 comments on commit c716c8f

Please sign in to comment.