alexpeattie/nitlink

View on GitHub

Showing 119 of 119 total issues

Final newline missing.
Open

end
Severity: Minor
Found in lib/nitlink/splitter.rb by rubocop

Line is too long. [86/80]
Open

        [response.request.uri, response.code, grab_headers(response.response.to_hash)]
Severity: Minor
Found in lib/nitlink/response_normalizer.rb by rubocop

Final newline missing.
Open

end
Severity: Minor
Found in lib/nitlink.rb by rubocop

Space inside string interpolation detected.
Open

      MalformedLinkHeaderError.new("Malformed link header (#{ link_string })")
Severity: Minor
Found in lib/nitlink/parser.rb by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

Redundant return detected.
Open

      return format(raw_params)
Severity: Minor
Found in lib/nitlink/param_extractor.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Freeze mutable objects assigned to constants.
Open

  VERSION = '1.1.0'
Severity: Minor
Found in lib/nitlink/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

Indent when as deep as case.
Open

      when 'HTTP::Response'
Severity: Minor
Found in lib/nitlink/response_normalizer.rb by rubocop

This cop checks how the whens of a case expression are indented in relation to its case or end keyword.

It will register a separate offense for each misaligned when.

Example:

# If Layout/EndAlignment is set to keyword style (default)
# *case* and *end* should always be aligned to same depth,
# and therefore *when* should always be aligned to both -
# regardless of configuration.

# bad for all styles
case n
  when 0
    x * 2
  else
    y / 3
end

# good for all styles
case n
when 0
  x * 2
else
  y / 3
end

Example: EnforcedStyle: case (default)

# if EndAlignment is set to other style such as
# start_of_line (as shown below), then *when* alignment
# configuration does have an effect.

# bad
a = case n
when 0
  x * 2
else
  y / 3
end

# good
a = case n
    when 0
      x * 2
    else
      y / 3
end

Example: EnforcedStyle: end

# bad
a = case n
    when 0
      x * 2
    else
      y / 3
end

# good
a = case n
when 0
  x * 2
else
  y / 3
end

Final newline missing.
Open

end
Severity: Minor
Found in lib/nitlink/link.rb by rubocop

Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem curb should appear before excon.
Open

  gem 'curb', '>= 0.9.3'
Severity: Minor
Found in Gemfile by rubocop

Gems should be alphabetically sorted within groups.

Example:

# bad
gem 'rubocop'
gem 'rspec'

# good
gem 'rspec'
gem 'rubocop'

# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'

Space inside string interpolation detected.
Open

      EncodedParamSyntaxError.new(%Q{Syntax error decoding encoded parameter value "#{ val }", must be in the form: charset "'" [ language ] "'" value-chars})
Severity: Minor
Found in lib/nitlink/param_decoder.rb by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

Trailing whitespace detected.
Open

      UnsupportedCharsetError.new("Invalid charset #{charset}, encoded parameter values must use the UTF-8 character encoding") 
Severity: Minor
Found in lib/nitlink/param_decoder.rb by rubocop

Final newline missing.
Open

end
Severity: Minor
Found in lib/nitlink/version.rb by rubocop

Indent when as deep as case.
Open

      when 'Unirest::HttpResponse'
Severity: Minor
Found in lib/nitlink/response_normalizer.rb by rubocop

This cop checks how the whens of a case expression are indented in relation to its case or end keyword.

It will register a separate offense for each misaligned when.

Example:

# If Layout/EndAlignment is set to keyword style (default)
# *case* and *end* should always be aligned to same depth,
# and therefore *when* should always be aligned to both -
# regardless of configuration.

# bad for all styles
case n
  when 0
    x * 2
  else
    y / 3
end

# good for all styles
case n
when 0
  x * 2
else
  y / 3
end

Example: EnforcedStyle: case (default)

# if EndAlignment is set to other style such as
# start_of_line (as shown below), then *when* alignment
# configuration does have an effect.

# bad
a = case n
when 0
  x * 2
else
  y / 3
end

# good
a = case n
    when 0
      x * 2
    else
      y / 3
end

Example: EnforcedStyle: end

# bad
a = case n
    when 0
      x * 2
    else
      y / 3
end

# good
a = case n
when 0
  x * 2
else
  y / 3
end

Line is too long. [86/80]
Open

        [response[:url], response[:status], grab_headers(response[:response_headers])]
Severity: Minor
Found in lib/nitlink/response_normalizer.rb by rubocop

Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem excon should appear before faraday.
Open

  gem 'excon', '>= 0.45.4'
Severity: Minor
Found in Gemfile by rubocop

Gems should be alphabetically sorted within groups.

Example:

# bad
gem 'rubocop'
gem 'rspec'

# good
gem 'rspec'
gem 'rubocop'

# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'

Omit parentheses for ternary conditions.
Open

      context = (context_string && @request_uri.scheme) ? @request_uri.merge(context_string) : nil
Severity: Minor
Found in lib/nitlink/parser.rb by rubocop

This cop checks for the presence of parentheses around ternary conditions. It is configurable to enforce inclusion or omission of parentheses using EnforcedStyle. Omission is only enforced when removing the parentheses won't cause a different behavior.

Example: EnforcedStyle: requirenoparentheses (default)

# bad
foo = (bar?) ? a : b
foo = (bar.baz?) ? a : b
foo = (bar && baz) ? a : b

# good
foo = bar? ? a : b
foo = bar.baz? ? a : b
foo = bar && baz ? a : b

Example: EnforcedStyle: require_parentheses

# bad
foo = bar? ? a : b
foo = bar.baz? ? a : b
foo = bar && baz ? a : b

# good
foo = (bar?) ? a : b
foo = (bar.baz?) ? a : b
foo = (bar && baz) ? a : b

Example: EnforcedStyle: requireparentheseswhen_complex

# bad
foo = (bar?) ? a : b
foo = (bar.baz?) ? a : b
foo = bar && baz ? a : b

# good
foo = bar? ? a : b
foo = bar.baz? ? a : b
foo = (bar && baz) ? a : b

%Q-literals should be delimited by ( and ).
Open

      EncodedParamSyntaxError.new(%Q{Syntax error decoding encoded parameter value "#{ val }", must be in the form: charset "'" [ language ] "'" value-chars})
Severity: Minor
Found in lib/nitlink/param_decoder.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Line is too long. [112/80]
Open

        [response.url.chomp('?'), response.response_code, grab_headers(headers_from_string response.header_str)]
Severity: Minor
Found in lib/nitlink/response_normalizer.rb by rubocop

Line is too long. [85/80]
Open

        [response[:request_uri], response[:status], grab_headers(response[:headers])]
Severity: Minor
Found in lib/nitlink/response_normalizer.rb by rubocop
Severity
Category
Status
Source
Language