AllenNeuralDynamics / AllenNeuralDynamics/aind-flake8-extensions

Force developers to name paired unit fields properly

Aperta
#4 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

# User story
This follows from this PR: https://github.com/AllenNeuralDynamics/aind-data-schema/pull/1122 which gives some context for how the _unit validator works in `aind-data-schema`. Going forward this will be an expectation for developers.

As a developer, I want to be warned if I mis-name units. E.g. if I make a unit called `variable_unit` and I don't put something called `variable` in my class, I should get a warning. Similarly if I put something called `variable_unit` and have several other fields called `something_variable` and `something_else_variable` I should get a warning that the `variable` label should be placed as a prefix (i.e. the user should have to name their fields variable_something and variable_something_else, which are matched with the variable_unit field).

An additional complication is Optional, whatever the variable is the unit should be as well.

# Acceptance criteria
- [ ] PF004 warning for paired variable/variable_unit
- [ ] PF005 warning for variable_*/variable_unit
- [ ] PF006 warning if variable/unit are not both required or both optional

# Sprint Ready Checklist
- [ ] 1. Acceptance criteria defined
- [ ] 2. Team understands acceptance criteria
- [ ] 3. Team has defined solution / steps to satisfy acceptance criteria
- [ ] 4. Acceptance criteria is verifiable / testable
- [ ] 5. External / 3rd Party dependencies identified
- [ ] 6. Ticket is prioritized and sized

# Notes
There may be other conditions that should get caught here, but all I can think of right now are these.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.