Fix haml-lint InstanceVariables rule for admin/webhooks/_form (#26062)

This commit is contained in:
Matt Jankowski 2023-09-28 10:23:35 -04:00 committed by GitHub
parent 3060bfa4bd
commit 9d56c1949b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 18 deletions

View File

@ -1,13 +1,13 @@
# This configuration was generated by # This configuration was generated by
# `haml-lint --auto-gen-config` # `haml-lint --auto-gen-config`
# on 2023-08-28 13:08:37 -0400 using Haml-Lint version 0.50.0. # on 2023-09-28 10:03:39 -0400 using Haml-Lint version 0.50.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the lints are removed from the code base. # one by one as the lints are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of Haml-Lint, may require this file to be generated again. # versions of Haml-Lint, may require this file to be generated again.
linters: linters:
# Offense count: 945 # Offense count: 946
LineLength: LineLength:
enabled: false enabled: false
@ -15,7 +15,7 @@ linters:
UnnecessaryStringOutput: UnnecessaryStringOutput:
enabled: false enabled: false
# Offense count: 57 # Offense count: 59
RuboCop: RuboCop:
enabled: false enabled: false
@ -26,12 +26,11 @@ linters:
- 'app/views/admin/reports/show.html.haml' - 'app/views/admin/reports/show.html.haml'
- 'app/views/disputes/strikes/show.html.haml' - 'app/views/disputes/strikes/show.html.haml'
# Offense count: 28 # Offense count: 25
InstanceVariables: InstanceVariables:
exclude: exclude:
- 'app/views/admin/reports/_actions.html.haml' - 'app/views/admin/reports/_actions.html.haml'
- 'app/views/admin/roles/_form.html.haml' - 'app/views/admin/roles/_form.html.haml'
- 'app/views/admin/webhooks/_form.html.haml'
- 'app/views/auth/registrations/_status.html.haml' - 'app/views/auth/registrations/_status.html.haml'
- 'app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml' - 'app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml'
- 'app/views/relationships/_account.html.haml' - 'app/views/relationships/_account.html.haml'

View File

@ -1,14 +1,10 @@
= simple_form_for @webhook, url: @webhook.new_record? ? admin_webhooks_path : admin_webhook_path(@webhook) do |f| = render 'shared/error_messages', object: form.object
= render 'shared/error_messages', object: @webhook
.fields-group .fields-group
= f.input :url, wrapper: :with_block_label, input_html: { placeholder: 'https://' } = form.input :url, wrapper: :with_block_label, input_html: { placeholder: 'https://' }
.fields-group .fields-group
= f.input :events, collection: Webhook::EVENTS, wrapper: :with_block_label, include_blank: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', disabled: Webhook::EVENTS.filter { |event| !current_user.role.can?(Webhook.permission_for_event(event)) } = form.input :events, collection: Webhook::EVENTS, wrapper: :with_block_label, include_blank: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', disabled: Webhook::EVENTS.filter { |event| !current_user.role.can?(Webhook.permission_for_event(event)) }
.fields-group .fields-group
= f.input :template, wrapper: :with_block_label, input_html: { placeholder: '{ "content": "Hello {{object.username}}" }' } = form.input :template, wrapper: :with_block_label, input_html: { placeholder: '{ "content": "Hello {{object.username}}" }' }
.actions
= f.button :button, @webhook.new_record? ? t('admin.webhooks.add_new') : t('generic.save_changes'), type: :submit

View File

@ -1,4 +1,7 @@
- content_for :page_title do - content_for :page_title do
= t('admin.webhooks.edit') = t('admin.webhooks.edit')
= render partial: 'form' = simple_form_for @webhook, url: admin_webhook_path(@webhook) do |form|
= render partial: 'form', object: form
.actions
= form.button :button, t('generic.save_changes'), type: :submit

View File

@ -1,4 +1,7 @@
- content_for :page_title do - content_for :page_title do
= t('admin.webhooks.new') = t('admin.webhooks.new')
= render partial: 'form' = simple_form_for @webhook, url: admin_webhooks_path do |form|
= render partial: 'form', object: form
.actions
= form.button :button, t('admin.webhooks.add_new'), type: :submit