complexipy 3.2.0__tar.gz → 3.3.0__tar.gz

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.
Files changed (42) hide show
  1. {complexipy-3.2.0 → complexipy-3.3.0}/Cargo.lock +1 -1
  2. {complexipy-3.2.0 → complexipy-3.3.0}/Cargo.toml +1 -1
  3. {complexipy-3.2.0 → complexipy-3.3.0}/PKG-INFO +46 -20
  4. {complexipy-3.2.0 → complexipy-3.3.0}/README.md +45 -19
  5. {complexipy-3.2.0 → complexipy-3.3.0}/complexipy/__init__.py +2 -0
  6. complexipy-3.3.0/complexipy/_complexipy.pyi +507 -0
  7. {complexipy-3.2.0 → complexipy-3.3.0}/complexipy/main.py +75 -3
  8. complexipy-3.3.0/complexipy/py.typed +0 -0
  9. {complexipy-3.2.0 → complexipy-3.3.0}/complexipy/utils.py +14 -9
  10. {complexipy-3.2.0 → complexipy-3.3.0}/docs/index.md +45 -19
  11. {complexipy-3.2.0 → complexipy-3.3.0}/src/cognitive_complexity/utils.rs +4 -2
  12. {complexipy-3.2.0 → complexipy-3.3.0}/src/lib.rs +3 -2
  13. complexipy-3.3.0/vscode/complexipy/CHANGELOG.md +94 -0
  14. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/README.md +11 -0
  15. complexipy-3.3.0/vscode/complexipy/extension.js +552 -0
  16. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/package.json +2 -2
  17. complexipy-3.3.0/vscode/complexipy/test/statusbar.test.js +66 -0
  18. complexipy-3.2.0/vscode/complexipy/CHANGELOG.md +0 -29
  19. complexipy-3.2.0/vscode/complexipy/extension.js +0 -200
  20. complexipy-3.2.0/vscode/complexipy/vsc-extension-quickstart.md +0 -42
  21. {complexipy-3.2.0 → complexipy-3.3.0}/.pre-commit-config.yaml +0 -0
  22. {complexipy-3.2.0 → complexipy-3.3.0}/LICENSE +0 -0
  23. {complexipy-3.2.0 → complexipy-3.3.0}/build-wasm.sh +0 -0
  24. {complexipy-3.2.0 → complexipy-3.3.0}/complexipy/types.py +0 -0
  25. {complexipy-3.2.0 → complexipy-3.3.0}/docs/img/complexipy_icon.svg +0 -0
  26. {complexipy-3.2.0 → complexipy-3.3.0}/mkdocs.yml +0 -0
  27. {complexipy-3.2.0 → complexipy-3.3.0}/pyproject.toml +0 -0
  28. {complexipy-3.2.0 → complexipy-3.3.0}/serve-web-version.sh +0 -0
  29. {complexipy-3.2.0 → complexipy-3.3.0}/src/classes/mod.rs +0 -0
  30. {complexipy-3.2.0 → complexipy-3.3.0}/src/cognitive_complexity/mod.rs +0 -0
  31. {complexipy-3.2.0 → complexipy-3.3.0}/src/wasm.rs +0 -0
  32. {complexipy-3.2.0 → complexipy-3.3.0}/uv.lock +0 -0
  33. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/.vscode-test.mjs +0 -0
  34. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/.vscodeignore +0 -0
  35. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/LICENSE +0 -0
  36. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/eslint.config.mjs +0 -0
  37. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/img/complexipy.png +0 -0
  38. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/img/complexipy_icon.png +0 -0
  39. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/img/complexipy_icon.svg +0 -0
  40. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/jsconfig.json +0 -0
  41. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/package-lock.json +0 -0
  42. {complexipy-3.2.0 → complexipy-3.3.0}/vscode/complexipy/test/extension.test.js +0 -0
