AllenNeuralDynamics / AllenNeuralDynamics/aind-flake8-extensions

Force developers to name paired unit fields properly

Abierto
#4 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
0
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.