Get the actual location of the license text in the source code of the package #6941
Replies: 6 comments
-
Are you looking for a way to programmatically get the license finding from Kotlin / Java code, or do you want to post-process license findings from an ORT result? The latter contains the license findings incl. line number like shown in this dummy example. Also, the static HTML report contains links to the exact original source code location, if feasible. But be advised that the line statements refer to the matched text by the scanner, which is not necessarily the full license text. |
Beta Was this translation helpful? Give feedback.
-
I want to programmatically get the license text location an make sure that the license text is present in the source code, There are some false positives with the locations of every license , sometimes the result is that a specific license exists in the package but the package doesn't include the full license text as whole. So is there a way to make sure if the license text already exists in the source code of the package or not , and If so how to how to get the exact location of it ? |
Beta Was this translation helpful? Give feedback.
-
That check does not make sense, IMO. The text found by e.g. ScanCode is by definition present in the source code. However, the found / matched text may not be the full license text, like you said.
I'm not sure whether you fully understand how ScanCode works here yet. What ScanCode gives you is the location (file and start / end line numbers) of the text block that triggered a ScanCode finding, and ORT records that finding. Additionally, ScanCode can extract the lines of text for you in its raw results, but ORT does not make use of that feature. Anyway, all you get is the piece of text that triggered a finding. That may or may not be (an excerpt of) a real / full license text. If you goal is to compare ScanCode's matched text (and determined license name) to the original text for that license (e.g. in a side-by-side diff for human review), then you'd need to post-process ORT's scan-result for findings and have access to the scanned source code to look up the file and line numbers from the findings in the source code and extract the matched text. Then you need to also get the original license texts (maybe from https://scancode-licensedb.aboutcode.org/) and finally compare the extracted matched text to the original license text. |
Beta Was this translation helpful? Give feedback.
-
Hi there, there might be some confusion here regarding workflow and procedure: |
Beta Was this translation helpful? Give feedback.
-
That can be achieved via the helper methods provided to reporter templates, see e.g. the |
Beta Was this translation helpful? Give feedback.
-
The only file content ORT stores is the content of all files matching the license file patterns [1]. [2] |
Beta Was this translation helpful? Give feedback.
-
In the ResolvedLicense.kt class there is a list of locations where the license text possibly exists in the source code, but what If I want the exact location of the license text in the source code, Is there a way to get the exact license text file location inside the source code?
Beta Was this translation helpful? Give feedback.
All reactions