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
# `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
# one by one as the lints are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of Haml-Lint, may require this file to be generated again.
linters:
# Offense count: 945
# Offense count: 946
LineLength:
enabled: false
@ -15,7 +15,7 @@ linters:
UnnecessaryStringOutput:
enabled: false
# Offense count: 57
# Offense count: 59
RuboCop:
enabled: false
@ -26,12 +26,11 @@ linters:
- 'app/views/admin/reports/show.html.haml'
- 'app/views/disputes/strikes/show.html.haml'
# Offense count: 28
# Offense count: 25
InstanceVariables:
exclude:
- 'app/views/admin/reports/_actions.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/sessions/two_factor/_otp_authentication_form.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: @webhook
= render 'shared/error_messages', object: form.object
.fields-group
= f.input :url, wrapper: :with_block_label, input_html: { placeholder: 'https://' }
.fields-group
= form.input :url, wrapper: :with_block_label, input_html: { placeholder: 'https://' }
.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)) }
.fields-group
= 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
= f.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
.fields-group
= form.input :template, wrapper: :with_block_label, input_html: { placeholder: '{ "content": "Hello {{object.username}}" }' }

View File

@ -1,4 +1,7 @@
- content_for :page_title do
= 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
= 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