AllenNeuralDynamics / AllenNeuralDynamics/aind-flake8-extensions

Force developers to name paired unit fields properly

Ouverte
#4 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
0
Forks
0
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

# 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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.