This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
Bugfix: Allow comments before module docstring noqa codes #446
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e27fa48
Allow comments before module docstring noqa codes
bsamseth c4a2ac1
Add a note to the release notes
bsamseth 7ceba2b
Break after first `noqa` is encountered
bsamseth 05ed598
Merge branch 'master' into master
bsamseth 5231051
added integration tests for comment files
Cielquan 98690b3
Merge branch 'master' into master
Cielquan eb0e39d
fixed docstring in test_comment_plus_docstring_file
Cielquan 87a3c04
added integration tests with noqa
Cielquan 151b6a6
Merge branch 'master' into master
samj1912 f2812a3
Merge branch 'master' into master
samj1912 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
What happens if a file only has comments and the stream gets exhausted? Will the current.kind access lead to Type Error because of self.current being None? Can we add a test for this?
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.
I've tried all kinds of empty files, files with only comments etc. Nothing unexpected occurs. My understanding is that if the file has only comments, this code won't be called anyway.
As for adding a test for a file with all comments, I don't see that fitting in with the current testing setup. This is because the test case files are expected to have an
expectation
variable defined. Can't do that in an empty file. If you want such a test, how would you go about implementing it?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.
You can add an integration test https://github.com/PyCQA/pydocstyle/blob/master/src/tests/test_integration.py#L333
See above for example. You can add tests with an empty file and check that the output code is 0
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.
I added two integration tests:
@samj1912 Is this ok?
EDIT: Added two more tests but with
# noaq
comments which tests the fixed behavior stated in the opening post.