Skip to content

Commit 34edf22

Browse files
committed
refactor(scanner): Split out config classes for all scanners
Do this for consistency and overview. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 6076c53 commit 34edf22

File tree

6 files changed

+171
-108
lines changed

6 files changed

+171
-108
lines changed

plugins/scanners/askalono/src/main/kotlin/Askalono.kt

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import org.ossreviewtoolkit.model.ScanSummary
3333
import org.ossreviewtoolkit.model.Severity
3434
import org.ossreviewtoolkit.model.TextLocation
3535
import org.ossreviewtoolkit.plugins.api.OrtPlugin
36-
import org.ossreviewtoolkit.plugins.api.OrtPluginOption
3736
import org.ossreviewtoolkit.plugins.api.PluginDescriptor
3837
import org.ossreviewtoolkit.scanner.LocalPathScannerWrapper
3938
import org.ossreviewtoolkit.scanner.ScanContext
@@ -58,41 +57,6 @@ object AskalonoCommand : CommandLineTool {
5857
output.removePrefix("askalono ")
5958
}
6059

61-
data class AskalonoConfig(
62-
/**
63-
* A regular expression to match the scanner name when looking up scan results in the storage.
64-
*/
65-
val regScannerName: String?,
66-
67-
/**
68-
* The minimum version of stored scan results to use.
69-
*/
70-
val minVersion: String?,
71-
72-
/**
73-
* The maximum version of stored scan results to use.
74-
*/
75-
val maxVersion: String?,
76-
77-
/**
78-
* The configuration to use for the scanner. Only scan results with the same configuration are used when looking up
79-
* scan results in the storage.
80-
*/
81-
val configuration: String?,
82-
83-
/**
84-
* Whether to read scan results from the storage.
85-
*/
86-
@OrtPluginOption(defaultValue = "true")
87-
val readFromStorage: Boolean,
88-
89-
/**
90-
* Whether to write scan results to the storage.
91-
*/
92-
@OrtPluginOption(defaultValue = "true")
93-
val writeToStorage: Boolean
94-
)
95-
9660
@OrtPlugin(
9761
displayName = "askalono",
9862
description = "askalono is a library and command-line tool to help detect license texts. It's designed to be " +
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (C) 2017 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.plugins.scanners.askalono
21+
22+
import org.ossreviewtoolkit.plugins.api.OrtPluginOption
23+
24+
data class AskalonoConfig(
25+
/**
26+
* A regular expression to match the scanner name when looking up scan results in the storage.
27+
*/
28+
val regScannerName: String?,
29+
30+
/**
31+
* The minimum version of stored scan results to use.
32+
*/
33+
val minVersion: String?,
34+
35+
/**
36+
* The maximum version of stored scan results to use.
37+
*/
38+
val maxVersion: String?,
39+
40+
/**
41+
* The configuration to use for the scanner. Only scan results with the same configuration are used when looking up
42+
* scan results in the storage.
43+
*/
44+
val configuration: String?,
45+
46+
/**
47+
* Whether to read scan results from the storage.
48+
*/
49+
@OrtPluginOption(defaultValue = "true")
50+
val readFromStorage: Boolean,
51+
52+
/**
53+
* Whether to write scan results to the storage.
54+
*/
55+
@OrtPluginOption(defaultValue = "true")
56+
val writeToStorage: Boolean
57+
)

plugins/scanners/boyterlc/src/main/kotlin/BoyterLc.kt

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import org.ossreviewtoolkit.model.ScanSummary
3232
import org.ossreviewtoolkit.model.Severity
3333
import org.ossreviewtoolkit.model.TextLocation
3434
import org.ossreviewtoolkit.plugins.api.OrtPlugin
35-
import org.ossreviewtoolkit.plugins.api.OrtPluginOption
3635
import org.ossreviewtoolkit.plugins.api.PluginDescriptor
3736
import org.ossreviewtoolkit.scanner.LocalPathScannerWrapper
3837
import org.ossreviewtoolkit.scanner.ScanContext
@@ -57,41 +56,6 @@ object BoyterLcCommand : CommandLineTool {
5756
output.removePrefix("licensechecker version ")
5857
}
5958

60-
data class BoyterLcConfig(
61-
/**
62-
* A regular expression to match the scanner name when looking up scan results in the storage.
63-
*/
64-
val regScannerName: String?,
65-
66-
/**
67-
* The minimum version of stored scan results to use.
68-
*/
69-
val minVersion: String?,
70-
71-
/**
72-
* The maximum version of stored scan results to use.
73-
*/
74-
val maxVersion: String?,
75-
76-
/**
77-
* The configuration to use for the scanner. Only scan results with the same configuration are used when looking up
78-
* scan results in the storage.
79-
*/
80-
val configuration: String?,
81-
82-
/**
83-
* Whether to read scan results from the storage.
84-
*/
85-
@OrtPluginOption(defaultValue = "true")
86-
val readFromStorage: Boolean,
87-
88-
/**
89-
* Whether to write scan results to the storage.
90-
*/
91-
@OrtPluginOption(defaultValue = "true")
92-
val writeToStorage: Boolean
93-
)
94-
9559
@OrtPlugin(
9660
displayName = "BoyterLc",
9761
description = "A command line application which scans directories and identifies what software license things " +
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (C) 2017 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.plugins.scanners.boyterlc
21+
22+
import org.ossreviewtoolkit.plugins.api.OrtPluginOption
23+
24+
data class BoyterLcConfig(
25+
/**
26+
* A regular expression to match the scanner name when looking up scan results in the storage.
27+
*/
28+
val regScannerName: String?,
29+
30+
/**
31+
* The minimum version of stored scan results to use.
32+
*/
33+
val minVersion: String?,
34+
35+
/**
36+
* The maximum version of stored scan results to use.
37+
*/
38+
val maxVersion: String?,
39+
40+
/**
41+
* The configuration to use for the scanner. Only scan results with the same configuration are used when looking up
42+
* scan results in the storage.
43+
*/
44+
val configuration: String?,
45+
46+
/**
47+
* Whether to read scan results from the storage.
48+
*/
49+
@OrtPluginOption(defaultValue = "true")
50+
val readFromStorage: Boolean,
51+
52+
/**
53+
* Whether to write scan results to the storage.
54+
*/
55+
@OrtPluginOption(defaultValue = "true")
56+
val writeToStorage: Boolean
57+
)

plugins/scanners/licensee/src/main/kotlin/Licensee.kt

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import org.ossreviewtoolkit.model.ScannerDetails
3939
import org.ossreviewtoolkit.model.Severity
4040
import org.ossreviewtoolkit.model.TextLocation
4141
import org.ossreviewtoolkit.plugins.api.OrtPlugin
42-
import org.ossreviewtoolkit.plugins.api.OrtPluginOption
4342
import org.ossreviewtoolkit.plugins.api.PluginDescriptor
4443
import org.ossreviewtoolkit.scanner.LocalPathScannerWrapper
4544
import org.ossreviewtoolkit.scanner.ScanContext
@@ -62,41 +61,6 @@ object LicenseeCommand : CommandLineTool {
6261
override fun getVersionArguments() = "version"
6362
}
6463

65-
data class LicenseeConfig(
66-
/**
67-
* A regular expression to match the scanner name when looking up scan results in the storage.
68-
*/
69-
val regScannerName: String?,
70-
71-
/**
72-
* The minimum version of stored scan results to use.
73-
*/
74-
val minVersion: String?,
75-
76-
/**
77-
* The maximum version of stored scan results to use.
78-
*/
79-
val maxVersion: String?,
80-
81-
/**
82-
* The configuration to use for the scanner. Only scan results with the same configuration are used when looking up
83-
* scan results in the storage.
84-
*/
85-
val configuration: String?,
86-
87-
/**
88-
* Whether to read scan results from the storage.
89-
*/
90-
@OrtPluginOption(defaultValue = "true")
91-
val readFromStorage: Boolean,
92-
93-
/**
94-
* Whether to write scan results to the storage.
95-
*/
96-
@OrtPluginOption(defaultValue = "true")
97-
val writeToStorage: Boolean
98-
)
99-
10064
@OrtPlugin(
10165
displayName = "Licensee",
10266
description = "Licensee is a command line tool to detect licenses in a given project.",
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (C) 2017 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.plugins.scanners.licensee
21+
22+
import org.ossreviewtoolkit.plugins.api.OrtPluginOption
23+
24+
data class LicenseeConfig(
25+
/**
26+
* A regular expression to match the scanner name when looking up scan results in the storage.
27+
*/
28+
val regScannerName: String?,
29+
30+
/**
31+
* The minimum version of stored scan results to use.
32+
*/
33+
val minVersion: String?,
34+
35+
/**
36+
* The maximum version of stored scan results to use.
37+
*/
38+
val maxVersion: String?,
39+
40+
/**
41+
* The configuration to use for the scanner. Only scan results with the same configuration are used when looking up
42+
* scan results in the storage.
43+
*/
44+
val configuration: String?,
45+
46+
/**
47+
* Whether to read scan results from the storage.
48+
*/
49+
@OrtPluginOption(defaultValue = "true")
50+
val readFromStorage: Boolean,
51+
52+
/**
53+
* Whether to write scan results to the storage.
54+
*/
55+
@OrtPluginOption(defaultValue = "true")
56+
val writeToStorage: Boolean
57+
)

0 commit comments

Comments
 (0)