-
Notifications
You must be signed in to change notification settings - Fork 19
feat(csv): adding data model to csv analyzer #194
feat(csv): adding data model to csv analyzer #194
Conversation
@@ -2,8 +2,8 @@ | |||
This analyzer investigates a given *csv* file. The format of this csv file follows this format: | |||
|
|||
``` | |||
"Artifact Id","Group Id","Version","License Short Name","License Long Name","File Name" |
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.
Why did you remove the quotes? In CSV they are commonly used.
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.
Is this a breaking change or is this still able to parse the "old" CSV files?
private static final String SOURCE_URL = "Source URL"; | ||
private static final String RELEASE_ARTIFACT_URL = "Release Artifact URL"; | ||
private static final String SWH_URL = "Software Heritage URL"; | ||
// private static final String ClEARING_STATE = "Clearing State"; |
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.
commented code
return license; | ||
} | ||
|
||
private void mapCoordinate(Artifact artifact, CSVRecord record) { |
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.
instead of this style of coding with mutations it would maybe be more consistent to use the same pattern as for createLicense
e.g.
private void mapCoordinate(Artifact artifact, CSVRecord record) { | |
private FactOrSomeOtherMatchingClass mapCoordinate(CSVRecord record) { |
@@ -1,2 +1,2 @@ | |||
Artifact Id,Group Id,Version,License Short Name,License Long Name,File Name | |||
commons-csv,org.apache.commons,1.4,Apache-2.0,Apache Software License 2.0,commons-csv.jar | |||
Artifact Id,Group Id,Version,License Short Name,License Long Name,File Name,Coordinate Type,Observed License Short Name,Observed License Long Name,Source URL,Release Artifact URL,Software Heritage URL |
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.
maybe add a test, that the old CSV format is still supported?
b92fb0d
to
2becc59
Compare
``` | ||
|
||
Note: In the previous documentation the format was given with the headers of the csv columns in quotation marks. |
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 note is unnecessary, this is common behaviour of csv.
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.
I added the quotation marks again and took the note out
97cb581
to
5e56cbd
Compare
artifact.addFact(new ArtifactReleaseTagURL(record.get(RELEASE_ARTIFACT_URL))); | ||
} | ||
if(record.isMapped(SWH_URL)) { | ||
artifact.addFact(new ArtifactSoftwareHeritageURL(record.get(SWH_URL))); |
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.
formatting
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.
formatted. Also removed two redundant imports from CSVAnalyzerTest
f4e459a
to
8402d3b
Compare
Signed-off-by: Stephanie <stephanie.neubauer@bosch-si.com> Signed-off-by: Stephanie Neubauer <Stephanie.Neubauer@bosch-si.com>
8402d3b
to
9cd1f78
Compare
It should work now, but @maxhbr do not merge yet, since I want to find out why MatchState is necessary before merging. |
Source of previous failing of Rule Engine has been determined: |
corresponding issue: #193
Currently Included:
Missing:
Due to belonging exclusively to SW360 data model at the moment
Due to unclear format