-
-
Notifications
You must be signed in to change notification settings - Fork 239
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(cli): do not return duplicate results #681
Conversation
const ARTIFICIAL_ROOT = Symbol('root'); | ||
|
||
const serializeRange = ({ start, end }: IRange) => `${start.line}:${start.character}:${end.line}:${end.character}`; | ||
const getIdentifier = (result: IRuleResult) => `${result.path.join('/')}${result.code}${serializeRange(result.range)}`; |
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.
@P0lip Just an idea. How about turning that into a comparisonFunction (cf. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)?
It could be used to detect duplicates in that use case (when === 0
) and reused in stylish
to order the results.
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.
My sincere apologies for dropping a ball on this one.
Your new WIP PR reminded me of this PR.
Seems like you've started some work on that, so how do you feel about merging this one and implementing the comparison fn in your PR?
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.
Seems like you've started some work on that
Well... I was merely scratching an itch to ensure my proposal was actually bringing some kind of value. 😉
so how do you feel about merging this one and implementing the comparison fn in your PR?
@P0lip 👍
Fixes #680
Checklist
Does this PR introduce a breaking change?