-
Notifications
You must be signed in to change notification settings - Fork 570
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
add lint for duplicate feature under a statement #2573
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: vibhatsu <[email protected]>
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.
Great start @v1bh475u
From the tracking issue:
We cannot use rule passed as argument for detecting duplicate features as the Rule class when retrieves features from the yaml file, it simply ignores the redundancies. Hence, we have to rely on definition which contains the entire unparsed yaml file as string.
With this background, it makes sense why you parsed the raw string, rather than using the structured data we already have. At the very least, this information should be provided as a comment to explain why the code appears so complex.
Given what it does, the code isn't too hard to follow. In fact, I like your code style quite a bit! Still, it takes some effort to follow along. I'd like either: simpler logic or tests that demonstrate the code working as expected.
For simpler logic, could you use a yaml parser to convert the raw text into a structured representation and avoid all the string splitting and searching?
If you want to stick with the current algorithm, please add some test cases that show the linter working as expected. Since the linter is found in ./scripts
and not in the Python module, I don't think we can easily integrate with pytest, so I'd recommend some "self check" code that runs at the start of main everytime the linter is started. Its not very efficient, but the linter isn't run often and the tests shouldn't take long anyways.
Thoughts?
- Also, please update the changelog and acknowledge yourself
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.
Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased)
section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed
Signed-off-by: vibhatsu <[email protected]>
Signed-off-by: vibhatsu <[email protected]>
CHANGELOG updated or no update needed, thanks! 😄
Signed-off-by: vibhatsu <[email protected]>
@williballenthin I used one of the function |
Also, please explain how I should handle conflicts in |
use your best judgement to merge the changes. order doesn't really matter, just that the content go into the right sections. |
The new code is so much cleaner! Great work. |
Signed-off-by: vibhatsu <[email protected]>
…g of line numbers Signed-off-by: vibhatsu <[email protected]>
Done with changes. |
closes #2250
Checklist