kenjij/darksky-ruby

View on GitHub

Showing 69 of 69 total issues

Redundant return detected.
Open

      return operate(__method__, path: path, params: params, body: body, query: query)
Severity: Minor
Found in lib/darksky-ruby/http.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.

Prefer annotated tokens (like %<foo>s</foo>) over template tokens (like %{foo}).
Open

  DARKSKY_PATH_TEMPLATE = '/forecast/%{key}/%{loc}'
Severity: Minor
Found in lib/darksky-ruby/api.rb by rubocop

Use a consistent style for named format string tokens.

Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

Example: EnforcedStyle: annotated (default)

# bad
format('%{greeting}', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%<greeting>s', greeting: 'Hello')</greeting>

Example: EnforcedStyle: template

# bad
format('%<greeting>s', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%{greeting}', greeting: 'Hello')</greeting>

Example: EnforcedStyle: unannotated

# bad
format('%<greeting>s', greeting: 'Hello')
format('%{greeting}', 'Hello')

# good
format('%s', 'Hello')</greeting>

Freeze mutable objects assigned to constants.
Open

  DARKSKY_URL = 'https://api.darksky.net/'
Severity: Minor
Found in lib/darksky-ruby/api.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

Put empty method definitions on a single line.
Open

    def initialize(*args)
    end
Severity: Minor
Found in lib/darksky-ruby/http.rb by rubocop

This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

Note: A method definition is not considered empty if it contains comments.

Example: EnforcedStyle: compact (default)

# bad
def foo(bar)
end

def self.foo(bar)
end

# good
def foo(bar); end

def foo(bar)
  # baz
end

def self.foo(bar); end

Example: EnforcedStyle: expanded

# bad
def foo(bar); end

def self.foo(bar); end

# good
def foo(bar)
end

def self.foo(bar)
end

Put empty method definitions on a single line.
Open

    def add(*args, &block)
    end
Severity: Minor
Found in lib/darksky-ruby/http.rb by rubocop

This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

Note: A method definition is not considered empty if it contains comments.

Example: EnforcedStyle: compact (default)

# bad
def foo(bar)
end

def self.foo(bar)
end

# good
def foo(bar); end

def foo(bar)
  # baz
end

def self.foo(bar); end

Example: EnforcedStyle: expanded

# bad
def foo(bar); end

def self.foo(bar); end

# good
def foo(bar)
end

def self.foo(bar)
end

Redundant return detected.
Open

      return data
Severity: Minor
Found in lib/darksky-ruby/http.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.

Redundant return detected.
Open

      return data
Severity: Minor
Found in lib/darksky-ruby/http.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.

Use the return of the conditional for variable assignment and comparison.
Open

if opts[:time_given]
  data = api.timemachine(loc: loc, ts: opts[:time])
else 
  data = api.forecast(loc: loc)
end
Severity: Minor
Found in bin/darksky by rubocop

Trailing whitespace detected.
Open

# 
Severity: Minor
Found in lib/darksky-ruby/http.rb by rubocop

Line is too long. [90/80]
Open

          logger.debug("Full URI object built for local redirect with path: #{data.path}")
Severity: Minor
Found in lib/darksky-ruby/http.rb by rubocop

Freeze mutable objects assigned to constants.
Open

    METHOD_HTTP_CLASS = {
      get: Net::HTTP::Get,
      put: Net::HTTP::Put,
      patch: Net::HTTP::Patch,
      post: Net::HTTP::Post,
Severity: Minor
Found in lib/darksky-ruby/http.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

Redundant return detected.
Open

      return operate(__method__, path: path, params: params, query: query)
Severity: Minor
Found in lib/darksky-ruby/http.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.

Redundant return detected.
Open

      return operate(__method__, path: path, params: params, body: body, query: query)
Severity: Minor
Found in lib/darksky-ruby/http.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.

Space inside { missing.
Open

    path = DARKSKY_PATH_TEMPLATE % {key: key, loc: loc}
Severity: Minor
Found in lib/darksky-ruby/api.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Line is too long. [83/80]
Open

        logger.info("External #{method.upcase} redirect, spawning new HTTP object")
Severity: Minor
Found in lib/darksky-ruby/http.rb by rubocop

Redundant return detected.
Open

      return data
Severity: Minor
Found in lib/darksky-ruby/http.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.

Redundant return detected.
Open

      return data
Severity: Minor
Found in lib/darksky-ruby/http.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.

The name of this source file (darksky-ruby.rb) should use snake_case.
Open

require 'darksky-ruby/api'
Severity: Minor
Found in lib/darksky-ruby.rb by rubocop

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

Example:

# bad
lib/layoutManager.rb

anything/usingCamelCase

# good
lib/layout_manager.rb

anything/using_snake_case.rake

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

  s.summary       = %q{Pure simple Ruby based Dark Sky API gem}
Severity: Minor
Found in darksky-ruby.gemspec 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. [86/80]
Open

        logger.info('HTTP response header says connection close; closing session now')
Severity: Minor
Found in lib/darksky-ruby/http.rb by rubocop
Severity
Category
Status
Source
Language