Skip to content

Commit 56b120f

Browse files
authored
Update index.js
1 parent 6e13ca7 commit 56b120f

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

scripts/solhint-custom/index.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,17 @@ module.exports = [
6565
}
6666

6767
FunctionDefinition(node) {
68-
if (node.visibility === 'private') {
69-
if (!/^_/.test(node.name)) {
70-
this.error(node, 'Private functions must have leading underscore');
71-
}
68+
if (node.visibility === 'private' && !/^_/.test(node.name)) {
69+
this.error(node, 'Private functions must have leading underscore');
7270
}
73-
if (node.visibility === 'internal' && node.parent.kind !== 'library') {
74-
if (!/^_/.test(node.name)) {
75-
this.error(node, 'Non-library internal functions must have leading underscore');
76-
}
71+
if (node.visibility === 'internal' && node.parent.kind !== 'library' && !/^_/.test(node.name)) {
72+
this.error(node, 'Non-library internal functions must have leading underscore');
7773
}
78-
if (node.visibility === 'internal' && node.parent.kind === 'library') {
79-
if (/^_/.test(node.name)) {
80-
this.error(node, 'Library internal functions should not have leading underscore');
81-
}
74+
if (node.visibility === 'internal' && node.parent.kind === 'library' && /^_/.test(node.name)) {
75+
this.error(node, 'Library internal functions should not have leading underscore');
8276
}
83-
if (node.visibility === 'public' || node.visibility === 'external') {
84-
if (/^_/.test(node.name)) {
85-
this.error(node, 'Public and external functions should not have leading underscore');
86-
}
77+
if (node.visibility === 'public' || node.visibility === 'external' && /^_/.test(node.name)) {
78+
this.error(node, 'Public and external functions should not have leading underscore');
8779
}
8880
}
8981
},

0 commit comments

Comments
 (0)