ikuseiGmbH/Goldencobra

View on GitHub
lib/goldencobra/acts_as_setting.rb

Summary

Maintainability
A
0 mins
Test Coverage

Goldencobra::ActsAsSetting::Controller has no descriptive comment
Open

    module Controller
Severity: Minor
Found in lib/goldencobra/acts_as_setting.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

Goldencobra::ActsAsSetting::Controller#s doesn't depend on instance state (maybe move it to another class?)
Open

      def s(name)
Severity: Minor
Found in lib/goldencobra/acts_as_setting.rb by reek

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

Goldencobra::ActsAsSetting::Controller#s has the name 's'
Open

      def s(name)
Severity: Minor
Found in lib/goldencobra/acts_as_setting.rb by reek

An Uncommunicative Method Name is a method 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.

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

        if name.present?
Severity: Minor
Found in lib/goldencobra/acts_as_setting.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

Use compact module/class definition instead of nested style.
Open

  module ActsAsSetting
Severity: Minor
Found in lib/goldencobra/acts_as_setting.rb by rubocop

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Missing top-level module documentation comment.
Open

    module Controller
Severity: Minor
Found in lib/goldencobra/acts_as_setting.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Use compact module/class definition instead of nested style.
Open

module Goldencobra
Severity: Minor
Found in lib/goldencobra/acts_as_setting.rb by rubocop

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

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

        if name.present?
Severity: Minor
Found in lib/goldencobra/acts_as_setting.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. The tab size is configured in the IndentationWidth of the Layout/Tab 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?

There are no issues that match your filters.

Category
Status