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

Release 4.5.0 #1189

Merged
merged 7 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.5.0] - 2023-08-27

### Added

- Add SECURITY.md ([#1147](https://github.com/josefpihrt/roslynator/pull/1147))
Expand Down
18 changes: 11 additions & 7 deletions src/Analyzers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1441,13 +1441,17 @@ void M(
<MessageFormat>A line is too long ({0} characters).</MessageFormat>
<DefaultSeverity>Info</DefaultSeverity>
<IsEnabledByDefault>false</IsEnabledByDefault>
<Summary>This analyzer reports any line that is longer than maximal length.
<Summary>This analyzer reports any line that is longer than maximum length.

Default maximal length is 140.</Summary>
Default maximum length is 140.</Summary>
<ConfigOptions>
<Option Key="max_line_length" />
<Option Key="tab_length" />
</ConfigOptions>
<Remarks>Code fixer is available for this analyzer but it cannot handle all cases as it's not possible to wrap a line in all cases (e.g. long string literals).

If a particular line seems that it could be reasonably wrapped but it's not, please file an [issue](https://github.com/JosefPihrt/Roslynator/issues/new).
</Remarks>
</Analyzer>
<Analyzer>
<Id>RCS0057</Id>
Expand Down Expand Up @@ -7416,12 +7420,12 @@ void M()
<SupportsFadeOut>true</SupportsFadeOut>
<Summary>This analyzer reports unnecessary syntax that can be safely removed such as:
* empty destructor
* empty 'else' clause
* empty empty statement
* empty 'finally' clause
* empty namespace declaration
* empty `else` clause
* empty `finally` clause
* empty `namespace` declaration
* empty object initializer
* empty region directive
* empty `#region`
* empty statement
</Summary>
</Analyzer>
<Analyzer Identifier="AddOrRemoveTrailingComma">
Expand Down
6 changes: 3 additions & 3 deletions src/Common/ConfigOptions.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static partial class ConfigOptions
key: ConfigOptionKeys.MaxLineLength,
defaultValue: "140",
defaultValuePlaceholder: "<NUM>",
description: "Max line length");
description: "Maximum line length");

public static readonly ConfigOptionDescriptor NewLineAtEndOfFile = new(
key: ConfigOptionKeys.NewLineAtEndOfFile,
Expand Down Expand Up @@ -186,13 +186,13 @@ public static partial class ConfigOptions
key: ConfigOptionKeys.TabLength,
defaultValue: "4",
defaultValuePlaceholder: "<NUM>",
description: "A length of a tab character.");
description: "A number of spaces that are equivalent to a tab character");

public static readonly ConfigOptionDescriptor TrailingCommaStyle = new(
key: ConfigOptionKeys.TrailingCommaStyle,
defaultValue: null,
defaultValuePlaceholder: "include|omit|omit_when_single_line",
description: "Include/omit trailing comma in initializer or enum.");
description: "Include/omit trailing comma in initializer or enum");

