diff --git a/secureli/actions/action.py b/secureli/actions/action.py index 12ec340f..a48e5245 100644 --- a/secureli/actions/action.py +++ b/secureli/actions/action.py @@ -148,13 +148,13 @@ def _install_secureli(self, folder_path: Path, always_yes: bool) -> VerifyResult languages = list(analyze_result.language_proportions.keys()) self.action_deps.echo.print(f"Overall Detected Languages: {languages}") - linter_languages = self._prompt_get_lint_config_languages( + lint_languages = self._prompt_get_lint_config_languages( languages, always_yes ) language_config_result = ( self.action_deps.language_support._build_pre_commit_config( - languages, linter_languages + languages, lint_languages ) ) @@ -172,7 +172,7 @@ def _install_secureli(self, folder_path: Path, always_yes: bool) -> VerifyResult config = SecureliConfig( languages=languages, - lint_languages=linter_languages, + lint_languages=lint_languages, version_installed=metadata.version, ) self.action_deps.secureli_config.save(config) @@ -218,17 +218,17 @@ def _prompt_get_lint_config_languages( if always_yes: return set(languages) - linter_languages: set[str] = set() + lint_languages: set[str] = set() for language in languages: add_linter = self.action_deps.echo.confirm( - f"Add lint pre-commit(s) for {language}?", default_response=True + f"Add lint pre-commit hook(s) for {language}?", default_response=True ) if add_linter: - linter_languages.add(language) + lint_languages.add(language) - return linter_languages + return lint_languages def _update_secureli(self, always_yes: bool): """ diff --git a/secureli/services/language_support.py b/secureli/services/language_support.py index a70ef434..30c7b43e 100644 --- a/secureli/services/language_support.py +++ b/secureli/services/language_support.py @@ -136,7 +136,7 @@ def secret_detection_hook_id(self, languages: list[str]) -> Optional[str]: :param languages: list of languages to check support for :return: The hook ID to use for secrets analysis if supported, otherwise None. """ - # linter_languages param can be an empty set since we only need secrets detection hooks + # lint_languages param can be an empty set since we only need secrets detection hooks language_config = self._build_pre_commit_config(languages, set()) config = language_config.config_data secrets_detecting_repos_data = self.data_loader( @@ -193,23 +193,23 @@ def create_repo(raw_repo: dict) -> Repo: return HookConfiguration(repos=repos) def _build_pre_commit_config( - self, languages: list[str], linter_languages: set[str] + self, languages: list[str], lint_languages: set[str] ) -> BuildConfigResult: """ Builds the final .pre-commit-config.yaml from all supported repo languages. Also returns any and all linter configuration data. :param languages: list of languages to get calculated configuration for. - :param linter_languages: set of languages to add lint pre-commit hooks for. + :param lint_languages: set of languages to add lint pre-commit hooks for. :return: BuildConfigResult """ config_data = [] successful_languages: list[str] = [] linter_configs: list[LinterConfig] = [] config_languages = [*languages, "base"] - config_linter_languages = set([*linter_languages, "base"]) + config_lint_languages = set([*lint_languages, "base"]) for language in config_languages: - include_linter = language in config_linter_languages + include_linter = language in config_lint_languages result = self.language_config.get_language_config(language, include_linter) if result.config_data: successful_languages.append(language) diff --git a/tests/services/test_language_support.py b/tests/services/test_language_support.py index 61532221..f535ec2a 100644 --- a/tests/services/test_language_support.py +++ b/tests/services/test_language_support.py @@ -246,10 +246,10 @@ def mock_loader_side_effect(resource): mock_data_loader.side_effect = mock_loader_side_effect languages = ["RadLang"] - linter_languages = set(languages) + lint_languages = set(languages) build_config_result = language_support_service._build_pre_commit_config( - languages, linter_languages + languages, lint_languages ) metadata = language_support_service.apply_support(["RadLang"], build_config_result) @@ -278,10 +278,10 @@ def test_that_language_support_throws_exception_when_language_config_file_cannot ) languages = ["RadLang"] - linter_languages = set(languages) + lint_languages = set(languages) build_config_result = language_support_service._build_pre_commit_config( - languages, linter_languages + languages, lint_languages ) mock_open.side_effect = IOError @@ -307,10 +307,10 @@ def test_that_language_support_handles_invalid_language_config( ) languages = ["RadLang"] - linter_languages = set(languages) + lint_languages = set(languages) build_config_result = language_support_service._build_pre_commit_config( - languages, linter_languages + languages, lint_languages ) metadata = language_support_service.apply_support(languages, build_config_result) @@ -337,10 +337,10 @@ def test_that_language_support_handles_empty_repos_list( mock_data_loader.return_value = "" languages = ["RadLang"] - linter_languages = set(languages) + lint_languages = set(languages) build_config_result = language_support_service._build_pre_commit_config( - languages, linter_languages + languages, lint_languages ) assert build_config_result.config_data["repos"] == []