cycode 3.4.2.dev1__py3-none-any.whl → 3.4.3.dev1__py3-none-any.whl

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.
cycode/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '3.4.2.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
1
+ __version__ = '3.4.3.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -212,24 +212,33 @@ def parse_pre_receive_input() -> str:
212
212
 
213
213
 
214
214
  def get_diff_file_path(diff: 'Diff', relative: bool = False, repo: Optional['Repo'] = None) -> Optional[str]:
215
- if relative:
216
- # relative to the repository root
217
- return diff.b_path if diff.b_path else diff.a_path
218
-
219
- # Try blob-based paths first (most reliable when available)
220
- if diff.b_blob:
221
- return diff.b_blob.abspath
222
- if diff.a_blob:
223
- return diff.a_blob.abspath
224
-
225
- # Fallback: construct an absolute path from a relative path
226
- # This handles renames and other cases where blobs might be None
227
- if repo and repo.working_tree_dir:
228
- target_path = diff.b_path if diff.b_path else diff.a_path
229
- if target_path:
230
- return os.path.abspath(os.path.join(repo.working_tree_dir, target_path))
231
-
232
- return None
215
+ """Get the file path from a git Diff object.
216
+
217
+ Args:
218
+ diff: Git Diff object representing the file change
219
+ relative: If True, return the path relative to the repository root;
220
+ otherwise, return an absolute path IF possible
221
+ repo: Optional Git Repo object, used to resolve absolute paths
222
+
223
+ Note:
224
+ It tries to get the absolute path, falling back to relative paths. `relative` flag forces relative paths.
225
+
226
+ One case of relative paths is when the repository is bare and does not have a working tree directory.
227
+ """
228
+ # try blob-based paths first (most reliable when available)
229
+ blob = diff.b_blob if diff.b_blob else diff.a_blob
230
+ if blob:
231
+ if relative:
232
+ return blob.path
233
+ if repo and repo.working_tree_dir:
234
+ return blob.abspath
235
+
236
+ path = diff.b_path if diff.b_path else diff.a_path # relative path within the repo
237
+ if not relative and path and repo and repo.working_tree_dir:
238
+ # convert to the absolute path using the repo's working tree directory
239
+ path = os.path.join(repo.working_tree_dir, path)
240
+
241
+ return path
233
242
 
234
243
 
235
244
  def get_diff_file_content(diff: 'Diff') -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cycode
3
- Version: 3.4.2.dev1
3
+ Version: 3.4.3.dev1
4
4
  Summary: Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.
5
5
  Home-page: https://github.com/cycodehq/cycode-cli
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- cycode/__init__.py,sha256=tyk-cmPAYJh__0HAgSy_VEBt6aZM1W1sW8kKzQPjso0,114
1
+ cycode/__init__.py,sha256=zAIW50L6NyQsZB1PsBUHoMMngFFuQzbuK1ksKCTylUY,114
2
2
  cycode/__main__.py,sha256=Z3bD5yrA7yPvAChcADQrqCaZd0ChGI1gdiwALwbWJ6U,104
3
3
  cycode/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cycode/cli/app.py,sha256=UC5A5TKIvlxOYKERfJykN8apTT0VyMY5pUjRh_LM-dw,6098
@@ -70,7 +70,7 @@ cycode/cli/exceptions/handle_errors.py,sha256=9ZiDbHswXLe0TscUqZL9Or5Jq2AlYtzGb6
70
70
  cycode/cli/exceptions/handle_report_sbom_errors.py,sha256=bi0EizHtQLL-ovhHRH98CZ7qXdDPLTYnI59Jn1Y5c0E,926
71
71
  cycode/cli/exceptions/handle_scan_errors.py,sha256=-QIYvbBXmZVOvAdNwGYwAdmBma6Z_pPpS0a77aDICp8,1916
72
72
  cycode/cli/files_collector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- cycode/cli/files_collector/commit_range_documents.py,sha256=rEdvXzO_wue3Tpt0-E-o_GqN12yRGxZvJ0tRmEmQX7U,12444
73
+ cycode/cli/files_collector/commit_range_documents.py,sha256=yDtUXXZ0Xk0k2Fau4cJ_Dzv1XV5QLLaLVbew2R0nxp4,12919
74
74
  cycode/cli/files_collector/file_excluder.py,sha256=FhBnYF889BOwx3fRjNyBaFix6-65jCejglf8MmiVxSk,7300
75
75
  cycode/cli/files_collector/iac/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
76
  cycode/cli/files_collector/iac/tf_content_generator.py,sha256=a65zA0Ejv_LSA5jac2omHck4IKoNS5MX6v6ltF2wo4E,2873
@@ -157,8 +157,8 @@ cycode/cyclient/report_client.py,sha256=h12pz3vWCwDF73BhqFX7iDSxBgQDFwkiGh3hmul2
157
157
  cycode/cyclient/scan_client.py,sha256=nQJyt34Bne8UAQNj9OHSgvoCfI1EJFKNaEeeGPnrKcg,12471
158
158
  cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
159
159
  cycode/logger.py,sha256=xAzpkWLZhixO4egRcYn4HXM9lIfx5wHdpkHxNc5jrX8,2225
160
- cycode-3.4.2.dev1.dist-info/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
161
- cycode-3.4.2.dev1.dist-info/METADATA,sha256=ebfwDPm_9tpFqZEBq3-HebH9uJLqo_l4A_MUYNW13K4,71912
162
- cycode-3.4.2.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
- cycode-3.4.2.dev1.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
164
- cycode-3.4.2.dev1.dist-info/RECORD,,
160
+ cycode-3.4.3.dev1.dist-info/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
161
+ cycode-3.4.3.dev1.dist-info/METADATA,sha256=Yx4WIy510N2Od0G0pCxC5zTae_9gHfviLQzKfFpDdyI,71912
162
+ cycode-3.4.3.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
+ cycode-3.4.3.dev1.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
164
+ cycode-3.4.3.dev1.dist-info/RECORD,,