Skip to content

editorconfig static rule is applying to const #23884

Open

Description

I have two rules in my .editorconfig file (that lives in the same folder as the .sln file). The first rule applies to private static fields and the second rule applies to private fields (with no required modifiers).

When creating a private const field in a class I am getting a naming error because it is trying to apply the static naming rule. It should be skipping that rule because that rule has "required_modifers = static" and this is a const field.

If I create an additional rule specifically for private const fields and put it before the static rule then everything works. However this shouldn't be necessary since I want all my private non-static fields to use the same naming convention (so anything non-static should fall past the first rule and be applied by the second rule).

This issue is similiar to https://developercommunity.visualstudio.com/content/problem/152286/editorconfig-constenum-settings-not-working-in-vis.html which was closed due to being a duplicate. I think it was incorrectly marked as a duplicate because the "original" report was a rule ordering issue. In this scenario the rules are ordered correctly, but appear to be applied incorrectly.

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/160932/editorconfig-static-rule-is-applying-to-const.html
VSTS ticketId: 533466

These are the original issue comments:

Jinu Joseph [MSFT] on ‎12‎/‎20‎/‎2017, 06:13 PM (8 min ago):

We appreciate you taking the time to report this problem. We are currently prioritizing problems that are impacting a broad set of our customers, so we may not be able to investigate this one immediately. We know this problem is important to you, so we will continue to monitor it.

These are the original issue solutions:
(no solutions)

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions