@fabriziosalmi/slopless 1.4.6 → 1.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriziosalmi/slopless",
3
- "version": "1.4.6",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  "verify:bundle": "node scripts/verify-bundle.js",
23
23
  "verify:action": "bash scripts/run-action-locally.sh . 'src/**/*.ts'",
24
24
  "release:prep": "npm run docs:gen && npm run build && npm test && npm run verify:bundle",
25
- "version": "npm run build && git add dist"
25
+ "version": "npm run docs:gen && npm run build && git add dist docs README.md"
26
26
  },
27
27
  "keywords": [
28
28
  "linter",
@@ -42,14 +42,14 @@
42
42
  },
43
43
  "type": "commonjs",
44
44
  "devDependencies": {
45
- "@types/glob": "^8.1.0",
45
+ "@types/glob": "^9.0.0",
46
46
  "@types/js-yaml": "^4.0.9",
47
- "@types/node": "^25.3.0",
47
+ "@types/node": "^26.4.0",
48
48
  "@vitest/coverage-v8": "^4.0.18",
49
- "commander": "^14.0.3",
49
+ "commander": "^15.0.0",
50
50
  "glob": "^13.0.6",
51
51
  "ignore": "^7.0.5",
52
- "js-yaml": "^4.1.1",
52
+ "js-yaml": "^5.4.1",
53
53
  "minimatch": "^10.2.6",
54
54
  "ts-node": "^10.9.2",
55
55
  "tsup": "^8.5.1",
@@ -10,6 +10,9 @@ match:
10
10
  - sh
11
11
  - py
12
12
  - js
13
+ # The same decision as the paths below, for languages that keep their
14
+ # tests in the file they test.
15
+ exclude_test_code: true
13
16
  exclude_files:
14
17
  - '**/test/**'
15
18
  - '**/tests/**'
@@ -11,6 +11,9 @@ match:
11
11
  - js
12
12
  - ts
13
13
  - py
14
+ # The same decision as the paths below, for languages that keep their
15
+ # tests in the file they test.
16
+ exclude_test_code: true
14
17
  exclude_files:
15
18
  - '**/test/**'
16
19
  - '**/tests/**'
@@ -13,6 +13,9 @@ match:
13
13
  - ts
14
14
  - py
15
15
  - sh
16
+ # The same decision as the paths below, for languages that keep their
17
+ # tests in the file they test.
18
+ exclude_test_code: true
16
19
  exclude_files:
17
20
  - '**/test/**'
18
21
  - '**/tests/**'
@@ -13,6 +13,9 @@ match:
13
13
  - ts
14
14
  - py
15
15
  - html
16
+ # The same decision as the paths below, for languages that keep their
17
+ # tests in the file they test.
18
+ exclude_test_code: true
16
19
  exclude_files:
17
20
  - '**/test/**'
18
21
  - '**/tests/**'
@@ -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' }
@@ -9,6 +9,7 @@ match:
9
9
  flags: m
10
10
  multiline: true
11
11
  scan: all
12
+ exclude_doc_comments: true
12
13
  file_types:
13
14
  - js
14
15
  - ts
@@ -17,10 +18,37 @@ message: >-
17
18
  Too many consecutive comment lines at line {line}. Code should be self-documenting.
18
19
  tests:
19
20
  fire:
20
- - code: |
21
- // filler comment line
22
- repeat: 12
21
+ # Below the first line of code, so it is commentary rather than a header.
22
+ - |
23
+ const answer = 42;
24
+ // filler comment line
25
+ // filler comment line
26
+ // filler comment line
27
+ // filler comment line
28
+ // filler comment line
29
+ // filler comment line
30
+ // filler comment line
31
+ // filler comment line
32
+ // filler comment line
33
+ // filler comment line
34
+ // filler comment line
35
+ // filler comment line
23
36
  quiet:
24
37
  - |
25
38
  // one explanatory comment
26
39
  const answer = 42;
40
+ # A banner at the top of a file explains what the file is. Counting it as
41
+ # excess commentary reported 79 module headers in one project.
42
+ - |
43
+ // ─────────────────────────────
44
+ // Wasm Core Bridge
45
+ //
46
+ // Lazy-loads the Rust module.
47
+ // All functions go through this singleton.
48
+ //
49
+ // Usage:
50
+ // import { core } from './bridge';
51
+ // const c = await core();
52
+ //
53
+ // ─────────────────────────────
54
+ import { core } from './bridge';
@@ -5,15 +5,40 @@ category: clean-code
5
5
  tags:
6
6
  - clean-code
7
7
  match:
8
- regex: \b[a-zA-Z0-9_]+\((true|false)\s*,
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
+ # The same decision as the paths below, for languages that keep their
20
+ # tests in the file they test.
21
+ exclude_test_code: true
22
+ exclude_files:
23
+ - '**/test/**'
24
+ - '**/tests/**'
25
+ - '**/__tests__/**'
26
+ - '**/test_*.py'
27
+ - '**/*_test.py'
28
+ - '**/*_test.go'
29
+ - '**/*.test.*'
30
+ - '**/*.spec.*'
12
31
  message: >-
13
32
  Magic boolean passed as first argument at line {line}. Use named parameters or a descriptive
14
33
  variable.
15
34
  tests:
16
35
  fire:
17
36
  - renderList(true, items);
37
+ - { file: a.py, code: 'toggle_server(True, port)' }
38
+ - { file: a.rs, code: 'format_warn(false, "health", msg);' }
18
39
  quiet:
19
40
  - 'renderList({ compact: true }, items);'
41
+ # The atomic API takes the value first; the ordering that follows is not a flag.
42
+ - { file: a.rs, code: 'healthy.store(false, Ordering::Relaxed);' }
43
+ # A CLI default, followed by the very name that documents it.
44
+ - { file: a.py, code: 'dry_run: bool = typer.Option(False, "--dry-run")' }
@@ -6,6 +6,9 @@ tags:
6
6
  - clean-code
7
7
  match:
8
8
  regex: /(?:[^/\n\\]|\\.){30,}/[dgimsuvy]*
9
+ # Regular expression literals and nothing else. Reading strings found the
10
+ # slashes in a translation file; reading code found the ones in a division.
11
+ scan: regex
9
12
  file_types:
10
13
  - js
11
14
  - ts
@@ -16,6 +16,9 @@ match:
16
16
  - java
17
17
  - json
18
18
  - env
19
+ # The same decision as the paths below, for languages that keep their
20
+ # tests in the file they test.
21
+ exclude_test_code: true
19
22
  exclude_files:
20
23
  - '**/test/**'
21
24
  - '**/tests/**'
@@ -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.
@@ -18,6 +18,9 @@ match:
18
18
  - go
19
19
  - rs
20
20
  - html
21
+ # The same decision as the paths below, for languages that keep their
22
+ # tests in the file they test.
23
+ exclude_test_code: true
21
24
  exclude_files:
22
25
  - '**/test/**'
23
26
  - '**/tests/**'
@@ -8,13 +8,18 @@ tags:
8
8
  match:
9
9
  regex: Lorem ipsum dolor sit amet
10
10
  flags: i
11
- scan: strings
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.