-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#354 Add better yaml errors when invalid file
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 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
21 changes: 21 additions & 0 deletions
21
hoplite-yaml/src/test/kotlin/com/sksamuel/hoplite/yaml/ParseErrorTest.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,21 @@ | ||
package com.sksamuel.hoplite.yaml | ||
|
||
import com.sksamuel.hoplite.ConfigLoaderBuilder | ||
import com.sksamuel.hoplite.PropertySource | ||
import io.kotest.assertions.throwables.shouldThrowAny | ||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.string.shouldInclude | ||
|
||
class ParseErrorTest : FunSpec() { | ||
init { | ||
test("foo") { | ||
shouldThrowAny { | ||
ConfigLoaderBuilder.default() | ||
.addSource(PropertySource.resource("/bad_indent.yml")) | ||
.build() | ||
.loadNodeOrThrow() | ||
}.message shouldInclude """while parsing a block mapping | ||
in 'reader', line 22, column 5""" | ||
} | ||
} | ||
} |
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,30 @@ | ||
ort: | ||
allowedProcessEnvironmentVariableNames: | ||
- PASSPORT | ||
- USER_HOME | ||
deniedProcessEnvironmentVariablesSubstrings: | ||
- PASS | ||
- SECRET | ||
- TOKEN | ||
- USER | ||
enableRepositoryPackageCurations: true | ||
enableRepositoryPackageConfigurations: true | ||
|
||
licenseFilePatterns: | ||
licenseFilenames: [ 'license*' ] | ||
patentFilenames: [ patents ] | ||
rootLicenseFilenames: [ 'readme*' ] | ||
|
||
severeIssueThreshold: ERROR | ||
severeRuleViolationThreshold: ERROR | ||
|
||
analyzer: | ||
allowDynamicVersions: true | ||
enabledPackageManagers: [ Gradle, Yarn ] | ||
packageManagers: | ||
Yarn: | ||
options: | ||
directDependenciesOnly: true | ||
Gradle: | ||
options: | ||
directDependenciesOnly: true |