-
Notifications
You must be signed in to change notification settings - Fork 289
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
fix #1032 by comparing string representations of types #1049
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.
Lgtm
We should also update the docs to remove the note I put there before. |
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.
failures = append(failures, lint.Failure{ | ||
Confidence: 1, | ||
Node: field, | ||
Node: prevType, |
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.
This change causes the first of the two compared arguments to be indicated in the results.
I don't know if this is a deliberate change, but it seems that it would be more consistent to indicate the first repeating argument (as it has been so far).
The same comment applies to return arguments.
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.
It's a deliberated change; the intent is to be coherent with the message ("repeated ... type ... can be omitted") by pointing to the type that it can actually removed/omitted.
@zak-pawel thanks for taking the time to test the PR. |
Closes #1032 by comparing string representations of types (and not relying on actual type information)
Failure messages were extended to provide the name of the type that can be omitted.
Failure position information were fixed to point to the type that can be omitted.
This new implementation of the rule spots more failures than the current implementation and it seems to not generate false positives.
The attached files contain the result of linting the
telegraf
codebase (cf #1032) with the current implementation and with the implementation proposed by this PR.pr-result.txt
head-result.txt