Repository navigation
Fix and enforce flake8 D400 (trailing dots on docstrings) in Tests/ - #2020
Merged
Merged
Conversation
Done with the following script, reverting false positives in
several files triggered by missing docstrings which the script
does not consider:
import sys
def fix(lines):
answer = []
post_def = False
for line in lines:
if line.lstrip().startswith(("def ", "class ")):
# print(line.rstrip())
post_def = True
if post_def and line.lstrip().startswith('"""'):
post_def = False
# Looks like line one of a docstring
if line.rstrip().endswith('"""'):
# a one-liner
if line.rstrip().endswith('."""'):
# good
pass
elif line.rstrip().endswith(('?"""', '!"""')):
# ugly
pass
else:
print(line.rstrip())
line = line.rstrip()[:-3] + '."""\n'
else:
# multi-liner
if line.rstrip().endswith('.'):
# good
pass
elif line.rstrip().endswith(('?', '!')):
# ugly
pass
else:
print(line.rstrip())
line = line.rstrip() + ".\n"
answer.append(line)
return answer
for f in sys.argv[1:]:
print(f)
with open(f) as handle:
old = list(handle)
new = fix(old)
with open(f, "w") as handle:
for line in new:
handle.write(line)
print("Done")
These last cases were done by hand.
peterjc
requested review from
JoaoRodrigues,
bow,
etal and
mdehoon
as code owners
April 19, 2019 14:57
Codecov Report
@@ Coverage Diff @@
## master #2020 +/- ##
==========================================
- Coverage 85.1% 85.08% -0.02%
==========================================
Files 314 314
Lines 50302 50302
==========================================
- Hits 42809 42801 -8
- Misses 7493 7501 +8
Continue to review full report at Codecov.
|
Member
Author
|
Missed two files... updating branch... |
mdehoon
approved these changes
Apr 21, 2019
bow
approved these changes
Apr 21, 2019
Member
Author
|
Thanks everyone for looking at this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Like #2016 and #2017, this pull request is somewhat related to issue #883 / #2014 and the goal of having universal flake8 settings for the entire project.
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I have read the
CONTRIBUTING.rstfile and understand that AppVeyor andTravisCI will be used to confirm the Biopython unit tests and
flake8stylechecks pass with these changes.
I have added my name to the alphabetical contributors listings in the files
NEWS.rstandCONTRIB.rstas part of this pull request, am listedalready, or do not wish to be listed. (This acknowledgement is optional.)