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.

Files changed (46) hide show
  1. {skylos-2.2.2 → skylos-2.2.3}/PKG-INFO +1 -1
  2. {skylos-2.2.2 → skylos-2.2.3}/README.md +3 -2
  3. {skylos-2.2.2 → skylos-2.2.3}/pyproject.toml +1 -1
  4. {skylos-2.2.2 → skylos-2.2.3}/setup.py +1 -1
  5. {skylos-2.2.2 → skylos-2.2.3}/skylos/__init__.py +1 -1
  6. {skylos-2.2.2 → skylos-2.2.3}/skylos/codemods.py +15 -6
  7. {skylos-2.2.2 → skylos-2.2.3}/skylos/rules/secrets.py +0 -1
  8. {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/PKG-INFO +1 -1
  9. {skylos-2.2.2 → skylos-2.2.3}/setup.cfg +0 -0
  10. {skylos-2.2.2 → skylos-2.2.3}/skylos/analyzer.py +0 -0
  11. {skylos-2.2.2 → skylos-2.2.3}/skylos/cli.py +0 -0
  12. {skylos-2.2.2 → skylos-2.2.3}/skylos/constants.py +0 -0
  13. {skylos-2.2.2 → skylos-2.2.3}/skylos/rules/__init__.py +0 -0
  14. {skylos-2.2.2 → skylos-2.2.3}/skylos/server.py +0 -0
  15. {skylos-2.2.2 → skylos-2.2.3}/skylos/visitor.py +0 -0
  16. {skylos-2.2.2 → skylos-2.2.3}/skylos/visitors/__init__.py +0 -0
  17. {skylos-2.2.2 → skylos-2.2.3}/skylos/visitors/framework_aware.py +0 -0
  18. {skylos-2.2.2 → skylos-2.2.3}/skylos/visitors/test_aware.py +0 -0
  19. {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/SOURCES.txt +0 -0
  20. {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/dependency_links.txt +0 -0
  21. {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/entry_points.txt +0 -0
  22. {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/requires.txt +0 -0
  23. {skylos-2.2.2 → skylos-2.2.3}/skylos.egg-info/top_level.txt +0 -0
  24. {skylos-2.2.2 → skylos-2.2.3}/test/__init__.py +0 -0
  25. {skylos-2.2.2 → skylos-2.2.3}/test/compare_tools.py +0 -0
  26. {skylos-2.2.2 → skylos-2.2.3}/test/conftest.py +0 -0
  27. {skylos-2.2.2 → skylos-2.2.3}/test/diagnostics.py +0 -0
  28. {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/__init__.py +0 -0
  29. {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/app.py +0 -0
  30. {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/__init__.py +0 -0
  31. {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/commands.py +0 -0
  32. {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/models.py +0 -0
  33. {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/routes.py +0 -0
  34. {skylos-2.2.2 → skylos-2.2.3}/test/sample_repo/sample_repo/utils.py +0 -0
  35. {skylos-2.2.2 → skylos-2.2.3}/test/test_analyzer.py +0 -0
  36. {skylos-2.2.2 → skylos-2.2.3}/test/test_changes_analyzer.py +0 -0
  37. {skylos-2.2.2 → skylos-2.2.3}/test/test_cli.py +0 -0
  38. {skylos-2.2.2 → skylos-2.2.3}/test/test_codemods.py +0 -0
  39. {skylos-2.2.2 → skylos-2.2.3}/test/test_constants.py +0 -0
  40. {skylos-2.2.2 → skylos-2.2.3}/test/test_framework_aware.py +0 -0
  41. {skylos-2.2.2 → skylos-2.2.3}/test/test_integration.py +0 -0
  42. {skylos-2.2.2 → skylos-2.2.3}/test/test_new_behaviours.py +0 -0
  43. {skylos-2.2.2 → skylos-2.2.3}/test/test_secrets.py +0 -0
  44. {skylos-2.2.2 → skylos-2.2.3}/test/test_skylos.py +0 -0
  45. {skylos-2.2.2 → skylos-2.2.3}/test/test_test_aware.py +0 -0
  46. {skylos-2.2.2 → skylos-2.2.3}/test/test_visitor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skylos
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: A static analysis tool for Python codebases
5
5
  Author-email: oha <aaronoh2015@gmail.com>
6
6
  Requires-Python: >=3.9
@@ -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.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.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "skylos"
7
- version = "2.2.2"
7
+ version = "2.2.3"
8
8
  requires-python = ">=3.9"
9
9
  description = "A static analysis tool for Python codebases"
10
10
  authors = [{name = "oha", email = "aaronoh2015@gmail.com"}]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="skylos",
5
- version="2.2.2",
5
+ version="2.2.3",
6
6
  packages=find_packages(),
7
7
  python_requires=">=3.9",
8
8
  install_requires=[
@@ -1,4 +1,4 @@
1
- __version__ = "2.2.2"
1
+ __version__ = "2.2.3"
2
2
 
3
3
  def analyze(*args, **kwargs):
4
4
  from .analyzer import analyze as _analyze
@@ -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
- if self._is_target(orig) and (orig.name.value == self.func_name):
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
- if self._is_target(orig) and (orig.name.value == self.func_name):
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
- if bound == self.target_name:
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
- if bound == self.target_name:
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
- if self._is_target(orig) and (orig.name.value == self.func_name):
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
- if self._is_target(orig) and (orig.name.value == self.func_name):
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
 
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
  import re, ast
3
3
  from math import log2
4
- from typing import Dict, Any, Iterable, List, Optional
5
4
 
6
5
  __all__ = ["scan_ctx"]
7
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skylos
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: A static analysis tool for Python codebases
5
5
  Author-email: oha <aaronoh2015@gmail.com>
6
6
  Requires-Python: >=3.9
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