Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Linter to Follow URL Naming Conventions #100

Open
bryanculver opened this issue Sep 30, 2024 · 1 comment
Open

Add Linter to Follow URL Naming Conventions #100

bryanculver opened this issue Sep 30, 2024 · 1 comment

Comments

@bryanculver
Copy link
Member

Environment

  • Nautobot version:
  • pylint-nautobot version:

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
Copy link
Contributor

To be clear, the above link shows incorrect urlpatterns - see nautobot/nautobot-app-circuit-maintenance#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants