Skip to content

New rule: Attribute groups should only contain one attribute #66

Open
@fourls

Description

@fourls

Prerequisites

  • This rule has not already been suggested.
  • This should be a new rule, not an improvement to an existing rule.
  • This rule would be generally useful, not specific to my code or setup.

Suggested rule title

Attribute groups should only contain one attribute

Rule description

This rule would detect instances of multiple attributes within the same square brackets (e.g. [Foo, Bar]).

type
  [Foo, Bar('test')] // Noncompliant
  TMyClass = class(TObject)
  public
    [Foo]
    [Bar('test')] // Compliant
    procedure Baz;
  end;

Rationale

Having multiple attributes combined under a single square brackets is confusing, difficult to read, and error-prone. It's not immediately clear that there are multiple attributes applied, instead of a single attribute with constructor arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestgood first issueGood for newcomersruleImprovements or additions to rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions