ikuseiGmbH/Goldencobra

View on GitHub
app/models/goldencobra/template.rb

Summary

Maintainability
A
0 mins
Test Coverage

Goldencobra::Template has no descriptive comment
Open

  class Template < ActiveRecord::Base
Severity: Minor
Found in app/models/goldencobra/template.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::Template#self.layouts_for_select has the variable name 'a'
Open

         .map { |a| File.basename(a, ".html.erb") }
         .delete_if { |a| a =~ /^_/ }
Severity: Minor
Found in app/models/goldencobra/template.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.

Missing top-level class documentation comment.
Open

  class Template < ActiveRecord::Base
Severity: Minor
Found in app/models/goldencobra/template.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 app/models/goldencobra/template.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.

Indent .map 2 spaces more than Dir on line 12.
Open

         .map { |a| File.basename(a, ".html.erb") }
Severity: Minor
Found in app/models/goldencobra/template.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned (default)

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

Indent .delete_if 2 spaces more than Dir on line 12.
Open

         .delete_if { |a| a =~ /^_/ }
Severity: Minor
Found in app/models/goldencobra/template.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned (default)

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

There are no issues that match your filters.

Category
Status