nautobot / pylint-nautobot

Custom Pylint Rules for Nautobot
https://docs.nautobot.com/projects/pylint-nautobot/en/latest/
Other
4 stars 0 forks source link

Add Linter to Follow URL Naming Conventions #100

Open bryanculver opened 1 month ago

bryanculver commented 1 month ago

Environment

Proposed Functionality

Use Case

Walk the urlpatterns in urls.py of an app and ensure that URLs with associated models (should be able to introspect the view) have names that are proper slugs of the model name.

If exclusively using NautobotUIViewset this should be a quick win as those create the preferred routes and names automatically. But if an app hasn't used NautobotUIViewSet or provides additional URLs/actions, they should follow the same convention (see: https://github.com/nautobot/nautobot-app-circuit-maintenance/blob/af6553cfddf8fe90c8abdd302f5018120d287e87/nautobot_circuit_maintenance/urls.py#L13-L32)

glennmatthews commented 1 month ago

To be clear, the above link shows incorrect urlpatterns - see https://github.com/nautobot/nautobot-app-circuit-maintenance/pull/320 for the appropriate corrections.

Most likely a linter here would need to check something like model._meta.verbose_name_plural.lower().replace(" ", "-") as a first pass.