#26356 closed New feature (wontfix)
Allow management commands to require tagged checks
Reported by: | julen | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | system checks |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It would be handy if management commands could opt-in for specific groups of system checks, as these can already be labeled.
As I read through the source code, making this change would be trivial (BaseCommand.check()
already supports tags), so I wonder if such a feature would be accepted by core devs. TIA!
Change History (4)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Thanks for the quick reply :)
Yeah, I'm aware of requires_system_checks
.
Our use-case is that some of our system checks deal with existing DB data and they assume such data is there, however some other commands might be run before the DB is setup (migrate
, and other related custom commands). For now we are catching potential exceptions in our checks' code, and hence it'd be sweet if we could just omit running such checks for certain commands in the first place as we have them tagged.
We could override BaseCommand.execute()
or BaseCommand.check()
, but this feels clumsy and error-prone. On the other hand, BaseCommand
could potentially read the tags to be checked from e.g. BaseCommand.requires_system_check_tags
and this would be AFAICT roughly a single-line change in Django and our management commands.
comment:3 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
As the documentations says, "The system check framework is a set of static checks for validating Django projects."
Therefore, I feel your use case of checks that deal with objects in the database is really outside the scope of the intended use of the checks framework. If you'd like to raise a wider discussion about it and see if anyone else supports expanding it, feel free to post to the DevelopersMailingList.
comment:4 by , 9 years ago
Thanks for the pointer, and no problem — we'll see if our need extends to the point we have to bring it up in the mailing list. Thanks again for the quick interaction!
There's the
BaseCommand.requires_system_checks
attribute. What's your use case for wanting some checks but not all?