github DotNetAnalyzers/StyleCopAnalyzers 1.3.98-beta

pre-release3 hours ago

This release adds three new rules and a long-requested code fix, makes member ordering and braceless guard clauses configurable, and tightens several existing rules. The package also has an icon now.

Highlights

  • New rules. SA1143 checks that wrapped conditional (?:) expressions are laid out consistently. SA1315 checks that overriding and implementing parameters keep their inherited names. SX1412 is an opt-in alternative to SA1412 that requires UTF-8 without a BOM. All three come with code fixes. (#4318, #4314, #4315)
  • Member-ordering code fix enabled. SA1201, SA1202, SA1203, SA1204 and SA1214 now offer their code fix, including Fix All. It had been turned off until it was stable. (#4312)
  • More configuration. The new orderingRules.memberKindOrder setting customizes the SA1201 member-kind order, and layoutRules.allowBracelessIfStatements lets SA1501 and SA1503 allow compact guard clauses. Both are off by default. (#4324, #4319)
  • Package icon. NuGet now shows the StyleCop.Analyzers icon. (#4320)

Behavior changes worth knowing about

  • New rules on by default: SA1143 (conditional expression formatting, #4318) and SA1315 (parameter names must match inherited names, #4314) are enabled as warnings. SX1412 is off by default.
  • SA1200 now reports and moves extern alias directives using the same placement setting as using directives. (#4313)
  • SA1017 now requires a space after a parameter's or type parameter's attribute list, for example [NotNullWhen(true)] out string? foo. (#4321)
  • SA1408 now reports ?? mixed with && or || without parentheses. (#4323)
  • SA1649 picks the type that names the file according to the maintainabilityRules.topLevelTypes setting, so the expected file name may change. (#4316)

All changes

Enhancements

  • SA1143: Format conditional expressions consistently by @AArnott in #4318
  • SA1315: Match inherited parameter names by @AArnott in #4314
  • SX1412: Add UTF-8 without BOM rule by @AArnott in #4315
  • Enable element order code fix provider by @AArnott in #4312
  • SA1201: support configurable member-kind ordering by @AArnott in #4324
  • SA1501/SA1503: Allow configurable braceless if guards by @AArnott in #4319
  • Adopt proposed StyleCop.Analyzers icon by @AArnott in #4320

Fixes

  • SA1200: Treat extern alias directives like using directives by @AArnott in #4313
  • SA1017: Require spacing after parameter attributes by @AArnott in #4321
  • SA1408: Include null-coalescing precedence by @AArnott in #4323
  • SA1649: Respect top-level type settings by @AArnott in #4316

Documentation

  • Clarify documentation requirement settings and rule interactions by @AArnott in #4322

Full Changelog: 1.3.82-beta...1.3.98-beta

Don't miss a new StyleCopAnalyzers release

NewReleases is sending notifications on new releases.