Skip to content

Backport PSSA 1.18.0 PRs #885

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,27 @@ public enum CodeFormattingPreset
Stroustrup
}

/// <summary>
/// Multi-line pipeline style settings.
/// </summary>
public enum PipelineIndentationStyle
{
/// <summary>
/// After the indentation level only once after the first pipeline and keep this level for the following pipelines.
/// </summary>
IncreaseIndentationForFirstPipeline,

/// <summary>
/// After every pipeline, keep increasing the indentation.
/// </summary>
IncreaseIndentationAfterEveryPipeline,

/// <summary>
/// Do not increase indentation level at all after pipeline.
/// </summary>
NoIndentation
}

public class CodeFormattingSettings
{
/// <summary>
Expand Down Expand Up @@ -172,12 +193,16 @@ public CodeFormattingSettings(CodeFormattingSettings codeFormattingSettings)
public bool OpenBraceOnSameLine { get; set; }
public bool NewLineAfterOpenBrace { get; set; }
public bool NewLineAfterCloseBrace { get; set; }
public PipelineIndentationStyle PipelineIndentationStyle { get; set; }
public bool WhitespaceBeforeOpenBrace { get; set; }
public bool WhitespaceBeforeOpenParen { get; set; }
public bool WhitespaceAroundOperator { get; set; }
public bool WhitespaceAfterSeparator { get; set; }
public bool WhitespaceInsideBrace { get; set; }
public bool WhitespaceAroundPipe { get; set; }
public bool IgnoreOneLineBlock { get; set; }
public bool AlignPropertyValuePairs { get; set; }
public bool UseCorrectCasing { get; set; }


/// <summary>
Expand Down Expand Up @@ -247,19 +272,25 @@ private Hashtable GetCustomPSSASettingsHashtable(int tabSize, bool insertSpaces)
{"PSUseConsistentIndentation", new Hashtable {
{"Enable", true},
{"IndentationSize", tabSize},
{"PipelineIndentation", PipelineIndentationStyle },
{"Kind", insertSpaces ? "space" : "tab"}
}},
{"PSUseConsistentWhitespace", new Hashtable {
{"Enable", true},
{"CheckOpenBrace", WhitespaceBeforeOpenBrace},
{"CheckOpenParen", WhitespaceBeforeOpenParen},
{"CheckOperator", WhitespaceAroundOperator},
{"CheckSeparator", WhitespaceAfterSeparator}
{"CheckSeparator", WhitespaceAfterSeparator},
{"CheckInnerBrace", WhitespaceInsideBrace},
{"CheckPipe", WhitespaceAroundPipe},
}},
{"PSAlignAssignmentStatement", new Hashtable {
{"Enable", true},
{"CheckHashtable", AlignPropertyValuePairs}
}},
{"PSUseCorrectCasing", new Hashtable {
{"Enable", true}
}},
}}
};
}
Expand Down