Skip to content

Conversation

zepatrik
Copy link
Contributor

This adds the golangci-lint config file schema derived from https://golangci-lint.run/usage/configuration/#config-file
As I am not affiliated with golangci-lint in any way, we can maybe wait for someone from their community to validate this schema. Hence I am opening this as a draft PR for now.

@zepatrik
Copy link
Contributor Author

Is using "$schema": "https://json-schema.org/draft/2019-09/schema#" not supported by your CI or why is it failing? 🤔

@madskristensen
Copy link
Contributor

It is recommended to use draft v4 or v7. Basically the lowest version that you need. Your schema seems to work fine with draft v4

@zepatrik
Copy link
Contributor Author

OK I see, I'd still rather go with v7 to have exclusiveMaximum hold the actual maximum instead of being a boolean flag. Or should I use v4 and change that part with exclusiveMaximum? I'd assume it is better to follow the latest draft when there are breaking changes.

@zepatrik
Copy link
Contributor Author

zepatrik commented Oct 16, 2020

I am quite confused by the CI error, as there is literally no "type" keyword at the reported path. Sorry to mention you here, @GerryFerdinandus but you seemed to have fixed some errors like this one recently. Maybe you understand a bit better what the problem is.

@GerryFerdinandus
Copy link
Contributor

Warning: Error: Unprocessed keywords: ["type"] at #/properties/linters-settings/properties/gocritic/properties/settings/propertyNames Use --force to continue.

Point to this json block


and the propertyNames use a enum list of string?
Is that posible? I never seen it before.

I have never used propertyNames
Don't know what the possibility are.

I only fix simple redundant "type" that can be removed. This is something else.

@zepatrik
Copy link
Contributor Author

Exactly, this means that the keys are allowed to be one of the string enum. There is no type keyword that could be "unprocessed".
I could not figure out what exact tool you are using in the CI to test stuff locally, can somebody point me to the script?

@GerryFerdinandus
Copy link
Contributor

I type make command in the console at the schema root folder.
It will download all the necessary npm module and run the test.
Also info about adding test files.

@GerryFerdinandus
Copy link
Contributor

            "settings": {
              "description": "Settings passed to gocritic. Properties must be valid and enabled check names.",
              "type": "object",
              "properties": {
                "propertyNames": {
                  "$ref": "#/definitions/gocritic-checks"
                }
              }
            }

@zepatrik
Should you not put it inside the "properties" blocks?

@zepatrik
Copy link
Contributor Author

I could list all of the properties there, but a) there are 68 of them, b) they are not further typed and c) the same 68 constants are used as array values in two other places. I really want to reduce the overhead there. Adding one item more should only happen in one place.

@GerryFerdinandus
Copy link
Contributor

I do not see "properties": {} in your code. maybe that is the issue.
See my example. And compare it with your code

@zepatrik
Copy link
Contributor Author

your example would validate the following yaml:

settings:
  propertyNames: "one of the enum values"

but I want to validate

settings:
  "one of the enum values": anything

@zepatrik
Copy link
Contributor Author

zepatrik commented Oct 19, 2020

Ok so I switched back to draft 2019-09 which actually fixed the problems schemasafe had. You can read more about that here: ExodusMovement/schemasafe#139
I guess it would be best to continue with that draft version.

@zepatrik zepatrik marked this pull request as ready for review October 19, 2020 21:08
@madskristensen
Copy link
Contributor

Let me know when it's ready to merge

@zepatrik
Copy link
Contributor Author

As it seems that nobody from golanci-lint is interested in reviewing this PR, I would say it is ready to merge. The other issue with schemasafe is probably also going to take a bit longer.

@madskristensen madskristensen merged commit c284ebd into SchemaStore:master Oct 21, 2020
@madskristensen
Copy link
Contributor

Thanks

@zepatrik zepatrik deleted the golangci-lint branch October 21, 2020 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants