Skip to content

Commit 2b2bb87

Browse files
committed
docs: Avoid "we" in comments and use passive voice
Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 81561d1 commit 2b2bb87

File tree

13 files changed

+31
-30
lines changed

13 files changed

+31
-30
lines changed

analyzer/src/main/kotlin/Analyzer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Analyzer(private val config: AnalyzerConfiguration, private val labels: Ma
104104
}.toMap(mutableMapOf())
105105

106106
// Check whether there are unmanaged files (because of deactivated, unsupported, or non-present package
107-
// managers) which we need to attach to an artificial "unmanaged" project.
107+
// managers) which need to get attached to an artificial "unmanaged" project.
108108
val managedDirs = managedFiles.values.flatten().mapNotNull { it.parentFile }
109109
val hasOnlyManagedDirs = absoluteProjectPath in managedDirs || absoluteProjectPath.walk().maxDepth(1)
110110
.all { it.isDirectory && (it in managedDirs || it.name in VCS_DIRECTORIES) }

analyzer/src/main/kotlin/AnalyzerResultBuilder.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class AnalyzerResultBuilder {
5454
fun addResult(projectAnalyzerResult: ProjectAnalyzerResult) =
5555
apply {
5656
// TODO: It might be, e.g. in the case of PIP "requirements.txt" projects, that different projects with
57-
// the same ID exist. We need to decide how to handle that case.
57+
// the same ID exist. Decide how to handle that case.
5858
val existingProject = projects.find { it.id == projectAnalyzerResult.project.id }
5959

6060
if (existingProject != null) {
@@ -123,7 +123,7 @@ private fun AnalyzerResult.resolvePackageManagerDependencies(): AnalyzerResult {
123123
}
124124

125125
// Package managers that do not use the dependency graph representation, might not have a check implemented to
126-
// verify that packages exist for all dependencies, so we need to disable the reference check here.
126+
// verify that packages exist for all dependencies, so the reference check needs to be disabled here.
127127
type to builder.build(checkReferences = false)
128128
}
129129

analyzer/src/main/kotlin/PackageManager.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ abstract class PackageManager(
174174
val mergedVcs = normalizedVcsFromPackage.merge(fallbackVcs)
175175
if (mergedVcs != normalizedVcsFromPackage) {
176176
// ... but if indeed metadata was enriched, overwrite the URL with the one from the fallback VCS
177-
// information to ensure we get the correct base URL if additional VCS information (like a revision
177+
// information to ensure to get the correct base URL if additional VCS information (like a revision
178178
// or path) has been split from the original URL.
179179
return mergedVcs.copy(url = fallbackVcs.url)
180180
}

clients/fossid-webapp/src/main/kotlin/FossIdRestService.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ interface FossIdRestService {
113113
boundType.rawClass
114114
)
115115
val map = JSON_MAPPER.readValue<Map<Any, Any>>(p, mapType)
116-
// we keep only the values of the map: when the FossID functions which return a PolymorphicList
117-
// return a map, this is always the list of elements grouped by id. Since the ids are also
118-
// present in the elements themselves, we don't lose any information by discarding the keys.
116+
117+
// Only keep the map's values: If the FossID functions which return a PolymorphicList return a
118+
// map, it always is the list of elements grouped by id. Since the ids are also present in the
119+
// elements themselves, no information is lost by discarding the keys.
119120
PolymorphicList(map.values.toList())
120121
}
121122

clients/fossid-webapp/src/test/kotlin/FossId2021dot2Test.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ class FossId2021dot2Test : StringSpec({
7373
}
7474

7575
"Scan status can be queried (2021.2)" {
76-
// because the service caches the version, we must recreate it
76+
// Recreate the version as the service caches it.
7777
service = FossIdServiceWithVersion.create(service)
78+
7879
service.checkScanStatus("", "", SCAN_CODE_2021_2).shouldNotBeNull().run {
7980
checkResponse("get scan status")
8081

clients/fossid-webapp/src/test/kotlin/FossId2023dot1Test.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ class FossId2023dot1Test : StringSpec({
7474
}
7575

7676
"Delete scan response can be parsed (2023.1)" {
77-
// because the service caches the version, we must recreate it
77+
// Recreate the version as the service caches it.
7878
service = FossIdServiceWithVersion.create(service)
79+
7980
service.deleteScan("", "", SCAN_CODE_2021_2).shouldNotBeNull().run {
8081
checkResponse("delete scan")
8182

downloader/src/main/kotlin/Downloader.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ class Downloader(private val config: DownloaderConfiguration) {
101101
val vcsMark = TimeSource.Monotonic.markNow()
102102

103103
try {
104-
// Cargo in general builds from source tarballs, so we prefer source artifacts over VCS, but still use VCS
105-
// if no source artifact is given.
104+
// Cargo in general builds from source tarballs, so prefer source artifacts over VCS, but still use VCS if
105+
// no source artifact is given.
106106
val isCargoPackageWithSourceArtifact = pkg.id.type == "Cargo" && pkg.sourceArtifact != RemoteArtifact.EMPTY
107107

108108
if (!isCargoPackageWithSourceArtifact) {
@@ -273,8 +273,7 @@ class Downloader(private val config: DownloaderConfiguration) {
273273
val workingTree = try {
274274
applicableVcs.download(pkg, outputDirectory, config.allowMovingRevisions, recursive)
275275
} catch (e: DownloadException) {
276-
// TODO: We should introduce something like a "strict" mode and only do these kind of fallbacks in
277-
// non-strict mode.
276+
// TODO: Introduce something like a "strict" mode and only do these kind of fallbacks in non-strict mode.
278277
val vcsUrlNoCredentials = pkg.vcsProcessed.url.replaceCredentialsInUri()
279278
if (vcsUrlNoCredentials != pkg.vcsProcessed.url) {
280279
// Try once more with any username / password stripped from the URL.
@@ -393,7 +392,7 @@ class Downloader(private val config: DownloaderConfiguration) {
393392
}
394393

395394
/**
396-
* Consolidate [projects] based on their VcsInfo without taking the path into account. As we store VcsInfo per project
395+
* Consolidate [projects] based on their VcsInfo without taking the path into account. As VcsInfo is stored per project
397396
* but many project definition files actually reside in different subdirectories of the same VCS working tree, it does
398397
* not make sense to download (and scan) all of them individually, not even if doing sparse checkouts. Return a map that
399398
* associates packages for projects in distinct VCS working trees with all other projects from the same VCS working

model/src/main/kotlin/Package.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import org.ossreviewtoolkit.utils.spdx.SpdxOperator
3333
/**
3434
* A generic descriptor for a software package. It contains all relevant metadata about a package like the name,
3535
* version, and how to retrieve the package and its source code. It does not contain information about the package's
36-
* dependencies, however. This is because at this stage we would only be able to get the declared dependencies, whereas
37-
* we are interested in the resolved dependencies. Resolved dependencies might differ from declared dependencies due to
36+
* dependencies, however. This is because at this stage ORT would only be able to get the declared dependencies, whereas
37+
* the resolved dependencies are of interest. Resolved dependencies might differ from declared dependencies due to
3838
* specified version ranges, or change depending on how the package is used in a project due to the build system's
3939
* dependency resolution process. For example, if multiple versions of the same package are used in a project, the build
4040
* system might decide to align on a single version of that package.

plugins/package-managers/composer/src/main/kotlin/Composer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class Composer(
151151
// required, but are not listed in composer.lock as installed.
152152
// If we didn't handle them specifically, we would report them as missing when trying to load the
153153
// dependency information for them. We can't simply put these "virtual" packages in the normal package
154-
// map as this would cause us to report a package which is not actually installed with the contents of
154+
// map as this would cause ORT to report a package which is not actually installed with the contents of
155155
// the "replacing" package.
156156
val virtualPackages = parseVirtualPackageNames(packages, projectPackageInfo, lockfile)
157157

plugins/scanners/fossid/src/main/kotlin/FossId.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ class FossId internal constructor(
219219

220220
// A list of all scans created in an ORT run, to be able to delete them in case of error.
221221
// The reasoning is that either all these scans are successful, either none is created at all (clean slate).
222-
// A use case is that an ORT run is created regularly e.g. nightly, and we want to have exactly the same amount
223-
// of scans for each package.
222+
// A use case is that an ORT run is created regularly, e.g. nightly, and exactly the same amount of scans for each
223+
// package is wanted.
224224
private val createdScans = mutableSetOf<String>()
225225

226226
private val service = runBlocking { FossIdRestService.create(config.serverUrl) }
@@ -433,8 +433,8 @@ class FossId internal constructor(
433433
): List<Scan> {
434434
val scans = filter {
435435
val isArchived = it.isArchived == true
436-
// The scans in the server contain the url with the credentials, so we have to remove it for the
437-
// comparison. If we don't, the scans won't be matched if the password changes!
436+
// The scans in the server contain the URL with credentials, so these have to be removed for the comparison.
437+
// Otherwise scans would not be matched if the password changed.
438438
val urlWithoutCredentials = it.gitRepoUrl?.replaceCredentialsInUri()
439439
!isArchived && urlWithoutCredentials == url
440440
}.sortedByDescending { it.id }
@@ -530,7 +530,7 @@ class FossId internal constructor(
530530
val mappedUrl = urlProvider.getUrl(urlWithoutCredentials)
531531
val mappedUrlWithoutCredentials = mappedUrl.replaceCredentialsInUri()
532532

533-
// we ignore the revision because we want to do a delta scan
533+
// Ignore the revision for delta scans.
534534
val recentScans = scans.recentScansForRepository(
535535
mappedUrlWithoutCredentials,
536536
projectRevision = projectRevision,
@@ -755,9 +755,9 @@ class FossId internal constructor(
755755
DownloadStatus.FAILED -> error("Could not download scan: ${response.message}.")
756756

757757
else -> {
758-
// There is a bug with the FossID server version < 20.2: Sometimes the download is complete, but it
759-
// stays in state "NOT FINISHED". Therefore, we check the output of the Git fetch to find out
760-
// whether the download is actually done.
758+
// There is a bug in FossID server version < 20.2: Sometimes the download is complete, but it stays
759+
// in "NOT FINISHED" state. Therefore, check the output of the Git fetch command to find out whether
760+
// the download has actually finished.
761761
val message = response.message
762762
val currentVersion = checkNotNull(Semver.coerce(version))
763763
val minVersion = checkNotNull(Semver.coerce("20.2"))

utils/common/src/main/kotlin/DirectoryStash.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ fun stashDirectories(vararg directories: File): Closeable = DirectoryStash(setOf
4343
*/
4444
private class DirectoryStash(directories: Set<File>) : Closeable {
4545
private val stashedDirectories: Map<File, File?> = directories.associateWith { originalDir ->
46-
// We need to check this on each iteration instead of filtering beforehand to properly handle parent / child
47-
// directories.
46+
// Check this on each iteration instead of filtering beforehand to properly handle parent / child directories.
4847
if (originalDir.isDirectory) {
4948
// Create a temporary directory to move the original directory into as a sibling of the original directory
5049
// to ensure it resides on the same file system for being able to perform an atomic move.

utils/ort/src/main/kotlin/Utils.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fun filterVersionNames(version: String, names: List<String>, project: String? =
111111
}
112112

113113
return filteredNames.filter {
114-
// startsWith("") returns "true" for any string, so we get an unfiltered list if "project" is "null".
114+
// startsWith("") returns "true" for any string, so this yields an unfiltered list if "project" is "null".
115115
it.startsWith(project.orEmpty())
116116
}.let {
117117
// Fall back to the original list if filtering by project results in an empty list.
@@ -176,7 +176,7 @@ fun normalizeVcsUrl(vcsUrl: String): String {
176176
}
177177
}
178178

179-
// If we have no protocol by now and the host is Git-specific, assume https.
179+
// If there is no protocol by now and the host is Git-specific, assume https.
180180
if (url.startsWith("github.com") || url.startsWith("gitlab.com")) {
181181
url = "https://$url"
182182
}

utils/ort/src/test/kotlin/OrtProxySelectorTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class OrtProxySelectorTest : WordSpec({
111111
})
112112

113113
private fun createProxySelector(protocol: String): OrtProxySelector {
114-
// Using a non-null assertion is fine here as we know the URL to be parsable.
114+
// Using a non-null assertion is fine here as the URL is known to be parsable.
115115
val proxy = determineProxyFromUrl("http://fake-proxy:8080")!!
116116

117117
return OrtProxySelector().removeAllProxies().addProxy("test", protocol, proxy)

0 commit comments

Comments
 (0)