-
Notifications
You must be signed in to change notification settings - Fork 47
Skip lines with #noqa comment #81
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
Open
mnojek
wants to merge
5
commits into
boakley:master
Choose a base branch
from
mnojek:feature/skip-linter-for-tagged-lines
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7bd7e7b
Add ignoring for lines containing comment 'noqa'
mnojek 403b35e
Fix reporting correct line number for TagWithSpaces rule
mnojek bcac5eb
Add tests to cover noqa feature
mnojek 03befe8
Add compiled regex, change test name
mnojek 5116fbe
Change noqa to dict type to speed up the lookup
mnojek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| *** Settings *** | ||
| Documentation Test cases with skip line indicator (# noqa) | ||
|
|
||
|
|
||
| *** Test Cases *** | ||
| Skip Tag With Spaces | ||
| [Documentation] Skip next line containing tag with spaces | ||
| [Tags] Tag With Spaces TagWithNoSpace # noqa | ||
| ${foo} Set Variable some variable | ||
| ${bar} Set Variable another variable | ||
|
|
||
| Do Not Skip Tag With Spaces | ||
| [Documentation] Report tag with spaces | ||
| [Tags] Tag With Spaces TagWithNoSpace | ||
| ${foo} Set Variable some variable | ||
| ${bar} Set Variable another variable | ||
|
|
||
| Skip This Test Case With Dot. #noqa | ||
| [Documentation] Do not report improper test case name | ||
| ${foo} Set Variable some variable | ||
| ${bar} Set Variable another variable | ||
|
|
||
| Do Not Skip This Test Case With Dot. | ||
| [Documentation] Report dot presence in test case name | ||
| ${foo} Set Variable some variable | ||
| ${bar} Set Variable another variable | ||
|
|
||
| Skip Very Long Line | ||
| [Documentation] Do not report very long line (+100 chars) | ||
| ${long_variable} Set Variable This is a very long sentence with too many characters that should not be reported because of the 'noqa' comment at the end of this line # noqa and something else | ||
| ${short_variable} Set Variable This is a short variable | ||
|
|
||
| Do Not Skip Very Long Line | ||
| [Documentation] Report very long line (+100 chars) | ||
| ${long_variable} Set Variable This is a very long sentence with too many characters that will be reported because of lack of 'noqa' comment at the end of this line | ||
| ${short_variable} Set Variable This is a short variable | ||
|
|
||
| Do Not Skip Line Because Of Improper Comment # noqaa | ||
| [Documentation] Improper comment should not make rflint omit the line | ||
| ${var} Set Variable This test case contains only one test step |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| *** Settings *** | ||
| | Documentation | ||
| | ... | Runs rflint against the rflint test suites and resource files | ||
| | | ||
| | Library | OperatingSystem | ||
| | Library | Process | ||
| | Resource | SharedKeywords.robot | ||
|
|
||
| *** Test Cases *** | ||
| | Run rflint and check if output contains given warnings and errors | ||
| | | Run rf-lint with the following options: | ||
| | | ... | test_data/acceptance/noqa.robot | ||
| | | | ||
| | | @{messages}= | Split to lines | ${result.stdout} | ||
| | | ${warnings}= | Get match count | ${messages} | regexp=^W: | ||
| | | ${errors}= | Get match count | ${messages} | regexp=^E: | ||
| | | | ||
| | | Run keyword if | "${result.rc}" != "${1}" or ${warnings} != 3 or ${errors} != 1 | ||
| | | ... | Fail | unexpectected errors or warnings: \n${result.stdout}\n${result.stderr} | ||
| | | | ||
| | | Output should contain | ||
| | | ... | W: 35, 100: Line is too long (exceeds 100 characters) (LineTooLong) | ||
| | | ... | E: 14, 0: space not allowed in tag name: 'Tag With Spaces' (TagWithSpaces) | ||
| | | ... | W: 23, 0: '.' in testcase name 'Do Not Skip This Test Case With Dot.' (PeriodInTestName) | ||
| | | ... | W: 38, 0: Too few steps (1) in test case (TooFewTestSteps) | ||
| | | Output should not contain | ||
| | | ... | W: 30, 100: Line is too long (exceeds 100 characters) (LineTooLong) | ||
| | | ... | E: 8, 0: space not allowed in tag name: 'Tag With Spaces' (TagWithSpaces) | ||
| | | ... | W: 18, 0: '.' in testcase name 'Skip This Test Case With Dot.' (PeriodInTestName) |
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.
Uh oh!
There was an error while loading. Please reload this page.