Skip to content

Commit a7aa2d0

Browse files
committed
CM-60869 fixed linting
1 parent 6f2e1e3 commit a7aa2d0

14 files changed

Lines changed: 73 additions & 45 deletions

cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
execute_commands,
1111
)
1212
from cycode.cli.models import Document
13-
from cycode.cli.utils.path_utils import get_file_content, get_file_dir, join_paths
13+
from cycode.cli.utils.path_utils import get_file_content, join_paths
1414
from cycode.logger import get_logger
1515

1616
logger = get_logger('Maven Restore Dependencies')

tests/cli/files_collector/sca/go/test_restore_go_dependencies.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def test_generated_output_file_is_deleted_after_restore(
6060
output_path = tmp_path / GO_RESTORE_FILE_NAME
6161

6262
def side_effect(
63-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
63+
commands: list,
64+
timeout: int,
65+
output_file_path: Optional[str] = None,
66+
working_directory: Optional[str] = None,
6467
) -> str:
6568
# Go uses create_output_file_manually=True; output_file_path is provided
6669
target = output_file_path or str(output_path)

tests/cli/files_collector/sca/maven/test_restore_gradle_dependencies.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def test_generated_dep_tree_file_is_deleted_after_restore(
6060
output_path = tmp_path / BUILD_GRADLE_DEP_TREE_FILE_NAME
6161

6262
def side_effect(
63-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
63+
commands: list,
64+
timeout: int,
65+
output_file_path: Optional[str] = None,
66+
working_directory: Optional[str] = None,
6467
) -> str:
6568
# Gradle uses create_output_file_manually=True; output_file_path is provided
6669
target = output_file_path or str(output_path)
@@ -91,9 +94,7 @@ def test_preexisting_dep_tree_file_is_not_deleted(
9194
assert result is not None
9295
assert output_path.exists(), f'Pre-existing {BUILD_GRADLE_DEP_TREE_FILE_NAME} must not be deleted'
9396

94-
def test_kts_build_file_also_cleaned_up(
95-
self, restore_gradle: RestoreGradleDependencies, tmp_path: Path
96-
) -> None:
97+
def test_kts_build_file_also_cleaned_up(self, restore_gradle: RestoreGradleDependencies, tmp_path: Path) -> None:
9798
(tmp_path / BUILD_GRADLE_KTS_FILE_NAME).write_text('plugins { java }\n')
9899
doc = Document(
99100
str(tmp_path / BUILD_GRADLE_KTS_FILE_NAME),
@@ -103,7 +104,10 @@ def test_kts_build_file_also_cleaned_up(
103104
output_path = tmp_path / BUILD_GRADLE_DEP_TREE_FILE_NAME
104105

105106
def side_effect(
106-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
107+
commands: list,
108+
timeout: int,
109+
output_file_path: Optional[str] = None,
110+
working_directory: Optional[str] = None,
107111
) -> str:
108112
target = output_file_path or str(output_path)
109113
Path(target).write_text('compileClasspath\n')

tests/cli/files_collector/sca/maven/test_restore_maven_dependencies.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ def test_generated_bom_is_deleted_after_primary_restore(
6161
)
6262

6363
def side_effect(
64-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
64+
commands: list,
65+
timeout: int,
66+
output_file_path: Optional[str] = None,
67+
working_directory: Optional[str] = None,
6568
) -> str:
6669
bom_path.write_text('{"bomFormat": "CycloneDX", "components": []}')
6770
return 'output'
@@ -87,7 +90,10 @@ def test_generated_dep_tree_is_deleted_after_secondary_restore(
8790
)
8891

8992
def side_effect(
90-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
93+
commands: list,
94+
timeout: int,
95+
output_file_path: Optional[str] = None,
96+
working_directory: Optional[str] = None,
9197
) -> str:
9298
dep_tree_path.write_text('[INFO] com.example:my-app:jar:1.0.0\n')
9399
return '[INFO] BUILD SUCCESS'
@@ -99,9 +105,7 @@ def side_effect(
99105
assert result.content is not None
100106
assert not dep_tree_path.exists(), f'{MAVEN_DEP_TREE_FILE_NAME} must be deleted after restore'
101107

102-
def test_preexisting_bom_is_not_deleted(
103-
self, restore_maven: RestoreMavenDependencies, tmp_path: Path
104-
) -> None:
108+
def test_preexisting_bom_is_not_deleted(self, restore_maven: RestoreMavenDependencies, tmp_path: Path) -> None:
105109
pom_content = '<project><modelVersion>4.0.0</modelVersion></project>'
106110
(tmp_path / BUILD_MAVEN_FILE_NAME).write_text(pom_content)
107111
target_dir = tmp_path / 'target'

tests/cli/files_collector/sca/npm/test_restore_npm_dependencies.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def test_generated_lockfile_is_deleted_after_restore(
112112
lock_path = tmp_path / NPM_LOCK_FILE_NAME
113113

114114
def side_effect(
115-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
115+
commands: list,
116+
timeout: int,
117+
output_file_path: Optional[str] = None,
118+
working_directory: Optional[str] = None,
116119
) -> str:
117120
lock_path.write_text('{"lockfileVersion": 3}')
118121
return 'output'
@@ -123,9 +126,7 @@ def side_effect(
123126
assert result is not None
124127
assert not lock_path.exists(), f'{NPM_LOCK_FILE_NAME} must be deleted after restore'
125128

126-
def test_preexisting_lockfile_is_not_deleted(
127-
self, restore_npm: RestoreNpmDependencies, tmp_path: Path
128-
) -> None:
129+
def test_preexisting_lockfile_is_not_deleted(self, restore_npm: RestoreNpmDependencies, tmp_path: Path) -> None:
129130
(tmp_path / 'package.json').write_text('{"name": "test"}')
130131
lock_path = tmp_path / NPM_LOCK_FILE_NAME
131132
lock_path.write_text('{"lockfileVersion": 3, "packages": {}}')

tests/cli/files_collector/sca/npm/test_restore_pnpm_dependencies.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ def test_generated_lockfile_is_deleted_after_restore(
106106
lock_path = tmp_path / PNPM_LOCK_FILE_NAME
107107

108108
def side_effect(
109-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
109+
commands: list,
110+
timeout: int,
111+
output_file_path: Optional[str] = None,
112+
working_directory: Optional[str] = None,
110113
) -> str:
111114
lock_path.write_text('lockfileVersion: 5.4\n')
112115
return 'output'
@@ -117,9 +120,7 @@ def side_effect(
117120
assert result is not None
118121
assert not lock_path.exists(), f'{PNPM_LOCK_FILE_NAME} must be deleted after restore'
119122

120-
def test_preexisting_lockfile_is_not_deleted(
121-
self, restore_pnpm: RestorePnpmDependencies, tmp_path: Path
122-
) -> None:
123+
def test_preexisting_lockfile_is_not_deleted(self, restore_pnpm: RestorePnpmDependencies, tmp_path: Path) -> None:
123124
lock_content = 'lockfileVersion: 5.4\n\npackages:\n /pkg@1.0.0:\n resolution: {}\n'
124125
(tmp_path / 'package.json').write_text('{"name": "test"}')
125126
lock_path = tmp_path / PNPM_LOCK_FILE_NAME

tests/cli/files_collector/sca/npm/test_restore_yarn_dependencies.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ def test_generated_lockfile_is_deleted_after_restore(
106106
lock_path = tmp_path / YARN_LOCK_FILE_NAME
107107

108108
def side_effect(
109-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
109+
commands: list,
110+
timeout: int,
111+
output_file_path: Optional[str] = None,
112+
working_directory: Optional[str] = None,
110113
) -> str:
111114
lock_path.write_text('# yarn lockfile v1\n')
112115
return 'output'
@@ -117,9 +120,7 @@ def side_effect(
117120
assert result is not None
118121
assert not lock_path.exists(), f'{YARN_LOCK_FILE_NAME} must be deleted after restore'
119122

120-
def test_preexisting_lockfile_is_not_deleted(
121-
self, restore_yarn: RestoreYarnDependencies, tmp_path: Path
122-
) -> None:
123+
def test_preexisting_lockfile_is_not_deleted(self, restore_yarn: RestoreYarnDependencies, tmp_path: Path) -> None:
123124
lock_content = '# yarn lockfile v1\n\npackage@1.0.0:\n resolved "https://example.com"\n'
124125
(tmp_path / 'package.json').write_text('{"name": "test"}')
125126
lock_path = tmp_path / YARN_LOCK_FILE_NAME

tests/cli/files_collector/sca/nuget/test_restore_nuget_dependencies.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def test_generated_lockfile_is_deleted_after_restore(
5858
lock_path = tmp_path / NUGET_LOCK_FILE_NAME
5959

6060
def side_effect(
61-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
61+
commands: list,
62+
timeout: int,
63+
output_file_path: Optional[str] = None,
64+
working_directory: Optional[str] = None,
6265
) -> str:
6366
lock_path.write_text('{"version": 1, "dependencies": {}}')
6467
return 'output'
@@ -69,9 +72,7 @@ def side_effect(
6972
assert result is not None
7073
assert not lock_path.exists(), f'{NUGET_LOCK_FILE_NAME} must be deleted after restore'
7174

72-
def test_preexisting_lockfile_is_not_deleted(
73-
self, restore_nuget: RestoreNugetDependencies, tmp_path: Path
74-
) -> None:
75+
def test_preexisting_lockfile_is_not_deleted(self, restore_nuget: RestoreNugetDependencies, tmp_path: Path) -> None:
7576
lock_content = '{"version": 1, "dependencies": {"net8.0": {}}}'
7677
(tmp_path / 'MyProject.csproj').write_text('<Project Sdk="Microsoft.NET.Sdk"/>')
7778
lock_path = tmp_path / NUGET_LOCK_FILE_NAME

tests/cli/files_collector/sca/php/test_restore_composer_dependencies.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def test_existing_composer_lock_returned_directly(
6969
def test_get_lock_file_name(self, restore_composer: RestoreComposerDependencies) -> None:
7070
assert restore_composer.get_lock_file_name() == COMPOSER_LOCK_FILE_NAME
7171

72+
7273
_BASE_MODULE = 'cycode.cli.files_collector.sca.base_restore_dependencies'
7374

7475

@@ -78,13 +79,14 @@ def test_generated_lockfile_is_deleted_after_restore(
7879
) -> None:
7980
manifest_content = '{"name": "vendor/project"}\n'
8081
(tmp_path / 'composer.json').write_text(manifest_content)
81-
doc = Document(
82-
str(tmp_path / 'composer.json'), manifest_content, absolute_path=str(tmp_path / 'composer.json')
83-
)
82+
doc = Document(str(tmp_path / 'composer.json'), manifest_content, absolute_path=str(tmp_path / 'composer.json'))
8483
lock_path = tmp_path / COMPOSER_LOCK_FILE_NAME
8584

8685
def side_effect(
87-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
86+
commands: list,
87+
timeout: int,
88+
output_file_path: Optional[str] = None,
89+
working_directory: Optional[str] = None,
8890
) -> str:
8991
lock_path.write_text('{"_readme": [], "packages": []}')
9092
return 'output'

tests/cli/files_collector/sca/python/test_restore_pipenv_dependencies.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def test_generated_lockfile_is_deleted_after_restore(
8787
lock_path = tmp_path / PIPENV_LOCK_FILE_NAME
8888

8989
def side_effect(
90-
commands: list, timeout: int, output_file_path: Optional[str] = None, working_directory: Optional[str] = None
90+
commands: list,
91+
timeout: int,
92+
output_file_path: Optional[str] = None,
93+
working_directory: Optional[str] = None,
9194
) -> str:
9295
lock_path.write_text('{"_meta": {}, "default": {}, "develop": {}}')
9396
return 'output'
@@ -105,7 +108,9 @@ def test_preexisting_lockfile_is_not_deleted(
105108
(tmp_path / 'Pipfile').write_text('[[source]]\nname = "pypi"\n')
106109
lock_path = tmp_path / PIPENV_LOCK_FILE_NAME
107110
lock_path.write_text(lock_content)
108-
doc = Document(str(tmp_path / 'Pipfile'), '[[source]]\nname = "pypi"\n', absolute_path=str(tmp_path / 'Pipfile'))
111+
doc = Document(
112+
str(tmp_path / 'Pipfile'), '[[source]]\nname = "pypi"\n', absolute_path=str(tmp_path / 'Pipfile')
113+
)
109114

110115
result = restore_pipenv.try_restore_dependencies(doc)
111116

0 commit comments

Comments
 (0)