Skip to content

Conversation

@dan-hughes
Copy link
Contributor

@dan-hughes dan-hughes commented Aug 4, 2025

Pull Request (PR) description

Add source filter to ExampleFiles.common.v4 to match other files.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the file CHANGELOG.md.
    Entry should say what was changed and how that affects users (if applicable), and
    reference the issue being resolved (if applicable).
  • Documentation added/updated in README.md.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Community Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

@coderabbitai
Copy link

coderabbitai bot commented Aug 4, 2025

Walkthrough

The changes remove a workaround for the ModuleBuilder patch from the CI pipeline, update the changelog to reflect recent fixes and removals, correct a comment typo, and modify the example files test to filter out excluded files using a dedicated filter function.

Changes

Cohort / File(s) Change Summary
Changelog Update
CHANGELOG.md
Updated "Unreleased" section with new "Fixed" and "Removed" subsections reflecting recent changes.
Pipeline Cleanup
azure-pipelines.yml
Removed the Windows PowerShell test job step that applied the ModuleBuilder workaround patch.
Typo Correction
source/DscResource.Test.psm1
Fixed a typographical error in a comment ("refe to" → "refer to").
Example File Filtering
source/Tests/QA/ExampleFiles.common.v4.Tests.ps1
Modified test to filter example files using WhereSourceFileNotExcluded before validation.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner as ExampleFiles.common.v4.Tests.ps1
    participant FileSystem as File System
    participant Filter as WhereSourceFileNotExcluded

    TestRunner->>FileSystem: Get all *.ps1 files recursively under Examples/
    FileSystem-->>TestRunner: List of *.ps1 files
    TestRunner->>Filter: Filter files using WhereSourceFileNotExcluded
    Filter-->>TestRunner: Filtered list of files
    loop For each filtered file
        TestRunner->>TestRunner: Run example file test
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
Add ability to exclude Example files or folders from being checked for validity by the Examples test (#120)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Removal of ModuleBuilder patch workaround (azure-pipelines.yml) This change is unrelated to excluding example files/folders from tests as described in #120.
Typo correction in comment (source/DscResource.Test.psm1) This is a documentation-only change and not related to the exclusion feature requested in #120.
Changelog update for unrelated removal/fix (CHANGELOG.md) The changelog includes removal of the ModuleBuilder patch, which is not part of #120's objectives.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69b8292 and 2ce3bad.

📒 Files selected for processing (1)
  • source/Tests/QA/ExampleFiles.common.v4.Tests.ps1 (1 hunks)
🔇 Additional comments (1)
source/Tests/QA/ExampleFiles.common.v4.Tests.ps1 (1)

31-31: Ensure WhereSourceFileNotExcluded is imported / in scope

Good call piping the file list through the filter – this aligns the v4 test with the v5 implementation.
Two things to double-check before merging:

  1. The filter function must already be dot-sourced (or defined in a loaded module) when this script runs; otherwise $examples will be empty and the test block will silently skip every example.
  2. Because you removed the explicit -ExcludeSourceFile $ExcludeSourceFile argument, the filter now relies on the $ExcludeSourceFile variable from the parent scope. That’s fine, but please verify the variable is always passed to this script so the filter does not evaluate $null unexpectedly.

If both conditions are satisfied the change looks solid.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dan-hughes
Copy link
Contributor Author

@johlju, can you take a look please.

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a comment that might not need fixing.

@johlju johlju added the needs review The pull request needs a code review. label Aug 6, 2025
@johlju
Copy link
Member

johlju commented Aug 6, 2025

FYI. I have strained my arm (repetitive strain injury) so need to stay of computers (and phone) as much as possible for a while - very hard when computers are the hobby 😄 So I might not answer as fast as usual.

@dan-hughes
Copy link
Contributor Author

FYI. I have strained my arm (repetitive strain injury) so need to stay of computers (and phone) as much as possible for a while - very hard when computers are the hobby 😄 So I might not answer as fast as usual.

Time to practice computing just using your healthy arm!

@dan-hughes
Copy link
Contributor Author

Back to the filter discussion, the testing I have just undertaken required the parameter on the filter for any exclusions to work.

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 5 files at r1, 3 of 3 files at r2, 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dan-hughes)

@johlju johlju merged commit 47dfe3e into dsccommunity:main Aug 8, 2025
10 checks passed
@johlju johlju removed the needs review The pull request needs a code review. label Aug 8, 2025
@dan-hughes dan-hughes deleted the issue-120 branch August 8, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to exclude Example folders from tests

2 participants