Codeminer42/cm42-central

View on GitHub

Showing 331 of 343 total issues

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if record.project

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

Freeze mutable objects assigned to constants.
Open

  CSV_HEADERS = [
    "Id", "Story", "Labels", "Iteration", "Iteration Start", "Iteration End",
    "Story Type", "Estimate", "Current State", "Started At", "Created at", "Accepted at",
    "Deadline", "Requested By", "Owned By", "Description", "URL"
    ]
Severity: Minor
Found in app/models/story.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    "Id", "Story", "Labels", "Iteration", "Iteration Start", "Iteration End",
Severity: Minor
Found in app/models/story.rb by rubocop

Align .since with where("subject_type in ('Project', 'Story')") on line 28.
Open

      .since(since).to_a
Severity: Minor
Found in app/models/activity.rb by rubocop

Line is too long. [101/100]
Open

  # with calculate_worst = true add the standard deviation of the velocity for the past 10 iterations
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Line is too long. [111/100]
Open

      std_dev                     = Statistics.standard_deviation(group_by_velocity.values, STD_DEV_ITERATIONS)
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    "Story Type", "Estimate", "Current State", "Started At", "Created at", "Accepted at",
Severity: Minor
Found in app/models/story.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    "Deadline", "Requested By", "Owned By", "Description", "URL"
Severity: Minor
Found in app/models/story.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    "Deadline", "Requested By", "Owned By", "Description", "URL"
Severity: Minor
Found in app/models/story.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    "Deadline", "Requested By", "Owned By", "Description", "URL"
Severity: Minor
Found in app/models/story.rb by rubocop

Avoid the use of double negation (!!).
Open

    !!archived_at
Severity: Minor
Found in app/models/project.rb by rubocop

This cop checks for uses of double negation (!!) to convert something to a boolean value. As this is both cryptic and usually redundant, it should be avoided.

Example:

# bad
!!something

# good
!something.nil?

Please, note that when something is a boolean value !!something and !something.nil? are not the same thing. As you're unlikely to write code that can accept values of any type this is rarely a problem in practice.

Shadowing outer local variable - activities.
Open

        activities.group_by(&:project_id).map do |project_id, activities|
Severity: Minor
Found in app/models/activity.rb by rubocop

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

Do not freeze immutable objects, as freezing them has no effect.
Open

  DOMAIN_SEPARATORS_REGEX = /[,;\|\n]/.freeze
Severity: Minor
Found in app/models/team.rb by rubocop

This cop check for uses of Object#freeze on immutable objects.

Example:

# bad
CONST = 1.freeze

# good
CONST = 1

Place the . on the next line, together with the method name.
Open

        group_by { |story| story.owned_by.name }.
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Line is too long. [112/100]
Open

      number_of_iterations = group_by_all_iterations.size if number_of_iterations > group_by_all_iterations.size
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Annotation keywords like FIXME should be all upper case, followed by a colon, and a space, then a note describing the problem.
Open

  # FIXME must figure out why the Story allows a nil owner in delivered states
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Place the . on the next line, together with the method name.
Open

      @backlog.
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Space inside parentheses detected.
Open

    ( days_apart / days_in_iteration ).floor + 1
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Line is too long. [121/100]
Open

      accepted = accepted.select  { |story| story.accepted_at >= range.first && story.accepted_at < range.last } if range
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Pass &:iteration_number as an argument to group_by instead of a block.
Open

      group_by { |story| story.iteration_number }.
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Use symbols as procs when possible.

Example:

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

# good
something.map(&:upcase)
Severity
Category
Status
Source
Language