skylos 2.2.2__tar.gz → 2.2.3__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.
Potentially problematic release.
This version of skylos might be problematic. Click here for more details.
- {skylos-2.2.2 → skylos-2.2.3}/PKG-INFO +1 -1
- {skylos-2.2.2 → skylos-2.2.3}/README.md +3 -2
- {skylos-2.2.2 → skylos-2.2.3}/pyproject.toml +1 -1
- {skylos-2.2.2 → skylos-2.2.3}/setup.py +1 -1
- {skylos-2.2.2 → skylos-2.2.3}/skylos/__init__.py +1 -1
- {skylos-2.2.2 → skylos-2.2.3}/skylos/codemods.py +15 -6
- {skylos-2.2.2 → skylos-2.2.3}/skylos/rules/secrets.py +0 -1
- {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/PKG-INFO +1 -1
- {skylos-2.2.2 → skylos-2.2.3}/setup.cfg +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/analyzer.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/cli.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/constants.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/rules/__init__.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/server.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/visitor.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/visitors/__init__.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/visitors/framework_aware.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos/visitors/test_aware.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/SOURCES.txt +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/dependency_links.txt +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/entry_points.txt +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/requires.txt +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/top_level.txt +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/__init__.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/compare_tools.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/conftest.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/diagnostics.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/__init__.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/app.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/__init__.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/commands.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/models.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/routes.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/utils.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_analyzer.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_changes_analyzer.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_cli.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_codemods.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_constants.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_framework_aware.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_integration.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_new_behaviours.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_secrets.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_skylos.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_test_aware.py +0 -0
- {skylos-2.2.2 → skylos-2.2.3}/test/test_visitor.py +0 -0
|
@@ -253,6 +253,7 @@ Options:
|
|
|
253
253
|
--json Output raw JSON instead of formatted text
|
|
254
254
|
-o, --output FILE Write output to file instead of stdout
|
|
255
255
|
-v, --verbose Enable verbose output
|
|
256
|
+
--version Checks version
|
|
256
257
|
-i, --interactive Interactively select items to remove
|
|
257
258
|
--dry-run Show what would be removed without modifying files
|
|
258
259
|
--exclude-folder FOLDER Exclude a folder from analysis (can be used multiple times)
|
|
@@ -290,7 +291,7 @@ Pick **one** (or use **both**)
|
|
|
290
291
|
## .pre-commit-config.yaml
|
|
291
292
|
repos:
|
|
292
293
|
- repo: https://github.com/duriantaco/skylos
|
|
293
|
-
rev: v2.2.
|
|
294
|
+
rev: v2.2.3
|
|
294
295
|
hooks:
|
|
295
296
|
- id: skylos-scan
|
|
296
297
|
name: skylos report
|
|
@@ -340,7 +341,7 @@ repos:
|
|
|
340
341
|
entry: python -m skylos.cli
|
|
341
342
|
pass_filenames: false
|
|
342
343
|
require_serial: true
|
|
343
|
-
additional_dependencies: [skylos==2.2.
|
|
344
|
+
additional_dependencies: [skylos==2.2.3]
|
|
344
345
|
args: [".", "--output", "report.json", "--confidence", "70"]
|
|
345
346
|
|
|
346
347
|
- id: skylos-fail-on-findings
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
import libcst as cst
|
|
3
3
|
from libcst.metadata import PositionProvider
|
|
4
|
+
from libcst.helpers import get_full_name_for_node
|
|
4
5
|
|
|
5
6
|
class _CommentOutBlock(cst.CSTTransformer):
|
|
6
7
|
|
|
@@ -31,14 +32,16 @@ class _CommentOutFunctionAtLine(_CommentOutBlock):
|
|
|
31
32
|
return pos and pos.start.line == self.target_line
|
|
32
33
|
|
|
33
34
|
def leave_FunctionDef(self, orig: cst.FunctionDef, updated: cst.FunctionDef):
|
|
34
|
-
|
|
35
|
+
target = self.func_name.split(".")[-1]
|
|
36
|
+
if self._is_target(orig) and (orig.name.value == target):
|
|
35
37
|
self.changed = True
|
|
36
38
|
pos = self.get_metadata(PositionProvider, orig)
|
|
37
39
|
return cst.FlattenSentinel(self._comment_block(pos.start.line, pos.end.line))
|
|
38
40
|
return updated
|
|
39
41
|
|
|
40
42
|
def leave_AsyncFunctionDef(self, orig: cst.AsyncFunctionDef, updated: cst.AsyncFunctionDef):
|
|
41
|
-
|
|
43
|
+
target = self.func_name.split(".")[-1]
|
|
44
|
+
if self._is_target(orig) and (orig.name.value == target):
|
|
42
45
|
self.changed = True
|
|
43
46
|
pos = self.get_metadata(PositionProvider, orig)
|
|
44
47
|
return cst.FlattenSentinel(self._comment_block(pos.start.line, pos.end.line))
|
|
@@ -73,7 +76,9 @@ class _CommentOutImportAtLine(_CommentOutBlock):
|
|
|
73
76
|
removed_for_comment= []
|
|
74
77
|
for alias in list(aliases):
|
|
75
78
|
bound = _bound_name_for_import_alias(alias)
|
|
76
|
-
|
|
79
|
+
name_code = get_full_name_for_node(alias.name)
|
|
80
|
+
tail = name_code.split(".")[-1]
|
|
81
|
+
if self.target_name in (bound, tail):
|
|
77
82
|
self.changed = True
|
|
78
83
|
removed_for_comment.append(self._render_single_alias_text(head, alias, is_from))
|
|
79
84
|
else:
|
|
@@ -175,7 +180,9 @@ class _RemoveImportAtLine(cst.CSTTransformer):
|
|
|
175
180
|
kept = []
|
|
176
181
|
for alias in aliases:
|
|
177
182
|
bound = _bound_name_for_import_alias(alias)
|
|
178
|
-
|
|
183
|
+
name_code = get_full_name_for_node(alias.name) or ""
|
|
184
|
+
tail = name_code.split(".")[-1]
|
|
185
|
+
if self.target_name in (bound, tail):
|
|
179
186
|
self.changed = True
|
|
180
187
|
continue
|
|
181
188
|
kept.append(alias)
|
|
@@ -213,13 +220,15 @@ class _RemoveFunctionAtLine(cst.CSTTransformer):
|
|
|
213
220
|
return pos and pos.start.line == self.target_line
|
|
214
221
|
|
|
215
222
|
def leave_FunctionDef(self, orig: cst.FunctionDef, updated: cst.FunctionDef):
|
|
216
|
-
|
|
223
|
+
target = self.func_name.split(".")[-1]
|
|
224
|
+
if self._is_target(orig) and (orig.name.value == target):
|
|
217
225
|
self.changed = True
|
|
218
226
|
return cst.RemoveFromParent()
|
|
219
227
|
return updated
|
|
220
228
|
|
|
221
229
|
def leave_AsyncFunctionDef(self, orig: cst.AsyncFunctionDef, updated: cst.AsyncFunctionDef):
|
|
222
|
-
|
|
230
|
+
target = self.func_name.split(".")[-1]
|
|
231
|
+
if self._is_target(orig) and (orig.name.value == target):
|
|
223
232
|
self.changed = True
|
|
224
233
|
return cst.RemoveFromParent()
|
|
225
234
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|