Skip to content
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

✨ Don't use full file paths for violations #548

Merged
merged 6 commits into from
Mar 29, 2024

Conversation

eemcmullan
Copy link
Contributor

Closes #322

Signed-off-by: Emily McMullan <emcmulla@redhat.com>
Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

I think you have to fix the dependency test as well:

https://github.com/konveyor/analyzer-lsp/actions/runs/8394658124/job/22992283193?pr=548#step:4:569

But other than that, this looks great and makes a ton of sense.

Copy link
Member

@aufi aufi left a comment

Choose a reason for hiding this comment

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

I agree with Shawn; need fix tests, otherwise looks great.

Signed-off-by: Emily McMullan <emcmulla@redhat.com>
@eemcmullan eemcmullan changed the title ✨ Don't use full file paths for violations ✨ Don't use full file paths for violations Mar 25, 2024
Signed-off-by: Emily McMullan <emcmulla@redhat.com>
Signed-off-by: Emily McMullan <emcmulla@redhat.com>
@@ -411,7 +411,7 @@ func (p *javaServiceClient) parseDepString(dep, localRepoPath, pomPath string) (
fp := resolveDepFilepath(&d, p, group, artifact, localRepoPath)

d.Labels = addDepLabels(p.depToLabels, d.Name)
d.FileURIPrefix = fmt.Sprintf("file://%v", filepath.Dir(fp))
d.FileURIPrefix = fmt.Sprintf("file://%v", filepath.Dir(strings.TrimPrefix(fp, localRepoPath)))
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should be doing this,

Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor

Choose a reason for hiding this comment

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

this will break the dependency filtering logic, either we fix it in both places or don't change the fileURIPrefix at all, because this is mainly just an internal field

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, that makes sense. I am a +1 on changing this too then :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@eemcmullan this could be causing the failures too then maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Think so. Probably best then to trim this prefix in https://github.com/konveyor/analyzer-lsp/blob/main/cmd/analyzer/main.go#L423

Signed-off-by: Emily McMullan <emcmulla@redhat.com>
Copy link
Contributor

@pranavgaikwad pranavgaikwad left a comment

Choose a reason for hiding this comment

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

Sorry there's one small thing that concerns me, otherwise looking good. Thank you!

var outputDepDag []konveyor.DepDAGItem
// trim m2 repo prefix for java deps
if name == "java" {
outputDepDag = trimDagItemPrefixes(ds)
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry one small request...I think hardcoding for java provider here is unnecessary. there is no need to change prefix fields on dependencies as it isn't output to users in any incidents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is for the --dep-output-file for the user. Just checking for the java provider here as the trim() function it's calling is only used to trim the local m2 repo prefix. Wanted to avoid issue with other dep providers. However, if I'm off-track, please let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is fine to leave the prefixes as-is in the output @shawn-hurley wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what users are doing with the dep output right now to have a strong opinion; I think because of that, I am ok with keeping the behavior, and if we need to change it later, we can come back. Thoughts?

Signed-off-by: Emily McMullan <emcmulla@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick/release-0.3 This PR should be cherry-picked to release-0.3 branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Full file paths for dependencies are irrelevant for the user
5 participants