-
Notifications
You must be signed in to change notification settings - Fork 510
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
Implement SA1138: Indent elements correctly #2025
Comments
I'm not completely clear on the relationship between this and #2023. Is this more specific than SA1137, or less? |
@nbarbettini Theoretically this rule could become more specific than SA1137 in the future, but we're a long way from that. Right now the two rules only partially overlap. For example, SA1137 ensures that when wrapping a method invocation so each argument is on its own line, those arguments are indented the same amount. The rule proposed here does not examine arguments at all. The goal is to progressively build up a flexible solution for indentation as a series of smaller steps. Right now I'm only planning to include two rules:
|
Makes perfect sense now. 👍 on this. |
👍 From me. I'm particularly interested in items 2 and 3. |
👍 |
Well, we can't use or reference the predefined formatting options from the analyzer, since they are defined in the workspaces assembly that isn't available during analysis (only during code fixes). So the behavior of |
Is there any progress on this? |
We need this too :) |
Any update? Very much looking forward to this rule. Right now, StyleCop doesn't complain about code like this: public class DateTimeProvider : IDateTimeProvider
{
public DateTime Now()
{
return DateTime.Now;
}
} Thanks for all your work on this project BTW! |
Category: Readability
Title: Indent elements correctly
Description: A line of code is not indented the correct amount, according to the currently applied style settings for the project.
This rule is intended to be a general rule which will eventually enforce indentation according to policies defined in stylecop.json. This rule works alongside SA1137 (#2023) to increase the overall consistency of indentation in the project. The initial implementation will consist of the following specific behaviors to match settings exposed in Visual Studio:
CSharpFormattingOptions.IndentBlock
(override withindentBlock
option in stylecop.json)CSharpFormattingOptions.IndentSwitchSection
(override withindentSwitchSection
in stylecop.json)CSharpFormattingOptions.IndentSwitchCaseSection
(override withindentSwitchCaseSection
in stylecop.json)CSharpFormattingOptions.LabelPositioning
(override withlabelPositioning
in stylecop.json)The text was updated successfully, but these errors were encountered: