-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Add get_top_level_resources()
to DatafileHandler
class
#3315
Conversation
9cdf85b
to
9e15906
Compare
I'd like your opinion on how the logic of determining the key files of a package should happen. Currently for the Maven POM xml DatafileHandler returns the Resources from the The logic here is strange:
|
@JonoYang you wrote:
In scancode-toolkit/src/packagedcode/maven.py Line 156 in 9e15906
That's ok: returning not too much and expend later if needed is better IMHO. I have seen whol JS npms stuffed under META-INF in the past.
This sounds reasonable to me, typically the key files from the root of a source repo and up being copied to the META-INF dir at build time. |
Every file in the META-INF directory would be a top-level file, but not every one of those file would be a key file. I was just thinking that the method name was misleading because of that. Edit: I ended up renaming |
get_key_files()
to DatafileHandler
class get_top_level_resources()
to DatafileHandler
class
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.
Looks great, thanks! I've asked for your advice on some questions above for using this in package license detection too, see comments for those
* Update classifier plugin to use package data * Classifier plugin is now a post-scan plugin Signed-off-by: Jono Yang <jyang@nexb.com>
* Simplify get_field_values_from_codebase_resources() * Update test expectations Signed-off-by: Jono Yang <jyang@nexb.com>
* Update test expectations Signed-off-by: Jono Yang <jyang@nexb.com>
* Just tag whether or not a file is top-level or not Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
* Add test for get_top_level_resources in maven tests * Add test in test_classify Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
6a56110
to
b897164
Compare
I rebased this branch onto the latest changes from develop, but I am failing this test for generating yaml output: https://dev.azure.com/nexB/scancode-toolkit/_build/results?buildId=10643&view=logs&j=1412dbfa-421a-5a40-8ddf-7073fc46aa19&t=13c90161-2109-5957-f563-a96fefc7d869&l=7692 I tried to regenerated the test files, but I get this error:
|
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
79ca0a3
to
a512d60
Compare
* Update expected test results Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
@AyanSinhaMahapatra Thanks for updating the yaml test results! Merging. |
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
This PR adds
get_key_files()
get_top_level_resources()
to theDatafileHandler
class. This method yields the resources that are considered key files of a package. Currently,MavenPomXmlHandler
is the only DatafileHandler that hasget_key_files()
get_top_level_resources()
implemented. The file classification plugin was made into a post-scan plugin, now that it has to wait for package data to be populated before working.This change allows us to run the scan summary plugin on an extracted source JAR in addition to a standard codebase.