diff --git a/.gitignore b/.gitignore index 55f89a0d..d88be7e6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +.python-version # PyInstaller # Usually these files are written by a python script from a template diff --git a/javascript.eslintrc.yaml b/javascript.eslintrc.yaml new file mode 100644 index 00000000..6e1a123c --- /dev/null +++ b/javascript.eslintrc.yaml @@ -0,0 +1,6 @@ +env: + es6: true +extends: +- eslint:recommended +plugins: +- prettier diff --git a/secureli/modules/core/core_services/scanner.py b/secureli/modules/core/core_services/scanner.py index e8ccd976..e5747201 100644 --- a/secureli/modules/core/core_services/scanner.py +++ b/secureli/modules/core/core_services/scanner.py @@ -82,7 +82,9 @@ def _parse_scan_ouput(self, folder_path: Path, output: str = "") -> scan.ScanOut files = self._find_file_names(failure_output_list=failure_output_list) for file in files: - failures.append(scan.ScanFailure(id=id, file=file, repo=repo)) + failures.append( + scan.ScanFailure(id=id, file=file, repo=repo, exitCode=id) + ) return scan.ScanOutput(failures=failures) diff --git a/secureli/modules/pii_scanner/pii_scanner.py b/secureli/modules/pii_scanner/pii_scanner.py index b8c7a77e..d8c3c137 100644 --- a/secureli/modules/pii_scanner/pii_scanner.py +++ b/secureli/modules/pii_scanner/pii_scanner.py @@ -144,7 +144,10 @@ def _generate_scan_failures( for pii_found_file in pii_found_files: failures.append( scan.ScanFailure( - id="pii_scan", file=pii_found_file, repo=SECURELI_GITHUB + id="pii_scan", + file=pii_found_file, + repo=SECURELI_GITHUB, + exitCode="PII_SCAN_ISSUES_DETECTED", ) ) return failures diff --git a/secureli/modules/shared/models/exit_codes.py b/secureli/modules/shared/models/exit_codes.py index ea797bc3..01015f5f 100644 --- a/secureli/modules/shared/models/exit_codes.py +++ b/secureli/modules/shared/models/exit_codes.py @@ -3,3 +3,10 @@ class ExitCode(Enum): SCAN_ISSUES_DETECTED = 3 + PII_SCAN_ISSUES_DETECTED = 4 + TYPE_ERROR = 5 + NAME_ERROR = 6 + VALIDATION_ERROR = 7 + CONFIG_ERROR = 8 + DICT_ERROR = 9 + MISSING_ERROR = 10 diff --git a/secureli/modules/shared/models/scan.py b/secureli/modules/shared/models/scan.py index 300787b3..63bc0dde 100644 --- a/secureli/modules/shared/models/scan.py +++ b/secureli/modules/shared/models/scan.py @@ -21,6 +21,7 @@ class ScanFailure(pydantic.BaseModel): repo: str id: str file: str + exitCode: str class ScanOutput(pydantic.BaseModel): diff --git a/tests/actions/test_action.py b/tests/actions/test_action.py index 5f0ef971..c66674ed 100644 --- a/tests/actions/test_action.py +++ b/tests/actions/test_action.py @@ -138,7 +138,11 @@ def test_that_initialize_repo_install_flow_displays_security_analysis_results( mock_hooks_scanner.scan_repo.return_value = ScanResult( successful=False, output="Detect secrets...Failed", - failures=[ScanFailure(repo="repo", id="id", file="file")], + failures=[ + ScanFailure( + repo="repo", id="id", file="file", exitCode="PII_SCAN_ISSUES_DETECTED" + ) + ], ) action.verify_install( test_folder_path, diff --git a/tests/modules/shared/utilities/test_usage_stats.py b/tests/modules/shared/utilities/test_usage_stats.py index 7d954bc0..140c6c79 100644 --- a/tests/modules/shared/utilities/test_usage_stats.py +++ b/tests/modules/shared/utilities/test_usage_stats.py @@ -13,9 +13,24 @@ def test_that_convert_failures_to_failure_count_returns_correct_count(): list_of_failure = [ - ScanFailure(id="testfailid1", file="testfile1", repo="testrepo1"), - ScanFailure(id="testfailid1", file="testfile2", repo="testrepo1"), - ScanFailure(id="testfailid2", file="testfile1", repo="testrepo1"), + ScanFailure( + id="testfailid1", + file="testfile1", + repo="testrepo1", + exitCode="SCAN_ISSUES_DETECTED", + ), + ScanFailure( + id="testfailid1", + file="testfile2", + repo="testrepo1", + exitCode="PII_SCAN_ISSUES_DETECTED", + ), + ScanFailure( + id="testfailid2", + file="testfile1", + repo="testrepo1", + exitCode="VALIDATION_ERROR", + ), ] result = utilities.convert_failures_to_failure_count(list_of_failure) diff --git a/typescript.eslintrc.yaml b/typescript.eslintrc.yaml new file mode 100644 index 00000000..91a59cab --- /dev/null +++ b/typescript.eslintrc.yaml @@ -0,0 +1,7 @@ +extends: +- eslint:recommended +- plugin:@typescript-eslint/recommended +- prettier +parser: '@typescript-eslint/parser' +plugins: +- '@typescript-eslint'