Skip to content

Commit c49c323

Browse files
committed
Review
1 parent f74c8fe commit c49c323

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

RULES_DESCRIPTIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,9 @@ _Description_: This rule enforces a maximum number of lines per file, in order t
508508

509509
_Configuration_:
510510

511-
* `max` (int) a maximum number of lines in a file (default 1000)
512-
* `skipComments` (bool) ignore lines containing just comments
513-
* `skipBlankLines` (bool) ignore lines made up purely of whitespace
511+
* `max` (int) a maximum number of lines in a file (default `1000`)
512+
* `skipComments` (bool) if true ignore and do not count lines containing just comments (default `false`)
513+
* `skipBlankLines` (bool) if true ignore and do not count lines made up purely of whitespace (default `false`)
514514

515515
Example:
516516

rule/file-length-limit.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (r *FileLengthLimitRule) Apply(file *lint.File, arguments lint.Arguments) [
3131
scanner := bufio.NewScanner(bytes.NewReader(file.Content()))
3232
for scanner.Scan() {
3333
all++
34-
if len(scanner.Bytes()) == 0 {
34+
if len(bytes.TrimSpace(scanner.Bytes())) == 0 {
3535
blank++
3636
}
3737
}
@@ -113,6 +113,9 @@ func countCommentLines(comments []*ast.CommentGroup) int {
113113
count := 0
114114
for _, cg := range comments {
115115
for _, comment := range cg.List {
116+
if len(comment.Text) < 2 {
117+
continue
118+
}
116119
switch comment.Text[1] {
117120
case '/': // single-line comment
118121
count++

0 commit comments

Comments
 (0)