Repository navigation
Stricter linting #156
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
Stricter linting #156
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,46 +1,94 @@ | ||||||
| # Starts from yamllint's standard ruleset, every rule of it stated. | ||||||
| # Then aligns the cosmetic rules with the repo's other tools so they never disagree. | ||||||
| # Then aligns the cosmetic rules with the repo's other tools so they never disagree, and pins each rule's strictest | ||||||
| # setting the repo already meets so a regression fails rather than passing under a looser default. | ||||||
| # Package-manager lockfiles are skipped whole: their generator owns every byte of the layout. | ||||||
| exclude = ["**/*-lock.yaml"] | ||||||
|
|
||||||
| [files] | ||||||
| markdown = ["*.md"] | ||||||
| yaml = ["*.yaml", "*.yml", ".yamllint"] | ||||||
|
|
||||||
| [lint] | ||||||
| strict = true | ||||||
|
|
||||||
| # Each glob resolves from this file's directory, hence the `../` up to the repository root. | ||||||
| [lint.per-file-ignores] | ||||||
| # A GitHub Actions trigger taking no filters is written as a bare key (`workflow_dispatch:`), the idiomatic form. | ||||||
| "../.github/workflows/*.yaml" = ["empty-values"] | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔎 Supported by static analysis
Make the per-file ignores match the target files. ryl anchors directory-qualified patterns at the configuration directory. Because Move the configuration to the repository root, update the task's Suggested path correction
Committable suggestion
|
||||||
| # The generated Kubernetes manifests carry the hub's module list as one env scalar, which has no way to wrap. | ||||||
| "../verification/**/k3s.yaml" = ["line-length"] | ||||||
|
|
||||||
| [lint.rules] | ||||||
| anchors = "enable" | ||||||
| braces = "enable" | ||||||
| brackets = "enable" | ||||||
| colons = "enable" | ||||||
| commas = "enable" | ||||||
| document-end = "disable" | ||||||
| # The repo's workflows and configs don't use a `---` document-start marker. | ||||||
| document-start = "disable" | ||||||
| empty-lines = "enable" | ||||||
| empty-values = "disable" | ||||||
| float-values = "disable" | ||||||
| hyphens = "enable" | ||||||
| indentation = "enable" | ||||||
| key-duplicates = "enable" | ||||||
| # Keys are ordered by meaning (`name`, then `runs-on`, then `steps`), not alphabetically. | ||||||
| key-ordering = "disable" | ||||||
| new-line-at-end-of-file = "enable" | ||||||
| new-lines = "enable" | ||||||
| octal-values = "disable" | ||||||
| # Quoting is left to the author: a regex in a rule file is single-quoted so its backslashes need no doubling. | ||||||
| quoted-strings = "disable" | ||||||
| trailing-spaces = "enable" | ||||||
|
|
||||||
| [lint.rules.anchors] | ||||||
| forbid-ambiguous-anchor-alias-names = true | ||||||
| forbid-duplicated-anchors = true | ||||||
| forbid-undeclared-aliases = true | ||||||
| forbid-unused-anchors = true | ||||||
|
|
||||||
| # An empty `{}` is the one flow mapping kept, for a value that must be present but has nothing to set. | ||||||
| [lint.rules.braces] | ||||||
| forbid = "non-empty" | ||||||
|
|
||||||
| # dprint (the YAML formatter) writes one space before an inline `#`. | ||||||
| # yamllint defaults to two. Defer to dprint so the two can't fight. | ||||||
| [lint.rules.comments] | ||||||
| level = "warning" | ||||||
| min-spaces-from-content = 1 | ||||||
|
|
||||||
| # A misindented comment reads as attached to the wrong block, so treat it as an error, not a warning. | ||||||
| [lint.rules.comments-indentation] | ||||||
| level = "error" | ||||||
|
|
||||||
| [lint.rules.empty-lines] | ||||||
| max = 1 | ||||||
| max-end = 0 | ||||||
| max-start = 0 | ||||||
|
|
||||||
| [lint.rules.empty-values] | ||||||
| forbid-in-block-mappings = true | ||||||
| forbid-in-block-sequences = true | ||||||
| forbid-in-flow-mappings = true | ||||||
|
|
||||||
| [lint.rules.float-values] | ||||||
| forbid-inf = true | ||||||
| forbid-nan = true | ||||||
| forbid-scientific-notation = true | ||||||
| require-numeral-before-decimal = true | ||||||
|
|
||||||
| [lint.rules.indentation] | ||||||
| indent-sequences = true | ||||||
| spaces = 2 | ||||||
|
|
||||||
| [lint.rules.key-duplicates] | ||||||
| forbid-duplicated-merge-keys = true | ||||||
|
|
||||||
| # Match the editorconfig line length (yamllint defaults to 80). | ||||||
| [lint.rules.line-length] | ||||||
| allow-non-breakable-words = false | ||||||
| max = 120 | ||||||
|
|
||||||
| [lint.rules.new-lines] | ||||||
| type = "unix" | ||||||
|
|
||||||
| [lint.rules.octal-values] | ||||||
| forbid-explicit-octal = true | ||||||
| forbid-implicit-octal = true | ||||||
|
|
||||||
| [lint.rules.truthy] | ||||||
| level = "warning" | ||||||
| level = "error" | ||||||
|
|
||||||
| [format] | ||||||
| quote-style = "preserve" | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check TOML source text for line-ending backslashes.
If a multi-line basic string contains a line-ending
\, the TOML parser removes that backslash and the following newline. The new Conftest pass therefore cannot detect that source-level continuation in arun = """..."""value. (toml.io) Move the TOML text check to a semgreplanguages: [generic]rule. As per coding guidelines, “text, including TOML” belongs in such a rule.Source: Coding guidelines