This should allow to get the matched lines between the source file and the snippet. Unfortunately, this is only character range information, not line range. To get the matched lines, one has to call files_and_folders/get_matched_lines with the source file name and the snippet id. Then FossID returns the matched lines equivalent.
Indeed, the FossID API is designed in such a way that, getting the matched lines of a snippet requires a separate query to the API server.
Therefore the workflow is :
For a given scancode list pending files scans/get_pending_files
For each pending file, list the snippets files_and_folders/get_fossid_results
For each snippet with partial match, list the matched lines files_and_folders/get_matched_lines.
These are way to much requests as we have scans with 2000 pending files! For such scans, we need more than 10000 requests to fetch all snippets data (snippet + matching lines).
FossID should provide an API to batch these operations. For instance:
List all snippets for all pending files or for a list of files.
List all matched lines for all snippets with partial match, or for a list of snippet ids.
Note: the fossid-cli proprietary tool seems to have a better performance for this, with the --sensitivity option. Is there an unofficial API to perform what we want to do ?
For what it's worth, the ticket FOSSIDSC-3099 has been opened at FossID support (access requires account).
This ticket is following a discussion at https://github.com/oss-review-toolkit/ort/pull/7022#discussion_r1200165856.
When listing the snippets through FossID API, FossID return each snippet with such a payload (in the highlighting property) :
This should allow to get the matched lines between the source file and the snippet. Unfortunately, this is only character range information, not line range. To get the matched lines, one has to call files_and_folders/get_matched_lines with the source file name and the snippet id. Then FossID returns the matched lines equivalent.
Indeed, the FossID API is designed in such a way that, getting the matched lines of a snippet requires a separate query to the API server.
Therefore the workflow is :
These are way to much requests as we have scans with 2000 pending files! For such scans, we need more than 10000 requests to fetch all snippets data (snippet + matching lines).
FossID should provide an API to batch these operations. For instance:
Note: the fossid-cli proprietary tool seems to have a better performance for this, with the --sensitivity option. Is there an unofficial API to perform what we want to do ?
For what it's worth, the ticket FOSSIDSC-3099 has been opened at FossID support (access requires account).