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

Feature suggestion: rules with different properties for specific files #2258

Open
michalbundyra opened this issue Nov 27, 2018 · 2 comments
Open

Comments

@michalbundyra
Copy link
Contributor

michalbundyra commented Nov 27, 2018

I have a feature suggestion to add ability to define different rule properties for specific files, let say something like:

<rule ref="MyRule.Ref">
  <include-pattern>./src</include-pattern>
  <properties>
    <property name="indent" value="4">
  </properties>
</rule>

<rule ref="MyRule.Ref"> <!-- the same rule -->
  <include pattern>./other</include-pattern> <!-- different files -->
  <properties>
    <property name="indent" value="2"> <!-- here different value -->
  </properties>
</rule>

Not sure what should be the format, maybe we can do it another way... Or maybe it is already possible to do something like that, but I am not aware of it?

What do you think? If you like that idea maybe I would be able to work on it in some near future ;-)

@jrfnl
Copy link
Contributor

jrfnl commented Nov 27, 2018

I like this idea.

Format-wise, I think we'd need a way to still allow a property to be set globally for a rule, while also allowing file-specific deviations. Maybe something along the lines of the below ?

<file>./src</file>
<file>./other</file>

<rule ref="MyRule.Ref">
  <properties>
    <property name="indent" value="4">
    <property name="indent" value="2" include-pattern="./other">
  </properties>
</rule>

@jrfnl
Copy link
Contributor

jrfnl commented Nov 27, 2018

Loosely related to #2126

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

3 participants