Skip to content

Commit bee7bc3

Browse files
authored
Update index.js
1 parent ba351f3 commit bee7bc3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/solhint-custom/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ module.exports = [
5252
this.error(node, 'Constant and immutable variables should not have leading underscore');
5353
}
5454
} 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-
}
55+
if (node.visibility === 'private' && !/^_/.test(node.name))
56+
this.error(node, 'Private state variables must have leading underscore');
57+
}
58+
if (node.visibility === 'internal' && !/^_/.test(node.name)) {
59+
this.error(node, 'Internal state variables must have leading underscore');
60+
}
61+
if (node.visibility === 'public' && /^_/.test(node.name)) {
62+
this.error(node, 'Public state variables should not have leading underscore');
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)