ps-lint: ignore rules that are not relevant to Ansible (#46376)

This commit is contained in:
Jordan Borean 2018-10-04 05:55:02 +10:00 committed by GitHub
parent 1de88cbaa9
commit ba638f40cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 40 deletions

View file

@ -71,8 +71,6 @@ Function Get-CommonChocolateyArguments {
} }
Function Get-InstallChocolateyArguments { Function Get-InstallChocolateyArguments {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Justification="We need to use the plaintext pass in the cmdline, also using a SecureString here doesn't make sense considering the source is not secure")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification="See above")]
param( param(
[bool]$allow_downgrade, [bool]$allow_downgrade,
[bool]$allow_empty_checksums, [bool]$allow_empty_checksums,
@ -165,9 +163,6 @@ Function Get-InstallChocolateyArguments {
} }
Function Install-Chocolatey { Function Install-Chocolatey {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Justification="We need to use the plaintext pass in the env vars, also using a SecureString here doesn't make sense considering the source is not secure")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification="See above")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "", Justification="See above")]
param( param(
[String]$proxy_url, [String]$proxy_url,
[String]$proxy_username, [String]$proxy_username,
@ -317,8 +312,6 @@ Function Get-ChocolateyPackageVersion {
} }
Function Update-ChocolateyPackage { Function Update-ChocolateyPackage {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Justification="We need to use the plaintext pass in the cmdline, also using a SecureString here doesn't make sense considering the source is not secure")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification="See above")]
param( param(
[Parameter(Mandatory=$true)][String]$choco_path, [Parameter(Mandatory=$true)][String]$choco_path,
[Parameter(Mandatory=$true)][String[]]$packages, [Parameter(Mandatory=$true)][String[]]$packages,
@ -378,8 +371,6 @@ Function Update-ChocolateyPackage {
} }
Function Install-ChocolateyPackage { Function Install-ChocolateyPackage {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Justification="We need to use the plaintext pass in the cmdline, also using a SecureString here doesn't make sense considering the source is not secure")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification="See above")]
param( param(
[Parameter(Mandatory=$true)][String]$choco_path, [Parameter(Mandatory=$true)][String]$choco_path,
[Parameter(Mandatory=$true)][String[]]$packages, [Parameter(Mandatory=$true)][String[]]$packages,

View file

@ -109,8 +109,6 @@ Function Get-ChocolateySources {
} }
Function New-ChocolateySource { Function New-ChocolateySource {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Justification="We need to use the plaintext pass in the cmdline, also using a SecureString here doesn't make sense considering the source is not secure")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification="See above")]
param( param(
$choco_app, $choco_app,
$name, $name,

View file

@ -41,8 +41,6 @@ function Get-Group($grp) {
} }
Function Test-LocalCredential { Function Test-LocalCredential {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Justification="We need to use the plaintext pass in the Win32 call, also the source isn't a secure string to using that is just a waste of time/code")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "", Justification="See above")]
param([String]$Username, [String]$Password) param([String]$Username, [String]$Password)
$platform_util = @' $platform_util = @'

View file

