Dalphi/dalphi

View on GitHub
app/controllers/raw_data_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [14/10]
Open

  def index
    respond_to do |format|
      format.js { render json: @raw_data }
      format.zip do
        raw_data_zip

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [11/10]
Open

    def raw_data_zip
      timestamp = Time.zone.now.strftime('%Y-%m-%d-%H-%M-%S')
      begin
        file = Tempfile.new('raw-data-zip')
        send_data @project.zip(file),

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [11/10]
Open

  def create
    data = raw_datum_params[:data]
    batch_result = RawDatum.batch_process @project,
                                          data
    if batch_result[:success].any?

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Inconsistent indentation detected.
Open

    def raw_datum_params
      data = { data: [] }
      data = :data if action_name == 'update'
      params.require(:raw_datum).permit(:shape, data)
    end

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Line is too long. [98/80]
Open

    redirect_to project_raw_data_path(@project), notice: I18n.t('raw-data.action.destroy.success')

Inconsistent indentation detected.
Open

    def set_project
      @project = current_role.projects.find(params[:project_id])
    end

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Inconsistent indentation detected.
Open

    def set_raw_data
      @raw_data = @project.raw_data
    end

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Line is too long. [87/80]
Open

  # the order of the following before actions matters, since setters rely on each other

Line is too long. [87/80]
Open

                  filename: "#{@project.title.parameterize}-raw-data-#{timestamp}.zip",

Put empty method definitions on a single line.
Open

  def edit
  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

Use %i or %I for an array of symbols.
Open

                only: [:index, :destroy_all]

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Use %i or %I for an array of symbols.
Open

                only: [:show, :edit, :update, :destroy]

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Keep a blank line before and after private.
Open

  private

Access modifiers should be surrounded by blank lines.

Example:

# bad
class Foo
  def bar; end
  private
  def baz; end
end

# good
class Foo
  def bar; end

  private

  def baz; end
end

Align .paginate with @raw_data on line 19.
Open

                      .paginate(

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

Example: EnforcedStyle: aligned

# 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

Line is too long. [98/80]
Open

        raw_data_per_page = Rails.configuration.x.dalphi['paginated-objects-per-page']['raw-data']

Line is too long. [88/80]
Open

    # Never trust parameters from the scary internet, only allow the white list through.

Line is too long. [82/80]
Open

      flash.now[:error] = I18n.t('simple_form.error_notification.default_message')

Inconsistent indentation detected.
Open

    def set_raw_datum
      @raw_datum = @project.raw_data.find(params[:id])
    end

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Inconsistent indentation detected.
Open

    def raw_data_zip
      timestamp = Time.zone.now.strftime('%Y-%m-%d-%H-%M-%S')
      begin
        file = Tempfile.new('raw-data-zip')
        send_data @project.zip(file),

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Line is too long. [98/80]
Open

    redirect_to project_raw_data_path(@project), notice: I18n.t('raw-data.action.destroy.success')

Line is too long. [82/80]
Open

      flash.now[:error] = I18n.t('simple_form.error_notification.default_message')

Missing top-level class documentation comment.
Open

class RawDataController < ApplicationController

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

There are no issues that match your filters.

Category
Status