Skip to content

Add endColumn/endLine to SARIF region#5011

Merged
picklebento merged 4 commits intodetekt:mainfrom
VitalyVPinchuk:sarif_end_block_fix
Jul 1, 2022
Merged

Add endColumn/endLine to SARIF region#5011
picklebento merged 4 commits intodetekt:mainfrom
VitalyVPinchuk:sarif_end_block_fix

Conversation

@VitalyVPinchuk
Copy link
Copy Markdown
Contributor

For #4919

Looks like the following:

SARIF finding image

But I wasn't able to come up with good tests so I just compare result against predefined text.

@cortinico
Copy link
Copy Markdown
Member

This is great. @chao2zhang do you want to pick this up?

Copy link
Copy Markdown
Member

@BraisGabin BraisGabin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm far from a computer for some days so I can't check. But isn't the psi api give us this information the same way it give us the start? I'm not 100% about this, I couldn't check the code that we have right now.


every { psiFileMock.text } returns code
every { ktElementMock.containingFile } returns psiFileMock
return ktElementMock
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to avoid the usage of mockk here if possible. Could this ktelement created/faked instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.
But why is it a bad idea to use mockk here?

Comment thread detekt-report-sarif/src/main/kotlin/io/github/detekt/report/sarif/Results.kt Outdated
Replace toSet() with distinct(), get rid of null check.
@VitalyVPinchuk
Copy link
Copy Markdown
Contributor Author

But isn't the psi api give us this information the same way it give us the start?

Sorry, could you be more specific?

Copy link
Copy Markdown
Member

@picklebento picklebento left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding tests!

@BraisGabin
Copy link
Copy Markdown
Member

Sorry, could you be more specific?

Chao answer this already. We need to refactor core to make this more precise. But that's out of scope of this PR.

@picklebento picklebento merged commit b49aea7 into detekt:main Jul 1, 2022
@BraisGabin
Copy link
Copy Markdown
Member

@VitalyVPinchuk first of all thank you so much for all the contributions they are really good <3

I want to ask you a favor. In next PRs, if you feel that you are fixing an issue use the ver 'close' or 'fix' before the number or the issue. This way gothub will be automatically close the issue once we merge the PR. This is not a big deal at all but if you can do that it will help a lot so we don't keep already solved issues open :)

@VitalyVPinchuk
Copy link
Copy Markdown
Contributor Author

In next PRs, if you feel that you are fixing an issue use the ver 'close' or 'fix' before the number or the issue. This way gothub will be automatically close the issue once we merge the PR.

Yes, sure! Thanks for letting me know.

@VitalyVPinchuk VitalyVPinchuk deleted the sarif_end_block_fix branch July 2, 2022 19:05
@cortinico cortinico added this to the 1.21.0 milestone Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants