Skip to content

A wrong value in .super-slim.yml is reported as such - #111

Merged
czj merged 1 commit into
mainfrom
config-values-checked
Nov 11, 2026
Merged

czj merged 1 commit into
mainfrom
config-values-checked

Conversation

@czj

@czj czj commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

.super-slim.yml was checked for the shape of its sections, not for the values in them. max: "120" on LineLength reported [Error] ArgumentError: comparison of Integer with String failed on line 0 of every template, classes: [close] and attribute_delimiters: "<>" ended in a Ruby backtrace, and enabled: "false", tailwind_classes: maybe and max_line_length: 0 were taken at their word: a rule left on, Tailwind shortcuts on, every line wrapped.

Each value is now checked when the file is read, against the kind of its rule's default, and a wrong one stops lint and format with a usage error that names the setting.

  • Rule options: enabled is true or false, max a whole number, classes and attributes a mapping, forbidden_engines a list.
  • Formatter settings: max_line_length is a whole number above 0, attribute_delimiters one of (), [], {}, with or without a length.
  • Left empty is fine: attributes: with nothing under a preset, and max_line_length: with no value, read as before.
  • Unknown names still pass: a rule or an option the linter doesn't know is ignored as before; that is for another pull request.
Proof

Each line is a .super-slim.yml, then what super-slim lint app or super-slim format --check app prints and its exit status, on main and with this change:

.super-slim.yml main This change
linters: {LineLength: {max: "20"}} app/a.slim:0: [Error] ArgumentError: comparison of Integer with String failed, 1 .super-slim.yml: `LineLength: max` must be a whole number, 64
linters: {DeprecatedClasses: {classes: [a, b]}} can't convert Array into Hash (TypeError) and its backtrace, 1 .super-slim.yml: `DeprecatedClasses: classes` must be a mapping, 64
linters: {EmbeddedEngines: {enabled: true, forbidden_engines: javascript}} nothing, 0 .super-slim.yml: `EmbeddedEngines: forbidden_engines` must be a list, 64
linters: {LineLength: {enabled: "false"}} nothing, 0: the rule stays on .super-slim.yml: `LineLength: enabled` must be true or false, 64
tailwind_classes: maybe nothing, 0: Tailwind shortcuts are on .super-slim.yml: `tailwind_classes` must be true or false, 64
format: {max_line_length: "40"} app/a.slim: ArgumentError: comparison of Integer with String failed, 1 .super-slim.yml: `format: max_line_length` must be a whole number above 0, 64
format: {max_line_length: 0} app/a.slim, 1: every line wraps the same message, 64
format: {max_line_length: 40, attribute_delimiters: "<>"} Invalid attribute_delimiters "<>" (ArgumentError) and its backtrace, 1 .super-slim.yml: `format: attribute_delimiters` must be one of (), [], {}, 64

test/cli_test.rb holds eight of these and the two settings left empty; the test of wrong shapes fails on main.

The file was checked for the shape of its sections only: a quoted number, a list for a mapping or an unknown pair of delimiters failed inside a rule or the formatter, on every template or with a backtrace, and a text for true or false was taken for true. Each value is checked against the kind of its default when the file is read.

Assisted-by: Claude Fable 5 [Claude Code]
@czj
czj enabled auto-merge (squash) November 11, 2026 09:53
@czj
czj merged commit e5a211f into main Nov 11, 2026
13 checks passed
@czj
czj deleted the config-values-checked branch November 11, 2026 09:54
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.

1 participant