-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fossid-webapp): Retain snippet choice state in FossID
When a file has been marked as identified in the current run or a previous one, it is not pending anymore, thus its snippets won't be listed. Consequently, proper license findings cannot be created because the license and the line range information is not stored nor returned by FossID. It is also important to retain which snippet was chosen, as it will allow to deal with deletion of snippet choices (which will be added in future commit). This commit solves the issue by storing the snippet artifact and version to an identification bound to the scan. Identically, the license and source location is stored as JSON in a comment attached to the scan. Then, when the ORT FossID scanner runs, this information is loaded to create a proper license finding out of it. Signed-off-by: Nicolas Nobelis <[email protected]>
- Loading branch information
Showing
5 changed files
with
270 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* License-Filename: LICENSE | ||
*/ | ||
|
||
package org.ossreviewtoolkit.plugins.scanners.fossid | ||
|
||
import org.ossreviewtoolkit.model.TextLocation | ||
|
||
/** | ||
* A class representing a comment generated by ORT and attached to a file marked as identified in FossID. | ||
* This comment contains a mapping between license identifiers and their corresponding source locations. | ||
* This comment is serialized as JSON in the marked as identified file's comment, hence the property being named | ||
* [OrtComment.ort]. | ||
*/ | ||
data class OrtComment(val ort: OrtCommentPayload) | ||
|
||
/** | ||
* The payload of an [OrtComment]. | ||
*/ | ||
data class OrtCommentPayload( | ||
/** | ||
* The license of chosen snippets mapped to their source location. | ||
*/ | ||
val licenses: Map<String, List<TextLocation>>, | ||
/** | ||
* The amount of chosen snippets for this file. | ||
*/ | ||
val snippetChoiceCount: Int, | ||
/** | ||
* The amount of non-relevant snippets for this file. | ||
*/ | ||
val nonRelevantSnippetsCount: Int | ||
) |
Oops, something went wrong.