Skip to content

AA1300ParametersShouldNotBeModified

David Arno edited this page Oct 3, 2016 · 2 revisions

Warning: this wiki page is auto-generated by the Arnolyzer solution-build process. Do not directly edit this page, as your changes will be lost on the next commit. To edit this page, please refer to Contributing to this project.

These wiki pages reflect the state of the project in development, per the last commit. For details of the latest release of the Arnolyzer Analysers, please see the Arnolyzer website.


AA1300 - Parameters Should Not Be Modified

Report code: AA1300-ParametersShouldNotBeModified

Summary

Status Implemented
Description Parameters should be treated as immutable and not used as a mutable variables
Category Immutability Analyzers
Enabled by default: Yes
Severity: Error

Cause

How to fix violations

There currently aren't any implemented code-fixes for this rule.

How to suppress violations

This rule can be suppressed using the following attributes:

[MutableParameter]
A method annotated with MutableParameter attribute is allowed to have parameters that change value (ie canbe reassigned. The parameters affected must be named in the MutableParameter attribute attribute, eg

[MutableParameter attribute("p1")]
public void F(int p1, int p2)
{
    p1 = 1;
p2 = 2;
}

would result in no errors over the reassignment of p1. Multiple variables can be supplied to the attribute, eg [MutableParameter attribute("p1", "p2")]