-
Notifications
You must be signed in to change notification settings - Fork 460
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
Biome step empties files when the file is ignored since biome 1.5.0 #1987
Comments
There's also a different scenario where biome refuses to format certain files, such as
|
blutorange
pushed a commit
to blutorange/spotless
that referenced
this issue
Jan 9, 2024
…d files The issue happens only with the latest release 1.5.0. * When the biome output is empty, the contents of the input file to format are used unchanged instead. * When biome outputs warnings / errors to stderr, these are now logged. This includes warnings such as when biome ignores files. Otherwise people would be left wondering why certain files are not formatted. I also added a test for this scenarion. On another note, I mostly use Maven, so I always need to look up how to run tests via Gradle. I added a short section to CONTRIBUTING.md that gives some example commands how to run tests for this project, especially how to run only a single test.
2 tasks
nedtwigg
added a commit
that referenced
this issue
Jan 15, 2024
Published in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please feel free to assign this issue to me.
The biome step uses the following command to format files via biome:
The
biome.json
config file can contain anignore
field with files that should not be processed. When the given file name matches that ignore list, biome won't format the file. In biome versions<1.5.0
, it would still output the input file unchanged to stdout, and log a warning to stderr.Since version 1.5.0, biome does not output anything to stdout, and only print a warning to stderr
As a result, when trying to format a file via the biome step that is ignored, the file will be emptied, without the user noticing.
I would consider this a misconfiguration, as the includes/excludes defined for the spotless plugin conflict with the includes from the biome configuration. Still, it's not good to destroy data without the user being aware that something went wrong (I accidentally committed something, only to realize this later).
Ideally, we would just ignore the include/exclude list from the biome configuration. Since the biome CLI doesn't have such a flag, my suggestion is to check whether the biome output is empty; and if it is, use the original file content instead. In addition, we could either output a warning on our own, or forward the warning from the stderr stream from biome (if that's not already being done).
The text was updated successfully, but these errors were encountered: