Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PSSA Custom rule violations and opt-in to tests - Fixes #209 #210

Merged
merged 4 commits into from
Mar 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .MetaTestOptIn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"Common Tests - Validate Example Files",
"Common Tests - Validate Module Files",
"Common Tests - Validate Script Files",
"Common Tests - Required Script Analyzer Rules",
"Common Tests - Flagged Script Analyzer Rules",
"Common Tests - New Error-Level Script Analyzer Rules",
"Common Tests - Custom Script Analyzer Rules",
"Common Tests - Validate Example Files To Be Published",
"Common Tests - Validate Markdown Links"
"Common Tests - Validate Markdown Links",
"Common Tests - Relative Path Length"
]
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

- Correct PSSA custom rule violations - fixes [Issue #209](https://github.com/PowerShell/ComputerManagementDsc/issues/209).
- Correct long example filenames for PowerShellExecutionPolicy examples.
- Opted into Common Tests 'Required Script Analyzer Rules',
'Flagged Script Analyzer Rules', 'New Error-Level Script Analyzer Rules'
'Custom Script Analyzer Rules' and 'Relative Path Length' -
fixes [Issue #152](https://github.com/PowerShell/ComputerManagementDsc/issues/152).
- PowerPlan:
- Added support to specify the desired power plan either as name or guid.
Fixes [Issue #59](https://github.com/PowerShell/ComputerManagementDsc/issues/59)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,8 @@ function Set-TargetResource
-ArgumentName ExecuteAsGMSA
}

if($SynchronizeAcrossTimeZone -and ($ScheduleType -notin @('Once', 'Daily', 'Weekly'))) {
if ($SynchronizeAcrossTimeZone -and ($ScheduleType -notin @('Once', 'Daily', 'Weekly')))
{
New-InvalidArgumentException `
-Message ($script:localizedData.SynchronizeAcrossTimeZoneInvalidScheduleType) `
-ArgumentName SynchronizeAcrossTimeZone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function Set-TargetResource
[System.String]
$LogFilePath
)

$log = Get-WindowsEventLog -LogName $LogName

if ($null -eq $log)
Expand Down Expand Up @@ -177,7 +177,6 @@ function Set-TargetResource

if ($PSBoundParameters.ContainsKey('LogRetentionDays'))
{

if ($LogMode -eq 'AutoBackup' -and (Get-EventLog -List | Where-Object {$_.Log -like $LogName}))
{
$matchingEventLog = Get-EventLog -List | Where-Object -FilterScript {
Expand Down Expand Up @@ -262,7 +261,7 @@ function Test-TargetResource
)

$log = Get-WindowsEventLog -LogName $LogName

if ($null -eq $log)
{
return
Expand All @@ -272,7 +271,6 @@ function Test-TargetResource

if ($IsEnabled -eq $true)
{

if ($PSBoundParameters.ContainsKey('IsEnabled') -and $log.IsEnabled -ne $IsEnabled)
{
Write-Verbose -Message ($localizedData.TestingEventlogIsEnabled -f $LogName, $IsEnabled)
Expand Down Expand Up @@ -305,7 +303,6 @@ function Test-TargetResource

if ($PSBoundParameters.ContainsKey('LogRetentionDays'))
{

if ($LogMode -eq 'AutoBackup')
{
$minimumRetentionDays = Get-EventLog -List | Where-Object -FilterScript { $_.Log -eq $LogName }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.DESCRIPTION
This example shows how to configure powershell's execution policy for the specified execution policy scope.
#>
Configuration PowerShellExecutionPolicy_SetPowerShellExecutionPolicy_Config
Configuration PowerShellExecutionPolicy_SetPolicy_Config
{
Import-DscResource -ModuleName ComputerManagementDsc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.DESCRIPTION
This example shows how to configure multiple powershell's execution policy for a specified execution policy scope.
#>
Configuration PowerShellExecutionPolicy_SetPowershellExecutionPolicyForMultipleScopes_Config
Configuration PowerShellExecutionPolicy_SetPolicyForMultipleScopes_Config
{
Import-DscResource -ModuleName ComputerManagementDsc

Expand Down