You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: RULES_DESCRIPTIONS.md
+46-42
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,7 @@ Example:
135
135
[rule.banned-characters]
136
136
arguments = ["Ω","Σ","σ"]
137
137
```
138
+
138
139
## bare-return
139
140
140
141
_Description_: Warns on bare (a.k.a. naked) returns
@@ -175,6 +176,7 @@ Example:
175
176
[rule.cognitive-complexity]
176
177
arguments = [7]
177
178
```
179
+
178
180
## comment-spacings
179
181
180
182
_Description_: Spots comments of the form:
@@ -195,6 +197,7 @@ Example:
195
197
[rule.comment-spacings]
196
198
arguments = ["mypragma:", "+optional"]
197
199
```
200
+
198
201
## comments-density
199
202
200
203
_Description_: Spots files not respecting a minimum value for the [_comments lines density_](https://docs.sonarsource.com/sonarqube/latest/user-guide/metric-definitions/) metric = _comment lines / (lines of code + comment lines) * 100_
@@ -259,6 +262,7 @@ Example:
259
262
[rule.cyclomatic]
260
263
arguments = [3]
261
264
```
265
+
262
266
## datarace
263
267
264
268
_Description_: This rule spots potential dataraces caused by go-routines capturing (by-reference) particular identifiers of the function from which go-routines are created. The rule is able to spot two of such cases: go-routines capturing named return values, and capturing `for-range` values.
_Description_: It is possible to unintentionally import the same package twice. This rule looks for packages that are imported two or more times.
@@ -361,32 +364,6 @@ _Description_: Sometimes `gofmt` is not enough to enforce a common formatting of
361
364
362
365
_Configuration_: N/A
363
366
364
-
## error-naming
365
-
366
-
_Description_: By convention, for the sake of readability, variables of type `error` must be named with the prefix `err`.
367
-
368
-
_Configuration_: N/A
369
-
370
-
## error-return
371
-
372
-
_Description_: By convention, for the sake of readability, the errors should be last in the list of returned values by a function.
373
-
374
-
_Configuration_: N/A
375
-
376
-
## error-strings
377
-
378
-
_Description_: By convention, for better readability, error messages should not be capitalized or end with punctuation or a newline.
379
-
380
-
More information [here](https://github.com/golang/go/wiki/CodeReviewComments#error-strings)
381
-
382
-
_Configuration_: N/A
383
-
384
-
## errorf
385
-
386
-
_Description_: It is possible to get a simpler program by replacing `errors.New(fmt.Sprintf())` with `fmt.Errorf()`. This rule spots that kind of simplification opportunities.
387
-
388
-
_Configuration_: N/A
389
-
390
367
## enforce-map-style
391
368
392
369
_Description_: This rule enforces consistent usage of `make(map[type]type)` or `map[type]type{}` for map initialization. It does not affect `make(map[type]type, size)` constructions as well as `map[type]type{k1: v1}`.
@@ -458,6 +435,32 @@ Example:
458
435
arguments = ["make"]
459
436
```
460
437
438
+
## error-naming
439
+
440
+
_Description_: By convention, for the sake of readability, variables of type `error` must be named with the prefix `err`.
441
+
442
+
_Configuration_: N/A
443
+
444
+
## error-return
445
+
446
+
_Description_: By convention, for the sake of readability, the errors should be last in the list of returned values by a function.
447
+
448
+
_Configuration_: N/A
449
+
450
+
## error-strings
451
+
452
+
_Description_: By convention, for better readability, error messages should not be capitalized or end with punctuation or a newline.
453
+
454
+
More information [here](https://github.com/golang/go/wiki/CodeReviewComments#error-strings)
455
+
456
+
_Configuration_: N/A
457
+
458
+
## errorf
459
+
460
+
_Description_: It is possible to get a simpler program by replacing `errors.New(fmt.Sprintf())` with `fmt.Errorf()`. This rule spots that kind of simplification opportunities.
461
+
462
+
_Configuration_: N/A
463
+
461
464
## exported
462
465
463
466
_Description_: Exported function and methods should have comments. This warns on undocumented exported functions and methods.
@@ -500,32 +503,32 @@ This rule warns on boolean parameters that create a control coupling.
500
503
501
504
_Configuration_: N/A
502
505
503
-
## function-result-limit
506
+
## function-length
504
507
505
-
_Description_: Functions returning too many results can be hard to understand/use.
508
+
_Description_: Functions too long (with many statements and/or lines) can be hard to understand.
506
509
507
-
_Configuration_: (int) the maximum allowed return values
510
+
_Configuration_: (int,int) the maximum allowed statements and lines. Must be non-negative integers. Set to 0 to disable the check
508
511
509
512
Example:
510
513
511
514
```toml
512
-
[rule.function-result-limit]
513
-
arguments = [3]
515
+
[rule.function-length]
516
+
arguments = [10, 0]
514
517
```
518
+
Will check for functions exceeding 10 statements and will not check the number of lines of functions
515
519
516
-
## function-length
520
+
## function-result-limit
517
521
518
-
_Description_: Functions too long (with many statements and/or lines) can be hard to understand.
522
+
_Description_: Functions returning too many results can be hard to understand/use.
519
523
520
-
_Configuration_: (int,int) the maximum allowed statements and lines. Must be non-negative integers. Set to 0 to disable the check
524
+
_Configuration_: (int) the maximum allowed return values
521
525
522
526
Example:
523
527
524
528
```toml
525
-
[rule.function-length]
526
-
arguments = [10, 0]
529
+
[rule.function-result-limit]
530
+
arguments = [3]
527
531
```
528
-
Will check for functions exceeding 10 statements and will not check the number of lines of functions
529
532
530
533
## get-return
531
534
@@ -644,7 +647,7 @@ _Configuration_: (int) maximum accepted nesting level of control structures (def
0 commit comments