Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): allow excluding patterns from formatter #72

Merged
merged 1 commit into from
Feb 8, 2025

Conversation

azjezz
Copy link
Member

@azjezz azjezz commented Feb 8, 2025

📌 What Does This PR Do?

This PR adds support for an excludes configuration option under the [format] section in mago.toml. With this new option, users can specify files, directories, or glob patterns that will be excluded from formatting operations. These files will not be modified during the formatting process, but they remain active for linting and other analysis tasks.

🔍 Context & Motivation

Several users have requested more granular control over formatting behavior. In many projects, there are files or directories (such as generated files ) that should not be reformatted by the tool. Prior to this change, Mago would format every file found during its scan, which sometimes led to unintended modifications.

By introducing an excludes option under [format], users now have the ability to tailor the formatting process. They can exclude specific paths or patterns from being formatted while still including them in other operations like linting. This enhancement improves both performance and user control.

🛠️ Summary of Changes

  • Feature: Added support for the excludes key under the [format] section in mago.toml. This option accepts an array of file/directory patterns to exclude from formatting.
  • Docs: Updated the configuration documentation to mention the new excludes option under [format].

📂 Affected Areas

  • Linter
  • Formatter
  • CLI
  • Composer Plugin
  • Dependencies
  • Documentation
  • Other (please specify):

🔗 Related Issues or PRs

closes #28

📝 Notes for Reviewers

N/A

Signed-off-by: azjezz <azjezz@protonmail.com>
@azjezz azjezz added Priority: High After critical issues are fixed, handle these before any further issues. Type: Enhancement Request for additions or changes that improve existing functionality. Subject: Formatter An issue or PR related to the formatter. labels Feb 8, 2025
@azjezz azjezz self-assigned this Feb 8, 2025
@azjezz azjezz merged commit 558256b into main Feb 8, 2025
4 checks passed
@azjezz azjezz deleted the feat/format-excludes branch February 8, 2025 14:54
@azjezz azjezz added the Status: Closed This issue is closed and no more work is planned. label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High After critical issues are fixed, handle these before any further issues. Status: Closed This issue is closed and no more work is planned. Subject: Formatter An issue or PR related to the formatter. Type: Enhancement Request for additions or changes that improve existing functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow ignoring certain paths from fmt
1 participant