Skip to content

Conversation

@jbrinkman
Copy link
Owner

This PR implements task 5.2 from the spec: Add filtering and configuration options.

Changes

  1. Enhanced CLI Interface:

    • Added namespace filtering with -f|--filter option
    • Added type pattern filtering with -t|--type option
    • Added exclusion pattern support with -e|--exclude option
    • Added options for including internal and compiler-generated types
  2. Configuration Loading:

    • Implemented proper configuration file loading from JSON
    • Added error handling for invalid configuration files
    • Ensured CLI options override configuration file settings
  3. Filtering Implementation:

    • Updated ApiExtractor to filter types based on namespace and type patterns
    • Added support for including/excluding specific types and namespaces
    • Implemented wildcard pattern matching for type names
  4. Testing:

    • Created comprehensive integration tests for all filtering options
    • Added tests for configuration loading and validation
    • Created a sample configuration file for testing
  5. Documentation:

    • Updated README.md with new CLI options and examples
    • Added detailed documentation about the configuration file format

Requirements Addressed

  • 3.2: When a configuration file is provided THEN the system SHALL load and apply the specified rules
  • 3.3: IF no configuration is provided THEN the system SHALL use sensible defaults for breaking change detection
  • 5.1: WHEN namespace filters are provided THEN the system SHALL only compare types within the specified namespaces
  • 5.2: WHEN type name patterns are provided THEN the system SHALL only compare types matching the specified patterns
  • 5.3: WHEN exclusion filters are provided THEN the system SHALL ignore types or namespaces matching the exclusion criteria
  • 5.4: IF no types match the provided filters THEN the system SHALL display a warning and continue with an empty comparison

- Updated ComparisonConfiguration to include JsonStringEnumConverter.
- Modified ApiComparerTests and ApiExtractorTests to support new method signatures.
- Improved CompareCommand tests to handle FilterConfiguration.
- Adjusted ComparisonConfigurationTests to load configuration from the correct path.
- Added TestData directory to project output.
@jbrinkman jbrinkman requested a review from Copilot July 20, 2025 18:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements comprehensive filtering and configuration options for the DotNetApiDiff tool. The implementation adds namespace filtering, type pattern matching, exclusion patterns, and configuration file loading functionality to enhance the tool's flexibility and usability.

Key changes include:

  • Enhanced CLI interface with filtering options for namespaces, types, and exclusions
  • Configuration file loading with JSON support and comprehensive error handling
  • API extractor filtering implementation with wildcard pattern matching for types and namespaces

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/DotNetApiDiff/Commands/CompareCommand.cs Enhanced CLI with new filtering options and configuration loading logic
src/DotNetApiDiff/ApiExtraction/ApiExtractor.cs Implemented filtering logic with namespace/type pattern matching
src/DotNetApiDiff/Interfaces/IApiExtractor.cs Updated interface to accept filter configuration parameters
src/DotNetApiDiff/Models/Configuration/ComparisonConfiguration.cs Added JSON enum converter for proper serialization
tests/DotNetApiDiff.Tests/Commands/CompareCommandFilteringTests.cs Comprehensive integration tests for all filtering scenarios
tests/DotNetApiDiff.Tests/TestData/sample-config.json Sample configuration file for testing and documentation
README.md Updated documentation with new CLI options and configuration examples
Comments suppressed due to low confidence (1)

tests/DotNetApiDiff.Tests/Models/Configuration/FilterConfigurationTests.cs:3

  • Unused import System.Text.Json should be removed as the serialization tests were removed from this file.
using Xunit;

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jbrinkman jbrinkman merged commit ab8e624 into main Jul 20, 2025
9 checks passed
@jbrinkman jbrinkman deleted the feature/task-5.2-cli-filtering branch July 23, 2025 16:06
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.

2 participants