dprint / dprint

Pluggable and configurable code formatting platform written in Rust.

Home Page:https://dprint.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regression - 0.43.2 finds fewer files than 0.43.1

bradzacher opened this issue · comments

It looks like #797 was a bit further-reaching than intended.
When I run dprint output-file-paths | wc -l on Canva's codebase:

  • 0.43.1 - 83,896 files
  • 0.43.2 - 69,695 files

Cases like this aren't being handled any more:

{
  "include": [
    "!src/foo/**/*",
    "src/foo/file.ts"
  ]
}

Our config setup is quite ugly and complicated, sadly.
We have an auto-generated config that allows teams to configure formatting using .gitattributes files. In some cases people will opt out a folder higher-up, and then opt-in specific files or specific sub-folders.

As an example one might opt-out all files in src/foo because it contains generated files, but specifically opt-in src/foo/README.md because that's a human-written file.

Ah, I remember that now and thanks for spotting this! I'll add a test for this scenario and look into this soon.

@bradzacher I was looking at this more and realized the CLI args just overridding what's in the config isn't a good design. I opened #804 -- Does what's done there make sense? Let me know if you have any suggestions.

That seems logical to me.

Based on what I've seen internally - all the usecases we have for CLI args is exactly as you describe - we are instructing dprint to format a subset of the allowed files and nothing more.

I don't even think people use the exclude arg - they just run dprint fmt "some/folder/**/*" to ensure their changes are good before submitting them.

Also worth noting that from CI we also don't even pass globs any more or call output-file-paths - we have got it fast enough to just run dprint fmt on CI!!

Great. I'm going to merge this and do a minor release tonight. I'm pretty confident that most people would expect this behaviour.

Also worth noting that from CI we also don't even pass globs any more or call output-file-paths - we have got it fast enough to just run dprint fmt on CI!!

That's great to hear and it's the way it should be! Way less complexity.

Should be fixed now in the latest release.