Introduce Black and Flake8 - #40
Conversation
|
I added the I configure it to ignore some of the errors raised by setup.py:1:1: F401 'setuptools.Extension' imported but unused
setup.py:1:1: F401 'setuptools.find_packages' imported but unused
src/tinypeel/Peeling/Peeling.py:1:1: F401 'concurrent.futures' imported but unused
src/tinypeel/Peeling/Peeling.py:2:1: F401 'numba.int8' imported but unused
src/tinypeel/Peeling/Peeling.py:2:1: F401 'numba.int64' imported but unused
src/tinypeel/Peeling/Peeling.py:2:1: F401 'numba.optional' imported but unused
src/tinypeel/Peeling/Peeling.py:2:1: F401 'numba.boolean' imported but unused
src/tinypeel/Peeling/Peeling.py:3:1: F401 'numba.experimental.jitclass' imported but unused
src/tinypeel/Peeling/Peeling.py:5:1: F401 'collections.OrderedDict' imported but unused
src/tinypeel/Peeling/Peeling.py:7:1: F401 '..tinyhouse.InputOutput' imported but unused
src/tinypeel/Peeling/Peeling.py:8:1: F401 '..tinyhouse.ProbMath' imported but unused
src/tinypeel/Peeling/Peeling.py:9:1: F401 '..tinyhouse.HaplotypeOperations' imported but unused
src/tinypeel/Peeling/Peeling.py:11:1: F401 'math' imported but unused
src/tinypeel/Peeling/Peeling.py:30:5: F841 local variable 'e16' is assigned to but never used
src/tinypeel/Peeling/PeelingInfo.py:1:1: F401 'concurrent.futures' imported but unused
src/tinypeel/Peeling/PeelingInfo.py:2:1: F401 'numba.int8' imported but unused
src/tinypeel/Peeling/PeelingInfo.py:7:1: F401 '..tinyhouse.InputOutput' imported but unused
src/tinypeel/Peeling/PeelingInfo.py:11:1: F401 'math' imported but unused
src/tinypeel/Peeling/PeelingInfo.py:163:5: F841 local variable 'changed' is assigned to but never used
src/tinypeel/Peeling/PeelingUpdates.py:1:1: F401 'concurrent.futures' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:2:1: F401 'numba.float32' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:2:1: F401 'numba.int8' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:2:1: F401 'numba.int64' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:2:1: F401 'numba.optional' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:2:1: F401 'numba.boolean' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:3:1: F401 'numba.experimental.jitclass' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:5:1: F401 'collections.OrderedDict' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:9:1: F401 '..tinyhouse.HaplotypeOperations' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:13:1: F401 'math' imported but unused
src/tinypeel/Peeling/PeelingUpdates.py:255:5: F821 undefined name 'setupTransmission'
src/tinypeel/Peeling/PeelingUpdates.py:272:5: F841 local variable 'patValid' is assigned to but never used
src/tinypeel/tinypeel.py:2:1: F401 'numba.jit' imported but unused
src/tinypeel/tinypeel.py:2:1: F401 'numba.float32' imported but unused
src/tinypeel/tinypeel.py:2:1: F401 'numba.int32' imported but unused
src/tinypeel/tinypeel.py:2:1: F401 'numba.int64' imported but unused
src/tinypeel/tinypeel.py:2:1: F401 'numba.optional' imported but unused
src/tinypeel/tinypeel.py:3:1: F401 'numba.experimental.jitclass' imported but unused
src/tinypeel/tinypeel.py:6:1: F401 '.tinyhouse.ProbMath' imported but unused
src/tinypeel/tinypeel.py:68:17: F841 local variable 'results' is assigned to but never used
src/tinypeel/tinypeel.py:194:5: F841 local variable 'segInfo' is assigned to but never used |
|
Even though
However, the homepage of the
And pre-commit.ci is a GitHub application that you can use with only So, in summary, there are two ways to automate the |
|
I just noticed that the devel branch is behind the main branch with a few commits, I rebased it onto the main branch. |
@XingerTang This is great work - exactly why I am proposing these tools;) There is always lots to do;) |
@XingerTang I don't have much experience with these tools and their workflow:( I really like GitHub actions, I think, suggesting we follow that approach;) If we do that, does a developer need to run |
There was a problem hiding this comment.
@XingerTang are these changes for AlphaPeel repo or for tinyhouse repo?
@XingerTang I think you did not I am happy with most changes, I am just confused why we see changes to |
|
@gregorgorjanc It gets run automatically. With the |
|
@gregorgorjanc I did the I explained the |
@XingerTang I think this would be a useful addition! Please add this option. |
|
@XingerTang Sure! I will do this later! |
|
@gregorgorjanc Done! The tests workflow I added runs the pre-commit every time a push or a pull request is created. |
| @@ -0,0 +1,19 @@ | |||
| name: Test the code | |||
There was a problem hiding this comment.
Are we "testing" the code here or "formatting" the code or something else? The word "test" is usually used to ensure that the code gives correct results. Here, to my understanding, we are doing more of a syntax check etc. Right? What would be a better term? Evaluate code?
There was a problem hiding this comment.
@gregorgorjanc We are evaluating the format of the code now. The reason I used the "tests" here is becasue I expect someday after we might add real code tests into this workflow, so the "checking the format of the code" plus "checking the outcomes of the code" becomes the complete tests workflow.
However, I can change the name of the workflow for now and rename it later when the real tests really applied.
There was a problem hiding this comment.
@XingerTang ok leave the file name but please change the name to "Evaluate code syntax (and correctness in the future)". Thanks!
gregorgorjanc
left a comment
There was a problem hiding this comment.
OK, code formatting is already happening;)
Solve #36.
I tried to implement
blackformatting hooks forAlphaPeel, I will do the else later.So far, the tools I have used are only
pre-commitandblack.pre-commitis a framework for managing and maintaining multi-language pre-commit hooks, andblackis one such pre-commit hook that can be used to format your code, whereasflake8is another hook used to check the style and quality of the code. Since the pre-commit hook is a kind of client-side hook and the client-side hooks are not copied when you clone a repository, one needs to run the following command to installpre-commitlocally,then the hooks will run every time the user made a commit of
AlphaPeel.I will add the above to the documentation once I finished all the hooks.