Skip to content

Conversation

@pablotoledo
Copy link
Owner

This pull request introduces a new feature to exclude specific file extensions from processing in the readium tool. The changes include updates to the CLI, configuration, core logic, and documentation, as well as the addition of comprehensive tests to ensure the feature works as expected.

New Feature: Exclude File Extensions

CLI and Configuration Updates:

  • Added a new --exclude-ext option to the CLI, allowing users to specify file extensions to exclude from processing. This option can be used multiple times (e.g., --exclude-ext .json --exclude-ext .yml) (src/readium/cli.py, src/readium/cli.pyR87-R92).
  • Updated the ReadConfig class to include an exclude_extensions attribute, which takes precedence over include_extensions during processing (src/readium/config.py, src/readium/config.pyR179).
  • Documented the new exclude_extensions attribute in the ReadConfig docstring (src/readium/config.py, src/readium/config.pyL163-R169).

Core Logic Enhancements:

  • Modified the should_process_file method to check for excluded extensions (case-insensitive) and skip processing files with those extensions (src/readium/core.py, src/readium/core.pyR240-R244).

Documentation:

  • Updated the README.md to explain the new --exclude-ext option and clarify that exclusions take precedence over inclusions (README.md, [1] [2] [3].

Testing

  • Added a new test file, tests/test_extension_exclusion.py, with multiple test cases to validate the behavior of the exclude_extensions feature:
    • Basic exclusion of single and multiple extensions.
    • Interaction between include_extensions and exclude_extensions.
    • Case-insensitive matching of extensions.
    • CLI integration tests for the --exclude-ext option.
    • Tests for excluding all extensions and ensuring no files are processed.
    • Tests for extension exclusion in Git repositories (tests/test_extension_exclusion.py, tests/test_extension_exclusion.pyR1-R147).

@pablotoledo pablotoledo requested a review from Copilot April 23, 2025 23:26
Copy link

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 introduces support for excluding specific file extensions from processing in the readium tool, enabling users to skip files based on their extensions.

  • Adds a new CLI option (--exclude-ext) and updates configuration to support file extension exclusions.
  • Modifies core file processing logic to check excluded extensions (case-insensitive).
  • Updates documentation and adds tests to validate the exclusion feature.

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
tests/test_extension_exclusion.py Adds test cases to cover various extension exclusion scenarios.
src/readium/core.py Updates should_process_file to skip files with excluded extensions.
src/readium/config.py Adds exclude_extensions attribute in configuration.
src/readium/cli.py Introduces CLI flag (--exclude-ext) to pass exclusion extensions.
README.md Documents the new exclude_extensions feature and usage.

@pablotoledo pablotoledo merged commit 88fed49 into main Apr 24, 2025
3 checks passed
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