public static readonly ConfigOptionDescriptor UseAnonymousFunctionOrMethodGroup = new(
key: ConfigOptionKeys.UseAnonymousFunctionOrMethodGroup,
Expand Down
6 changes: 3 additions & 3 deletions src/ConfigOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@
<Option Id="MaxLineLength">
<DefaultValue>140</DefaultValue>
<ValuePlaceholder>&lt;NUM&gt;</ValuePlaceholder>
<Description>Max line length</Description>
<Description>Maximum line length</Description>
</Option>
<Option Id="TabLength">
<DefaultValue>4</DefaultValue>
<ValuePlaceholder>&lt;NUM&gt;</ValuePlaceholder>
<Description>A number of spaces that are equivalent to a tab character.</Description>
<Description>A number of spaces that are equivalent to a tab character</Description>
</Option>
<Option Id="NewLineAtEndOfFile">
<ValuePlaceholder>true|false</ValuePlaceholder>
Expand Down Expand Up @@ -205,7 +205,7 @@
<Description>Add/remove blank line after file scoped namespace declaration</Description>
</Option>
<Option Id="TrailingCommaStyle">
<Description>Include/omit trailing comma in initializer or enum.</Description>
<Description>Include/omit trailing comma in initializer or enum</Description>
<Values>
<Value>include</Value>
<Value>omit</Value>
Expand Down
1 change: 1 addition & 0 deletions src/Roslynator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\.editorconfig = ..\.editorconfig
..\.github\workflows\build.yml = ..\.github\workflows\build.yml
..\ChangeLog.md = ..\ChangeLog.md
VisualStudioCode\package\CHANGELOG.md = VisualStudioCode\package\CHANGELOG.md
Directory.Build.props = Directory.Build.props
..\README.md = ..\README.md
spellcheck = spellcheck
Expand Down
29 changes: 19 additions & 10 deletions src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static string CreateAnalyzerMarkdown(AnalyzerMetadata analyzer, Immutable
string title = analyzer.Title.TrimEnd('.');

MDocument document = Document(
CreateFrontMatter(label: analyzer.Id),
CreateFrontMatter(label: (string.IsNullOrEmpty(analyzer.ObsoleteMessage)) ? analyzer.Id : $"[deprecated] {analyzer.Id}"),
Heading1($"{analyzer.Id}: {title}"),
CreateObsoleteWarning(analyzer),
Heading2("Properties"),
Expand Down Expand Up @@ -190,7 +190,8 @@ static IEnumerable<object> CreateConfiguration(AnalyzerMetadata analyzer, Immuta
.Select(f => InlineCode(f.Key))
.ToArray();

yield return CreateRequiredOptionsInfoBlock(requiredOptions);
if (requiredOptions.Any())
yield return CreateRequiredOptionsInfoBlock(requiredOptions);

var sb = new StringBuilder();
var isFirst = true;
Expand All @@ -205,8 +206,19 @@ static IEnumerable<object> CreateConfiguration(AnalyzerMetadata analyzer, Immuta

isFirst = false;

sb.Append('#');
sb.AppendLine(en.Current.Description);
sb.Append("# ");

if (!string.IsNullOrEmpty(en.Current.Description))
sb.AppendLine(en.Current.Description);

string defaultValue = en.Current.DefaultValue;

if (!string.IsNullOrEmpty(defaultValue))
{
sb.Append("# Default value is ");
sb.AppendLine(defaultValue);
}

sb.Append(en.Current.Key);
sb.Append(" = ");
sb.Append(en.Current.DefaultValuePlaceholder ?? "true");
Expand All @@ -227,9 +239,6 @@ static MContainer CreateRequiredOptionsInfoBlock(MInlineCode[] requiredOptions)

static IEnumerable<MObject> CreateContent(MInlineCode[] requiredOptions)
{
if (!requiredOptions.Any())
yield break;

if (requiredOptions.Length == 1)
{
yield return Inline("Option ", requiredOptions[0], " is required to be set for this analyzer to work.");
Expand All @@ -256,13 +265,13 @@ static IEnumerable<MElement> CreateAppliesTo(AnalyzerMetadata analyzer)
}

if (analyzer.Id.StartsWith("RCS0"))
yield return BulletItem(Link("Roslynator.Formatting.Analyzers", "https://www.nuget.org/packages/Roslynator.Formatting.Analyzers"));
yield return BulletItem(Link(new[] { "Package ", "Roslynator.Formatting.Analyzers" }, "https://www.nuget.org/packages/Roslynator.Formatting.Analyzers"));

if (analyzer.Id.StartsWith("RCS1"))
yield return BulletItem(Link("Roslynator.Analyzers", "https://www.nuget.org/packages/Roslynator.Analyzers"));
yield return BulletItem(Link(new[] { "Package ", "Roslynator.Analyzers" }, "https://www.nuget.org/packages/Roslynator.Analyzers"));

if (analyzer.Id.StartsWith("RCS9"))
yield return BulletItem(Link("Roslynator.CodeAnalysis.Analyzers", "https://www.nuget.org/packages/Roslynator.CodeAnalysis.Analyzers"));
yield return BulletItem(Link(new[] { "Package ", "Roslynator.CodeAnalysis.Analyzers" }, "https://www.nuget.org/packages/Roslynator.CodeAnalysis.Analyzers"));
}
}

Expand Down
74 changes: 74 additions & 0 deletions src/VisualStudioCode/package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,80 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.5.0] - 2023-08-27

### Added

- Add SECURITY.md ([#1147](https://github.com/josefpihrt/roslynator/pull/1147))
- Add custom FixAllProvider for [RCS1014](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1014) ([#1070](https://github.com/JosefPihrt/Roslynator/pull/1070)).
- Add more cases to [RCS1097](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1097) ([#1160](https://github.com/JosefPihrt/Roslynator/pull/1160)).
- Add analyzer "Use enum field explicitly" ([RCS1257](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1257)) ([#889](https://github.com/josefpihrt/roslynator/pull/889)).
- Enabled by default.
- Add analyzer "Unnecessary enum flag" [RCS1258](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1258) ([#886](https://github.com/JosefPihrt/Roslynator/pull/886)).
- Enabled by default.
- Make `Roslynator.Rename.SymbolRenamer` public ([#1161](https://github.com/josefpihrt/roslynator/pull/1161))
- Analyzer 'Remove empty syntax' ([RCS1259](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1259)) ([#913](https://github.com/josefpihrt/roslynator/pull/913)).
- This analyzer replaces following analyzers:
- Remove empty empty statement ([RCS1038](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1038))
- Remove empty 'else' clause ([RCS1040](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1040))
- Remove empty object initializer ([RCS1041](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1041))
- Remove empty 'finally' clause ([RCS1066](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1066))
- Remove empty namespace declaration ([RCS1072](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1072))
- Remove empty region directive ([RCS1091](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1091))
- Remove empty destructor ([RCS1106](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1106))
- [CLI] Add glob pattern matching (`--include` or/and `--exclude`) ([#1178](https://github.com/josefpihrt/roslynator/pull/1178), [#1183](https://github.com/josefpihrt/roslynator/pull/1183)).
- Add analyzer "Include/omit trailing comma" ([RCS1256](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1256.md)) ([#931](https://github.com/JosefPihrt/Roslynator/pull/931)).
- Required option: `roslynator_trailing_comma_style = include|omit|omit_when_single_line`
- Not enabled by default

### Changed

- [CLI] Open help in web browser when running command `roslynator help <COMMAND>` ([#1179](https://github.com/josefpihrt/roslynator/pull/1179))

### Fixed

- Fix [RCS1187](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1187) ([#1150](https://github.com/JosefPihrt/Roslynator/pull/1150)).
- Fix [RCS1056](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1056) ([#1154](https://github.com/JosefPihrt/Roslynator/pull/1154)).
- Fix [RCS1208](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1208) ([#1153](https://github.com/JosefPihrt/Roslynator/pull/1153)).
- Fix [RCS1043](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1043) ([#1176](https://github.com/JosefPihrt/Roslynator/pull/1176)).
- [CLI] Fix exit code of `spellcheck` command ([#1177](https://github.com/JosefPihrt/Roslynator/pull/1177)).
- Improve indentation analysis ([#1188](https://github.com/JosefPihrt/Roslynator/pull/1188)).

## [4.4.0] - 2023-08-01

### Added

- Add GitHub workflow ([#1112](https://github.com/josefpihrt/roslynator/pull/1112))

### Changed

- [CLI] Bump Roslyn to 4.6.0 ([#1106](https://github.com/josefpihrt/roslynator/pull/1106)).
- Bump Roslyn to 4.4.0 ([#1116](https://github.com/josefpihrt/roslynator/pull/1116)).
- Migrate documentation to [Docusaurus](https://josefpihrt.github.io/docs/roslynator) ([#922](https://github.com/josefpihrt/roslynator/pull/922)).
- [Testing Framework] Bump Roslyn to 4.6.0 ([#1144](https://github.com/josefpihrt/roslynator/pull/1144)).

### Fixed

- Fix [RCS1016](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1016) ([#1090](https://github.com/josefpihrt/roslynator/pull/1090)).
- Improve inversion of logical expressions to handling additional cases ([#1086](https://github.com/josefpihrt/roslynator/pull/1086)).
- Fix [RCS1084](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1084) ([#1085](https://github.com/josefpihrt/roslynator/pull/1085)).
- Fix [RCS1169](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1169) ([#1092](https://github.com/JosefPihrt/Roslynator/pull/1092)).
- Recognize more shapes of IAsyncEnumerable as being Async ([RCS1047](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1047)) ([#1084](https://github.com/josefpihrt/roslynator/pull/1084)).
- Fix [RCS1197](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1197) ([#1093](https://github.com/JosefPihrt/Roslynator/pull/1093)).
- Fix [RCS1056](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1056) ([#1096](https://github.com/JosefPihrt/Roslynator/pull/1096)).
- Fix [RCS1216](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1216) ([#1094](https://github.com/JosefPihrt/Roslynator/pull/1094)).
- Fix [RCS1146](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1146) ([#1098](https://github.com/JosefPihrt/Roslynator/pull/1098)).
- Fix [RCS1154](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1154) ([#1105](https://github.com/JosefPihrt/Roslynator/pull/1105)).
- Fix [RCS1211](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1211) ([#1095](https://github.com/JosefPihrt/Roslynator/pull/1095)).
- Fix [RCS0005](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0005) ([#1114](https://github.com/JosefPihrt/Roslynator/pull/1114)).
- Fix [RCS1176](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1176) ([#1122](https://github.com/JosefPihrt/Roslynator/pull/1122), [#1140](https://github.com/JosefPihrt/Roslynator/pull/1140)).
- Fix [RCS1085](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1085) ([#1120](https://github.com/josefpihrt/roslynator/pull/1120)).
- Fix [RCS1208](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1208) ([#1119](https://github.com/JosefPihrt/Roslynator/pull/1119)).
- [CLI] Fix member full declaration in generated documentation (command `generate-doc`) ([#1130](https://github.com/josefpihrt/roslynator/pull/1130)).
- Append `?` to nullable reference types.
- Fix [RCS1179](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1179) ([#1129](https://github.com/JosefPihrt/Roslynator/pull/1129)).
- Fix [RCS0060](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0060) ([#1139](https://github.com/JosefPihrt/Roslynator/pull/1139)).

## [4.3.0] - 2023-04-24

### Changed
Expand Down
2 changes: 1 addition & 1 deletion tools/generate_metadata.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dotnet restore "../src/Tools/Tools.sln" --force
dotnet build "../src/Tools/Tools.sln" --no-restore /p:"Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors=1591" /m
dotnet build "../src/Tools/Tools.sln" --no-restore /p:"Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors=`"1591,RS1025,RS1026`"" /m

if(!$?) { Read-Host; Exit }

Expand Down