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: ...

@Vampire
Copy link

Vampire commented Jun 4, 2024

Any news here? :-)

@florianb
Copy link
Member

@cxw42 thanks for opening this - i got a question, so this to clarify that all empty lines (using only invisible characters) are ignored and all other lines should be interpreted after trimming (removing all invisible characters)?

I am asking this because i was confused if that is meant with "once leading whitespace is removed (and ignoring any trailing line separator".

@Vampire
Copy link

Vampire commented Jul 25, 2024

I'd say the only meaning changes here are, that blank lines may be empty when before they needed to have any whitespace, except if you consider the line separator part of the line. In the latter case I'd say all here is just using clearer words without semantic changes

@florianb
Copy link
Member

Thanks @Vampire - i'm no native speaker so i wonder if the whole description is just difficult paraphrase of

  • A EditorConfig file is consumed line by line
  • Each line has to be trimmed before interpretation
  • Empty lines should be ignored

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
4 participants