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

Allow file pattern filters when using a commit filter #21

Open
Drise13 opened this issue Mar 16, 2022 · 1 comment
Open

Allow file pattern filters when using a commit filter #21

Drise13 opened this issue Mar 16, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@Drise13
Copy link

Drise13 commented Mar 16, 2022

Looking for something that satisfies the following command:

'dotnet regitlint -f commits -a head^ -b head -p "**/*.cs"

@sethreno sethreno added the enhancement New feature or request label Mar 19, 2022
@bart-vmware
Copy link
Contributor

This command could mean two things:

  • Reformat only the *.cs files from the last commit
  • Reformat all files changed in the last commit, and also run on all files that match *.cs

Besides that, this is very tricky to get right, because today the pattern is simply passed onto cleanupcode. And cleanupcode is full of bugs in handling glob patterns (which may change at any time). So now regitlint would need to re-implement that buggy behavior, so it can apply the equivalent filtering logic on the found files from git.

Another approach could be to use .NETs own file globbing on the found git files. But that would mean regitlint gets two different interpretations for globs, depending on whether you combine it with commit hashes or not.

Neither sound very appealing. A third option (breaking change) could be to never send the pattern onto cleanupcode, but make regitlint always expand the pattern into a fileset. That raises the question how to deal with conflicting include/exclude patterns (who wins?). It also makes running regitlint on a large set of files magnitudes slower, because now it needs to break the set into individual calls to cleanupcode because of command-line length restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants