erichmenge/signed_form

View on GitHub

Showing 5 of 5 total issues

Method permit_signed_form_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def permit_signed_form_data
        return if request.method == 'GET' || params['form_signature'].blank?

        gate_keeper = GateKeeper.new(self)

Severity: Minor
Found in lib/signed_form/action_controller/permit_signed_params.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method form_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def form_for(record, options = {}, &block)
        if options[:signed].nil? && !SignedForm.options[:signed] || !options[:signed].nil? && !options[:signed]
          return super
        end

Severity: Minor
Found in lib/signed_form/action_view/form_helper.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(options = {})
      self.secret_key = options[:secret_key]

      if secret_key.nil? || secret_key.empty?
        if defined?(::Rails) and ::Rails.application.respond_to?(:secrets)
Severity: Minor
Found in lib/signed_form/hmac.rb - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method verify_destination has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_destination
      return unless options[:method] && options[:url]
      raise Errors::InvalidURL if options[:method].to_s.casecmp(@request.request_method) != 0
      url = @controller.url_for(options[:url]).split('#').first
      raise Errors::InvalidURL if url != @request.fullpath && url != @request.url
Severity: Minor
Found in lib/signed_form/gate_keeper.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method verify_digest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_digest
      return unless options[:digest]

      return if options[:digest_expiration] && Time.now < options[:digest_expiration]

Severity: Minor
Found in lib/signed_form/gate_keeper.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language