Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the WalkthroughUpdated Test-ModuleExist.ps1 to use localized Write-Debug messages and added corresponding en-US string resources. Adjusted GitVersion feature-branch regex to anchor at start of string. Updated CHANGELOG with notes on localization and GitVersion regex change. No changes to public APIs or control flow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
…n Test-ModuleExist
ddb0f64 to
501f2a1
Compare
…localized strings
…ndant GitVersion.Tool command in Azure Pipelines
…ith `f/` or `feature/` to avoid conflicts with GitHub Copilot Agent branches
Test-ModuleExist: Localize messages
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
johlju
left a comment
There was a problem hiding this comment.
@johlju reviewed 4 of 4 files at r1, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @copilot)
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
CHANGELOG.md (1)
20-20: Clarify message type: these were Write-Debug diagnosticsWording says "Write-Verbose" but the implementation uses Write-Debug. Recommend adjusting for accuracy.
- - Localized hardcoded Write-Verbose messages to use localized strings ([#168](https://github.com/dsccommunity/DscResource.Common/issues/168)). + - Localized hardcoded diagnostic messages (Write-Debug) to use localized strings ([#168](https://github.com/dsccommunity/DscResource.Common/issues/168)).GitVersion.yml (1)
17-17: Addfeat/alias to branch regex (optional)We ran a targeted check against the remote to see if any branches use the
feat/prefix:git ls-remote --heads origin 'refs/heads/feat/*'No matches were found, confirming that introducing
feat/support is safe and won’t inadvertently catch existing branches.• File: GitVersion.yml
Line: 17Proposed (optional) diff:
- regex: ^f(eature(s)?)?[\/-] + regex: ^(f(eature(s)?)?|feat)[\/-]This enhancement simply broadens the pattern to include the common
feat/alias used in Conventional Commits workflows, but can be skipped if it doesn’t match your team’s conventions.source/en-US/DscResource.Common.strings.psd1 (1)
69-72: Align key naming with Verb_Function_Action conventionExisting keys (e.g., Test_PendingRestart_UnsupportedOs, Format_Path_NormalizedPath) use Verb_Function_Action. Adjust these to Test_ModuleExist_* for consistency.
- TestModuleExist_FilteringByPath = Filtering modules by path '{0}'. (DRC0056) - TestModuleExist_FilteringByVersion = Filtering modules by version '{0}'. (DRC0057) - TestModuleExist_FilteringByPrerelease = Filtering modules by prerelease '{0}'. (DRC0058) + Test_ModuleExist_FilteringByPath = Filtering modules by path '{0}'. (DRC0056) + Test_ModuleExist_FilteringByVersion = Filtering modules by version '{0}'. (DRC0057) + Test_ModuleExist_FilteringByPrerelease = Filtering modules by prerelease '{0}'. (DRC0058)Note: Update call sites accordingly (see comments in Test-ModuleExist.ps1).
source/Public/Test-ModuleExist.ps1 (1)
106-106: Use renamed localized keys to match repository key conventionIf you adopt the suggested key renames in the strings file, update usages here.
- Write-Debug -Message ($script:localizedData.TestModuleExist_FilteringByPath -f $modulePath) + Write-Debug -Message ($script:localizedData.Test_ModuleExist_FilteringByPath -f $modulePath) - Write-Debug -Message ($script:localizedData.TestModuleExist_FilteringByVersion -f $moduleVersion) + Write-Debug -Message ($script:localizedData.Test_ModuleExist_FilteringByVersion -f $moduleVersion) - Write-Debug -Message ($script:localizedData.TestModuleExist_FilteringByPrerelease -f $modulePrerelease) + Write-Debug -Message ($script:localizedData.Test_ModuleExist_FilteringByPrerelease -f $modulePrerelease)Also applies to: 122-122, 131-131
📜 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 (4)
CHANGELOG.md(2 hunks)GitVersion.yml(1 hunks)source/Public/Test-ModuleExist.ps1(3 hunks)source/en-US/DscResource.Common.strings.psd1(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow
- Run project scripts in PowerShell from repository root
- Build after source changes:
.\build.ps1 -Tasks build- Test workflow: Build →
Invoke-Pester -Path @('<test paths>') -Output Detailed- New session required after class changes
File 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:
GitVersion.ymlsource/en-US/DscResource.Common.strings.psd1CHANGELOG.mdsource/Public/Test-ModuleExist.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:
@{}- Multi-line: 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.
- ...
Files:
source/en-US/DscResource.Common.strings.psd1source/Public/Test-ModuleExist.ps1
**/*.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 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_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
source/**/*.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/SqlServerDsc.strings.psd1- Class resources:
source/en-US/{ResourceClassName}.strings.psd1Key Naming Patterns
- Format:
Verb_FunctionName_Action(underscore separators), e.g.Get_SqlDscDatabase_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/Test-ModuleExist.ps1
⏰ 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). (7)
- GitHub Check: dsccommunity.DscResource.Common (Test Publish Code Coverage)
- GitHub Check: dsccommunity.DscResource.Common (Test Linux)
- GitHub Check: dsccommunity.DscResource.Common (Test HQRM)
- GitHub Check: dsccommunity.DscResource.Common (Test macOS)
- GitHub Check: dsccommunity.DscResource.Common (Test Windows (PowerShell Core))
- GitHub Check: dsccommunity.DscResource.Common (Test Windows (Windows PowerShell))
- GitHub Check: dsccommunity.DscResource.Common (Build Package Module)
🔇 Additional comments (1)
CHANGELOG.md (1)
31-33: LGTM: GitVersion regex change documented correctlyThe CHANGELOG accurately reflects the start-anchored feature-branch regex update.
johlju
left a comment
There was a problem hiding this comment.
@johlju reviewed 3 of 3 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @copilot)
johlju
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @copilot)
This PR addresses issue #168 by replacing hardcoded Write-Verbose messages in
Test-ModuleExist.ps1with localized string lookups, following DSC Community localization guidelines.Changes Made
1. Added Localized String Keys
Added three new localized string entries to
source/en-US/DscResource.Common.strings.psd1:TestModuleExist_FilteringByPath(DRC0056)TestModuleExist_FilteringByVersion(DRC0057)TestModuleExist_FilteringByPrerelease(DRC0058)2. Updated Write-Verbose Calls
Replaced hardcoded strings in
source/Public/Test-ModuleExist.ps1with localized lookups:Line 106:
Line 122:
Line 131:
Testing
This change ensures consistency with the DSC Community's localization standards and makes the module more maintainable for future internationalization efforts.
Fixes #168
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.powershellgallery.compwsh -c & ./build.ps1 -ResolveDependency -Tasks 'noop'(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
This change is