Skip to content

New rule: Dead stores should be removed #455

Description

@jgardn3r

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

Variables shouldn't be unnecessarily assigned

Rule description

Dead stores refer to assignments made to local variables that are subsequently never used or immediately overwritten. Such assignments are unnecessary and impact the clarity and potentially performance of the code. Removing them improves clarity, intentionality, and readability.

For example:

function Test: Integer;
begin
  var I := 10; // This assignment is useless
  I := 20;
  Exit(I);
end;

Rationale

This rule will limit extraneous variable assignment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureNew feature or requestruleImprovements or additions to rules

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions