@fabriziosalmi/slopless 1.4.6 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/api.js +147 -143
- package/dist/index.d.ts +0 -1
- package/dist/index.js +153 -149
- package/package.json +1 -1
- package/rules/VBC-039.yaml +8 -1
- package/rules/VBC-049.yaml +23 -1
- package/rules/VBC-917.yaml +8 -0
- package/rules/VBC-928.yaml +6 -1
package/package.json
CHANGED
package/rules/VBC-039.yaml
CHANGED
|
@@ -5,14 +5,21 @@ category: core
|
|
|
5
5
|
tags:
|
|
6
6
|
- security
|
|
7
7
|
match:
|
|
8
|
-
regex: eval\(
|
|
8
|
+
regex: (?<![.\w])eval\s*\(
|
|
9
9
|
file_types:
|
|
10
10
|
- js
|
|
11
11
|
- ts
|
|
12
|
+
- py
|
|
13
|
+
- rb
|
|
14
|
+
- php
|
|
12
15
|
message: >-
|
|
13
16
|
Use of 'eval()' detected at line {line}. This is a massive security risk.
|
|
14
17
|
tests:
|
|
15
18
|
fire:
|
|
16
19
|
- eval(userInput);
|
|
20
|
+
- { file: a.py, code: 'result = eval(expr)' }
|
|
17
21
|
quiet:
|
|
18
22
|
- JSON.parse(userInput);
|
|
23
|
+
# PyTorch puts a model into evaluation mode several times per script.
|
|
24
|
+
- { file: a.py, code: 'model.eval()' }
|
|
25
|
+
- { file: a.py, code: 'if is_eval(node): pass' }
|
package/rules/VBC-049.yaml
CHANGED
|
@@ -5,15 +5,37 @@ category: clean-code
|
|
|
5
5
|
tags:
|
|
6
6
|
- clean-code
|
|
7
7
|
match:
|
|
8
|
-
|
|
8
|
+
# `store` and `swap` take the value first: `flag.store(false, Ordering::Relaxed)`
|
|
9
|
+
# is the atomic API, not an opaque flag. `Option(False, "--dry-run", ...)` is a
|
|
10
|
+
# CLI default followed by the very name that documents it.
|
|
11
|
+
regex: >-
|
|
12
|
+
\b(?!(?:store|swap|compare_exchange|compare_and_swap|Option)\b)[a-zA-Z0-9_]+\((true|false|True|False)\s*,
|
|
9
13
|
file_types:
|
|
10
14
|
- js
|
|
11
15
|
- ts
|
|
16
|
+
- py
|
|
17
|
+
- go
|
|
18
|
+
- rs
|
|
19
|
+
exclude_files:
|
|
20
|
+
- '**/test/**'
|
|
21
|
+
- '**/tests/**'
|
|
22
|
+
- '**/__tests__/**'
|
|
23
|
+
- '**/test_*.py'
|
|
24
|
+
- '**/*_test.py'
|
|
25
|
+
- '**/*_test.go'
|
|
26
|
+
- '**/*.test.*'
|
|
27
|
+
- '**/*.spec.*'
|
|
12
28
|
message: >-
|
|
13
29
|
Magic boolean passed as first argument at line {line}. Use named parameters or a descriptive
|
|
14
30
|
variable.
|
|
15
31
|
tests:
|
|
16
32
|
fire:
|
|
17
33
|
- renderList(true, items);
|
|
34
|
+
- { file: a.py, code: 'toggle_server(True, port)' }
|
|
35
|
+
- { file: a.rs, code: 'format_warn(false, "health", msg);' }
|
|
18
36
|
quiet:
|
|
19
37
|
- 'renderList({ compact: true }, items);'
|
|
38
|
+
# The atomic API takes the value first; the ordering that follows is not a flag.
|
|
39
|
+
- { file: a.rs, code: 'healthy.store(false, Ordering::Relaxed);' }
|
|
40
|
+
# A CLI default, followed by the very name that documents it.
|
|
41
|
+
- { file: a.py, code: 'dry_run: bool = typer.Option(False, "--dry-run")' }
|
package/rules/VBC-917.yaml
CHANGED
|
@@ -7,9 +7,17 @@ tags:
|
|
|
7
7
|
- style
|
|
8
8
|
match:
|
|
9
9
|
regex: \b[A-Z]{3,}\b(?:\s+\b[A-Z]{2,}\b){3,}
|
|
10
|
+
# In a source file, prose lives in comments. Without this the rule would read
|
|
11
|
+
# a run of constants as shouting, and miss the comment that actually shouts.
|
|
12
|
+
scan: comments
|
|
10
13
|
file_types:
|
|
11
14
|
- md
|
|
12
15
|
- txt
|
|
16
|
+
- py
|
|
17
|
+
- go
|
|
18
|
+
- rs
|
|
19
|
+
- js
|
|
20
|
+
- ts
|
|
13
21
|
opt_in: true
|
|
14
22
|
message: >-
|
|
15
23
|
Sustained all-caps text at line {line}. Shouting does not add emphasis, it costs readability.
|
package/rules/VBC-928.yaml
CHANGED
|
@@ -8,13 +8,18 @@ tags:
|
|
|
8
8
|
match:
|
|
9
9
|
regex: Lorem ipsum dolor sit amet
|
|
10
10
|
flags: i
|
|
11
|
-
scan:
|
|
11
|
+
scan: all
|
|
12
12
|
file_types:
|
|
13
13
|
- md
|
|
14
14
|
- txt
|
|
15
15
|
- html
|
|
16
16
|
- js
|
|
17
17
|
- ts
|
|
18
|
+
- py
|
|
19
|
+
- go
|
|
20
|
+
- rs
|
|
21
|
+
- java
|
|
22
|
+
- sh
|
|
18
23
|
message: >-
|
|
19
24
|
Placeholder text 'Lorem ipsum' detected at line {line}. Replace with real content before
|
|
20
25
|
committing.
|