Skip to content
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

Clarify whitespace handling #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cxw42
Copy link
Member

@cxw42 cxw42 commented Feb 11, 2024

  • Section names can have trailing whitespace (the core tests expressly check this).
  • When deciding what kind of line we have, all leading whitespace is ignored, and the trailing LF or CRLF is also ignored.
  • Blank lines do not have to include whitespace.
  • Fix some typos (change Markdown single-backticks to rst double-backticks).

Fixes editorconfig/editorconfig#500

Change single-backticks to double-backticks as required by rst.
Previously, the rule for blank lines technically did not cover
empty lines.  Clarify that blank lines are lines that are empty after
any leading whitespace is removed.  Also clarify that the trailing
line separator (if any) is ignored.
Make the spec conform to existing test `spaces_after_section_name`.

Fixes editorconfig/editorconfig#500
@cxw42 cxw42 added the bug Something isn't working label Feb 11, 2024
@cxw42 cxw42 requested a review from xuhdev February 11, 2024 20:38
@cxw42 cxw42 self-assigned this Feb 11, 2024
@cxw42 cxw42 requested a review from ppalaga February 12, 2024 02:23
Copy link
Member

@xuhdev xuhdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one question, otherwise LTGM


- Blank: contains only whitespace characters.
- Blank: contains nothing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

Suggested change
- Blank: contains nothing.
- Blank: contains nothing or only whitespace characters.

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I scratched my head a bit about that as well. The line just before the bullets says "once leading whitespace is removed", so there would be nothing left. I thought that was cleaner than adding "may contain leading whitespace" to each bullet.

How about moving blanks out of the bullets? Something like:

+When reading an EditorConfig file, the following are ignored:
+ - blank lines (empty, or nothing but whitespace)
+ - all beginning whitespace on each line.
+Each non-blank line must be one of the following, once leading whitespace is removed
+(and ignoring any trailing line separator):
- - Blank: contains only whitespace characters
  - Comment: ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spec incorrectly prohibits spaces around section-name square brackets
2 participants