Codeminer42/cm42-central

View on GitHub

Showing 331 of 343 total issues

Use find_by instead of dynamic find_by_user_id.
Open

    enrollments.find_by_user_id(user.id)&.is_admin?
Severity: Minor
Found in app/models/team.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)

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

                 select { |story| story.state == state }.
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)

Use !empty? instead of size > 0.
Open

      if iterations.size > 0
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

This cop checks for numeric comparisons that can be replaced by a predicate method, such as receiver.length == 0, receiver.length > 0, receiver.length != 0, receiver.length < 1 and receiver.size == 0 that can be replaced by receiver.empty? and !receiver.empty.

Example:

# bad
[1, 2, 3].length == 0
0 == "foobar".length
array.length < 1
{a: 1, b: 2}.length != 0
string.length > 0
hash.size > 0

# good
[1, 2, 3].empty?
"foobar".empty?
array.empty?
!{a: 1, b: 2}.empty?
!string.empty?
!hash.empty?

Trailing whitespace detected.
Open

      

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

Line is too long. [111/100]
Open

        story.project.suppress_notifications = true # otherwise the import will generate massive notifications!
Severity: Minor
Found in app/models/project.rb by rubocop

Surrounding space missing for operator =>.
Open

      :type=>'text/javascript'
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

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

    @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 { |story| story.iteration_number }.
Severity: Minor
Found in app/services/iteration_service.rb by rubocop

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

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

Unnecessary spacing detected.
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

Align select with @stories. on line 20.
Open

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

Align group_by with @accepted_stories. on line 106.
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

    @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

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

    if record.project && !value.nil?

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

Replace "central" with 'central'
Open

import ProjectsShowController from "central";

For more information visit Source: http://eslint.org/docs/rules/

Replace "libs" with 'libs'
Open

import "libs";

For more information visit Source: http://eslint.org/docs/rules/

Replace "beta/projects.show" with 'beta/projects.show'
Open

  "beta/projects.show": BetaShowProjectBoardController,

For more information visit Source: http://eslint.org/docs/rules/

Replace "controllers/projects/IndexController" with 'controllers/projects/IndexController'
Open

import ProjectsIndexController from "controllers/projects/IndexController";

For more information visit Source: http://eslint.org/docs/rules/

Severity
Category
Status
Source
Language