@@ -71,7 +71,7 @@ dependencies = [
71
71
 
72
72
  [[package]]
73
73
  name = "complexipy"
74
- version = "3.2.0"
74
+ version = "3.3.0"
75
75
  dependencies = [
76
76
  "console_error_panic_hook",
77
77
  "csv",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "complexipy"
3
- version = "3.2.0"
3
+ version = "3.3.0"
4
4
  edition = "2024"
5
5
  authors = ["Robin Quintero <rohaquinlop301@gmail.com>"]
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: complexipy
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -152,20 +152,27 @@ complexipy path/to/directory --sort desc # or -s desc
152
152
  # Save results
153
153
  complexipy path/to/directory --output-csv # -c, writes complexipy.csv
154
154
  complexipy path/to/directory --output-json # -j, writes complexipy.json
155
+
156
+ # Set custom complexity threshold (default is 15)
157
+ complexipy path/to/directory --max-complexity-allowed 10 # or -mx 10
158
+
159
+ # Combine with other options
160
+ complexipy path/to/directory --max-complexity-allowed 20 --details low --sort desc
155
161
  ```
156
162
 
157
163
  #### Command-line options
158
164
 
159
- | Short | Long | Parameters | Description | Default |
160
- | ----- | ------------------------ | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
161
- | `-c` | `--output-csv` | – | Write the report to `complexipy.csv` in the current working directory. | false |
162
- | `-j` | `--output-json` | – | Write the report to `complexipy.json` in the current working directory. | false |
163
- | `-i` | `--ignore-complexity` | – | Do not stop with an error when a function's cognitive complexity is > 15. All functions are still listed in the output. | off |
164
- | `-d` | `--details <normal∣low>` | required | Control the verbosity of the output.<br>• `normal` – show every file and function (default)<br>• `low` – show only entries that exceed the complexity threshold | `normal` |
165
- | `-q` | `--quiet` | – | Suppress console output. Exit codes are still returned. | false |
166
- | `-s` | `--sort <asc∣desc∣name>` | required | Order the results.<br>• `asc` – complexity ascending (default)<br>• `desc` – complexity descending<br>• `name` – alphabetical A→Z | `asc` |
165
+ | Short | Long | Parameters | Description | Default |
166
+ | ----- | -------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
167
+ | `-c` | `--output-csv` | – | Write the report to `complexipy.csv` in the current working directory. | false |
168
+ | `-j` | `--output-json` | – | Write the report to `complexipy.json` in the current working directory. | false |
169
+ | `-i` | `--ignore-complexity` | – | Do not stop with an error when a function's cognitive complexity exceeds the threshold. All functions are still listed in the output. | off |
170
+ | `-d` | `--details <normal∣low>` | required | Control the verbosity of the output.<br>• `normal` – show every file and function (default)<br>• `low` – show only entries that exceed the complexity threshold | `normal` |
171
+ | `-q` | `--quiet` | – | Suppress console output. Exit codes are still returned. | false |
172
+ | `-s` | `--sort <asc∣desc∣name>` | required | Order the results.<br>• `asc` – complexity ascending (default)<br>• `desc` – complexity descending<br>• `name` – alphabetical A→Z | `asc` |
173
+ | `-mx` | `--max-complexity-allowed` | number | Set the maximum allowed cognitive complexity threshold per function. Functions exceeding this value will be highlighted and cause exit code 1. | `15` |
167
174
 
168
- > **Note** The CLI exits with code **1** when at least one function exceeds the threshold of **15** points. Pass `--ignore-complexity` (`-i`) to disable this behaviour.
175
+ > **Note** The CLI exits with code **1** when at least one function exceeds the complexity threshold (default: 15 points). You can customize this threshold using `--max-complexity-allowed` or disable this behavior with `--ignore-complexity` (`-i`).
169
176
 
170
177
  ### GitHub Action
171
178
 
@@ -188,15 +195,16 @@ jobs:
188
195
 
189
196
  #### Action Inputs
190
197
 
191
- | Input | Type / Allowed Values | Required |
192
- | ----------------- | ------------------------------------- | -------- |
193
- | paths | string (single path or list of paths) | Yes |
194
- | quiet | boolean | No |
195
- | ignore_complexity | boolean | No |
196
- | details | normal, low | No |
197
- | sort | asc, desc, name | No |
198
- | output_csv | boolean | No |
199
- | output_json | boolean | No |
198
+ | Input | Type / Allowed Values | Required |
199
+ | ---------------------- | ------------------------------------- | -------- |
200
+ | paths | string (single path or list of paths) | Yes |
201
+ | quiet | boolean | No |
202
+ | ignore_complexity | boolean | No |
203
+ | details | normal, low | No |
204
+ | sort | asc, desc, name | No |
205
+ | output_csv | boolean | No |
206
+ | output_json | boolean | No |
207
+ | max_complexity_allowed | number | No |
200
208
 
201
209
  #### Examples
202
210
 
@@ -234,6 +242,24 @@ Analyze Specific Directory with Low Detail Output:
234
242
  sort: desc
235
243
  ```
236
244
 
245
+ Set Custom Complexity Threshold:
246
+ ```yaml
247
+ - uses: rohaquinlop/complexipy-action@v1
248
+ with:
249
+ paths: .
250
+ max_complexity_allowed: 10
251
+ ```
252
+
253
+ Strict Analysis with Low Threshold and Details:
254
+ ```yaml
255
+ - uses: rohaquinlop/complexipy-action@v1
256
+ with:
257
+ paths: ./src
258
+ max_complexity_allowed: 8
259
+ details: low
260
+ sort: desc
261
+ ```
262
+
237
263
  ### Pre-commit Hook
238
264
 
239
265
  You can use complexipy as a pre-commit hook to automatically check code complexity before each commit. This helps maintain code quality by preventing complex code from being committed.
@@ -366,7 +392,7 @@ complexipy example.py
366
392
  Typical output (shortened):
367
393
 
368
394
  ```text
369
- ───────────────────────────── 🐙 complexipy 3.2.0 ──────────────────────────────
395
+ ───────────────────────────── 🐙 complexipy 3.3.0 ──────────────────────────────
370
396
  Summary
371
397
  ┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
372
398
  ┃ Path ┃ File ┃ Function ┃ Complexity ┃
@@ -122,20 +122,27 @@ complexipy path/to/directory --sort desc # or -s desc
122
122
  # Save results
123
123
  complexipy path/to/directory --output-csv # -c, writes complexipy.csv
124
124
  complexipy path/to/directory --output-json # -j, writes complexipy.json
125
+
126
+ # Set custom complexity threshold (default is 15)
127
+ complexipy path/to/directory --max-complexity-allowed 10 # or -mx 10
128
+
129
+ # Combine with other options
130
+ complexipy path/to/directory --max-complexity-allowed 20 --details low --sort desc
125
131
  ```
126
132
 
127
133
  #### Command-line options
128
134
 
129
- | Short | Long | Parameters | Description | Default |
130
- | ----- | ------------------------ | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
131
- | `-c` | `--output-csv` | – | Write the report to `complexipy.csv` in the current working directory. | false |
132
- | `-j` | `--output-json` | – | Write the report to `complexipy.json` in the current working directory. | false |
133
- | `-i` | `--ignore-complexity` | – | Do not stop with an error when a function's cognitive complexity is > 15. All functions are still listed in the output. | off |
134
- | `-d` | `--details <normal∣low>` | required | Control the verbosity of the output.<br>• `normal` – show every file and function (default)<br>• `low` – show only entries that exceed the complexity threshold | `normal` |
135
- | `-q` | `--quiet` | – | Suppress console output. Exit codes are still returned. | false |
136
- | `-s` | `--sort <asc∣desc∣name>` | required | Order the results.<br>• `asc` – complexity ascending (default)<br>• `desc` – complexity descending<br>• `name` – alphabetical A→Z | `asc` |
135
+ | Short | Long | Parameters | Description | Default |
136
+ | ----- | -------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
137
+ | `-c` | `--output-csv` | – | Write the report to `complexipy.csv` in the current working directory. | false |
138
+ | `-j` | `--output-json` | – | Write the report to `complexipy.json` in the current working directory. | false |
139
+ | `-i` | `--ignore-complexity` | – | Do not stop with an error when a function's cognitive complexity exceeds the threshold. All functions are still listed in the output. | off |
140
+ | `-d` | `--details <normal∣low>` | required | Control the verbosity of the output.<br>• `normal` – show every file and function (default)<br>• `low` – show only entries that exceed the complexity threshold | `normal` |
141
+ | `-q` | `--quiet` | – | Suppress console output. Exit codes are still returned. | false |
142
+ | `-s` | `--sort <asc∣desc∣name>` | required | Order the results.<br>• `asc` – complexity ascending (default)<br>• `desc` – complexity descending<br>• `name` – alphabetical A→Z | `asc` |
143
+ | `-mx` | `--max-complexity-allowed` | number | Set the maximum allowed cognitive complexity threshold per function. Functions exceeding this value will be highlighted and cause exit code 1. | `15` |
137
144
 
138
- > **Note** The CLI exits with code **1** when at least one function exceeds the threshold of **15** points. Pass `--ignore-complexity` (`-i`) to disable this behaviour.
145
+ > **Note** The CLI exits with code **1** when at least one function exceeds the complexity threshold (default: 15 points). You can customize this threshold using `--max-complexity-allowed` or disable this behavior with `--ignore-complexity` (`-i`).
139
146
 
140
147
  ### GitHub Action
141
148
 
@@ -158,15 +165,16 @@ jobs:
158
165
 
159
166
  #### Action Inputs
160
167
 
161
- | Input | Type / Allowed Values | Required |
162
- | ----------------- | ------------------------------------- | -------- |
163
- | paths | string (single path or list of paths) | Yes |
164
- | quiet | boolean | No |
165
- | ignore_complexity | boolean | No |
166
- | details | normal, low | No |
167
- | sort | asc, desc, name | No |
168
- | output_csv | boolean | No |
169
- | output_json | boolean | No |
168
+ | Input | Type / Allowed Values | Required |
169
+ | ---------------------- | ------------------------------------- | -------- |
170
+ | paths | string (single path or list of paths) | Yes |
171
+ | quiet | boolean | No |
172
+ | ignore_complexity | boolean | No |
173
+ | details | normal, low | No |
174
+ | sort | asc, desc, name | No |
175
+ | output_csv | boolean | No |
176
+ | output_json | boolean | No |
177
+ | max_complexity_allowed | number | No |
170
178
 
171
179
  #### Examples
172
180
 
@@ -204,6 +212,24 @@ Analyze Specific Directory with Low Detail Output:
204
212
  sort: desc
205
213
  ```
206
214
 
215
+ Set Custom Complexity Threshold:
216
+ ```yaml
217
+ - uses: rohaquinlop/complexipy-action@v1
218
+ with:
219
+ paths: .
220
+ max_complexity_allowed: 10
221
+ ```
222
+
223
+ Strict Analysis with Low Threshold and Details:
224
+ ```yaml
225
+ - uses: rohaquinlop/complexipy-action@v1
226
+ with:
227
+ paths: ./src
228
+ max_complexity_allowed: 8
229
+ details: low
230
+ sort: desc
231
+ ```
232
+
207
233
  ### Pre-commit Hook
208
234
 
209
235
  You can use complexipy as a pre-commit hook to automatically check code complexity before each commit. This helps maintain code quality by preventing complex code from being committed.
@@ -336,7 +362,7 @@ complexipy example.py
336
362
  Typical output (shortened):
337
363
 
338
364
  ```text
339
- ───────────────────────────── 🐙 complexipy 3.2.0 ──────────────────────────────
365
+ ───────────────────────────── 🐙 complexipy 3.3.0 ──────────────────────────────
340
366
  Summary
341
367
  ┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
342
368
  ┃ Path ┃ File ┃ Function ┃ Complexity ┃
@@ -2,6 +2,7 @@ from complexipy._complexipy import (
2
2
  CodeComplexity,
3
3
  FileComplexity,
4
4
  FunctionComplexity,
5
+ LineComplexity,
5
6
  )
6
7
 
7
8
  from .main import (
@@ -13,6 +14,7 @@ __all__ = [
13
14
  "CodeComplexity",
14
15
  "FileComplexity",
15
16
  "FunctionComplexity",
17
+ "LineComplexity",
16
18
  "code_complexity",
17
19
  "file_complexity",
18
20
  ]