checkExpressionAlignment
Reports code blocks with expressions that are not properly aligned. In order to make your code more readable, consider aligning equals signs of the assignment expressions in a code block. This check reports contiguous blocks of assignments that do not have their equals signs aligned. Any non-assignment line (includes empty lines) indicates the end of a contiguous block of assignments. Some examples that will be reported are:
a = 12;
foobar = 101;
b = 1 ...
+ 3.1415 ^ 2;
eggs = 3;
more = 'test';
These examples after fixing will look as follows:
a = 12;
foobar = 101;
b = 1 ...
+ 3.1415 ^ 2;
eggs = 3;
more = 'test';
Here are some examples of pieces of code that will not be reported by this check.
a = 12;
foobar = 101;
b = 1 ...
+ 3.1415 ^ 2;
someFunctionCall(b);
eggs = 3;
Alignment is checked based on the number of characters before the equals
signs. A tab is treated as a single character, which means that equals
signs may seem aligned, but a violation is reported anyway because for a
different setting of the tab size, they are not aligned. Sets of method
declarations, properties
blocks and
arguments
blocks will not be reported by this
check.
This check has an auto-fixer. Clicking the Fix all button in the report fixes all violations for this check, clicking the Fix all in this file button fixes all violations for this check for one file. You can use the Fix on this line button to apply the fix to the violations in an individual block of code. The auto-fixer insert spaces, not tabs. For more information, see section Automatic fixes.
Configurable parameter
- IndentationLength (double): The indentation length of indented code should be divisible by the parameter IndentationLength. The default value for this parameter is 4 and it can be changed to anywhere between 1 and 12.
Exemption tag: %@ok<EXPAL>