Skip to content

Comments

refactor: change regex match to the glob path pattern#73

Merged
gaius-qi merged 1 commit intomainfrom
refactor/glob-path
Feb 17, 2025
Merged

refactor: change regex match to the glob path pattern#73
gaius-qi merged 1 commit intomainfrom
refactor/glob-path

Conversation

@chlins
Copy link
Member

@chlins chlins commented Feb 17, 2025

This pull request includes significant changes to the backend package, focusing on refactoring the processor logic and improving the Build function. The most important changes include the introduction of a base struct for processors, modifications to the Build function, and updates to the processor implementations and their corresponding tests.

Refactoring and Enhancements:

  • Introduction of base struct for processors:

    • Added a new base struct in pkg/backend/processor/base.go to handle common processor logic, including the Process method.
    • Updated licenseProcessor, modelProcessor, and modelConfigProcessor to utilize the new base struct for processing files. [1] [2] [3]
  • Modifications to the Build function:

    • Changed the defaultProcessors and getProcessors methods to be part of the backend struct, allowing them to access the store and other members.
    • Updated the process method to simplify file processing by removing the directory walking logic and using the Process method of each processor.
  • Updates to processor implementations:

    • Refactored NewLicenseProcessor, NewModelProcessor, and NewModelConfigProcessor to accept store, mediaType, and patterns parameters, and to use the base struct for processing. [1] [2] [3]

Testing Improvements:

  • Processor tests refactoring:
    • Updated tests for licenseProcessor, modelProcessor, and modelConfigProcessor to use the suite package for better test organization and setup. [1] [2] [3]
    • Modified test cases to reflect the changes in processor initialization and processing logic.

Additional Changes:

  • Imports and minor adjustments:
    • Removed unused imports and reorganized import statements in various files. [1] [2]
    • Adjusted the parameter order in the BuildLayer function to maintain consistency.

@chlins chlins force-pushed the refactor/glob-path branch from 479956c to 30dd426 Compare February 17, 2025 07:04
gaius-qi
gaius-qi previously approved these changes Feb 17, 2025
Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

LGTM

@gaius-qi
Copy link
Member

@chlins Fix lint.

Signed-off-by: chlins <chlins.zhang@gmail.com>
Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

LGTM

@gaius-qi gaius-qi merged commit dd95023 into main Feb 17, 2025
5 checks passed
@gaius-qi gaius-qi deleted the refactor/glob-path branch February 17, 2025 07:20
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