fga-gpp-mds/2017.1-Escola-X

View on GitHub

Showing 3,213 of 3,213 total issues

Don't use parentheses around an unary operation.
Open

      if ( !(@current_user = Employee.find_by_authorization_token(cookies[:authorization_token])).nil? )
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Missing space after #.
Open

#Description: Validates suspension's attributes
Severity: Minor
Found in app/models/suspension.rb by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Space inside { missing.
Open

  validates :title, presence: {message: "Este não pode estar em branco"},
Severity: Minor
Found in app/models/suspension.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

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

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

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

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Don't use parentheses around a method call.
Open

    if ( (logged_in?) and (current_user.is_a?(Principal)) )
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Space inside } missing.
Open

  validates :date_suspension, presence: { message: "Este campo não pode estar em branco."}
Severity: Minor
Found in app/models/suspension.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

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

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

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

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Tab detected.
Open

         correctDate = year + SPACE_TRACE_SPACE + month + SPACE_TRACE_SPACE + day 
Severity: Minor
Found in app/helpers/reader_helper.rb by rubocop

Don't use parentheses around a method call.
Open

    if ( (logged_in?) and (current_user.is_a?(Parent)))
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Trailing whitespace detected.
Open

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

Redundant return detected.
Open

      return true
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Use the new Ruby 1.9 hash syntax.
Open

                     :too_short => "deve possuir no mínimo 5 caracteres",
Severity: Minor
Found in app/models/parent.rb 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}

Don't use parentheses around the condition of an if.
Open

         if (day.length == SINGLE_CHAR)
Severity: Minor
Found in app/helpers/reader_helper.rb by rubocop

This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

Example:

# bad
x += 1 while (x < 10)
foo unless (bar || baz)

if (x > 10)
elsif (x < 3)
end

# good
x += 1 while x < 10
foo unless bar || baz

if x > 10
elsif x < 3
end

Redundant return detected.
Open

      return true
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Missing top-level module documentation comment.
Open

module SubjectsHelper
Severity: Minor
Found in app/helpers/subjects_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 after keyword if is missing.
Open

      if(data_exists == false)

Checks the spacing around the keywords.

Example:

# bad
something 'test'do|x|
end

while(something)
end

something = 123if test

# good
something 'test' do |x|
end

while (something)
end

something = 123 if test

Use empty lines between method definitions.
Open

  def verify_parent(id)
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Put empty method definitions on a single line.
Open

  def login_helper
  end

This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

Note: A method definition is not considered empty if it contains comments.

Example: EnforcedStyle: compact (default)

# bad
def foo(bar)
end

def self.foo(bar)
end

# good
def foo(bar); end

def foo(bar)
  # baz
end

def self.foo(bar); end

Example: EnforcedStyle: expanded

# bad
def foo(bar); end

def self.foo(bar); end

# good
def foo(bar)
end

def self.foo(bar)
end

Space inside parentheses detected.
Open

      if ( !(@current_user = Employee.find_by_authorization_token(cookies[:authorization_token])).nil? )
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

Checks for spaces inside ordinary round parentheses.

Example:

# bad
f( 3)
g = (a + 3 )

# good
f(3)
g = (a + 3)

Missing space after #.
Open

#Class name: Employee
Severity: Minor
Found in app/models/employee.rb by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Prefer each over for.
Open

    for day_of_class in days_of_class

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.

Space inside parentheses detected.
Open

      if ( !(@current_user = Employee.find_by_authorization_token(cookies[:authorization_token])).nil? )
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

Checks for spaces inside ordinary round parentheses.

Example:

# bad
f( 3)
g = (a + 3 )

# good
f(3)
g = (a + 3)
Severity
Category
Status
Source
Language