datacite/levriero

View on GitHub

Showing 368 of 369 total issues

Do not read from ENV directly post initialization.
Open

                                          bearer: ENV["STAFF_ADMIN_TOKEN"],
Severity: Minor
Found in app/models/related_igsn.rb by rubocop

Do not read from ENV directly post initialization.
Open

        push_url = "#{ENV['LAGOTTINO_URL']}/events"
Severity: Minor
Found in app/models/related_pmid.rb by rubocop

Empty class detected.
Open

class DoiDeleteWorker
  # include Shoryuken::Worker

  # shoryuken_options queue: ->{ "#{ENV['RAILS_ENV']}_doi" }

Severity: Minor
Found in app/workers/doi_delete_worker.rb by rubocop

Checks for classes and metaclasses without a body. Such empty classes and metaclasses are typically an oversight or we should provide a comment to be clearer what we're aiming for.

Example:

# bad
class Foo
end

class Bar
  class << self
  end
end

class << obj
end

# good
class Foo
  def do_something
    # ... code
  end
end

class Bar
  class << self
    attr_reader :bar
  end
end

class << obj
  attr_reader :bar
end

Example: AllowComments: false (default)

# bad
class Foo
  # TODO: implement later
end

class Bar
  class << self
    # TODO: implement later
  end
end

class << obj
  # TODO: implement later
end

Example: AllowComments: true

# good
class Foo
  # TODO: implement later
end

class Bar
  class << self
    # TODO: implement later
  end
end

class << obj
  # TODO: implement later
end

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

gem "json-canonicalization", '0.3.1'
Severity: Minor
Found in Gemfile by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Do not read from ENV directly post initialization.
Open

                                          bearer: ENV["EVENTDATA_TOKEN"],
Severity: Minor
Found in app/models/related_identifier.rb by rubocop

Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant.
Open

        if [200, 201].include?(response.status)
Severity: Minor
Found in app/models/related_pmid.rb by rubocop

Do not return a value in initialize.
Open

    return @errors if report.body.fetch("errors", nil).present?
Severity: Minor
Found in app/models/report.rb by rubocop

Checks for the use of a return with a value in a context where the value will be ignored. (initialize and setter methods)

Example:

# bad
def initialize
  foo
  return :qux if bar?
  baz
end

def foo=(bar)
  return 42
end

Example:

# good
def initialize
  foo
  return if bar?
  baz
end

def foo=(bar)
  return
end

Do not read from ENV directly post initialization.
Open

      source_token = ENV["DATACITE_RESOLUTION_SOURCE_TOKEN"]
Severity: Minor
Found in app/models/usage_update.rb by rubocop

Do not read from ENV directly post initialization.
Open

  shoryuken_options queue: -> { "#{ENV['RAILS_ENV']}_doi" }, auto_delete: true
Severity: Minor
Found in app/workers/doi_import_worker.rb by rubocop

Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem next_rails should appear before sprockets.
Open

gem 'next_rails'
Severity: Minor
Found in Gemfile by rubocop

Gems should be alphabetically sorted within groups.

Example:

# bad
gem 'rubocop'
gem 'rspec'

# good
gem 'rspec'
gem 'rubocop'

# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'

Do not read from ENV directly post initialization.
Open

        host = ENV["EVENTDATA_URL"]
Severity: Minor
Found in app/models/related_identifier.rb by rubocop

Useless assignment to variable - response.
Open

    response = Maremma.post(push_url, data: data.to_json,
Severity: Minor
Found in app/models/usage_update.rb by rubocop

Checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Do not read from ENV directly post initialization.
Open

    "#{ENV['SASHIMI_QUERY_URL']}/reports"
Severity: Minor
Found in app/models/usage_update.rb by rubocop

Do not read from ENV directly post initialization.
Open

        push_url = "#{ENV['LAGOTTINO_URL']}/events"
Severity: Minor
Found in app/models/related_url.rb by rubocop

Do not read from ENV directly post initialization.
Open

          when ENV["API_URL"].include?("test")
Severity: Minor
Found in app/models/report.rb by rubocop

Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem json-canonicalization should appear before next_rails.
Open

gem "json-canonicalization", '0.3.1'
Severity: Minor
Found in Gemfile by rubocop

Gems should be alphabetically sorted within groups.

Example:

# bad
gem 'rubocop'
gem 'rspec'

# good
gem 'rspec'
gem 'rubocop'

# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'

Do not read from ENV directly post initialization.
Open

        source_token = ENV["DATACITE_RELATED_SOURCE_TOKEN"]
Severity: Minor
Found in app/models/related_identifier.rb by rubocop

Do not read from ENV directly post initialization.
Open

      source_token = ENV["DATACITE_USAGE_SOURCE_TOKEN"]
Severity: Minor
Found in app/models/usage_update.rb by rubocop

Do not read from ENV directly post initialization.
Open

      if ENV["STAFF_ADMIN_TOKEN"].present?
Severity: Minor
Found in app/models/related_url.rb by rubocop

Do not read from ENV directly post initialization.
Open

      if ENV["STAFF_ADMIN_TOKEN"].present?
Severity: Minor
Found in app/models/related_identifier.rb by rubocop
Severity
Category
Status
Source
Language