2019-12-04 16:07:31 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-07-23 14:10:06 -04:00
|
|
|
require_relative '../routes_under_scope'
|
|
|
|
|
2019-12-04 16:07:31 -05:00
|
|
|
module RuboCop
|
|
|
|
module Cop
|
|
|
|
# Checks for a group routes outside '/-/' scope.
|
|
|
|
# For more information see: https://gitlab.com/gitlab-org/gitlab/issues/29572
|
|
|
|
class PutGroupRoutesUnderScope < RuboCop::Cop::Cop
|
2020-07-23 14:10:06 -04:00
|
|
|
include RoutesUnderScope
|
|
|
|
|
2019-12-04 16:07:31 -05:00
|
|
|
MSG = 'Put new group routes under /-/ scope'
|
|
|
|
|
|
|
|
def_node_matcher :dash_scope?, <<~PATTERN
|
|
|
|
(:send nil? :scope (hash <(pair (sym :path)(str "groups/*group_id/-")) ...>))
|
|
|
|
PATTERN
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|