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

Ignore specific rules within file #302

Open
andrewvaughan opened this issue Oct 10, 2023 · 1 comment
Open

Ignore specific rules within file #302

andrewvaughan opened this issue Oct 10, 2023 · 1 comment

Comments

@andrewvaughan
Copy link

andrewvaughan commented Oct 10, 2023

It's great that I can do this:

<!-- editorconfig-checker-disable -->

| Permission               | Description                                                                                                                                           |
|:-------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------|
| Disclose Source          | Source code must be made available when the licensed material is distributed                                                                          |
| License/Copyright Notice | A copy of the license and copyright notice must be included with the licensed material                                                                |
| Same License             | Modifications must be released under the same license when distributing the licensed material; in some cases a similar or related license may be used |
| State Changes            | Changes made to the licensed material must be documented                                                                                              |

<!-- editorconfig-checker-enable -->

However, it's a shame that the entire editorconfig file is disabled in this section, when the only issue have is my line-length descriptor (which I have no good solution for with Markdown).

It would be great if I could do this in a way that allows me to only exclude specific rule(s), for example:

<!-- editorconfig-checker-disable max_line_length -->

| Permission               | Description                                                                                                                                           |
|:-------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------|
| Disclose Source          | Source code must be made available when the licensed material is distributed                                                                          |
| License/Copyright Notice | A copy of the license and copyright notice must be included with the licensed material                                                                |
| Same License             | Modifications must be released under the same license when distributing the licensed material; in some cases a similar or related license may be used |
| State Changes            | Changes made to the licensed material must be documented                                                                                              |

<!-- editorconfig-checker-enable max_line_length -->

Backwards compatibility would be trivial - the default would disable all rules, but a defined EditorConfig configuration would only disable that rule.

Design wise, it's up to you as to whether to require separate lines for each rule; but I think a space-separated list would be cleaner. For example:

<!-- editorconfig-checker-disable max_line_length trim_trailing_whitespace -->

Versus:

<!-- editorconfig-checker-disable max_line_length -->
<!-- editorconfig-checker-disable trim_trailing_whitespace -->
@mstruebing
Copy link
Member

Thanks for your issue. I agree this is a nice feature and should be implemented.
Whoever wants to start, feel free to create a PR.

Jayman2000 added a commit to Jayman2000/jasons-pre-commit-hooks that referenced this issue Jan 10, 2024
max_line_length is not listed on the EditorConfig home page [1] or in
the EditorConfig specification [2], but it is still supported by some
editors [3].

I would have done this in e082ec6 (Create EditorConfig, 2023-12-26) or
in fa459f7 (Add recommendation about line length, 2023-12-27), but I
didn’t know about the max_line_length setting at the time.

This change also adds some “editorconfig-checker-disable” lines [4].
Those lines prevent the editorconfig-checker pre-commit hook from
failing due to overly long lines. Unfortunately, it also disable all of
the other checks that editorconfig-checker does. Once this feature is
implemented [5], I want to change those lines to only disable the line
length check.

[1]: <https://editorconfig.org>
[2]: <https://spec.editorconfig.org>
[3]: <https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties/51aed8a166860bde25de10bc6813d4c1a59d80d5#max_line_length>
[4]: <https://github.com/editorconfig-checker/editorconfig-checker/tree/e40e7aca8824d568afa2e5a9705c60c2692fcfd4#excluding-blocks>
[5]: <editorconfig-checker/editorconfig-checker#302>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants