Skip to content

Commit c716c8f

Browse files
authored
Enable checks for mismatching format arguments (F523, F524) (senaite#2084)
* Enable checks for mismatching format arguments (F523, F524) * Remove unnecessary format argument from analysisrequest.py * Fix format argument index in exportimport.setupdata
1 parent b2122d5 commit c716c8f

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/bika/lims/utils/analysisrequest.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ def create_retest(ar):
276276

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

282281
# Open the actions pool
283282
actions_pool = ActionHandlerPool.get_instance()

src/senaite/core/exportimport/setupdata/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,10 @@ def Import(self):
430430
username = safe_unicode(row['Username']).encode('utf-8')
431431
passw = row['Password']
432432
if not passw:
433-
warn = "Lab Contact: No password defined for user '{0}' in row {1}. Password established automatically to '{3}'".format(username, str(rownum), username)
434-
logger.warning(warn)
435433
passw = username
434+
warn = ("Lab Contact: No password defined for user '{0}' in row {1}."
435+
" Password established automatically to '{2}'").format(username, str(rownum), passw)
436+
logger.warning(warn)
436437

437438
try:
438439
member = portal_registration.addMember(

travis_ci_flake8.cfg

-4
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ ignore =
9595
F403,
9696
# F405: 'AddAnalysisProfile' may be undefined, or defined from star imports: bika.lims.permissions
9797
F405,
98-
# F523: '...'.format(...) has unused arguments at position(s): 0
99-
F523,
100-
# F524: '...'.format(...) is missing argument(s) for placeholder(s): 3
101-
F524,
10298
# F632: use ==/!= to compare constant literals (str, bytes, int, float, tuple)
10399
F632,
104100
# F706: 'return' outside function

0 commit comments

Comments
 (0)