Codeminer42/cm42-central

View on GitHub

Showing 331 of 343 total issues

Align the elements of a hash literal if they span more than one line.
Open

            user: project.users.find_by_username(matches[2]),
Severity: Minor
Found in app/models/story.rb by rubocop

Align the elements of a hash literal if they span more than one line.
Open

            created_at: matches[3])
Severity: Minor
Found in app/models/story.rb by rubocop

Line is too long. [113/100]
Open

        if iteration_service.current_iteration_number == iteration_service.iteration_number_for_date(accepted_at)
Severity: Minor
Found in app/models/story.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

      :type=>'text/javascript'
Severity: Minor
Found in app/helpers/application_helper.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'"

# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden

# bad
{:a => 2}
{b: 1, :c => 2}

Example:

"EnforcedStyle => 'hash_rockets'"

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

# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}

Example:

"EnforcedStyle => 'no_mixed_keys'"

# good
{:a => 1, :b => 2}
{c: 1, d: 2}

# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}

Example:

"EnforcedStyle => 'ruby19_no_mixed_keys'"

# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}

# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets

Freeze mutable objects assigned to constants.
Open

  CLOUDINARY_JS_CONFIG_PARAMS = %i[
    api_key
    cloud_name
    private_cdn
    secure_distribution
Severity: Minor
Found in app/helpers/application_helper.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

Align reduce with @accepted_stories. on line 146.
Open

      reduce({}) do |group, iteration|
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Align group_by with @accepted_stories. on line 146.
Open

      group_by { |story| story.iteration_number }.
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

    relation = relation.where("accepted_at > ? or accepted_at is null", since) if since
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

          owner.last.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)

Assignment in condition - you probably meant to use ==.
Open

          next unless matches = /(.*)\((.*) - (.*)\)$/.match(value)
Severity: Minor
Found in app/models/story.rb by rubocop

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

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

Use find_by instead of dynamic find_by_username.
Open

            user: project.users.find_by_username(matches[2]),
Severity: Minor
Found in app/models/story.rb by rubocop

This cop checks dynamic find_by_* methods. Use find_by instead of dynamic method. See. https://github.com/bbatsov/rails-style-guide#find_by

Example:

# bad
User.find_by_name(name)

# bad
User.find_by_name_and_email(name)

# bad
User.find_by_email!(name)

# good
User.find_by(name: name)

# good
User.find_by(name: name, email: email)

# good
User.find_by!(email: email)

Line is too long. [105/100]
Open

      requested_by_attrs = user.requested?(story) ? { requested_by_id: nil, requested_by_name: nil } : {}

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

      select { |story| story.column == '#done' }.
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

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

    @group_by_iteration ||= @accepted_stories.
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

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

    @group_by_bugs ||= @accepted_stories.
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Space inside parentheses detected.
Open

                 reduce(0) { |points, story| points + (story.estimate || 0) } )
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Space inside parentheses detected.
Open

        extra_iterations            = ( std_dev * iterations.size / mean_of_last_ten_iterations ).round
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

    @dummy_user ||= User.find_or_create_by!(username: "dummy", email: "dummy@foo.com", name: "Dummy", initials: "XX")
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

Pass &:accepted_at as an argument to select instead of a block.
Open

      accepted += backlog_iterations.first.select { |story| story.accepted_at }
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