Skip to content

Comments

Add ability to exclude by type name, attribute or assignable type#25

Merged
Dreamescaper merged 5 commits intomainfrom
exclude-filters
May 3, 2025
Merged

Add ability to exclude by type name, attribute or assignable type#25
Dreamescaper merged 5 commits intomainfrom
exclude-filters

Conversation

@Dreamescaper
Copy link
Owner

No description provided.

@Dreamescaper Dreamescaper requested a review from Copilot April 25, 2025 10:36
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 adds functionality to exclude types from service registrations based on either their type name (using wildcards) or by the presence of a specific attribute. Key changes include updating the AttributeModel to support new exclusion parameters, extending the attribute generator to include new properties with updated documentation, and adjusting the dependency injection filtering along with adding corresponding tests.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ServiceScan.SourceGenerator/Model/AttributeModel.cs Added new parameters to capture exclusion options and updated the Create method accordingly.
ServiceScan.SourceGenerator/GenerateAttributeSource.cs Introduced new attribute properties and adjusted documentation.
ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs Incorporated new logic to filter out types based on exclusion rules.
ServiceScan.SourceGenerator.Tests/AddServicesTests.cs Added tests for excluding services by type name and attribute.
README.md Updated usage documentation to reflect the new exclusion properties.

@Dreamescaper Dreamescaper requested a review from Copilot May 3, 2025 11:22
@Dreamescaper Dreamescaper changed the title Add ability to exclude by type name or attribute Add ability to exclude by type name, attribute or assignable type May 3, 2025
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 adds new exclusion options to the service registration source generator, allowing users to prevent types from being registered based on type names, attributes, or assignability. Key changes include:

  • Updates to the AttributeModel to include new exclusion properties.
  • Adjustments to the generator logic in DependencyInjectionGenerator.FilterTypes.cs to handle exclusions.
  • New tests and documentation updates to validate and explain the new behavior.

Reviewed Changes

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

Show a summary per file
File Description
ServiceScan.SourceGenerator/Model/AttributeModel.cs Added exclusion properties and updated the Create method to set exclusion type names.
ServiceScan.SourceGenerator/GenerateAttributeSource.cs Introduced new properties for exclusions and updated comments accordingly.
ServiceScan.SourceGenerator/EquatableArray.cs Changed the EquatableArrayBuilder class accessibility for better encapsulation.
ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs Updated filtering logic to consider exclusions based on type name, attribute, and assignability.
ServiceScan.SourceGenerator.Tests/AddServicesTests.cs Added tests to verify the new exclusion functionalities.
README.md Updated documentation to reflect new exclusion parameters and behavior.

@Dreamescaper Dreamescaper requested a review from Copilot May 3, 2025 11:27
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 adds new exclusion criteria for type registration by introducing filtering based on type name, attribute presence, and assignable types. Key changes include additions to the AttributeModel for new exclusion properties, updates to the generator’s filtering logic and attribute source definitions, and comprehensive new tests and README updates validating these changes.

Reviewed Changes

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

Show a summary per file
File Description
ServiceScan.SourceGenerator/Model/AttributeModel.cs Adds new exclusion properties and updates the Create method accordingly.
ServiceScan.SourceGenerator/GenerateAttributeSource.cs Updates property names and comments to reflect the new exclusion options.
ServiceScan.SourceGenerator/EquatableArray.cs Changes class modifier for improved internal accessibility.
ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs Implements and applies new exclusion filters in the DI generator logic.
ServiceScan.SourceGenerator.Tests/AddServicesTests.cs Introduces new test cases to verify the exclusion filter functionality.
README.md Updates documentation to include details about the new exclusion filters.
Comments suppressed due to low confidence (1)

ServiceScan.SourceGenerator/Model/AttributeModel.cs:15

  • Consider aligning the naming of 'ExcludeByAttributeTypeName' with the property 'ExcludeByAttribute' in GenerateAttributeSource.cs for consistency.
string? ExcludeByAttributeTypeName,

@Dreamescaper Dreamescaper merged commit 0dd0f01 into main May 3, 2025
1 check passed
@Dreamescaper Dreamescaper deleted the exclude-filters branch May 3, 2025 11:29
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.

1 participant