appbot/kms_rails

View on GitHub

Showing 182 of 182 total issues

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

        if value.is_a?(Proc)
Severity: Minor
Found in lib/kms_rails/core.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Space inside parentheses detected.
Open

          Core.to64( get_hash(field) )
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

Checks for spaces inside ordinary round parentheses.

Example:

# bad
f( 3)
g = (a + 3 )

# good
f(3)
g = (a + 3)

Move plaintext out of the conditional.
Open

            plaintext
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

This cop checks for identical lines at the beginning or end of each branch of a conditional statement.

Example:

# bad
if condition
  do_x
  do_z
else
  do_y
  do_z
end

# good
if condition
  do_x
else
  do_y
end
do_z

# bad
if condition
  do_z
  do_x
else
  do_z
  do_y
end

# good
do_z
if condition
  do_x
else
  do_y
end

# bad
case foo
when 1
  do_x
when 2
  do_x
else
  do_x
end

# good
case foo
when 1
  do_x
  do_y
when 2
  # nothing
else
  do_x
  do_z
end

Redundant RuntimeError argument can be removed.
Open

          raise RuntimeError, "Field '#{field}' must not be a real column, '#{real_field}' is the real column" if self.class.column_names.include?(field.to_s)
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

This cop checks for RuntimeError as the argument of raise/fail.

It checks for code like this:

Example:

# Bad
raise RuntimeError, 'message'

# Bad
raise RuntimeError.new('message')

# Good
raise 'message'

Line is too long. [104/80]
Open

  spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
Severity: Minor
Found in kms_rails.gemspec by rubocop

Unnecessary utf-8 encoding comment.
Open

# coding: utf-8
Severity: Minor
Found in kms_rails.gemspec by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require "bundler/gem_tasks"
Severity: Minor
Found in Rakefile by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [86/80]
Open

      key_id, decoded_context, plaintext = MessagePack.unpack(ciphertext_blob.reverse)
Severity: Minor
Found in lib/kms_rails/kms_client_mock.rb by rubocop

Space inside { missing.
Open

      {iv: iv, data: cipher.update(data.to_s) + cipher.final}
Severity: Minor
Found in lib/kms_rails/core.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 }}

Space inside } missing.
Open

      {iv: iv, data: cipher.update(data.to_s) + cipher.final}
Severity: Minor
Found in lib/kms_rails/core.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 }}

Use %q only for strings that contain both single quotes and double quotes.
Open

  spec.description   = %q{Quickly add KMS encryption and decryption to your ActiveRecord model attributes and ActiveJob parameters. Improves upon kms_attrs with ActiveJob support, more efficient binary serialization and a test suite.}
Severity: Minor
Found in kms_rails.gemspec by rubocop

Space inside parentheses detected.
Open

          Core.to64( get_hash(field) )
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

Checks for spaces inside ordinary round parentheses.

Example:

# bad
f( 3)
g = (a + 3 )

# good
f(3)
g = (a + 3)

Redundant RuntimeError argument can be removed.
Open

          raise RuntimeError, "Field '#{real_field}' must exist to store encrypted data" unless self.class.column_names.include?(real_field)
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

This cop checks for RuntimeError as the argument of raise/fail.

It checks for code like this:

Example:

# Bad
raise RuntimeError, 'message'

# Bad
raise RuntimeError.new('message')

# Good
raise 'message'

Redundant RuntimeError argument can be removed.
Open

      raise RuntimeError, 'Unsupported key_spec in test mode' unless key_spec == 'AES_256'
Severity: Minor
Found in lib/kms_rails/kms_client_mock.rb by rubocop

This cop checks for RuntimeError as the argument of raise/fail.

It checks for code like this:

Example:

# Bad
raise RuntimeError, 'message'

# Bad
raise RuntimeError.new('message')

# Good
raise 'message'

Prefer to_s over string interpolation.
Open

        define_method "#{real_field}" do
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

This cop checks for strings that are just an interpolated expression.

Example:

# bad
"#{@var}"

# good
@var.to_s

# good if @var is already a String
@var

Redundant RuntimeError argument can be removed.
Open

        raise RuntimeError, 'Only Proc and String arguments are supported'
Severity: Minor
Found in lib/kms_rails/core.rb by rubocop

This cop checks for RuntimeError as the argument of raise/fail.

It checks for code like this:

Example:

# Bad
raise RuntimeError, 'message'

# Bad
raise RuntimeError.new('message')

# Good
raise 'message'

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  VERSION = "1.0.0"
Severity: Minor
Found in lib/kms_rails/version.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [119/80]
Open

        enc        = Core.new(key_id: key_id, msgpack: msgpack, context_key: context_key, context_value: context_value)
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

Line is too long. [143/80]
Open

          raise RuntimeError, "Field '#{real_field}' must exist to retrieve encrypted data" unless self.class.column_names.include?(real_field)
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop

Line is too long. [158/80]
Open

          raise RuntimeError, "Field '#{field}' must not be a real column, '#{real_field}' is the real column" if self.class.column_names.include?(field.to_s)
Severity: Minor
Found in lib/kms_rails/active_record.rb by rubocop
Severity
Category
Status
Source
Language