Adds two different linter rules (one general purpose and another PHP specific) to prevent empty files from being added to a repository. For some unknown reason, people seem to like to do this.
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rARC6fa2de5ff813: Add a linter rule for detecting empty files
Added test cases.
Diff Detail
- Repository
- rARC Arcanist
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
FWIW Creating an hidden empty file in a directoy seems to be the convention for making git create a directory in the working copy on checkout.
It's also practically required with python (To specify a package directory with __init__.py).
Sometimes people put stuff in it, which makes it even worse, IMO.
Maybe default this to advice?
Ah, good points.
You can put some text in .keep files to explain what the directory is used for, and they're normally fairly few and far between. This probably isn't a bad practice, but this isn't terribly obvious and is a little cumbersome. And this is pretty unreasonable to expect of __init__.py files.
We could try excluding .dotfiles and __init__.py by default. I'm not sure if this gets us 50% or 99% coverage of exceptions.
We could toss the generic version of the rule or disable it by default.
This is also tricky because there's no way to selectively disable it on-site via some eventual syntax added by T1549.