|
| 1 | +/* |
| 2 | + * Copyright (C) 2021 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>) |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + * |
| 16 | + * SPDX-License-Identifier: Apache-2.0 |
| 17 | + * License-Filename: LICENSE |
| 18 | + */ |
| 19 | + |
| 20 | +package org.ossreviewtoolkit.advisor.advisors |
| 21 | + |
| 22 | +import com.fasterxml.jackson.annotation.JsonInclude |
| 23 | +import com.fasterxml.jackson.annotation.JsonProperty |
| 24 | + |
| 25 | +/** |
| 26 | + * The configuration for the GitHub Defects advisor. |
| 27 | + */ |
| 28 | +data class GitHubDefectsConfiguration( |
| 29 | + /** |
| 30 | + * The access token to authenticate against the GitHub GraphQL endpoint. |
| 31 | + */ |
| 32 | + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) |
| 33 | + val token: String? = null, |
| 34 | + |
| 35 | + /** |
| 36 | + * The URL of the GraphQL endpoint to be accessed by the service. If undefined, default is the endpoint of the |
| 37 | + * official GitHub GraphQL API. |
| 38 | + */ |
| 39 | + @JsonInclude(JsonInclude.Include.NON_DEFAULT) |
| 40 | + val endpointUrl: String? = null, |
| 41 | + |
| 42 | + /** |
| 43 | + * A list with labels to be used for filtering GitHub issues. With GitHub's data model for issues, it is not |
| 44 | + * possible to determine whether a specific issue is actually a defect or something else, e.g. a feature request. |
| 45 | + * Via this property, it is possible to limit the issues retrieved by the GitHub defects advisor by filtering for |
| 46 | + * specific label values. The filtering works as follows: |
| 47 | + * - Each string in this list refers to a label to be matched. The strings are processed in order. |
| 48 | + * - If for an issue a label with the name of the current string is found, the issue is included into the result |
| 49 | + * set. |
| 50 | + * - If the current string starts with one of the characters '-' or '!', it defines an exclusion. So, if an issue |
| 51 | + * contains a label named like the current string with the first character removed, this issue is not added to |
| 52 | + * the result set, and filtering stops here. (The ordered processing resolves conflicting filters, as the first |
| 53 | + * match wins.) |
| 54 | + * - Label name matches are case-insensitive. |
| 55 | + * - Wildcards are supported; a "*" matches arbitrary characters. |
| 56 | + * - If the end of the list is reached and no match was found, the issue is not added to the result set. In order |
| 57 | + * to have all issues included for which no specific exclusion was found, a wildcard match "*" can be added at |
| 58 | + * the end. |
| 59 | + * Per default, some of GitHub's default labels are excluded that typically indicate that an issue is not a defect |
| 60 | + * (see https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels#about-default-labels) |
| 61 | + */ |
| 62 | + @JsonInclude(JsonInclude.Include.NON_DEFAULT) |
| 63 | + val labelFilter: List<String> = listOf("!duplicate", "!enhancement", "!invalid", "!question", "*"), |
| 64 | + |
| 65 | + /** |
| 66 | + * The maximum number of defects that are retrieved from a single repository. If a repository contains more |
| 67 | + * issues, only this number is returned (the newest ones). Popular libraries hosted on GitHub can really have a |
| 68 | + * large number of issues; therefore, it makes sense to restrict the result set produced by this advisor. |
| 69 | + */ |
| 70 | + val maxNumberOfIssuesPerRepository: Int? = null, |
| 71 | + |
| 72 | + /** |
| 73 | + * Determines the number of requests to the GitHub GraphQL API that are executed in parallel. Rather than querying |
| 74 | + * each repository one after the other, fetching the data of multiple repositories concurrently can reduce the |
| 75 | + * execution times for this advisor implementation. If unspecified, a default value for parallel executions as |
| 76 | + * defined in the _GitHubDefects_ class is used. |
| 77 | + */ |
| 78 | + val parallelRequests: Int? = null |
| 79 | +) |
0 commit comments