ninoseki/urlscan

View on GitHub

Showing 4 of 4 total issues

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

      def request(req)
        Net::HTTP.start(HOST, 443, https_options) do |http|
          response = http.request(req)

          case response.code
Severity: Minor
Found in lib/urlscan/clients/base.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

unexpected token tCOLON (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
Open

        @default_headers ||= { "API-KEY": key }.compact
Severity: Minor
Found in lib/urlscan/clients/base.rb by rubocop

Freeze mutable objects assigned to constants.
Open

  VERSION = "0.8.0"
Severity: Minor
Found in lib/urlscan/version.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Freeze mutable objects assigned to constants.
Open

      HOST = "urlscan.io"
Severity: Minor
Found in lib/urlscan/clients/pro.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze
Severity
Category
Status
Source
Language