-
Notifications
You must be signed in to change notification settings - Fork 227
Fix to be compliant with QA tests #2162
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
Conversation
WalkthroughRemoved leading-comma array wrapping in several public Get-* commands to return typed arrays directly, changed two New-InvalidArgumentException calls to New-ArgumentException in New-SqlDscDatabase, removed a redundant example parameter, bumped DscResource.Test to latest, and updated CHANGELOG entries. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
source/Public/Get-SqlDscConfigurationOption.ps1 (1)
60-60: Unify parameter casing for consistency.Use
$ServerObject(parameter casing) everywhere for readability.- $serverObject.Configuration.Refresh() + $ServerObject.Configuration.Refresh() @@ - $configurationOption = $serverObject.Configuration.Properties.ForEach({ $_ }) + $configurationOption = $ServerObject.Configuration.Properties.ForEach({ $_ })Also applies to: 86-86
source/Public/Get-SqlDscAudit.ps1 (2)
27-29: Align .OUTPUTS with actual return type.Docs show singular type but the command returns
Audit[]. Suggest updating.- `[Microsoft.SqlServer.Management.Smo.Audit]` + `[Microsoft.SqlServer.Management.Smo.Audit[]]`
64-66: Normalize variable casing.
$AuditObjectvs$auditObjectis inconsistent; prefer one casing.- if (-not $AuditObject) + if (-not $auditObject)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Jira integration is disabled
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (9)
CHANGELOG.md(2 hunks)RequiredModules.psd1(1 hunks)source/Examples/Resources/SqlSetup/5-InstallNamedInstanceInFailoverClusterSecondNode.ps1(0 hunks)source/Public/Get-SqlDscAudit.ps1(1 hunks)source/Public/Get-SqlDscConfigurationOption.ps1(1 hunks)source/Public/Get-SqlDscDatabasePermission.ps1(1 hunks)source/Public/Get-SqlDscServerPermission.ps1(1 hunks)source/Public/Get-SqlDscTraceFlag.ps1(1 hunks)source/Public/New-SqlDscDatabase.ps1(2 hunks)
💤 Files with no reviewable changes (1)
- source/Examples/Resources/SqlSetup/5-InstallNamedInstanceInFailoverClusterSecondNode.ps1
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ps1,psm1,psd1}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow PowerShell code style guidelines in all PowerShell scripts, modules, and manifests
**/*.{ps1,psm1,psd1}: End files with exactly one trailing blank line
Use CRLF line endings
Allow at most two consecutive newlines in files
Use UTF-8 encoding without BOM for all files
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1RequiredModules.psd1source/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
**/*.{ps1,psm1}
📄 CodeRabbit inference engine (.github/instructions/SqlServerDsc-guidelines.instructions.md)
**/*.{ps1,psm1}: Public PowerShell commands must use the naming format Verb-SqlDsc{Noun}
Private PowerShell functions must use the naming format Verb-Noun (no SqlDsc infix)
Always prefer SMO over T-SQL for SQL Server interaction
**/*.{ps1,psm1}: Use descriptive names (3+ characters, no abbreviations)
Function names: PascalCase with Verb-Noun format using approved verbs
Parameter names: PascalCase
Variable names: camelCase
Keywords must be lower-case
Class names: PascalCase
Include scope prefix for script/global/environment variables: $script:, $global:, $env:
Use 4 spaces for indentation (no tabs)
Use one space around operators (e.g., $a = 1 + 2)
Use one space between type and variable (e.g., [String] $name)
Use one space between keyword and parenthesis (e.g., if ($condition))
No spaces on empty lines
Try to limit lines to 120 characters
Place opening brace on a new line (except in variable assignments)
Add one newline after an opening brace
Add two newlines after a closing brace (one if followed by another brace or continuation)
Use single quotes unless variable expansion is needed
Arrays: single-line as @('one','two'), multi-line with one element per line and proper indentation
Do not use unary comma in return statements to force an array
Hashtables: empty as @{}; otherwise each property on its own line with proper indentation; property names in PascalCase
Comments: use '# Comment' (capitalized) on its own line for single-line comments
Multi-line comments use <# #> with opening/closing on their own lines; indent comment text
Do not commit commented-out code
Always add comment-based help to all functions and scripts
Comment-based help must include: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, and EXAMPLE sections before function/class
Comment-based help indentation: keywords indented 4 spaces; text indented 8 spaces
Include examples for all parameter sets and combinations in comment-based help
In comment-based help, INPUTS: list each pipeline-accepted type (o...
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1source/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
source/**/*.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines-localization.instructions.md)
source/**/*.ps1: Localize all Write-Debug, Write-Verbose, Write-Error, Write-Warning, and $PSCmdlet.ThrowTerminatingError() messages
Use localized string keys instead of hardcoded strings in script output/messages
Assume and use $script:localizedData for accessing localized strings
When emitting messages, reference $script:localizedData.KeyName and format with the -f operator (e.g., Write-Verbose -Message ($script:localizedData.KeyName -f $value1))
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1source/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
⚙️ CodeRabbit configuration file
source/**/*.ps1: # Localization GuidelinesRequirements
- Localize all Write-Debug, Write-Verbose, Write-Error, Write-Warning and $PSCmdlet.ThrowTerminatingError() messages
- Use localized string keys, not hardcoded strings
- Assume
$script:localizedDatais availableString Files
- Commands/functions:
source/en-US/{MyModuleName}.strings.psd1- Class resources:
source/en-US/{ResourceClassName}.strings.psd1Key Naming Patterns
- Format:
Verb_FunctionName_Action(underscore separators), e.g.Get_Database_ConnectingToDatabaseString Format
ConvertFrom-StringData @' KeyName = Message with {0} placeholder. (PREFIX0001) '@String IDs
- Format:
(PREFIX####)- PREFIX: First letter of each word in class or function name (SqlSetup → SS, Get-SqlDscDatabase → GSDD)
- Number: Sequential from 0001
Usage
Write-Verbose -Message ($script:localizedData.KeyName -f $value1)
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1source/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
source/Public/*.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines.instructions.md)
source/Public/*.ps1: Place public commands in source/Public/{CommandName}.ps1
Separate reusable logic into private functions (keep public commands thin)
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1source/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
**/*.{ps1,psd1}
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines.instructions.md)
Localize all strings using string keys and remove any orphaned string keys
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1RequiredModules.psd1source/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow
- Run in PowerShell, from repository root
- Build before running tests:
.\build.ps1 -Tasks build- Always run tests in new PowerShell session:
Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow guidelines over existing code patterns
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1RequiredModules.psd1CHANGELOG.mdsource/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
**/*.ps?(m|d)1
⚙️ CodeRabbit configuration file
**/*.ps?(m|d)1: # PowerShell GuidelinesNaming
- Use descriptive names (3+ characters, no abbreviations)
- Functions: PascalCase with Verb-Noun format using approved verbs
- Parameters: PascalCase
- Variables: camelCase
- Keywords: lower-case
- Classes: PascalCase
- Include scope for script/global/environment variables:
$script:,$global:,$env:File naming
- Class files:
###.ClassName.ps1format (e.g.001.SqlReason.ps1,004.StartupParameters.ps1)Formatting
Indentation & Spacing
- Use 4 spaces (no tabs)
- One space around operators:
$a = 1 + 2- One space between type and variable:
[String] $name- One space between keyword and parenthesis:
if ($condition)- No spaces on empty lines
- Try to limit lines to 120 characters
Braces
- Newline before opening brace (except variable assignments)
- One newline after opening brace
- Two newlines after closing brace (one if followed by another brace or continuation)
Quotes
- Use single quotes unless variable expansion is needed:
'text'vs"text $variable"Arrays
- Single line:
@('one', 'two', 'three')- Multi-line: each element on separate line with proper indentation
- Do not use the unary comma operator (
,) in return statements to force
an arrayHashtables
- Empty:
@{}- Each property on separate line with proper indentation
- Properties: Use PascalCase
Comments
- Single line:
# Comment(capitalized, on own line)- Multi-line:
<# Comment #>format (opening and closing brackets on own line), and indent text- No commented-out code
Comment-based help
- Always add comment-based help to all functions and scripts
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
- Include examples for all parameter sets and combinations
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description.
- OUTPUTS: Lis...
Files:
source/Public/New-SqlDscDatabase.ps1source/Public/Get-SqlDscTraceFlag.ps1RequiredModules.psd1source/Public/Get-SqlDscDatabasePermission.ps1source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1source/Public/Get-SqlDscServerPermission.ps1
**/*.psd1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines-powershell.instructions.md)
In module manifests, do not use NestedModules for shared commands without specifying RootModule
Files:
RequiredModules.psd1
**/*.md
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow Markdown formatting requirements for documentation
**/*.md: Wrap lines at word boundaries when over 80 characters (except tables/code blocks)
Use 2 spaces for indentation in Markdown documents
Use '1.' for all items in ordered lists (1/1/1 numbering style)
Disable MD013 for tables/code blocks exceeding 80 characters via an inline comment
Require empty lines before and after code blocks and headings (except before line 1)
Escape backslashes in file paths only, not inside code blocks
All fenced code blocks must specify a language identifier
Format parameter names as bold
Format values/literals as inline code
Format resource/module/product names as italic
Format commands, file names, and paths as inline code
Files:
CHANGELOG.md
⚙️ CodeRabbit configuration file
**/*.md: # Markdown Style Guidelines
- Wrap lines at word boundaries when over 80 characters (except tables/code blocks)
- Use 2 spaces for indentation
- Use '1.' for all items in ordered lists (1/1/1 numbering style)
- Disable
MD013rule by adding a comment for tables/code blocks exceeding 80 characters- Empty lines required before/after code blocks and headings (except before line 1)
- Escape backslashes in file paths only (not in code blocks)
- Code blocks must specify language identifiers
Text Formatting
- Parameters: bold
- Values/literals:
inline code- Resource/module/product names: italic
- Commands/files/paths:
inline code
Files:
CHANGELOG.md
CHANGELOG.md
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Always update CHANGELOG.md
CHANGELOG.md: Always update the Unreleased section in CHANGELOG.md
Use Keep a Changelog format
Describe notable changes briefly, with no more than 2 items per change type
Reference issues using the format issue #<issue_number>
No empty lines between list items in the same section
Do not add an item if there is already an existing item for the same changeAlways update the CHANGELOG.md Unreleased section
Files:
CHANGELOG.md
⚙️ CodeRabbit configuration file
CHANGELOG.md: # Changelog Guidelines
- Always update the Unreleased section in CHANGELOG.md
- Use Keep a Changelog format
- Describe notable changes briefly, ≤2 items per change type
- Reference issues using format issue #<issue_number>
- No empty lines between list items in same section
- Do not add item if there are already an existing item for the same change
Files:
CHANGELOG.md
🧠 Learnings (3)
📚 Learning: 2025-08-28T15:44:12.628Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The SqlServerDsc repository uses RequiredModules.psd1 to specify Pester with Version = 'latest' and AllowPrerelease = $true, ensuring the latest Pester version (well beyond 5.4) is available, which supports Should -Invoke syntax and other modern Pester features.
Applied to files:
RequiredModules.psd1CHANGELOG.md
📚 Learning: 2025-08-28T15:44:12.628Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The repository uses RequiredModules.psd1 to specify Pester version requirements with RequiredVersion = 'latest', which ensures compatibility with Should -Invoke syntax (requires Pester 5.4+).
Applied to files:
RequiredModules.psd1CHANGELOG.md
📚 Learning: 2025-09-05T18:39:21.909Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-09-05T18:39:21.909Z
Learning: Applies to **/*.{ps1,psm1} : Use [OutputType({return type})] for functions with output; use [OutputType()] if no output
Applied to files:
source/Public/Get-SqlDscConfigurationOption.ps1
🧬 Code graph analysis (2)
source/Public/Get-SqlDscDatabasePermission.ps1 (1)
tests/Unit/Stubs/SMO.cs (3)
Microsoft(604-611)DatabasePermissionInfo(252-271)DatabasePermissionInfo(254-258)
source/Public/Get-SqlDscServerPermission.ps1 (1)
tests/Unit/Stubs/SMO.cs (4)
ServerPermissionInfo(212-227)ServerPermissionSet(184-206)Microsoft(332-340)ServerPermissionSet(186-186)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: dsccommunity.SqlServerDsc (Build Package Module)
- GitHub Check: PSScriptAnalyzer
- GitHub Check: PSScriptAnalyzer
🔇 Additional comments (9)
RequiredModules.psd1 (1)
31-31: Unpinning DscResource.Test tolatestis safe. Current stable version is 0.16.3 (published 2024-08-29) with no breaking changes noted.source/Public/Get-SqlDscServerPermission.ps1 (1)
198-198: Return a flat ServerPermissionInfo[] (removed unary comma) — LGTM. Confirmed no other public cmdlets use unary commas in return statements.source/Public/New-SqlDscDatabase.ps1 (1)
142-143: Confirm DscResource.Common is declared as a RequiredModule in the module’s .psd1 manifest so New-ArgumentException is guaranteed to load at runtime.source/Public/Get-SqlDscTraceFlag.ps1 (1)
85-85: Return typed [UInt32[]] directly — LGTM.Consistent, flat array shape; avoids ScriptAnalyzer warning.
source/Public/Get-SqlDscDatabasePermission.ps1 (1)
99-99: Return a flat DatabasePermissionInfo[] (removed unary comma) — LGTM.Return now matches OutputType and prevents nested arrays.
source/Public/Get-SqlDscConfigurationOption.ps1 (1)
89-92: Approve array return shape
Returns a flatConfigProperty[], matching the declared[OutputType()].source/Public/Get-SqlDscAudit.ps1 (1)
83-83: Correct array return shape; unary comma removed — good.Now returns a flat
Audit[]consistent with[OutputType()]. LGTM.CHANGELOG.md (2)
26-33: Changelog entry for array return fixes looks good.Clear, scoped to affected commands, and follows section style.
141-147: Changelog updates for dependency and example cleanup look good.Placement under “Changed” is appropriate.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2162 +/- ##
====================================
Coverage 94% 94%
====================================
Files 131 131
Lines 8701 8701
====================================
Hits 8245 8245
Misses 456 456
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
source/Public/Get-SqlDscConfigurationOption.ps1 (2)
21-22: Examples use the wrong variable name ($sqlServerObject vs $serverObject)This is user-facing; fix to prevent copy/paste errors.
Apply:
- $serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance' - $sqlServerObject | Get-SqlDscConfigurationOption + $serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance' + $serverObject | Get-SqlDscConfigurationOption @@ - $serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance' - $sqlServerObject | Get-SqlDscConfigurationOption -Name '*threshold*' + $serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance' + $serverObject | Get-SqlDscConfigurationOption -Name '*threshold*' @@ - Get the configuration options that contains the word **threshold**. + Get the configuration options that contain the word **threshold**.Also applies to: 27-30
15-19: Grammar: “trying get” → “trying to get”Minor but visible in help.
- refreshed before trying get the available configuration options. This is + refreshed before trying to get the available configuration options. This issource/Public/Get-SqlDscAudit.ps1 (2)
21-24: Example uses the wrong variable name ($sqlServerObject vs $serverObject)Fix to avoid confusing users.
- $serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance' - $sqlServerObject | Get-SqlDscAudit -Name 'MyFileAudit' + $serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance' + $serverObject | Get-SqlDscAudit -Name 'MyFileAudit'
15-20: Grammar: “trying get the audit object” → “trying to get the audit object”Minor help-text correction.
- trying get the audit object. This is helpful when audits could have been + trying to get the audit object. This is helpful when audits could have been
🧹 Nitpick comments (2)
source/Public/Get-SqlDscConfigurationOption.ps1 (1)
32-34: OUTPUTS should include a 1‑line description per guidelinesAdd a brief description under the type.
- .OUTPUTS - `[Microsoft.SqlServer.Management.Smo.ConfigProperty[]]` + .OUTPUTS + `[Microsoft.SqlServer.Management.Smo.ConfigProperty[]]` + Array of SMO ConfigProperty objects representing server configuration options.source/Public/Get-SqlDscAudit.ps1 (1)
28-28: OUTPUTS updated to typed arrayMatches OutputType and return-shape changes. Consider adding a 1‑line description.
- .OUTPUTS - `[Microsoft.SqlServer.Management.Smo.Audit[]]` + .OUTPUTS + `[Microsoft.SqlServer.Management.Smo.Audit[]]` + Array of SMO Audit objects from the target SQL Server instance.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Jira integration is disabled
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
source/Public/Get-SqlDscAudit.ps1(3 hunks)source/Public/Get-SqlDscConfigurationOption.ps1(2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ps1,psm1,psd1}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow PowerShell code style guidelines in all PowerShell scripts, modules, and manifests
**/*.{ps1,psm1,psd1}: End files with exactly one trailing blank line
Use CRLF line endings
Allow at most two consecutive newlines in files
Use UTF-8 encoding without BOM for all files
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
**/*.{ps1,psm1}
📄 CodeRabbit inference engine (.github/instructions/SqlServerDsc-guidelines.instructions.md)
**/*.{ps1,psm1}: Public PowerShell commands must use the naming format Verb-SqlDsc{Noun}
Private PowerShell functions must use the naming format Verb-Noun (no SqlDsc infix)
Always prefer SMO over T-SQL for SQL Server interaction
**/*.{ps1,psm1}: Use descriptive names (3+ characters, no abbreviations)
Function names: PascalCase with Verb-Noun format using approved verbs
Parameter names: PascalCase
Variable names: camelCase
Keywords must be lower-case
Class names: PascalCase
Include scope prefix for script/global/environment variables: $script:, $global:, $env:
Use 4 spaces for indentation (no tabs)
Use one space around operators (e.g., $a = 1 + 2)
Use one space between type and variable (e.g., [String] $name)
Use one space between keyword and parenthesis (e.g., if ($condition))
No spaces on empty lines
Try to limit lines to 120 characters
Place opening brace on a new line (except in variable assignments)
Add one newline after an opening brace
Add two newlines after a closing brace (one if followed by another brace or continuation)
Use single quotes unless variable expansion is needed
Arrays: single-line as @('one','two'), multi-line with one element per line and proper indentation
Do not use unary comma in return statements to force an array
Hashtables: empty as @{}; otherwise each property on its own line with proper indentation; property names in PascalCase
Comments: use '# Comment' (capitalized) on its own line for single-line comments
Multi-line comments use <# #> with opening/closing on their own lines; indent comment text
Do not commit commented-out code
Always add comment-based help to all functions and scripts
Comment-based help must include: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, and EXAMPLE sections before function/class
Comment-based help indentation: keywords indented 4 spaces; text indented 8 spaces
Include examples for all parameter sets and combinations in comment-based help
In comment-based help, INPUTS: list each pipeline-accepted type (o...
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
source/**/*.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines-localization.instructions.md)
source/**/*.ps1: Localize all Write-Debug, Write-Verbose, Write-Error, Write-Warning, and $PSCmdlet.ThrowTerminatingError() messages
Use localized string keys instead of hardcoded strings in script output/messages
Assume and use $script:localizedData for accessing localized strings
When emitting messages, reference $script:localizedData.KeyName and format with the -f operator (e.g., Write-Verbose -Message ($script:localizedData.KeyName -f $value1))
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
⚙️ CodeRabbit configuration file
source/**/*.ps1: # Localization GuidelinesRequirements
- Localize all Write-Debug, Write-Verbose, Write-Error, Write-Warning and $PSCmdlet.ThrowTerminatingError() messages
- Use localized string keys, not hardcoded strings
- Assume
$script:localizedDatais availableString Files
- Commands/functions:
source/en-US/{MyModuleName}.strings.psd1- Class resources:
source/en-US/{ResourceClassName}.strings.psd1Key Naming Patterns
- Format:
Verb_FunctionName_Action(underscore separators), e.g.Get_Database_ConnectingToDatabaseString Format
ConvertFrom-StringData @' KeyName = Message with {0} placeholder. (PREFIX0001) '@String IDs
- Format:
(PREFIX####)- PREFIX: First letter of each word in class or function name (SqlSetup → SS, Get-SqlDscDatabase → GSDD)
- Number: Sequential from 0001
Usage
Write-Verbose -Message ($script:localizedData.KeyName -f $value1)
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
source/Public/*.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines.instructions.md)
source/Public/*.ps1: Place public commands in source/Public/{CommandName}.ps1
Separate reusable logic into private functions (keep public commands thin)
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
**/*.{ps1,psd1}
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines.instructions.md)
Localize all strings using string keys and remove any orphaned string keys
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow
- Run in PowerShell, from repository root
- Build before running tests:
.\build.ps1 -Tasks build- Always run tests in new PowerShell session:
Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow guidelines over existing code patterns
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
**/*.ps?(m|d)1
⚙️ CodeRabbit configuration file
**/*.ps?(m|d)1: # PowerShell GuidelinesNaming
- Use descriptive names (3+ characters, no abbreviations)
- Functions: PascalCase with Verb-Noun format using approved verbs
- Parameters: PascalCase
- Variables: camelCase
- Keywords: lower-case
- Classes: PascalCase
- Include scope for script/global/environment variables:
$script:,$global:,$env:File naming
- Class files:
###.ClassName.ps1format (e.g.001.SqlReason.ps1,004.StartupParameters.ps1)Formatting
Indentation & Spacing
- Use 4 spaces (no tabs)
- One space around operators:
$a = 1 + 2- One space between type and variable:
[String] $name- One space between keyword and parenthesis:
if ($condition)- No spaces on empty lines
- Try to limit lines to 120 characters
Braces
- Newline before opening brace (except variable assignments)
- One newline after opening brace
- Two newlines after closing brace (one if followed by another brace or continuation)
Quotes
- Use single quotes unless variable expansion is needed:
'text'vs"text $variable"Arrays
- Single line:
@('one', 'two', 'three')- Multi-line: each element on separate line with proper indentation
- Do not use the unary comma operator (
,) in return statements to force
an arrayHashtables
- Empty:
@{}- Each property on separate line with proper indentation
- Properties: Use PascalCase
Comments
- Single line:
# Comment(capitalized, on own line)- Multi-line:
<# Comment #>format (opening and closing brackets on own line), and indent text- No commented-out code
Comment-based help
- Always add comment-based help to all functions and scripts
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
- Include examples for all parameter sets and combinations
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description.
- OUTPUTS: Lis...
Files:
source/Public/Get-SqlDscConfigurationOption.ps1source/Public/Get-SqlDscAudit.ps1
🧬 Code graph analysis (1)
source/Public/Get-SqlDscAudit.ps1 (1)
tests/Unit/Stubs/SMO.cs (1)
Audit(936-974)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: dsccommunity.SqlServerDsc (Build Package Module)
- GitHub Check: PSScriptAnalyzer
- GitHub Check: PSScriptAnalyzer
🔇 Additional comments (6)
source/Public/Get-SqlDscConfigurationOption.ps1 (4)
60-60: Fix: correct object variable casing in Refresh()Good catch switching to $ServerObject; aligns with the parameter name and avoids referencing an undefined variable.
65-68: Fix: consistent use of $ServerObject in Name-filtering pathLooks correct; preserves wildcard-friendly behavior (-like) while eliminating the case mismatch from earlier.
86-86: Materializing the collection avoids returning an enumeratorUsing .ForEach({ $_ }) is fine here and keeps the later typed cast predictable.
89-92: Unary-comma return patterns eliminated: no instances ofreturn , [Type]remain insource/PublicPowerShell files.source/Public/Get-SqlDscAudit.ps1 (2)
64-64: Fix: correct variable casing in missing-audit checkUsing $auditObject fixes a logic bug from the prior $AuditObject mismatch.
83-83: Return-shape corrected: remove unary comma and cast to Audit[]Consistent with the project guidelines and other Get-* fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1 (1)
44-44: Add -ErrorAction Stop to Connect-SqlDscDatabaseEngine for clearer failuresIntegration tests should surface errors immediately. Recommend adding -ErrorAction 'Stop' here.
- $script:serverObject = Connect-SqlDscDatabaseEngine -InstanceName $script:mockInstanceName -Credential $script:mockSqlAdminCredential + $script:serverObject = Connect-SqlDscDatabaseEngine -InstanceName $script:mockInstanceName -Credential $script:mockSqlAdminCredential -ErrorAction 'Stop'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
source/Public/Get-SqlDscAudit.ps1(3 hunks)source/Public/Get-SqlDscConfigurationOption.ps1(3 hunks)tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- source/Public/Get-SqlDscAudit.ps1
- source/Public/Get-SqlDscConfigurationOption.ps1
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ps1,psm1,psd1}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow PowerShell code style guidelines in all PowerShell scripts, modules, and manifests
**/*.{ps1,psm1,psd1}: End files with exactly one trailing blank line
Use CRLF line endings
Allow at most two consecutive newlines in files
Use UTF-8 encoding without BOM for all files
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
**/*.Tests.ps1
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow test patterns strictly for maintainability in Pester tests
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
**/*Integration.Tests.ps1
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Always add and structure Integration tests according to the integration testing guidelines
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
**/*.{ps1,psm1}
📄 CodeRabbit inference engine (.github/instructions/SqlServerDsc-guidelines.instructions.md)
**/*.{ps1,psm1}: Public PowerShell commands must use the naming format Verb-SqlDsc{Noun}
Private PowerShell functions must use the naming format Verb-Noun (no SqlDsc infix)
Always prefer SMO over T-SQL for SQL Server interaction
**/*.{ps1,psm1}: Use descriptive names (3+ characters, no abbreviations)
Function names: PascalCase with Verb-Noun format using approved verbs
Parameter names: PascalCase
Variable names: camelCase
Keywords must be lower-case
Class names: PascalCase
Include scope prefix for script/global/environment variables: $script:, $global:, $env:
Use 4 spaces for indentation (no tabs)
Use one space around operators (e.g., $a = 1 + 2)
Use one space between type and variable (e.g., [String] $name)
Use one space between keyword and parenthesis (e.g., if ($condition))
No spaces on empty lines
Try to limit lines to 120 characters
Place opening brace on a new line (except in variable assignments)
Add one newline after an opening brace
Add two newlines after a closing brace (one if followed by another brace or continuation)
Use single quotes unless variable expansion is needed
Arrays: single-line as @('one','two'), multi-line with one element per line and proper indentation
Do not use unary comma in return statements to force an array
Hashtables: empty as @{}; otherwise each property on its own line with proper indentation; property names in PascalCase
Comments: use '# Comment' (capitalized) on its own line for single-line comments
Multi-line comments use <# #> with opening/closing on their own lines; indent comment text
Do not commit commented-out code
Always add comment-based help to all functions and scripts
Comment-based help must include: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, and EXAMPLE sections before function/class
Comment-based help indentation: keywords indented 4 spaces; text indented 8 spaces
Include examples for all parameter sets and combinations in comment-based help
In comment-based help, INPUTS: list each pipeline-accepted type (o...
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
tests/Integration/**/*.ps1
📄 CodeRabbit inference engine (.github/instructions/SqlServerDsc-guidelines.instructions.md)
tests/Integration/**/*.ps1: Use DSCSQLTEST (Database Engine), SSRS (Reporting Services), and PBIRS (Power BI Report Server) instance names in CI integration tests
If an integration test requires a SQL Server Database Engine, start the Windows service in BeforeAll and stop it in AfterAll
In integration tests requiring a SQL Server DB, use Connect-SqlDscDatabaseEngine with correct CI credentials to open the session
Always call Disconnect-SqlDscDatabaseEngine after Connect-SqlDscDatabaseEngine in integration tests
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
tests/[iI]ntegration/[cC]ommands/*.[iI]ntegration.[tT]ests.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md)
Place command integration tests at tests/Integration/Commands/{CommandName}.Integration.Tests.ps1
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md)
tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1: Do not use mocking in integration tests; run against a real environment
Ensure integration tests cover all scenarios and code paths
In CI, use Get-ComputerName for computer names
Avoid using ExpectedMessage with Should -Throw assertions in Pester
When calling commands in integration tests, pass -Force where applicable to avoid prompts
Use -ErrorAction Stop on commands in integration tests so failures surface immediately
Include the required setup block at the top of each integration test: the SuppressMessage param(), a BeforeDiscovery block that ensures DscResource.Test is available (or runs build.ps1 -Tasks 'noop' and imports it), and a BeforeAll block that sets $script:moduleName and imports the module under test with -Force -ErrorAction Stop
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
⚙️ CodeRabbit configuration file
tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1: # Integration Tests GuidelinesRequirements
- Location Commands:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1- Location Resources:
tests/Integration/Resources/{ResourceName}.Integration.Tests.ps1- No mocking - real environment only
- Cover all scenarios and code paths
- Use
Get-ComputerNamefor computer names in CI- Avoid
ExpectedMessageforShould -Throwassertions- Only run integration tests in CI unless explicitly instructed.
- Call commands with
-Forceparameter where applicable (avoids prompting).- Use
-ErrorAction Stopon commands so failures surface immediatelyRequired Setup Block
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')] param () BeforeDiscovery { try { if (-not (Get-Module -Name 'DscResource.Test')) { # Assumes dependencies have been resolved, so if this module is not available, run 'noop' task. if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable)) { # Redirect all streams to $null, except the error stream (stream 2) & "$PSScriptRoot/../../../build.ps1" -Tasks 'noop' 3>&1 4>&1 5>&1 6>&1 > $null } # If the dependencies have not been resolved, this will throw an error. Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop' } } catch [System.IO.FileNotFoundException] { throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.' } } BeforeAll { $script:moduleName = '{MyModuleName}' Import-Module -Name $script:moduleName -Force -ErrorAction 'Stop' }
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
tests/Integration/Commands/*.Integration.Tests.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines.instructions.md)
Place command integration tests in tests/Integration/Commands/{CommandName}.Integration.Tests.ps1
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
**/*.{ps1,psd1}
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines.instructions.md)
Localize all strings using string keys and remove any orphaned string keys
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
tests/Integration/**/*.Integration.Tests.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines.instructions.md)
Add integration tests for all public commands and resources
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
**/*.[Tt]ests.ps1
📄 CodeRabbit inference engine (.github/instructions/dsc-community-style-guidelines-pester.instructions.md)
**/*.[Tt]ests.ps1: Use Pester v5 syntax only
Test code only inside Describe blocks
Assertions only in It blocks
Never test verbose messages, debug messages or parameter binding behavior
Pass all mandatory parameters to avoid prompts
Inside It blocks, assign unused return objects to $null (unless part of pipeline)
The tested entity must be called from within It blocks
Keep results and assertions in the same It block
Avoid try-catch-finally for cleanup; use AfterAll or AfterEach
Avoid unnecessary remove/recreate cycles in tests
One Describe block per file matching the tested entity name
Context descriptions start with 'When'
It descriptions start with 'Should' and must not contain 'when'
Prefix mock variables with 'mock'
Each class method should have a separate Context block
Each scenario should have a separate Context block
Use nested Context blocks for complex scenarios
Do mocking in BeforeAll (use BeforeEach only when required)
Place setup/teardown hooks (BeforeAll, BeforeEach, AfterAll, AfterEach) close to usage
Use PascalCase for Pester keywords: Describe, Context, It, Should, BeforeAll, BeforeEach, AfterAll, AfterEach
Prefer Should -BeTrue / -BeFalse over -Be $true / -Be $false
Never use Assert-MockCalled; use Should -Invoke instead
Do not use Should -Not -Throw; invoke commands directly
Never add an empty -MockWith block
Omit -MockWith when returning $null
Set $PSDefaultParameterValues for Mock:ModuleName, Should:ModuleName, InModuleScope:ModuleName
Omit -ModuleName parameter on Pester commands
Never use Mock inside an InModuleScope block
Define variables for -ForEach in a separate BeforeDiscovery close to usage
Use -ForEach only on Context and It blocks
Keep variable scope close to the usage context
Use BeforeEach and AfterEach sparingly
Use $PSDefaultParameterValues only for Pester commands (Describe, Context, It, Mock, Should, InModuleScope)
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
⚙️ CodeRabbit configuration file
**/*.[Tt]ests.ps1: # Tests GuidelinesCore Requirements
- All public commands, private functions and classes must have unit tests
- All public commands and class-based resources must have integration tests
- Use Pester v5 syntax only
- Test code only inside
Describeblocks- Assertions only in
Itblocks- Never test verbose messages, debug messages or parameter binding behavior
- Pass all mandatory parameters to avoid prompts
Requirements
- Inside
Itblocks, assign unused return objects to$null(unless part of pipeline)- Tested entity must be called from within the
Itblocks- Keep results and assertions in same
Itblock- Avoid try-catch-finally for cleanup, use
AfterAllorAfterEach- Avoid unnecessary remove/recreate cycles
Naming
- One
Describeblock per file matching the tested entity nameContextdescriptions start with 'When'Itdescriptions start with 'Should', must not contain 'when'- Mock variables prefix: 'mock'
Structure & Scope
- Public commands: Never use
InModuleScope(unless retrieving localized strings)- Private functions/class resources: Always use
InModuleScope- Each class method = separate
Contextblock- Each scenario = separate
Contextblock- Use nested
Contextblocks for complex scenarios- Mocking in
BeforeAll(BeforeEachonly when required)- Setup/teardown in
BeforeAll,BeforeEach/AfterAll,AfterEachclose to usageSyntax Rules
- PascalCase:
Describe,Context,It,Should,BeforeAll,BeforeEach,AfterAll,AfterEach- Prefer
-BeTrue/-BeFalseover-Be $true/-Be $false- Never use
Assert-MockCalled, useShould -Invokeinstead- No
Should -Not -Throw- invoke commands directly- Never add an empty
-MockWithblock- Omit
-MockWithwhen returning$null- Set
$PSDefaultParameterValuesforMock:ModuleName,Should:ModuleName,InModuleScope:ModuleName- Omit
-ModuleNameparameter on Pester commands- Never use
Mockinside `InModule...
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow
- Run in PowerShell, from repository root
- Build before running tests:
.\build.ps1 -Tasks build- Always run tests in new PowerShell session:
Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow guidelines over existing code patterns
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
**/*.ps?(m|d)1
⚙️ CodeRabbit configuration file
**/*.ps?(m|d)1: # PowerShell GuidelinesNaming
- Use descriptive names (3+ characters, no abbreviations)
- Functions: PascalCase with Verb-Noun format using approved verbs
- Parameters: PascalCase
- Variables: camelCase
- Keywords: lower-case
- Classes: PascalCase
- Include scope for script/global/environment variables:
$script:,$global:,$env:File naming
- Class files:
###.ClassName.ps1format (e.g.001.SqlReason.ps1,004.StartupParameters.ps1)Formatting
Indentation & Spacing
- Use 4 spaces (no tabs)
- One space around operators:
$a = 1 + 2- One space between type and variable:
[String] $name- One space between keyword and parenthesis:
if ($condition)- No spaces on empty lines
- Try to limit lines to 120 characters
Braces
- Newline before opening brace (except variable assignments)
- One newline after opening brace
- Two newlines after closing brace (one if followed by another brace or continuation)
Quotes
- Use single quotes unless variable expansion is needed:
'text'vs"text $variable"Arrays
- Single line:
@('one', 'two', 'three')- Multi-line: each element on separate line with proper indentation
- Do not use the unary comma operator (
,) in return statements to force
an arrayHashtables
- Empty:
@{}- Each property on separate line with proper indentation
- Properties: Use PascalCase
Comments
- Single line:
# Comment(capitalized, on own line)- Multi-line:
<# Comment #>format (opening and closing brackets on own line), and indent text- No commented-out code
Comment-based help
- Always add comment-based help to all functions and scripts
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
- Include examples for all parameter sets and combinations
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description.
- OUTPUTS: Lis...
Files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
🧠 Learnings (8)
📚 Learning: 2025-08-29T17:20:42.266Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-08-29T17:20:42.266Z
Learning: Applies to tests/Integration/**/*.ps1 : Use DSCSQLTEST (Database Engine), SSRS (Reporting Services), and PBIRS (Power BI Report Server) instance names in CI integration tests
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
📚 Learning: 2025-08-29T17:25:09.959Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-08-29T17:25:09.959Z
Learning: Applies to tests/Integration/**/*.Integration.Tests.ps1 : Add integration tests for all public commands and resources
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
📚 Learning: 2025-08-29T17:20:42.266Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-08-29T17:20:42.266Z
Learning: Applies to tests/Integration/**/*.ps1 : In integration tests requiring a SQL Server DB, use Connect-SqlDscDatabaseEngine with correct CI credentials to open the session
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
📚 Learning: 2025-08-29T17:22:07.610Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-08-29T17:22:07.610Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : When calling commands in integration tests, pass -Force where applicable to avoid prompts
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
📚 Learning: 2025-08-29T17:20:42.266Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-08-29T17:20:42.266Z
Learning: Applies to tests/Integration/**/*.ps1 : Always call Disconnect-SqlDscDatabaseEngine after Connect-SqlDscDatabaseEngine in integration tests
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
📚 Learning: 2025-08-29T17:25:09.959Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-08-29T17:25:09.959Z
Learning: Applies to tests/Integration/Commands/*.Integration.Tests.ps1 : Place command integration tests in tests/Integration/Commands/{CommandName}.Integration.Tests.ps1
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
📚 Learning: 2025-08-18T13:50:53.789Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2132
File: tests/Unit/Public/New-SqlDscLogin.Tests.ps1:0-0
Timestamp: 2025-08-18T13:50:53.789Z
Learning: In SqlServerDsc unit tests, SMO stub objects can be used to verify method calls like Create() on Login objects by adding mock verifications with Should -Invoke, providing more robust testing than just checking for no exceptions.
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
📚 Learning: 2025-08-17T10:13:30.079Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2136
File: source/Public/Remove-SqlDscLogin.ps1:104-108
Timestamp: 2025-08-17T10:13:30.079Z
Learning: In SqlServerDsc unit tests, SMO object stubs (like Login objects) should have properly mocked Parent properties with correct Server stub types and valid InstanceName values, rather than handling null Parent scenarios in production code.
Applied to files:
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1
🧬 Code graph analysis (1)
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1 (1)
tests/Unit/Stubs/SMO.cs (7)
ServerPermissionSet(184-206)ServerPermissionInfo(212-227)Microsoft(332-340)Server(278-373)ServerPermissionSet(186-186)ServerPermissionSet(188-198)Microsoft(12-1051)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: dsccommunity.SqlServerDsc (Build Package Module)
- GitHub Check: PSScriptAnalyzer
🔇 Additional comments (2)
tests/Integration/Commands/Get-SqlDscServerPermission.Integration.Tests.ps1 (2)
236-236: Good fix: assert element type (not array) to catch nested-array regressionsUsing -BeOfType [Microsoft.SqlServer.Management.Smo.ServerPermissionInfo] on the piped result validates each emitted item and prevents the previous “array-of-arrays” shape from slipping through. Count > 1 then verifies multiplicity. LGTM.
274-274: Same here: correct per-item type assertion for multi-role pipelineThis aligns the test with the flattened output contract and will fail if a nested array is returned. LGTM.
Pull Request (PR) description
Get-*commands byremoving a leading comma in return statements which could cause incorrect
output and ScriptAnalyzer warnings:
Get-SqlDscAudit,Get-SqlDscConfigurationOption,Get-SqlDscDatabasePermission,Get-SqlDscServerPermission, andGet-SqlDscTraceFlag.New-ArgumentExceptioninstead ofNew-InvalidArgumentExceptionfor parameter validation errors.This Pull Request (PR) fixes the following issues
Task list
file CHANGELOG.md. Entry should say what was changed and how that
affects users (if applicable), and reference the issue being resolved
(if applicable).
This change is