@@ -53,9 +53,6 @@ def lint_rproject(self):
5353 with click .progressbar (check_functions , label = 'Running R projects tests' , item_show_func = repr ) as fnames :
5454 for fname in fnames :
5555 getattr (self , fname )()
56- if len (self .failed ) > 0 :
57- logging .error ("Found test failures in '{}', halting lint run." .format (fname ))
58- break
5956
6057 def check_files_exist (self ):
6158 """ Check, that files like Dockerfile and the conda
@@ -140,7 +137,7 @@ def check_dockerfile(self):
140137 ]
141138 for label in expected_labels :
142139 if not any (label == x for x in labels .keys ()):
143- self .failed .append ((2 , 'You havent\' t set LABEL \' {}\' in the Dockerfile.' . format ( label ) ))
140+ self .failed .append ((2 , f 'You havent\' t set LABEL \' { label } \' in the Dockerfile.' ))
144141 return
145142
146143 # 3. Check if labels are empty
@@ -193,9 +190,7 @@ def check_conda_environment(self):
193190 # Check that the mandatory conda env declarations are there
194191 for declaration in mand_conda_settings :
195192 if not self .conda_config .get (declaration ):
196- self .failed .append ((3 , "The conda env declaration \' {dec}\' is missing." .format (
197- dec = declaration
198- )))
193+ self .failed .append ((3 , f"The conda env declaration \' { declaration } \' is missing." ))
199194 return
200195
201196 # Check the name regex
@@ -212,27 +207,28 @@ def check_conda_environment(self):
212207 if not ch in self .conda_config .get ('channels' )])
213208
214209 for ch in missing_channels :
215- self .failed .append ((3 , "Channel {ch} was not defined." . format ( ch = ch ) ))
210+ self .failed .append ((3 , f "Channel { ch } was not defined." ))
216211 return
217212
218- # Check that the dependency for r-base is there, and a version is set.
213+ # Check that the dependency for r-base is there
219214 rbase = list ([basepkg for basepkg in self .conda_config .get ("dependencies" ) if 'r-base' in basepkg ])
220215 if not rbase :
221216 self .failed .append ((3 , "Could not find the \' r-base\' dependency." ))
222217 return
223218
224- # Check that a version is given for the r-base pkg
225- if not '=' in rbase [0 ]:
226- self .failed .append ((3 , "Could not determine that \' r-base\' has a version tag." ))
227- return
228-
229- # Check that the version is numeric
230- version = rbase [0 ].strip ().split ('=' )[- 1 ].replace ('.' , '' )
231- if not version .isdigit ():
232- self .failed .append ((3 , "The version tag \' {tag}\' was not numeric!" .format (
233- tag = rbase [0 ].strip ().split ('=' )[- 1 ]
234- )))
235- return
219+ # Check that every dependency has a version tag and that it's numerical
220+ dependencies = list ([basepkg for basepkg in self .conda_config .get ("dependencies" )])
221+ for dependency in dependencies :
222+ strip = dependency .strip ().split ('=' )
223+ version = strip [- 1 ] if len (strip ) > 1 else None
224+ if not version :
225+ self .failed .append ((3 , f"No version was supplied for { dependency } "
226+ ))
227+ return
228+ cleaned_version = version .replace ('.' , '' )
229+ if not cleaned_version .isdigit ():
230+ self .failed .append ((3 , f"The version tag \' { version } \' was not numeric!" ))
231+ return
236232
237233 self .passed .append ((3 , 'The conda environment seems to be OK.' ))
238234
@@ -242,10 +238,10 @@ def pf(self, file_path):
242238
243239 def print_results (self ):
244240 logging .info ("===========\n LINT RESULTS\n =================\n " +
245- "{0:>4} build steps passed" .format (len (self .passed )) +
246- "{0:>4} build steps had warnings" .format (len (self .warned )) +
247- "{0:>4} build steps failed" .format (len (self .failed ))
248- )
241+ "{0:>4} build steps passed" .format (len (self .passed )) +
242+ "{0:>4} build steps had warnings" .format (len (self .warned )) +
243+ "{0:>4} build steps failed" .format (len (self .failed ))
244+ )
249245 if len (self .passed ) > 0 :
250246 logging .debug (
251247 "Test Passed:\n {}" .format ("\n " .join (["#{}: {}" .format (eid , msg ) for eid , msg in self .passed ])))
0 commit comments