Sha256: 949cd1a9d229928467660b2df8cc09013bb6f3ff4464c3e50768afa55aae6115

Contents?: true

Size: 496 Bytes

Versions: 4

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

module PlatformosCheck
  class FormAction < HtmlCheck
    severity :error
    categories :html
    doc docs_url(__FILE__)

    def on_form(node)
      action = node.attributes["action"]&.strip
      return if action.nil?
      return if action.empty?
      return if action.start_with?('/', '{{')

      add_offense("Use action=\"/#{action}\" (start with /) to ensure the form can be submitted multiple times in case of validation errors", node:)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
platformos-check-0.4.8 lib/platformos_check/checks/form_action.rb
platformos-check-0.4.7 lib/platformos_check/checks/form_action.rb
platformos-check-0.4.6 lib/platformos_check/checks/form_action.rb
platformos-check-0.4.5 lib/platformos_check/checks/form_action.rb