Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lovro-bikic
Copy link
Contributor

@lovro-bikic lovro-bikic commented Apr 18, 2025

This PR adds linting for whitespace after control code (-). With this patch, a line that doesn't have a single whitespace between - and the code gets registered as an offense:

# bad (no whitespace)
-cond

# bad (too much whitespace)
-  cond

# good (single whitespace)
- cond

By all accounts, this seems to be the preferred style in slim documentation.

In the implementation, I added this feature to the existing linter ControlStatementSpacing. I did this because linters for control code have ControlStatement in the name (e.g. EmptyControlStatement, CommentControlStatement or ConsecutiveControlStatements). Let me know if this should be moved to a new linter, although I'm not sure how I'd name it because this linter is currently used to lint output code instead of control code.

@lovro-bikic lovro-bikic changed the title Lint for one space after control code Lint for whitespace after control code Apr 18, 2025
@lovro-bikic lovro-bikic changed the title Lint for whitespace after control code Lint for whitespace after control code (-) Apr 18, 2025
@lovro-bikic lovro-bikic force-pushed the control-code-spacing branch from 9e8c084 to 02958e1 Compare April 20, 2025 14:33
@lovro-bikic lovro-bikic force-pushed the control-code-spacing branch from 02958e1 to b37b6c1 Compare April 21, 2025 09:49
@sds sds merged commit 6a44765 into sds:main Apr 21, 2025
4 checks passed
@sds
Copy link
Owner

sds commented Apr 21, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants