fga-gpp-mds/2017.1-Escola-X

View on GitHub

Showing 3,213 of 3,213 total issues

ClassroomSubject#update_alumns_grades calls 'self.classroom_id' 2 times
Open

      if !Grade.where(alumn_id: alumn.id).where(classroom_id: self.classroom_id).where(subject_id: self.subject_id).exists?
        Grade.create(alumn_id: alumn.id, classroom_id: self.classroom_id, subject_id: self.subject_id)
Severity: Minor
Found in app/models/classroom_subject.rb by reek

Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

Reek implements a check for Duplicate Method Call.

Example

Here's a very much simplified and contrived example. The following method will report a warning:

def double_thing()
  @other.thing + @other.thing
end

One quick approach to silence Reek would be to refactor the code thus:

def double_thing()
  thing = @other.thing
  thing + thing
end

A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

class Other
  def double_thing()
    thing + thing
  end
end

The approach you take will depend on balancing other factors in your code.

ParentsHelper has no descriptive comment
Open

module ParentsHelper
Severity: Minor
Found in app/helpers/parents_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

SecretaryHelper has no descriptive comment
Open

module SecretaryHelper
Severity: Minor
Found in app/helpers/secretary_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

SchoolMiss has no descriptive comment
Open

class SchoolMiss < ApplicationRecord
Severity: Minor
Found in app/models/school_miss.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

PrincipalHelper has no descriptive comment
Open

module PrincipalHelper
Severity: Minor
Found in app/helpers/principal_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

StrikeSerializer has no descriptive comment
Open

class StrikeSerializer < ActiveModel::Serializer
Severity: Minor
Found in app/serializers/strike_serializer.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

SubjectsHelper has no descriptive comment
Open

module SubjectsHelper
Severity: Minor
Found in app/helpers/subjects_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

NotificationSerializer has no descriptive comment
Open

class NotificationSerializer < ActiveModel::Serializer

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

ParentSerializer has no descriptive comment
Open

class ParentSerializer < ActiveModel::Serializer
Severity: Minor
Found in app/serializers/parent_serializer.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

rails-html-sanitizer 1.0.3 is vulnerable (CVE-2018-3741). Upgrade to 1.0.4
Open

    rails-html-sanitizer (1.0.3)
Severity: Minor
Found in Gemfile.lock by brakeman

Loofah 2.0.3 is vulnerable (CVE-2018-8048). Upgrade to 2.1.2
Open

    loofah (2.0.3)
Severity: Minor
Found in Gemfile.lock by brakeman

Similar blocks of code found in 5 locations. Consider refactoring.
Open

Given (/^I am logged in as principal$/) do
    driver.get('http://localhost:3000/')
    login = driver.find_element(:name, 'login')
    login.send_keys "123456"
    senha = driver.find_element(:name, 'password')
Severity: Major
Found in features/step_definitions/escolaX.rb and 4 other locations - About 25 mins to fix
features/step_definitions/escolaX.rb on lines 9..16
features/step_definitions/escolaX.rb on lines 19..26
features/step_definitions/escolaX.rb on lines 39..46
features/step_definitions/escolaX.rb on lines 49..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 30.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

Given (/^I am logged in as parent$/) do
    driver.get('http://localhost:3000/')
    login = driver.find_element(:name, 'login')
    login.send_keys "00968977162"
    senha = driver.find_element(:name, 'password')
Severity: Major
Found in features/step_definitions/escolaX.rb and 4 other locations - About 25 mins to fix
features/step_definitions/escolaX.rb on lines 19..26
features/step_definitions/escolaX.rb on lines 29..36
features/step_definitions/escolaX.rb on lines 39..46
features/step_definitions/escolaX.rb on lines 49..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 30.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

Given (/^I am logged in as alumn$/) do
    driver.get('http://localhost:3000/')
    login = driver.find_element(:name, 'login')
    login.send_keys "654321"
    senha = driver.find_element(:name, 'password')
Severity: Major
Found in features/step_definitions/escolaX.rb and 4 other locations - About 25 mins to fix
features/step_definitions/escolaX.rb on lines 9..16
features/step_definitions/escolaX.rb on lines 29..36
features/step_definitions/escolaX.rb on lines 39..46
features/step_definitions/escolaX.rb on lines 49..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 30.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

Given (/^I am logged in as secretary$/) do
    driver.get('http://localhost:3000/')
    login = driver.find_element(:name, 'login')
    login.send_keys "456456"
    senha = driver.find_element(:name, 'password')
Severity: Major
Found in features/step_definitions/escolaX.rb and 4 other locations - About 25 mins to fix
features/step_definitions/escolaX.rb on lines 9..16
features/step_definitions/escolaX.rb on lines 19..26
features/step_definitions/escolaX.rb on lines 29..36
features/step_definitions/escolaX.rb on lines 39..46

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 30.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

Given (/^I am logged in as teacher$/) do
    driver.get('http://localhost:3000/')
    login = driver.find_element(:name, 'login')
    login.send_keys "363636"
    senha = driver.find_element(:name, 'password')
Severity: Major
Found in features/step_definitions/escolaX.rb and 4 other locations - About 25 mins to fix
features/step_definitions/escolaX.rb on lines 9..16
features/step_definitions/escolaX.rb on lines 19..26
features/step_definitions/escolaX.rb on lines 29..36
features/step_definitions/escolaX.rb on lines 49..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 30.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    def mountCurrentDate() 
Severity: Minor
Found in app/controllers/reader_controller.rb by reek

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

SessionsController#create performs a nil-check
Open

    if ( !Alumn.find_by_registry(params[:login]).nil? )
      @user = Alumn.find_by_registry(params[:login])
    elsif ( !Parent.find_by_login(params[:login]).nil? )
      @user = Parent.find_by_login(params[:login])
    elsif ( !Employee.find_by_registry(params[:login]).nil? )
Severity: Minor
Found in app/controllers/sessions_controller.rb by reek

A NilCheck is a type check. Failures of NilCheck violate the "tell, don't ask" principle.

Additionally, type checks often mask bigger problems in your source code like not using OOP and / or polymorphism when you should.

Example

Given

class Klass
  def nil_checker(argument)
    if argument.nil?
      puts "argument isn't nil!"
    end
  end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [3]:Klass#nil_checker performs a nil-check. (NilCheck)

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

    def give_presence_to_alumn(date , alumn)
Severity: Minor
Found in app/controllers/reader_controller.rb by reek

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

ClassroomsController#add_alumn performs a nil-check
Open

    if ( (@alumn).nil? )

A NilCheck is a type check. Failures of NilCheck violate the "tell, don't ask" principle.

Additionally, type checks often mask bigger problems in your source code like not using OOP and / or polymorphism when you should.

Example

Given

class Klass
  def nil_checker(argument)
    if argument.nil?
      puts "argument isn't nil!"
    end
  end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [3]:Klass#nil_checker performs a nil-check. (NilCheck)
Severity
Category
Status
Source
Language