Skip to content

Commit

Permalink
Add GovukSubmit cop
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd authored and duncanjbrown committed Feb 14, 2021
1 parent 87edebc commit a21ba48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require:
- rubocop-rspec
- ./lib/rubocop/cop/govuk/govuk_button_to.rb
- ./lib/rubocop/cop/govuk/govuk_link_to.rb
- ./lib/rubocop/cop/govuk/govuk_submit.rb

AllCops:
Exclude:
Expand Down
13 changes: 13 additions & 0 deletions lib/rubocop/cop/govuk/govuk_submit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module RuboCop
module Cop
module Govuk
class GovukSubmit < Base
def on_send(node)
return unless node.method_name == :submit

add_offense(node, message: 'Use govuk_submit instead of submit')
end
end
end
end
end

0 comments on commit a21ba48

Please sign in to comment.