Skip to content

Commit a4010a9

Browse files
authored
CM-41380 - Fix SBOM report creation (#258)
1 parent 68ad6c8 commit a4010a9

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ python cycode/cli/main.py
5353

5454
### Code linting and formatting
5555

56-
We use `ruff` and `ruff format`.
56+
We use `ruff`.
5757
It is configured well, so you don’t need to do anything.
5858
You can see all enabled rules in the `pyproject.toml` file.
5959
Both tests and the main codebase are checked.
@@ -63,7 +63,7 @@ GitHub Actions will check that your code is formatted well. You can run it local
6363

6464
```shell
6565
# lint
66-
poetry run ruff .
66+
poetry run ruff check .
6767
# format
6868
poetry run ruff format .
6969
```

cycode/cli/files_collector/sca/sca_code_scanner.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -93,27 +93,28 @@ def try_restore_dependencies(
9393
restore_dependencies: 'BaseRestoreDependencies',
9494
document: Document,
9595
) -> None:
96-
if restore_dependencies.is_project(document):
97-
restore_dependencies_document = restore_dependencies.restore(document)
98-
if restore_dependencies_document is None:
99-
logger.warning('Error occurred while trying to generate dependencies tree, %s', {'filename': document.path})
100-
return
101-
102-
if restore_dependencies_document.content is None:
103-
logger.warning('Error occurred while trying to generate dependencies tree, %s', {'filename': document.path})
104-
restore_dependencies_document.content = ''
105-
else:
106-
is_monitor_action = context.obj['monitor']
107-
108-
project_path = get_path_from_context(context)
109-
110-
manifest_file_path = get_manifest_file_path(document, is_monitor_action, project_path)
111-
logger.debug('Succeeded to generate dependencies tree on path: %s', manifest_file_path)
112-
113-
if restore_dependencies_document.path in documents_to_add:
114-
logger.debug('Duplicate document on restore for path: %s', restore_dependencies_document.path)
115-
else:
116-
documents_to_add[restore_dependencies_document.path] = restore_dependencies_document
96+
if not restore_dependencies.is_project(document):
97+
return
98+
99+
restore_dependencies_document = restore_dependencies.restore(document)
100+
if restore_dependencies_document is None:
101+
logger.warning('Error occurred while trying to generate dependencies tree, %s', {'filename': document.path})
102+
return
103+
104+
if restore_dependencies_document.content is None:
105+
logger.warning('Error occurred while trying to generate dependencies tree, %s', {'filename': document.path})
106+
restore_dependencies_document.content = ''
107+
else:
108+
is_monitor_action = context.obj.get('monitor', False)
109+
project_path = get_path_from_context(context)
110+
111+
manifest_file_path = get_manifest_file_path(document, is_monitor_action, project_path)
112+
logger.debug('Succeeded to generate dependencies tree on path: %s', manifest_file_path)
113+
114+
if restore_dependencies_document.path in documents_to_add:
115+
logger.debug('Duplicate document on restore for path: %s', restore_dependencies_document.path)
116+
else:
117+
documents_to_add[restore_dependencies_document.path] = restore_dependencies_document
117118

118119

119120
def add_dependencies_tree_document(

0 commit comments

Comments
 (0)