-
Notifications
You must be signed in to change notification settings - Fork 395
Add code formatting rules #690
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
Conversation
We do not want formatting rules to be run by default whenever scriptanalyzer is invoked. However, the engine doesn't provide a way to disable a given built-in rule without messing with the input parameters or input settings file. Hence we add this parameter to the formatting rules so that they are not run by default whenever scriptanalyer is invoked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome! A couple comments, but overall this is a great start.
@@ -0,0 +1,30 @@ | |||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright headers might be necessary on the new files
foreach (var settingKey in settings.Keys) | ||
|
||
var settingsKeys = new string[settings.Keys.Count]; | ||
settings.Keys.CopyTo(settingsKeys, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do settings get removed from the dictionary in the loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigning elements to the dictionary while iterating over it was causing problems. After creating a separate copy of the keys the problem went way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh yes, makes sense!
<value>Place close braces</value> | ||
</data> | ||
<data name="PlaceCloseBraceDescription" xml:space="preserve"> | ||
<value>Place close brace show be on a new line by itself.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "Close brace should be on a new line by itself." ?
Looks good! |
Thanks @daviwil I just renamed the |
Sounds good to me! |
Adds the following rules
These rules are disabled by default and can enabled only through settings.
Adds an abstract class called
ConfigurableRule
to allow easy configuration of rules from settings.An accompanying settings file (Settings/CodeFormatting.psd1) is provided to run only the formatting rules.
This change is