-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Black and flake8 #96
Black and flake8 #96
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately Black doesn't format docstrings and comments. At some point we might want to conform comments to the 88 line-length limit as well.
This is just personal preference but I'll leave it here in case it's useful.
To break long strings and statements (without using 'backslash'):
"There are no error messages, but an Earthdata login token was not successfully generated"
vs.
("There are no error messages, "
"but an Earthdata login token was not successfully generated")
To simplify long conditional statements:
cond1 = ["bounding_box", "polygon"]
cond2 = ["bbox", "Boundingshape"]
assert ext_type in cond1 or ext_type in cond2, "Invalid spatial extent type."
or
msg = "Your search returned no results; try different search parameters"
assert len(self.avail) > 0, msg
There's |
Codecov Report
@@ Coverage Diff @@
## development #96 +/- ##
===============================================
- Coverage 49.27% 48.21% -1.07%
===============================================
Files 15 15
Lines 1029 1062 +33
Branches 214 236 +22
===============================================
+ Hits 507 512 +5
- Misses 493 518 +25
- Partials 29 32 +3
Continue to review full report at Codecov.
|
After discovering the GitHub action to run flake8 was failing, I did some playing around and it should be working now. @fspaolo I think you raise a few great points. There's a longstanding debate about whether or not black should format docstrings in any way, and if so, how. I think for now that using the numpydoc format gives us some guidance, if not specifics on spaces and newlines... @weiji14 Thanks for the info about |
@JessicaS11 right, formatting docstrings usually comes with a lot of personal preference... this is one reason why Black is not imposing this (yet). I would say (as a personal rule) when writing docstrings just keep in mind Black's default 88 line length (since we are imposing that for the rest of the code). |
* add black pre-commit hook and reformat files using black * add github action workflow with flake8 on PRs
* add black pre-commit hook and reformat files using black * add github action workflow with flake8 on PRs
Formatted code using black (and added a pre-commit hook to run black). Added a github action to run flake8 and annotate where code doesn't meet standards