Skip to content

Releases: hlib-zinchenko/Hlibz.TypeRules.Analyzers

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 24 Oct 17:40

The first stable release. TypeRules enforces the shape of a type based on what it inherits or implements (accessibility, sealing, namespace, companion interfaces, constructors, equality, setters, collections, immutability, held references), configured in .editorconfig and checked while you type.

dotnet add package Hlibz.TypeRules.Analyzers

Requires the .NET 8 SDK or later. See the README to configure your first rule set.

Stable from here

Rule IDs, option names and option values are now public contract: never renamed or removed outside a major release. See Versioning.

Upgrading from a preview

From preview.1, rename two options. The old keys are unknown options: TR000 reports them, and their rule set is ignored until you rename them.

preview.1 1.0.0
typerules.<rule set>.readonly_collections typerules.<rule set>.require_readonly_collections
typerules.<rule set>.companion_interface typerules.<rule set>.require_companion_interface

From preview.2, nothing to change.

New since preview.2

  • For an unknown option, TR000 suggests the closest known one, including the renamed options above:
    unknown option 'companion_interface' in rule set 'handlers' (did you mean 'require_companion_interface'? ...)

Rules

ID Rule
TR000 TypeRules configuration is invalid
TR101 Type is more accessible than its rule set allows
TR102 Type must be sealed
TR103 Type is declared in the wrong namespace
TR104 Type must implement its companion interface
TR201 Constructor is more accessible than its rule set allows
TR202 Type has the wrong equality semantics
TR301 Setter is more accessible than its rule set allows
TR302 Mutable collection is exposed
TR303 Type must be immutable
TR304 Type holds a reference to a forbidden type

Full Changelog: v1.0.0-preview.2...v1.0.0

v1.0.0-preview.2

v1.0.0-preview.2 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 24 Oct 17:06

Breaking: two options renamed

The two boolean constraints that lacked the require_ prefix now have it, like require_sealed and require_immutable:

preview.1 preview.2
typerules.<rule set>.readonly_collections typerules.<rule set>.require_readonly_collections
typerules.<rule set>.companion_interface typerules.<rule set>.require_companion_interface

The old keys are now unknown options: TR000 reports them, and their rule set is ignored until you rename them. This is the last option change before 1.0.0, after which option names are stable (see Versioning).

Other changes

  • Messages naming several violated rule sets now read rule sets 'a' and 'b' allow ... instead of rule set 'a', 'b' allows .... Indexers are named Order.this[int] instead of Order.this[].
  • The package has an icon, and its README has NuGet badges.
  • Docs: TR000's severity can only be set in a .globalconfig (it has no source location), CA1710 and CA1852 have to be enabled before the README's configuration for them does anything, and the Versioning section now covers option names.
  • CI also runs the packed analyzers on the .NET 8 SDK, the oldest supported.

Full Changelog: v1.0.0-preview.1...v1.0.0-preview.2

v1.0.0-preview.1

v1.0.0-preview.1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 24 Oct 09:55