org.sonar.css.checks.l10n.less.multiple-variable-declarations-same-scope.html Maven / Gradle / Ivy
Declaring the same variable twice within the same scope is error-prone. Thus, redeclaring variables twice within the
same scope should be avoided.
Noncompliant Code Example
1 @myvar: blue; /* Noncompliant: redeclared line 2 and 11 */
2 @myvar: white;
3
4 .mybox {
5 @size: 1px; /* Noncompliant: redeclared line 8 */
6 color: @myvar;
7 width: @size;
8 @size: 2px;
9 }
10
11 @myvar: red;
Compliant Solution
1 @myvar: red;
2 .mybox {
3 @size: 1px;
4 color: @myvar;
5 width: @size;
6 }
© 2015 - 2024 Weber Informatics LLC | Privacy Policy