fga-eps-mds/2019.2-Vsign

View on GitHub
backend/app/controllers/v1/contracts_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Favor a normal if-statement over a modifier clause in a multiline statement.
Open

    render json: {
      message: 'Modelo de contrato não encontrado.'
    }, status: :not_found if @script.nil?

Checks for uses of if/unless modifiers with multiple-lines bodies.

Example:

# bad
{
  result: 'this should not happen'
} unless cond

# good
{ result: 'ok' } if cond

Line is too long. [81/80]
Open

    @script = Script.where(company: @company, kind: kind).order('RANDOM()').first

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

class V1::ContractsController < V1Controller

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 class documentation comment.
Open

class V1::ContractsController < V1Controller

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

Shadowing outer local variable - contract.
Open

    contract = Contract.find_or_create_by(company: @company, order: order) do |contract|

This cop looks for use of the same name as outer local variables for block arguments or block local variables. This is a mimic of the warning "shadowing outer local variable - foo" from ruby -cw.

Example:

# bad

def some_method
  foo = 1

  2.times do |foo| # shadowing outer `foo`
    do_something(foo)
  end
end

Example:

# good

def some_method
  foo = 1

  2.times do |bar|
    do_something(bar)
  end
end

Line is too long. [88/80]
Open

    contract = Contract.find_or_create_by(company: @company, order: order) do |contract|

There are no issues that match your filters.

Category
Status