@ -1,5 +1,4 @@
examples/scripts/ConfigureRemotingForAnsible.ps1 PSAvoidUsingCmdletAliases examples/scripts/ConfigureRemotingForAnsible.ps1 PSAvoidUsingCmdletAliases
examples/scripts/ConfigureRemotingForAnsible.ps1 PSUseBOMForUnicodeEncodedFile
examples/scripts/upgrade_to_ps3.ps1 PSAvoidUsingWriteHost examples/scripts/upgrade_to_ps3.ps1 PSAvoidUsingWriteHost
examples/scripts/upgrade_to_ps3.ps1 PSUseApprovedVerbs examples/scripts/upgrade_to_ps3.ps1 PSUseApprovedVerbs
lib/ansible/module_utils/powershell/Ansible.ModuleUtils.ArgvParser.psm1 PSUseApprovedVerbs lib/ansible/module_utils/powershell/Ansible.ModuleUtils.ArgvParser.psm1 PSUseApprovedVerbs
@ -11,7 +10,6 @@ lib/ansible/module_utils/powershell/Ansible.ModuleUtils.LinkUtil.psm1 PSUseAppro
lib/ansible/modules/windows/setup.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/setup.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/setup.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/setup.ps1 PSAvoidUsingEmptyCatchBlock
lib/ansible/modules/windows/setup.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/setup.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_certificate_store.ps1 PSAvoidUsingPlainTextForPassword
lib/ansible/modules/windows/win_copy.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_copy.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_copy.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_copy.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_dns_client.ps1 PSAvoidGlobalVars lib/ansible/modules/windows/win_dns_client.ps1 PSAvoidGlobalVars
@ -19,28 +17,18 @@ lib/ansible/modules/windows/win_dns_client.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_dns_client.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_dns_client.ps1 PSAvoidUsingWMICmdlet
lib/ansible/modules/windows/win_dns_client.ps1 PSUseApprovedVerbs 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 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingEmptyCatchBlock
lib/ansible/modules/windows/win_domain.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_domain.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_domain.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_domain.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidGlobalVars lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidGlobalVars
lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidUsingPlainTextForPassword
lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidUsingUserNameAndPassWordParams
lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidUsingWMICmdlet
lib/ansible/modules/windows/win_domain_controller.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_domain_controller.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_domain_controller.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_domain_controller.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_domain_group.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidGlobalVars lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidGlobalVars
lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingPlainTextForPassword
lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingUserNameAndPassWordParams
lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingWMICmdlet
lib/ansible/modules/windows/win_domain_membership.ps1 PSUseApprovedVerbs 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 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_domain_user.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_dsc.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_dsc.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_dsc.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_dsc.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_dsc.ps1 PSAvoidUsingEmptyCatchBlock
lib/ansible/modules/windows/win_dsc.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_dsc.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_eventlog.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_eventlog.ps1 PSUseDeclaredVarsMoreThanAssignments
@ -48,27 +36,16 @@ lib/ansible/modules/windows/win_find.ps1 PSAvoidUsingEmptyCatchBlock
lib/ansible/modules/windows/win_find.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_find.ps1 PSAvoidUsingWMICmdlet
lib/ansible/modules/windows/win_firewall_rule.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_firewall_rule.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_firewall_rule.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_firewall_rule.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_get_url.ps1 PSAvoidUsingPlainTextForPassword
lib/ansible/modules/windows/win_get_url.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_get_url.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_get_url.ps1 PSUseSupportsShouldProcess lib/ansible/modules/windows/win_get_url.ps1 PSUseSupportsShouldProcess
lib/ansible/modules/windows/win_hotfix.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_hotfix.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_iis_virtualdirectory.ps1 PSUseBOMForUnicodeEncodedFile
lib/ansible/modules/windows/win_iis_webapplication.ps1 PSUseBOMForUnicodeEncodedFile
lib/ansible/modules/windows/win_iis_webapppool.ps1 PSUseBOMForUnicodeEncodedFile
lib/ansible/modules/windows/win_iis_webbinding.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_iis_webbinding.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_iis_webbinding.ps1 PSUseBOMForUnicodeEncodedFile
lib/ansible/modules/windows/win_iis_website.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_iis_website.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_iis_website.ps1 PSAvoidUsingPositionalParameters lib/ansible/modules/windows/win_iis_website.ps1 PSAvoidUsingPositionalParameters
lib/ansible/modules/windows/win_iis_website.ps1 PSUseBOMForUnicodeEncodedFile
lib/ansible/modules/windows/win_iis_website.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_iis_website.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_mapped_drive.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_nssm.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_nssm.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_nssm.ps1 PSAvoidUsingPlainTextForPassword
lib/ansible/modules/windows/win_nssm.ps1 PSAvoidUsingUserNameAndPassWordParams
lib/ansible/modules/windows/win_nssm.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_nssm.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_nssm.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_nssm.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_package.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_package.ps1 PSAvoidUsingPlainTextForPassword
lib/ansible/modules/windows/win_package.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_package.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_package.ps1 PSUsePSCredentialType lib/ansible/modules/windows/win_package.ps1 PSUsePSCredentialType
lib/ansible/modules/windows/win_pagefile.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_pagefile.ps1 PSAvoidUsingCmdletAliases
@ -86,15 +63,12 @@ lib/ansible/modules/windows/win_scheduled_task_stat.ps1 PSAvoidUsingCmdletAliase
lib/ansible/modules/windows/win_scheduled_task_stat.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_scheduled_task_stat.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_security_policy.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_security_policy.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_security_policy.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_security_policy.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_service.ps1 PSAvoidUsingPlainTextForPassword
lib/ansible/modules/windows/win_service.ps1 PSAvoidUsingUserNameAndPassWordParams
lib/ansible/modules/windows/win_shell.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_shell.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_shell.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_shell.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_stat.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_stat.ps1 PSAvoidUsingWMICmdlet
lib/ansible/modules/windows/win_stat.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_stat.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_unzip.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_unzip.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_unzip.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_unzip.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_uri.ps1 PSAvoidUsingConvertToSecureStringWithPlainText
lib/ansible/modules/windows/win_uri.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_uri.ps1 PSAvoidUsingEmptyCatchBlock
lib/ansible/modules/windows/win_user.ps1 PSAvoidUsingCmdletAliases lib/ansible/modules/windows/win_user.ps1 PSAvoidUsingCmdletAliases
lib/ansible/modules/windows/win_wait_for.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_wait_for.ps1 PSAvoidUsingEmptyCatchBlock

View file

@ -2,6 +2,13 @@
ExcludeRules=@( ExcludeRules=@(
'PSPossibleIncorrectComparisonWithNull', 'PSPossibleIncorrectComparisonWithNull',
'PSUseOutputTypeCorrectly', 'PSUseOutputTypeCorrectly',
'PSUseShouldProcessForStateChangingFunctions' 'PSUseShouldProcessForStateChangingFunctions',
# We send strings as plaintext so will always come across the 3 issues
'PSAvoidUsingPlainTextForPassword',
'PSAvoidUsingConvertToSecureStringWithPlainText',
'PSAvoidUsingUserNameAndPassWordParams',
# We send the module as a base64 encoded string and a BOM will cause
# issues here
'PSUseBOMForUnicodeEncodedFile'
) )
} }