diff --git a/test/runner/lib/sanity/pslint.py b/test/runner/lib/sanity/pslint.py index 4a9655482a..b5cc0dd6b4 100644 --- a/test/runner/lib/sanity/pslint.py +++ b/test/runner/lib/sanity/pslint.py @@ -66,7 +66,7 @@ class PslintTest(SanitySingleVersion): ignore[path][code] = line - paths = sorted(i.path for i in targets.include if os.path.splitext(i.path)[1] in ('.ps1', '.psm1') and i.path not in skip_paths) + paths = sorted(i.path for i in targets.include if os.path.splitext(i.path)[1] in ('.ps1', '.psm1', '.psd1') and i.path not in skip_paths) if not paths: return SanitySkipped(self.name) diff --git a/test/sanity/pslint/ignore.txt b/test/sanity/pslint/ignore.txt index 2597d15c1b..ef66e4d697 100644 --- a/test/sanity/pslint/ignore.txt +++ b/test/sanity/pslint/ignore.txt @@ -1,6 +1,5 @@ examples/scripts/ConfigureRemotingForAnsible.ps1 PSAvoidUsingCmdletAliases examples/scripts/ConfigureRemotingForAnsible.ps1 PSUseBOMForUnicodeEncodedFile -examples/scripts/ConfigureRemotingForAnsible.ps1 PSUseShouldProcessForStateChangingFunctions examples/scripts/upgrade_to_ps3.ps1 PSAvoidUsingWriteHost examples/scripts/upgrade_to_ps3.ps1 PSUseApprovedVerbs lib/ansible/module_utils/powershell/Ansible.ModuleUtils.ArgvParser.psm1 PSUseApprovedVerbs @@ -12,16 +11,13 @@ lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 PSAvoidUsing lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 PSAvoidUsingWMICmdlet lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 PSPossibleIncorrectComparisonWithNull lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 PSUseApprovedVerbs -lib/ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 PSUseShouldProcessForStateChangingFunctions lib/ansible/module_utils/powershell/Ansible.ModuleUtils.LinkUtil.psm1 PSUseApprovedVerbs -lib/ansible/module_utils/powershell/Ansible.ModuleUtils.LinkUtil.psm1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/setup.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/setup.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/setup.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/setup.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_certificate_store.ps1 PSAvoidUsingPlainTextForPassword lib/ansible/modules/windows/win_certificate_store.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_certificate_store.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_chocolatey.ps1 PSAvoidUsingConvertToSecureStringWithPlainText lib/ansible/modules/windows/win_chocolatey.ps1 PSAvoidUsingPlainTextForPassword lib/ansible/modules/windows/win_chocolatey.ps1 PSAvoidUsingUserNameAndPassWordParams @@ -39,7 +35,6 @@ lib/ansible/modules/windows/win_dns_client.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_dns_client.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_dns_client.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_dns_client.ps1 PSUseDeclaredVarsMoreThanAssignments -lib/ansible/modules/windows/win_dns_client.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingConvertToSecureStringWithPlainText lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_domain.ps1 PSUseApprovedVerbs @@ -61,7 +56,6 @@ lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_domain_membership.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_domain_membership.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_domain_membership.ps1 PSUseDeclaredVarsMoreThanAssignments -lib/ansible/modules/windows/win_domain_membership.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_domain_user.ps1 PSAvoidUsingConvertToSecureStringWithPlainText lib/ansible/modules/windows/win_domain_user.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_dsc.ps1 PSAvoidUsingCmdletAliases @@ -74,7 +68,6 @@ lib/ansible/modules/windows/win_feature.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_feature.ps1 PSAvoidUsingInvokeExpression lib/ansible/modules/windows/win_feature.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_file.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_file.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_file_version.ps1 PSUseBOMForUnicodeEncodedFile lib/ansible/modules/windows/win_find.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_find.ps1 PSAvoidUsingWMICmdlet @@ -82,7 +75,6 @@ lib/ansible/modules/windows/win_find.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_firewall_rule.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_firewall_rule.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_firewall_rule.ps1 PSUseApprovedVerbs -lib/ansible/modules/windows/win_firewall_rule.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_get_url.ps1 PSAvoidUsingPlainTextForPassword lib/ansible/modules/windows/win_get_url.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_get_url.ps1 PSUseApprovedVerbs @@ -105,7 +97,6 @@ lib/ansible/modules/windows/win_iis_website.ps1 PSUseDeclaredVarsMoreThanAssignm lib/ansible/modules/windows/win_lineinfile.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_mapped_drive.ps1 PSAvoidUsingConvertToSecureStringWithPlainText lib/ansible/modules/windows/win_mapped_drive.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_mapped_drive.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_nssm.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_nssm.ps1 PSAvoidUsingInvokeExpression lib/ansible/modules/windows/win_nssm.ps1 PSAvoidUsingPlainTextForPassword @@ -124,28 +115,22 @@ lib/ansible/modules/windows/win_pagefile.ps1 PSAvoidUsingPositionalParameters lib/ansible/modules/windows/win_pagefile.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_pagefile.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_pagefile.ps1 PSUseDeclaredVarsMoreThanAssignments -lib/ansible/modules/windows/win_pagefile.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_pagefile.ps1 PSUseSupportsShouldProcess -lib/ansible/modules/windows/win_path.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_power_plan.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_product_facts.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_psexec.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_psexec.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_psmodule.ps1 PSAvoidUsingCmdletAliases -lib/ansible/modules/windows/win_psmodule.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_rabbitmq_plugin.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_rabbitmq_plugin.ps1 PSAvoidUsingInvokeExpression lib/ansible/modules/windows/win_reg_stat.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_regedit.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_region.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_region.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_region.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_robocopy.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_route.ps1 PSAvoidUsingCmdletAliases -lib/ansible/modules/windows/win_route.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_scheduled_task.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_scheduled_task.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_scheduled_task.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_scheduled_task_stat.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_scheduled_task_stat.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_scheduled_task_stat.ps1 PSUseDeclaredVarsMoreThanAssignments @@ -156,7 +141,6 @@ lib/ansible/modules/windows/win_service.ps1 PSAvoidUsingPlainTextForPassword lib/ansible/modules/windows/win_service.ps1 PSAvoidUsingUserNameAndPassWordParams lib/ansible/modules/windows/win_service.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_service.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_service.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_shell.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_shell.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_shortcut.ps1 PSPossibleIncorrectComparisonWithNull @@ -164,14 +148,12 @@ lib/ansible/modules/windows/win_stat.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_stat.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_stat.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_tempfile.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_tempfile.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_unzip.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_unzip.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_updates.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_uri.ps1 PSAvoidUsingConvertToSecureStringWithPlainText lib/ansible/modules/windows/win_user.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_user.ps1 PSPossibleIncorrectComparisonWithNull -lib/ansible/modules/windows/win_user.ps1 PSUseShouldProcessForStateChangingFunctions lib/ansible/modules/windows/win_wait_for.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_wait_for.ps1 PSPossibleIncorrectComparisonWithNull lib/ansible/modules/windows/win_wakeonlan.ps1 PSAvoidUsingCmdletAliases @@ -182,7 +164,6 @@ test/integration/targets/uri/files/testserver.ps1 PSPossibleIncorrectComparisonW test/integration/targets/win_audit_rule/library/test_get_audit_rule.ps1 PSAvoidUsingCmdletAliases test/integration/targets/win_dsc/library/test_win_dsc_iis_info.ps1 PSPossibleIncorrectComparisonWithNull test/integration/targets/win_dsc/templates/ANSIBLE_xTestResource.psm1 PSAvoidDefaultValueForMandatoryParameter -test/integration/targets/win_dsc/templates/ANSIBLE_xTestResource.psm1 PSUseShouldProcessForStateChangingFunctions test/integration/targets/win_iis_webbinding/library/test_get_webbindings.ps1 PSUseApprovedVerbs test/integration/targets/win_module_utils/library/argv_parser_test.ps1 PSUseApprovedVerbs test/integration/targets/win_module_utils/library/camel_conversion_test.ps1 PSUseDeclaredVarsMoreThanAssignments diff --git a/test/sanity/pslint/pslint.ps1 b/test/sanity/pslint/pslint.ps1 index 00229476af..8f7beab294 100755 --- a/test/sanity/pslint/pslint.ps1 +++ b/test/sanity/pslint/pslint.ps1 @@ -8,7 +8,7 @@ $ErrorActionPreference = "Stop" $Results = @() ForEach ($Path in $Args) { - $Results += Invoke-ScriptAnalyzer -Path $Path + $Results += Invoke-ScriptAnalyzer -Path $Path -Setting $PSScriptRoot/settings.psd1 } ConvertTo-Json -InputObject $Results diff --git a/test/sanity/pslint/settings.psd1 b/test/sanity/pslint/settings.psd1 new file mode 100644 index 0000000000..234ccbd957 --- /dev/null +++ b/test/sanity/pslint/settings.psd1 @@ -0,0 +1,5 @@ +@{ + ExcludeRules=@( + 'PSUseShouldProcessForStateChangingFunctions' + ) +}