Dalphi/dalphi

View on GitHub

Showing 1,441 of 1,441 total issues

Line is too long. [97/80]
Open

    per_page = Rails.configuration.x.dalphi['paginated-objects-per-page']['annotation-documents']

Line is too long. [89/80]
Open

      timeout = Rails.configuration.x.dalphi['timeouts']['annotation-document-edit-time']

Line is too long. [84/80]
Open

      time_range = INITIAL_DALPHI_COMMIT_DATETIME..(Time.zone.now - timeout.minutes)

Line is too long. [88/80]
Open

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

Use the double pipe equals operator ||= instead.
Open

      count = 1 unless count

This cop checks for potential usage of the ||= operator.

Example:

# bad
name = name ? name : 'Bozhidar'

# bad
name = if name
         name
       else
         'Bozhidar'
       end

# bad
unless name
  name = 'Bozhidar'
end

# bad
name = 'Bozhidar' unless name

# good - set name to 'Bozhidar', only if it's nil or false
name ||= 'Bozhidar'

Missing top-level class documentation comment.
Open

    class ErrorModel

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

Missing top-level module documentation comment.
Open

module ErrorResponse

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

Inconsistent indentation detected.
Open

    def set_interfaces
      @interfaces = {}
      return unless @project

      associated_problem_identifier = @project.associated_problem_identifiers.first

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def process_merged_data(response_body)
      @project.update_merged_raw_datum(response_body)
    end

This cops checks for inconsistent indentation.

Example:

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

Line is too long. [81/80]
Open

      @additional_annotator = Annotator.find_by(id: params[:project][:annotator])

Line is too long. [90/80]
Open

          interface.associated_problem_identifiers.include?(associated_problem_identifier)

Inconsistent indentation detected.
Open

    def annotation_documents(count)
      count = 1 unless count
      timeout = Rails.configuration.x.dalphi['timeouts']['annotation-document-edit-time']
      time_range = INITIAL_DALPHI_COMMIT_DATETIME..(Time.zone.now - timeout.minutes)

This cops checks for inconsistent indentation.

Example:

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

Line is too long. [90/80]
Open

    annotation_documents = annotation_documents.where(raw_datum: @raw_datum) if @raw_datum

Pass &:relevant_attributes as an argument to map instead of a block.
Open

      render json: documents.map{ |document| document.relevant_attributes }

Use symbols as procs when possible.

Example:

# bad
something.map { |s| s.upcase }

# good
something.map(&:upcase)

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

                except: [:index, :show]

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]

Inconsistent indentation detected.
Open

    def set_raw_datum
      raw_datum_id = params[:raw_datum_id]
      @raw_datum = RawDatum.find(raw_datum_id) if raw_datum_id
    rescue
      @raw_datum = false

This cops checks for inconsistent indentation.

Example:

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

Prefer Date or Time over DateTime.
Open

  INITIAL_DALPHI_COMMIT_DATETIME = DateTime.parse '07.03.2016 09:39:24 MEZ'

This cop checks for uses of DateTime that should be replaced by Date or Time.

Example:

# bad - uses `DateTime` for current time
DateTime.now

# good - uses `Time` for current time
Time.now

# bad - uses `DateTime` for modern date
DateTime.iso8601('2016-06-29')

# good - uses `Date` for modern date
Date.iso8601('2016-06-29')

# good - uses `DateTime` with start argument for historical date
DateTime.iso8601('1751-04-23', Date::ENGLAND)

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

        [
          :interface_type,
          :payload,
          :raw_datum_id,
          :meta
Severity: Minor
Found in app/models/annotation_document.rb by rubocop

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]

Align the parameters of a method call if they span more than one line.
Open

    presence: true
Severity: Minor
Found in app/models/annotation_document.rb by rubocop

Here we check if the parameters on a multi-line method call or definition are aligned.

Example: EnforcedStyle: withfirstparameter (default)

# good

foo :bar,
    :baz

# bad

foo :bar,
  :baz

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

Align .singularize with predecessor_token on line 82.
Open

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

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
Severity
Category
Status
Source
Language