-
Notifications
You must be signed in to change notification settings - Fork 314
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
Migrate Advisor plugins to configurable plugin API #7690
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
e2cf54c
feat(advisor)!: Use the configurable plugin API for advice providers
mnonnenmacher a8d501e
refactor(advisor)!: Move advisor configuration classes to advisor module
mnonnenmacher 48ea526
chore(advisor): Remove Jackson annotations from configuration classes
mnonnenmacher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
73 changes: 73 additions & 0 deletions
73
advisor/src/main/kotlin/advisors/GitHubDefectsConfiguration.kt
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,73 @@ | ||
/* | ||
* Copyright (C) 2021 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>) | ||
sschuberth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* 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.advisor.advisors | ||
|
||
/** | ||
* The configuration for the GitHub Defects advisor. | ||
*/ | ||
data class GitHubDefectsConfiguration( | ||
/** | ||
* The access token to authenticate against the GitHub GraphQL endpoint. | ||
*/ | ||
val token: String? = null, | ||
|
||
/** | ||
* The URL of the GraphQL endpoint to be accessed by the service. If undefined, default is the endpoint of the | ||
* official GitHub GraphQL API. | ||
*/ | ||
val endpointUrl: String? = null, | ||
|
||
/** | ||
* A list with labels to be used for filtering GitHub issues. With GitHub's data model for issues, it is not | ||
* possible to determine whether a specific issue is actually a defect or something else, e.g. a feature request. | ||
* Via this property, it is possible to limit the issues retrieved by the GitHub defects advisor by filtering for | ||
* specific label values. The filtering works as follows: | ||
* - Each string in this list refers to a label to be matched. The strings are processed in order. | ||
* - If for an issue a label with the name of the current string is found, the issue is included into the result | ||
* set. | ||
* - If the current string starts with one of the characters '-' or '!', it defines an exclusion. So, if an issue | ||
* contains a label named like the current string with the first character removed, this issue is not added to | ||
* the result set, and filtering stops here. (The ordered processing resolves conflicting filters, as the first | ||
* match wins.) | ||
* - Label name matches are case-insensitive. | ||
* - Wildcards are supported; a "*" matches arbitrary characters. | ||
* - If the end of the list is reached and no match was found, the issue is not added to the result set. In order | ||
* to have all issues included for which no specific exclusion was found, a wildcard match "*" can be added at | ||
* the end. | ||
* Per default, some of GitHub's default labels are excluded that typically indicate that an issue is not a defect | ||
* (see https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels#about-default-labels) | ||
*/ | ||
val labelFilter: List<String> = listOf("!duplicate", "!enhancement", "!invalid", "!question", "*"), | ||
|
||
/** | ||
* The maximum number of defects that are retrieved from a single repository. If a repository contains more | ||
* issues, only this number is returned (the newest ones). Popular libraries hosted on GitHub can really have a | ||
* large number of issues; therefore, it makes sense to restrict the result set produced by this advisor. | ||
*/ | ||
val maxNumberOfIssuesPerRepository: Int? = null, | ||
|
||
/** | ||
* Determines the number of requests to the GitHub GraphQL API that are executed in parallel. Rather than querying | ||
* each repository one after the other, fetching the data of multiple repositories concurrently can reduce the | ||
* execution times for this advisor implementation. If unspecified, a default value for parallel executions as | ||
* defined in the _GitHubDefects_ class is used. | ||
*/ | ||
val parallelRequests: Int? = null | ||
) |
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,47 @@ | ||
/* | ||
* Copyright (C) 2020 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.advisor.advisors | ||
|
||
/** | ||
* The configuration for Nexus IQ as a security vulnerability provider. | ||
*/ | ||
data class NexusIqConfiguration( | ||
/** | ||
* The URL to use for REST API requests against the server. | ||
*/ | ||
val serverUrl: String, | ||
|
||
/** | ||
* A URL to use as a base for browsing vulnerability details. Defaults to the server URL. | ||
*/ | ||
val browseUrl: String = serverUrl, | ||
|
||
/** | ||
* The username to use for authentication. If not both [username] and [password] are provided, authentication is | ||
* disabled. | ||
*/ | ||
val username: String? = null, | ||
|
||
/** | ||
* The password to use for authentication. If not both [username] and [password] are provided, authentication is | ||
* disabled. | ||
*/ | ||
val password: String? = null | ||
) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 now duplicates the default value of
GitHubDefectsConfiguration.labelFilter
, which IMO is not so nice. In my old draft I tried to solve this by extracting default values to constants (not fully implemented, also see the last commit in that PR).This raises the general question where default values should be applied. I see basically tree options:
parseConfig()
,My current preference would be 1., and I'd propose a clean-up commit that removes the default parameters from
GitHubDefectsConfiguration
's constructor.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.
Would you be fine with doing that clean up commit outside of this PR?
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.
Yes, if it's resolved within reasonable time, before we forget about it.