Skip to content
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

Fix display of the list of linters #91

Merged
merged 2 commits into from Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main/kotlin/com/ypwang/plugin/GolangCiOutputParser.kt
Expand Up @@ -35,8 +35,8 @@ object GolangCiOutputParser {

val linters = mutableListOf<GoLinter>()
val linterRaw = result.stdout.lines()
// format: name[ (aka)]: description [fast: bool, auto-fix: bool]
val regex = Regex("""(?<name>\w+)( \((?<aka>[\w, ]+)\))?: (?<description>.+) \[fast: (?<fast>true|false), auto-fix: (?<autofix>true|false)]""")
// format: name[ (aka)][ deprecated]: description [fast: bool, auto-fix: bool]
val regex = Regex("""(?<name>\w+)( \((?<aka>[\w, ]+)\))?( \[(?<deprecated>deprecated)])?: (?<description>.+) \[fast: (?<fast>true|false), auto-fix: (?<autofix>true|false)]""")
// parse output
var enabled = true
for (line in linterRaw) {
Expand All @@ -57,9 +57,11 @@ object GolangCiOutputParser {
enabled,
it.groups["name"]!!.value,
it.groups["aka"]?.value ?: "",
it.groups["deprecated"]?.value == "deprecated",
it.groups["description"]!!.value,
it.groups["fast"]!!.value.toBoolean(),
it.groups["autofix"]!!.value.toBoolean())
it.groups["autofix"]!!.value.toBoolean(),
)
)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/ypwang/plugin/model/GoLinter.kt
Expand Up @@ -4,6 +4,7 @@ data class GoLinter (
val defaultEnabled: Boolean,
val name: String,
val aka: String,
val isDeprecated: Boolean,
val description: String,
val fast: Boolean,
val autoFix: Boolean
Expand Down