Skip to content

Commit

Permalink
Detekt Configuration Schema 1.22.0 (#2623)
Browse files Browse the repository at this point in the history
* Backup old configs

* Add new test configs by converting
 * detekt\detekt-core\src\main\resources\default-detekt-config.yml
 * gradlew :detektGenerateConfig output on v1.22.0 tag
via https://onlineyamltools.com/convert-yaml-to-json.

* Add old config with new name

* Run generated-detekt-config.json
through https://www.liquid-technologies.com/online-json-to-schema-converter
Options: array rules = allow anything, make required = false

* Replace `"items": {}` with `"items": { "type": "string" }` and format.

* Update ForbiddenImport.imports and ForbiddenMethodCall.methods schemas to mimic valuesWithReason()

* Update build.weights to accept numeric weights with any key.

* Add common rule properties based on https://json-schema.org/understanding-json-schema/structuring.html#defs
and https://stackoverflow.com/a/52579526/253468

Search (regex, spaces matter):
```
          "properties": \{
            "active": \{
              "type": "boolean"
            },?
```
Replace (regex):
```
          "allOf": [
            {
              "\$ref": "#/\$defs/ruleProperties"
            }
          ],
          "properties": {
```

(I left autoCorrect at the original places, because, while it's valid to define it, it won't have effect other than where it's already shown.)

* Remove excludes and define it centrally.

Search (regex, spaces and new line at the end matter):
```
            "excludes": \{
              "type": "array",
              "items": \{
                "type": "string"
              }
            },?

```
Replace: nothing

* Minor cleanup to shorten schema

,\s*"properties": \{\s*}
->
nothing

* Fix YAML to JSON conversion weirdness

* Rename files to match store conventions.
Inferred original detekt schema and example to be 1.14.1 based on date and contents.

* Fix ajv strict validation errors in detekt schemas

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
TWiStErRob and pre-commit-ci[bot] committed Nov 30, 2022
1 parent 5088af7 commit c5f9000
Show file tree
Hide file tree
Showing 7 changed files with 5,722 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,11 @@
"name": "detekt.yml",
"description": "Detekt Configuration File schema",
"fileMatch": ["detekt.yml", "detekt.yaml"],
"url": "https://json.schemastore.org/detekt.json"
"url": "https://json.schemastore.org/detekt-1.22.0.json",
"versions": {
"1.14.1": "https://json.schemastore.org/detekt-1.14.1.json",
"1.22.0": "https://json.schemastore.org/detekt-1.22.0.json"
}
},
{
"name": "Discord Webhook",
Expand Down
1 change: 0 additions & 1 deletion src/schema-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"debugsettings.json",
"dependabot-2.0.json",
"dependabot.json",
"detekt.json",
"devinit.schema-1.0.json",
"devinit.schema-2.0.json",
"devinit.schema-3.0.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
"ignoredLabels": {
"type": "array",
"items": {
"items": {}
"type": "string"
}
}
}
Expand Down Expand Up @@ -279,7 +279,7 @@
"ignoreAnnotated": {
"type": "array",
"items": {
"items": {}
"type": "string"
}
}
}
Expand Down Expand Up @@ -1248,7 +1248,7 @@
"forbiddenName": {
"type": "array",
"items": {
"items": {}
"type": "string"
}
}
}
Expand Down Expand Up @@ -1692,7 +1692,7 @@
"excludeAnnotatedProperties": {
"type": "array",
"items": {
"items": {}
"type": "string"
}
},
"ignoreOnClassesPattern": {
Expand Down Expand Up @@ -1908,7 +1908,7 @@
"imports": {
"type": "array",
"items": {
"items": {}
"type": "string"
}
},
"forbiddenPatterns": {
Expand Down Expand Up @@ -2383,7 +2383,7 @@
"excludeAnnotatedClasses": {
"type": "array",
"items": {
"items": {}
"type": "string"
}
},
"allowVars": {
Expand Down

0 comments on commit c5f9000

Please sign in to comment.