skcc321/dumpman

View on GitHub

Showing 151 of 151 total issues

Dumpman declares the class variable '@@dump_folder'
Open

  @@dump_folder = '.'
  @@dump_file_name = 'dumpman.sql.gz'
  @@connections = []

  class << self
Severity: Minor
Found in lib/dumpman.rb by reek

Class variables form part of the global runtime state, and as such make it easy for one part of the system to accidentally or inadvertently depend on another part of the system. So the system becomes more prone to problems where changing something over here breaks something over there. In particular, class variables can make it hard to set up tests (because the context of the test includes all global state).

For a detailed explanation, check out this article

Example

Given

class Dummy
  @@class_variable = :whatever
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Dummy declares the class variable @@class_variable (ClassVariable)

Getting rid of the smell

You can use class-instance variable to mitigate the problem (as also suggested in the linked article above):

class Dummy
  @class_variable = :whatever
end

Dumpman declares the class variable '@@dump_file_name'
Open

  @@dump_file_name = 'dumpman.sql.gz'
  @@connections = []

  class << self
    def setup(&block)
Severity: Minor
Found in lib/dumpman.rb by reek

Class variables form part of the global runtime state, and as such make it easy for one part of the system to accidentally or inadvertently depend on another part of the system. So the system becomes more prone to problems where changing something over here breaks something over there. In particular, class variables can make it hard to set up tests (because the context of the test includes all global state).

For a detailed explanation, check out this article

Example

Given

class Dummy
  @@class_variable = :whatever
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Dummy declares the class variable @@class_variable (ClassVariable)

Getting rid of the smell

You can use class-instance variable to mitigate the problem (as also suggested in the linked article above):

class Dummy
  @class_variable = :whatever
end

Dumpman has no descriptive comment
Open

module Dumpman
Severity: Minor
Found in lib/dumpman.rb by reek

Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

Example

Given

class Dummy
  # Do things...
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [1]:Dummy has no descriptive comment (IrresponsibleModule)

Fixing this is simple - just an explaining comment:

# The Dummy class is responsible for ...
class Dummy
  # Do things...
end

Dumpman::Adapters::Base has no descriptive comment
Open

    class Base
Severity: Minor
Found in lib/dumpman/adapters/base.rb by reek

Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

Example

Given

class Dummy
  # Do things...
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [1]:Dummy has no descriptive comment (IrresponsibleModule)

Fixing this is simple - just an explaining comment:

# The Dummy class is responsible for ...
class Dummy
  # Do things...
end

Dumpman::Connection#fetch_strategy is a writable attribute
Open

    attr_accessor :name, :app_env, :ssh_cmd, :app_path, :ssh_opts, :fetch_strategy, :docker_image
Severity: Minor
Found in lib/dumpman/connection.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

Dumpman::Commandor#drop_db doesn't depend on instance state (maybe move it to another class?)
Open

    def drop_db
Severity: Minor
Found in lib/dumpman/comandor.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Dumpman::Connection#app_path is a writable attribute
Open

    attr_accessor :name, :app_env, :ssh_cmd, :app_path, :ssh_opts, :fetch_strategy, :docker_image
Severity: Minor
Found in lib/dumpman/connection.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

Dumpman::Connection#app_env is a writable attribute
Open

    attr_accessor :name, :app_env, :ssh_cmd, :app_path, :ssh_opts, :fetch_strategy, :docker_image
Severity: Minor
Found in lib/dumpman/connection.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

Dumpman::Executor#rake doesn't depend on instance state (maybe move it to another class?)
Open

    def rake(*commands)
Severity: Minor
Found in lib/dumpman/executor.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Dumpman::Connection#ssh_cmd is a writable attribute
Open

    attr_accessor :name, :app_env, :ssh_cmd, :app_path, :ssh_opts, :fetch_strategy, :docker_image
Severity: Minor
Found in lib/dumpman/connection.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

Dumpman::Commandor#dump doesn't depend on instance state (maybe move it to another class?)
Open

    def dump
Severity: Minor
Found in lib/dumpman/comandor.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Dumpman::Connection#name is a writable attribute
Open

    attr_accessor :name, :app_env, :ssh_cmd, :app_path, :ssh_opts, :fetch_strategy, :docker_image
Severity: Minor
Found in lib/dumpman/connection.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

Dumpman::Commandor#restore doesn't depend on instance state (maybe move it to another class?)
Open

    def restore
Severity: Minor
Found in lib/dumpman/comandor.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Dumpman::Commandor#create_db doesn't depend on instance state (maybe move it to another class?)
Open

    def create_db
Severity: Minor
Found in lib/dumpman/comandor.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Dumpman::Connection#docker_image is a writable attribute
Open

    attr_accessor :name, :app_env, :ssh_cmd, :app_path, :ssh_opts, :fetch_strategy, :docker_image
Severity: Minor
Found in lib/dumpman/connection.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

Dumpman::Connection#ssh_opts is a writable attribute
Open

    attr_accessor :name, :app_env, :ssh_cmd, :app_path, :ssh_opts, :fetch_strategy, :docker_image
Severity: Minor
Found in lib/dumpman/connection.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

Dumpman::Executor#info has the variable name 'x'
Open

          .map { |x| x.squeeze(' ') }
Severity: Minor
Found in lib/dumpman/executor.rb by reek

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

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

require "irb"
Severity: Minor
Found in bin/console 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"

Use the new Ruby 1.9 hash syntax.
Open

  task :restore => :environment do
Severity: Minor
Found in lib/tasks/db.rake by rubocop

This cop checks hash literal syntax.

It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

A separate offense is registered for each problematic pair.

The supported styles are:

  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
  • hash_rockets - forces use of hash rockets for all hashes
  • nomixedkeys - simply checks for hashes with mixed syntaxes
  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

Example: EnforcedStyle: ruby19 (default)

# bad
{:a => 2}
{b: 1, :c => 2}

# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden

Example: EnforcedStyle: hash_rockets

# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}

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

Example: EnforcedStyle: nomixedkeys

# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}

# good
{:a => 1, :b => 2}
{c: 1, d: 2}

Example: EnforcedStyle: ruby19nomixed_keys

# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets

# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}

The use of eval is a serious security risk.
Open

  eval(config)
Severity: Minor
Found in lib/tasks/db.rake by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)
Severity
Category
Status
Source
Language