Class: RuboCop::Cop::Zuno::ApiPathFormat
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Zuno::ApiPathFormat
- Defined in:
- lib/rubocop/cop/zuno/api_path_format.rb
Overview
Clients expect to interface with our API using kebab-case.
This cop ensures that our API paths are formatted using the correct case.
Underscores are acceptable in path variables (e.g. “/path/:path_id/update”)
Constant Summary collapse
- MSG =
"Use kebab-case for the API path"
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/rubocop/cop/zuno/api_path_format.rb', line 35 def on_send(node) path_defining_method_with_string_path(node) do |path| add_offense(node) if path_name_does_not_follow_kebab_case?(path) end namespace_with_symbol(node) do |path| add_offense(node) if path.to_s.include?("_") end end |