Skip to content

Commit

Permalink
Logging output improvements microsoft#1456 microsoft#1432
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite committed Feb 26, 2023
1 parent da7aa30 commit 4c4206f
Show file tree
Hide file tree
Showing 19 changed files with 627 additions and 120 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

See [upgrade notes][1] for helpful information when upgrading from previous versions.

[1]: https://microsoft.github.io/PSRule/latest/upgrade-notes/
[1]: https://aka.ms/ps-rule/upgrade

## Current release

Expand Down
10 changes: 8 additions & 2 deletions docs/CHANGELOG-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ discussion: false

See [upgrade notes][1] for helpful information when upgrading from previous versions.

[1]: https://microsoft.github.io/PSRule/latest/upgrade-notes/
[1]: https://aka.ms/ps-rule/upgrade

**Important notes**:

- Several properties of rule and language block elements will be removed from v3.
See [deprecations][2] for details.

[2]: https://microsoft.github.io/PSRule/latest/deprecations/#deprecations-for-v3
[2]: https://aka.ms/ps-rule/deprecations#deprecations-for-v3

**Experimental features**:

Expand All @@ -33,6 +33,12 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers
What's changed since v2.7.0:

- General improvements:
- **Important change**: Replaced `SuppressedRuleWarning` execution option with `RuleSuppressed` by @BernieWhite.
[#1456](https://github.com/microsoft/PSRule/issues/1456)
- Improved options for output of suppressed rules with `RuleSuppressed` option.
- Deprecated `SuppressedRuleWarning` option, which will be removed in v3.
- Added support for logging excluded rules by @BernieWhite.
[#1432](https://github.com/microsoft/PSRule/issues/1432)
- Added additional options to schema for PSRule for Azure by @BernieWhite.
[#1446](https://github.com/microsoft/PSRule/issues/1446)
- Improved error message for failing to read options file by @BernieWhite.
Expand Down
126 changes: 90 additions & 36 deletions docs/commands/PSRule/en-US/New-PSRuleOption.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ New-PSRuleOption [[-Path] <String>] [-Configuration <ConfigurationOption>]
[-BindingNameSeparator <String>] [-BindingPreferTargetInfo <Boolean>] [-TargetName <String[]>]
[-TargetType <String[]>] [-BindingUseQualifiedName <Boolean>] [-Convention <String[]>]
[-AliasReferenceWarning <Boolean>] [-DuplicateResourceId <ExecutionActionPreference>]
[-InconclusiveWarning <Boolean>] [-NotProcessedWarning <Boolean>] [-SuppressedRuleWarning <Boolean>]
[-InvariantCultureWarning <Boolean>] [-InitialSessionState <SessionState>] [-IncludeModule <String[]>]
[-IncludePath <String[]>] [-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>]
[-InputIgnoreRepositoryCommon <Boolean>] [-InputIgnoreObjectSource <Boolean>]
[-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>] [-InputTargetType <String[]>]
[-InputPathIgnore <String[]>] [-LoggingLimitDebug <String[]>] [-LoggingLimitVerbose <String[]>]
[-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>] [-OutputAs <ResultFormat>]
[-OutputBanner <BannerFormat>] [-OutputCulture <String[]>] [-OutputEncoding <OutputEncoding>]
[-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>] [-OutputJobSummaryPath <String>]
[-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>] [-OutputPath <String>]
[-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>] [-RepositoryBaseRef <String>]
[-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [<CommonParameters>]
[-InconclusiveWarning <Boolean>] [-InvariantCultureWarning <Boolean>] [-InitialSessionState <SessionState>]
[-NotProcessedWarning <Boolean>] [-SuppressedRuleWarning <Boolean>]
[-SuppressionGroupExpired <ExecutionActionPreference>] [-ExecutionRuleExcluded <ExecutionActionPreference>]
[-ExecutionRuleSuppressed <ExecutionActionPreference>] [-IncludeModule <String[]>] [-IncludePath <String[]>]
[-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>] [-InputIgnoreRepositoryCommon <Boolean>]
[-InputIgnoreObjectSource <Boolean>] [-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>]
[-InputTargetType <String[]>] [-InputPathIgnore <String[]>] [-LoggingLimitDebug <String[]>]
[-LoggingLimitVerbose <String[]>] [-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>]
[-OutputAs <ResultFormat>] [-OutputBanner <BannerFormat>] [-OutputCulture <String[]>]
[-OutputEncoding <OutputEncoding>] [-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>]
[-OutputJobSummaryPath <String>] [-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>]
[-OutputPath <String>] [-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>]
[-RepositoryBaseRef <String>] [-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [<CommonParameters>]
```

### FromOption
Expand All @@ -45,18 +46,19 @@ New-PSRuleOption [-Option] <PSRuleOption> [-Configuration <ConfigurationOption>]
[-BindingNameSeparator <String>] [-BindingPreferTargetInfo <Boolean>] [-TargetName <String[]>]
[-TargetType <String[]>] [-BindingUseQualifiedName <Boolean>] [-Convention <String[]>]
[-AliasReferenceWarning <Boolean>] [-DuplicateResourceId <ExecutionActionPreference>]
[-InconclusiveWarning <Boolean>] [-NotProcessedWarning <Boolean>] [-SuppressedRuleWarning <Boolean>]
[-InvariantCultureWarning <Boolean>] [-InitialSessionState <SessionState>] [-IncludeModule <String[]>]
[-IncludePath <String[]>] [-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>]
[-InputIgnoreRepositoryCommon <Boolean>] [-InputIgnoreObjectSource <Boolean>]
[-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>] [-InputTargetType <String[]>]
[-InputPathIgnore <String[]>] [-LoggingLimitDebug <String[]>] [-LoggingLimitVerbose <String[]>]
[-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>] [-OutputAs <ResultFormat>]
[-OutputBanner <BannerFormat>] [-OutputCulture <String[]>] [-OutputEncoding <OutputEncoding>]
[-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>] [-OutputJobSummaryPath <String>]
[-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>] [-OutputPath <String>]
[-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>] [-RepositoryBaseRef <String>]
[-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [<CommonParameters>]
[-InconclusiveWarning <Boolean>] [-InvariantCultureWarning <Boolean>] [-InitialSessionState <SessionState>]
[-NotProcessedWarning <Boolean>] [-SuppressedRuleWarning <Boolean>]
[-SuppressionGroupExpired <ExecutionActionPreference>] [-ExecutionRuleExcluded <ExecutionActionPreference>]
[-ExecutionRuleSuppressed <ExecutionActionPreference>] [-IncludeModule <String[]>] [-IncludePath <String[]>]
[-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>] [-InputIgnoreRepositoryCommon <Boolean>]
[-InputIgnoreObjectSource <Boolean>] [-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>]
[-InputTargetType <String[]>] [-InputPathIgnore <String[]>] [-LoggingLimitDebug <String[]>]
[-LoggingLimitVerbose <String[]>] [-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>]
[-OutputAs <ResultFormat>] [-OutputBanner <BannerFormat>] [-OutputCulture <String[]>]
[-OutputEncoding <OutputEncoding>] [-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>]
[-OutputJobSummaryPath <String>] [-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>]
[-OutputPath <String>] [-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>]
[-RepositoryBaseRef <String>] [-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [<CommonParameters>]
```

### FromDefault
Expand All @@ -67,18 +69,19 @@ New-PSRuleOption [-Default] [-Configuration <ConfigurationOption>] [-SuppressTar
[-BindingField <Hashtable>] [-BindingNameSeparator <String>] [-BindingPreferTargetInfo <Boolean>]
[-TargetName <String[]>] [-TargetType <String[]>] [-BindingUseQualifiedName <Boolean>]
[-Convention <String[]>] [-AliasReferenceWarning <Boolean>] [-DuplicateResourceId <ExecutionActionPreference>]
[-InconclusiveWarning <Boolean>] [-NotProcessedWarning <Boolean>] [-SuppressedRuleWarning <Boolean>]
[-InvariantCultureWarning <Boolean>] [-InitialSessionState <SessionState>] [-IncludeModule <String[]>]
[-IncludePath <String[]>] [-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>]
[-InputIgnoreRepositoryCommon <Boolean>] [-InputIgnoreObjectSource <Boolean>]
[-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>] [-InputTargetType <String[]>]
[-InputPathIgnore <String[]>] [-LoggingLimitDebug <String[]>] [-LoggingLimitVerbose <String[]>]
[-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>] [-OutputAs <ResultFormat>]
[-OutputBanner <BannerFormat>] [-OutputCulture <String[]>] [-OutputEncoding <OutputEncoding>]
[-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>] [-OutputJobSummaryPath <String>]
[-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>] [-OutputPath <String>]
[-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>] [-RepositoryBaseRef <String>]
[-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [<CommonParameters>]
[-InconclusiveWarning <Boolean>] [-InvariantCultureWarning <Boolean>] [-InitialSessionState <SessionState>]
[-NotProcessedWarning <Boolean>] [-SuppressedRuleWarning <Boolean>]
[-SuppressionGroupExpired <ExecutionActionPreference>] [-ExecutionRuleExcluded <ExecutionActionPreference>]
[-ExecutionRuleSuppressed <ExecutionActionPreference>] [-IncludeModule <String[]>] [-IncludePath <String[]>]
[-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>] [-InputIgnoreRepositoryCommon <Boolean>]
[-InputIgnoreObjectSource <Boolean>] [-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>]
[-InputTargetType <String[]>] [-InputPathIgnore <String[]>] [-LoggingLimitDebug <String[]>]
[-LoggingLimitVerbose <String[]>] [-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>]
[-OutputAs <ResultFormat>] [-OutputBanner <BannerFormat>] [-OutputCulture <String[]>]
[-OutputEncoding <OutputEncoding>] [-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>]
[-OutputJobSummaryPath <String>] [-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>]
[-OutputPath <String>] [-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>]
[-RepositoryBaseRef <String>] [-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -1037,6 +1040,57 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ExecutionRuleExcluded

Sets the option `Execution.RuleExcluded`.
The `Execution.RuleExcluded` option determines how to handle excluded rules.

```yaml
Type: ExecutionActionPreference
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ExecutionRuleSuppressed

Sets the option `Execution.RuleSuppressed`.
The `Execution.RuleSuppressed` option determines how to handle suppressed rules.

```yaml
Type: ExecutionActionPreference
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SuppressionGroupExpired

Sets the option `Execution.SuppressionGroupExpired`.
The `Execution.SuppressionGroupExpired` option determines how to handle expired suppression groups.

```yaml
Type: ExecutionActionPreference
Parameter Sets: (All)
Aliases: ExecutionSuppressionGroupExpired
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
Expand Down
76 changes: 64 additions & 12 deletions docs/commands/PSRule/en-US/Set-PSRuleOption.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ Set-PSRuleOption [[-Path] <String>] [-Option <PSRuleOption>] [-PassThru] [-Force
[-BindingPreferTargetInfo <Boolean>] [-TargetName <String[]>] [-TargetType <String[]>]
[-BindingUseQualifiedName <Boolean>] [-Convention <String[]>] [-AliasReferenceWarning <Boolean>]
[-DuplicateResourceId <ExecutionActionPreference>] [-InconclusiveWarning <Boolean>]
[-NotProcessedWarning <Boolean>] [-SuppressedRuleWarning <Boolean>] [-InvariantCultureWarning <Boolean>]
[-InitialSessionState <SessionState>] [-IncludeModule <String[]>] [-IncludePath <String[]>]
[-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>] [-InputIgnoreObjectSource <Boolean>]
[-InputIgnoreRepositoryCommon <Boolean>] [-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>]
[-InputPathIgnore <String[]>] [-InputTargetType <String[]>] [-LoggingLimitDebug <String[]>]
[-LoggingLimitVerbose <String[]>] [-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>]
[-OutputAs <ResultFormat>] [-OutputBanner <BannerFormat>] [-OutputCulture <String[]>]
[-OutputEncoding <OutputEncoding>] [-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>]
[-OutputJobSummaryPath <String>] [-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>]
[-OutputPath <String>] [-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>]
[-RepositoryBaseRef <String>] [-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [-WhatIf] [-Confirm]
[<CommonParameters>]
[-InvariantCultureWarning <Boolean>] [-InitialSessionState <SessionState>] [-NotProcessedWarning <Boolean>]
[-SuppressedRuleWarning <Boolean>] [-SuppressionGroupExpired <ExecutionActionPreference>]
[-ExecutionRuleExcluded <ExecutionActionPreference>] [-ExecutionRuleSuppressed <ExecutionActionPreference>]
[-IncludeModule <String[]>] [-IncludePath <String[]>] [-Format <InputFormat>] [-InputIgnoreGitPath <Boolean>]
[-InputIgnoreObjectSource <Boolean>] [-InputIgnoreRepositoryCommon <Boolean>]
[-InputIgnoreUnchangedPath <Boolean>] [-ObjectPath <String>] [-InputPathIgnore <String[]>]
[-InputTargetType <String[]>] [-LoggingLimitDebug <String[]>] [-LoggingLimitVerbose <String[]>]
[-LoggingRuleFail <OutcomeLogStream>] [-LoggingRulePass <OutcomeLogStream>] [-OutputAs <ResultFormat>]
[-OutputBanner <BannerFormat>] [-OutputCulture <String[]>] [-OutputEncoding <OutputEncoding>]
[-OutputFooter <FooterFormat>] [-OutputFormat <OutputFormat>] [-OutputJobSummaryPath <String>]
[-OutputJsonIndent <Int32>] [-OutputOutcome <RuleOutcome>] [-OutputPath <String>]
[-OutputSarifProblemsOnly <Boolean>] [-OutputStyle <OutputStyle>] [-RepositoryBaseRef <String>]
[-RepositoryUrl <String>] [-RuleIncludeLocal <Boolean>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -954,6 +955,57 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ExecutionRuleExcluded

Sets the option `Execution.RuleExcluded`.
The `Execution.RuleExcluded` option determines how to handle excluded rules.

```yaml
Type: ExecutionActionPreference
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ExecutionRuleSuppressed

Sets the option `Execution.RuleSuppressed`.
The `Execution.RuleSuppressed` option determines how to handle suppressed rules.

```yaml
Type: ExecutionActionPreference
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SuppressionGroupExpired

Sets the option `Execution.SuppressionGroupExpired`.
The `Execution.SuppressionGroupExpired` option determines how to handle expired suppression groups.

```yaml
Type: ExecutionActionPreference
Parameter Sets: (All)
Aliases: ExecutionSuppressionGroupExpired
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
Expand Down
Loading

0 comments on commit 4c4206f

Please sign in to comment.