Skip to content

Commit 6e13ca7

Browse files
authored
Update index.js
1 parent 37c7a52 commit 6e13ca7

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

scripts/solhint-custom/index.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,19 @@ module.exports = [
4747
static ruleId = 'leading-underscore';
4848

4949
VariableDeclaration(node) {
50-
if (node.isDeclaredConst || node.isImmutable) {
51-
if (/^_/.test(node.name)) {
52-
this.error(node, 'Constant and immutable variables should not have leading underscore');
53-
}
50+
if (node.isDeclaredConst || node.isImmutable) {
51+
if (/^_/.test(node.name)) {
52+
this.error(node, 'Constant and immutable variables should not have leading underscore');
5453
}
55-
else {
56-
if (node.isStateVar) {
57-
if (node.visibility === 'private' || node.visibility === 'internal') {
58-
if (!/^_/.test(node.name)) {
59-
this.error(node, 'Private and internal state variables must have leading underscore');
60-
}
61-
}
62-
else {
63-
if (/^_/.test(node.name)) {
64-
this.error(node, 'Public state variables should not have leading underscore');
65-
}
66-
}
54+
} else if (node.isStateVar) {
55+
if (node.visibility === 'private' || node.visibility === 'internal') {
56+
if (!/^_/.test(node.name)) {
57+
this.error(node, 'Private and internal state variables must have leading underscore');
58+
}
59+
} else {
60+
if (/^_/.test(node.name)) {
61+
this.error(node, 'Public state variables should not have leading underscore');
62+
}
6763
}
6864
}
6965
}

0 commit comments

Comments
 (0)