<commit_before>module ActiveAdminAddons
  class InputBase < Formtastic::Inputs::StringInput
    include InputOptionsHandler
    include InputMethods
    include InputHtmlHelpers

    def to_html
      load_input_class
      load_control_attributes
      render_custom_input
      if parts.any?
        return input_wrapping { parts_to_html }
      else
        super
      end
    end

    def input_html_options
      super.merge(control_attributes)
    end

    def parts_to_html
      parts.flatten.join("\n").html_safe
    end

    def load_input_class
      load_class(self.class.to_s.underscore.dasherize)
    end

    def load_control_attributes
      # Override on child classes if needed
    end

    def render_custom_input
      # Override on child classes if needed
    end

    def parts
      @parts ||= []
    end
<commit_msg>Remove invalid html attributes for inputs<commit_after>module ActiveAdminAddons
  class InputBase < Formtastic::Inputs::StringInput
    include InputOptionsHandler
    include InputMethods
    include InputHtmlHelpers

    def to_html
      load_input_class
      load_control_attributes
      render_custom_input
      if parts.any?
        return input_wrapping { parts_to_html }
      else
        super
      end
    end

    def input_html_options
      # maxwidth and size are added by Formtastic::Inputs::StringInput
      # but according to the HTML standard these are not valid attributes
      # on the inputs provided by this module
      super.except(:maxlength, :size).merge(control_attributes)
    end

    def parts_to_html
      parts.flatten.join("\n").html_safe
    end

    def load_input_class
      load_class(self.class.to_s.underscore.dasherize)
    end

    def load_control_attributes
      # Override on child classes if needed
    end

    def render_custom_input
      # Override on child classes if needed
    end

    def parts
      @parts ||= []
    end

{'fraction_non_alphanumeric': 0.045147898287493514, 'fraction_numerical': 0.0, 'mean_word_length': 2.5970149253731343, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7049227', 'n_tokens_mistral': 550, 'n_tokens_neox': 542, 'n_words': 149}