fga-gpp-mds/2017.1-Escola-X

View on GitHub
app/helpers/school_misses_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage

SchoolMissesHelper has no descriptive comment
Open

module SchoolMissesHelper
Severity: Minor
Found in app/helpers/school_misses_helper.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

SchoolMissesHelper#give_fault_to_all_alumns doesn't depend on instance state (maybe move it to another class?)
Open

    def give_fault_to_all_alumns(date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by reek

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

Use 2 (not 1) spaces for indentation.
Open

            SchoolMiss.create(alumn_id:alumn.id , date:date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Use 2 (not 1) spaces for indentation.
Open

        alumns = Alumn.all
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Missing top-level module documentation comment.
Open

module SchoolMissesHelper
Severity: Minor
Found in app/helpers/school_misses_helper.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

Space missing after colon.
Open

            SchoolMiss.create(alumn_id:alumn.id , date:date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

            SchoolMiss.create(alumn_id:alumn.id , date:date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Tab detected.
Open

            SchoolMiss.create(alumn_id:alumn.id , date:date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Space found before comma.
Open

            SchoolMiss.create(alumn_id:alumn.id , date:date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Checks for comma (,) preceded by space.

Example:

# bad
[1 , 2 , 3]
a(1 , 2)
each { |a , b| }

# good
[1, 2, 3]
a(1, 2)
each { |a, b| }

Extra empty line detected at module body beginning.
Open


    def give_fault_to_all_alumns(date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

This cops checks if empty lines around the bodies of modules match the configuration.

Example: EnforcedStyle: empty_lines

# good

module Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

module Foo
  module Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
module Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

module Foo
  def bar
    # ...
  end
end

Prefer each over for.
Open

        for alumn in alumns 
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

This cop looks for uses of the for keyword, or each method. The preferred alternative is set in the EnforcedStyle configuration parameter. An each call with a block on a single line is always allowed, however.

Tab detected.
Open

    def give_fault_to_all_alumns(date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Tab detected.
Open

        alumns = Alumn.all
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Use 2 (not 1) spaces for indentation.
Open

    def give_fault_to_all_alumns(date)
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Tab detected.
Open

        for alumn in alumns 
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Tab detected.
Open

        end
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Tab detected.
Open

    end
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

Trailing whitespace detected.
Open

        for alumn in alumns 
Severity: Minor
Found in app/helpers/school_misses_helper.rb by rubocop

There are no issues that match your filters.

Category
Status