scarlehoff / pyHepGrid

Tool for distributed computing management geared towards HEP applications.
GNU General Public License v3.0
6 stars 4 forks source link

Pep8 #68

Closed marianheil closed 4 years ago

marianheil commented 4 years ago

All files should now follow the pep8 style. This shouldn't break anything, but since I changed every single file it is possible that something accidentally got broken.

Please test this changes.

Additionally the code is now checked with flake8 and the bugbear plugin.

marianheil commented 4 years ago

@marianheil Are we still aiming for runscripts to be python 2.x compatible?

Yes unless you know that all nodes are able to use python3 by now. This I broke python2 compatibility somewhere?

scarlehoff commented 4 years ago

I have the feeling the action is not checking the whole code base, i think it would be impossible for all the imports to work when there is no header defined.

marianheil commented 4 years ago

I don't understand your comment. flake8 only gives a static code analysis file by file, without checking any includes. Namely we are using pycodestyle (W,E), bugbear (B) and flake's own checks (F). This gives only testing for the basic (syntax) errors.

I don't think it checks the McCabe complexity (C) without setting max-complexity

scarlehoff commented 4 years ago

Ah, I thought it checked whether the imports had everything they were supposed to have. Meaning if I import header and use header.function_that_doesnt_exist, shouldn't it fail?

marianheil commented 4 years ago

No I don't think so:

$ git diff
diff --git a/src/pyHepGrid/src/main_routines.py b/src/pyHepGrid/src/main_routines.py
index 9afae15..d64f87a 100644
--- a/src/pyHepGrid/src/main_routines.py
+++ b/src/pyHepGrid/src/main_routines.py
@@ -9,6 +9,7 @@ def management_routine(backend, args):

     if args.list_disabled:
         backend.set_list_disabled()
+    pyHepGrid.src.header.function_that_doesnt_exist("hallo")

     if args.get_data and pyHepGrid.src.header.finalisation_script:
         backend.get_data(0, custom_get=pyHepGrid.src.header.finalisation_script)
$ flake8 . --show-source --statistics --count
0

The checks are really naive.

scarlehoff commented 4 years ago

oh, nvm, I stand corrected then.

DWalker487 commented 4 years ago

Ever get the feeling that refactoring/testing rates increase proportionally to time spent in lockdown? :P

scarlehoff commented 4 years ago

Ever get the feeling that refactoring/testing rates increase proportionally to time spent in lockdown? :P

By the end of May the survivors will find beautiful code all over github :_)

marianheil commented 4 years ago

Can this be merged? We can improve the CI later in a different merge request.