Open jmle opened 1 year ago
I don't know if I would consider this a bug, we are finding real things in the project layout.
We could give users some way to filter out specific directories using the built-in provider, but as this does not exist, I worry that this is another feature that needs to be added.
@shawn-hurley this is mainly producing duplicate incidents, so I think it's not a huge problem. But at some point we'll probably have to fix it.
I hit this with https://github.com/deewhyweb/eap-coolstore-monolith/tree/main
What surprised me is I didn't intentionally compile the application, so was confused when I saw references to a 'target' directory. I now assume that during analysis the target directory was created and hence analyzed.
The real thing that threw me off with this is I was programmatically grabbing the files from Git that the analyzer flagged as an issue, and when I hit the 'target/*' files they were not in Git so I threw an exception in my code. For now I'll just work around this
javaee-to-jakarta-namespaces-00002:
description: |-
Replace the Java EE persistence namespace, schemaLocation and version with the Jakarta equivalent
Replace `http://xmlns.jcp.org/xml/ns/persistence` with `https://jakarta.ee/xml/ns/persistence` and change the schema version number
category: mandatory
labels:
- konveyor.io/target=jakarta-ee9+
- konveyor.io/target=jakarta-ee
- konveyor.io/target=eap8
- konveyor.io/target=eap
- konveyor.io/source
incidents:
- uri: file:///opt/input/source/target/classes/META-INF/persistence.xml
message: Replace `http://xmlns.jcp.org/xml/ns/persistence` with `https://jakarta.ee/xml/ns/persistence` and change the schema version number
codeSnip: |2
1 <?xml version="1.0" encoding="UTF-8"?>
2 <persistence version="2.1"
3 xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="
5 http://xmlns.jcp.org/xml/ns/persistence
6 http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
7 <persistence-unit name="primary">
8 <jta-data-source>java:jboss/datasources/CoolstoreDS</jta-data-source>
9 <properties>
10 <property name="javax.persistence.schema-generation.database.action" value="none"/>
11 <property name="hibernate.show_sql" value="false" />
12 </properties>
13 </persistence-unit>
14 </persistence>
lineNumber: 3
variables:
matchingText: http://xmlns.jcp.org/xml/ns/persistence
We should filter out results coming from target
folders. I thought the folder was appearing due to our use of Maven for getting the dependency tree and downloading sources, but it looks like the language server does some sort of compilation and creates them.
@jmle @shawn-hurley @pranavgaikwad I've been consistently reproducing this with multiple apps. An example of that can be seen with the properties file from the tackle-testapp application, the Hardcoded IP issue gets triggered twice, both in the application directory and under the target directory.
This issue is currently awaiting triage.
If contributors determine this is a relevant issue, they will accept it by applying the triage/accepted
label and provide further guidance.
The triage/accepted
label can be added by org members.
I assume this is because of the builtin provider not excluding this directory, while the java LS and stuff is (AFAIK) now not searching there.
@eemcmullan if we can, we should wait for the PR that I have in flight because I am making some changes here.
Is there an existing issue for this?
Konveyor version
0.3.0-alpha.5
Priority
Major
Current Behavior
Duplicate entries are appearing because some files inside the
target
folder are being analyzed.Expected Behavior
When analyzing a source code project with "source only", the
target
folder appearing as a result of running maven compilation should not be included in the analysis.How Reproducible
Always (Default)
Steps To Reproduce
javaee-to-jakarta-namespaces-00002
.target
folder are included:Environment
Anything else?
No response