debian-mirror-gitlab/rubocop/cop/put_group_routes_under_scope.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
542 B
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
2020-10-24 23:57:45 +05:30
require_relative '../routes_under_scope'
2020-01-01 13:55:28 +05:30
module RuboCop
module Cop
# Checks for a group routes outside '/-/' scope.
# For more information see: https://gitlab.com/gitlab-org/gitlab/issues/29572
2022-10-11 01:57:18 +05:30
class PutGroupRoutesUnderScope < RuboCop::Cop::Base
2020-10-24 23:57:45 +05:30
include RoutesUnderScope
2020-01-01 13:55:28 +05:30
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