122 files inspected, 69 offenses detected:

 

Gemfile - 2 offenses

Line #46convention: Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem karafka-testing should appear before rspec-rails.
gem 'karafka-testing'
Line #46convention: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
gem 'karafka-testing'

 

app/controllers/application_controller.rb - 1 offense

Line #36convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
    MapStatus.map_status.update(last_request_time: Time.now) unless request.path == "/status"

 

app/controllers/gameworlds_controller.rb - 1 offense

Line #6convention: Rails/LexicallyScopedActionFilter: update, destroy are not explicitly defined on the class.
  before_action :set_gameworld, only: %i[show update destroy]

 

app/controllers/gameworlds_web_controller.rb - 1 offense

Line #29convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
    @planet.deleted_at = @planet.deleted_at ? nil : Time.now

 

app/controllers/planets_controller.rb - 1 offense

Line #4convention: Rails/LexicallyScopedActionFilter: take is not explicitly defined on the class.
  before_action :set_planet, only: %i[show take]

 

app/controllers/web_controller.rb - 1 offense

Line #3convention: Rails/ApplicationController: Controllers should subclass ApplicationController.
class WebController < ActionController::Base

 

app/events/gameworld/gameworld_created.rb - 1 offense

Line #7convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
      @timestamp = Time.now

 

app/events/gameworld/gameworld_deleted.rb - 1 offense

Line #7convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
      @timestamp = Time.now

 

app/events/gameworld/gameworld_status_changed.rb - 1 offense

Line #7convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
      @timestamp = Time.now

 

app/events/planet/resource_mined.rb - 1 offense

Line #8convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
      @timestamp = Time.now

 

app/models/gameworld.rb - 3 offenses

Line #23convention: Metrics/AbcSize: Assignment Branch Condition size for prune_inactive_gameworlds is too high. [<3, 24, 0> 24.19/17]
  def self.prune_inactive_gameworlds ...
Line #23convention: Metrics/MethodLength: Method has too many lines. [28/20]
  def self.prune_inactive_gameworlds ...
Line #24convention: Metrics/BlockLength: Block has too many lines. [26/25]
    Gameworld.transaction do ...

 

app/models/gameworld_builder.rb - 14 offenses

Line #56convention: Rails/SkipsModelValidations: Avoid using insert_all because it skips validations.
    Planet.insert_all(planets)
Line #106convention: Metrics/AbcSize: Assignment Branch Condition size for create_specific_resources is too high. [<7, 18, 4> 19.72/17]
  def create_specific_resources(name, patch_factor, part_of_map) ...
Line #106convention: Metrics/MethodLength: Method has too many lines. [25/20]
  def create_specific_resources(name, patch_factor, part_of_map) ...
Line #117convention: Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
    if num_planets < 1
Line #131convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
       created_at:     Time.now,
Line #132convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
       updated_at:     Time.now}
Line #135convention: Rails/SkipsModelValidations: Avoid using insert_all because it skips validations.
    Resource.insert_all(resources)
Line #138warning: Lint/UnusedMethodArgument: Unused method argument - planets. If it's necessary, use _ or _planets as an argument name to indicate that it won't be used. If it's unnecessary, remove it. You can also write as generate_resource_distribution_quotas(*) if you want the method to accept any arguments but don't care about them.
  def generate_resource_distribution_quotas(planets)
Line #140convention: Layout/LineLength: Line is too long. [122/120]
      {patch_factor: Rails.application.config.gameworld_coal_patch_factor || 0.8, name: "coal", part_of_map: :outer_map?},
Line #143convention: Layout/LineLength: Line is too long. [122/120]
      {patch_factor: Rails.application.config.gameworld_gold_patch_factor || 0.2, name: "gold", part_of_map: :inner_map?},
Line #144convention: Layout/LineLength: Line is too long. [125/120]
      {patch_factor: Rails.application.config.gameworld_platin_patch_factor || 0.1, name: "platin", part_of_map: :inner_map?}
Line #157convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
         created_at:             Time.now,
Line #158convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
         updated_at:             Time.now,
Line #193convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
      planet[:deleted_at] = Time.now if deleted_planets.include?([planet[:x], planet[:y]])

 

app/models/map_status.rb - 1 offense

Line #9convention: Rails/TimeZone: Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
    map_status = create_with(last_request_time: Time.now)

 

app/models/planet.rb - 1 offense

Line #72convention: Layout/TrailingWhitespace: Trailing whitespace detected.
  # Returns the direction of the neighbour planet relative 

 

app/printer/gameworld_printer.rb - 5 offenses

Line #4convention: Metrics/AbcSize: Assignment Branch Condition size for print_gameworld is too high. [<9, 18, 5> 20.74/17]
  def self.print_gameworld(gwb, margin_width=2) ...
Line #14convention: Rails/Output: Do not write to stdout. Use Rails's logger if you want to log.
    puts(
Line #15convention: Style/CollectionMethods: Prefer map over collect.
      gameworld.collect do |row|
Line #18convention: Style/MethodCalledOnDoEndBlock: Avoid chaining a method call on a do...end block.
        end.join
Line #43convention: Metrics/AbcSize: Assignment Branch Condition size for gameworld_to_stringified_2d_array is too high. [<7, 15, 9> 18.84/17]
  def self.gameworld_to_stringified_2d_array(gwb) ...

 

config/definitions.rb - 1 offense

Line #1convention: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
# The following comments fill some of the gaps in Solargraph's understanding of

 

config/environments/development.rb - 1 offense

Line #21convention: Rails/FilePath: Prefer Rails.root.join('path/to').
  if Rails.root.join("tmp", "caching-dev.txt").exist?

 

config/environments/production.rb - 2 offenses

Line #54convention: Style/RedundantConstantBase: Remove redundant ::.
  config.log_formatter = ::Logger::Formatter.new
Line #55convention: Layout/TrailingWhitespace: Trailing whitespace detected.

 

config/initializers/kaminari.rb - 1 offense

Line #1convention: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
Kaminari.configure do |config|

 

config/initializers/rswag-ui.rb - 1 offense

Line #1convention: Naming/FileName: The name of this source file (rswag-ui.rb) should use snake_case.
# frozen_string_literal: true

 

config/initializers/rswag_api.rb - 1 offense

Line #8convention: Rails/FilePath: Prefer Rails.root.join('path/to').
  c.swagger_root = "#{Rails.root}/swagger"

 

config/initializers/will_paginate.rb - 1 offense

Line #1convention: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
if defined?(WillPaginate)

 

db/migrate/20211026132842_create_planets_neighbours.rb - 1 offense

Line #5convention: Rails/CreateTableWithTimestamps: Add timestamps when creating a new table.
    create_table :planets_neighbours, id: false do |t| ...

 

db/migrate/20211029115101_update_minings.rb - 1 offense

Line #6convention: Rails/NotNullColumn: Do not add a NOT NULL column without a default value.
    add_reference :minings, :resource, null: false, foreign_key: true, type: :uuid

 

db/migrate/20211029122322_update_replenishments.rb - 1 offense

Line #6convention: Rails/NotNullColumn: Do not add a NOT NULL column without a default value.
    add_reference :replenishments, :resource, null: false, foreign_key: true, type: :uuid

 

db/migrate/20211115153831_add_versions.rb - 1 offense

Line #15convention: Layout/LineLength: Line is too long. [127/120]
    execute "ALTER TABLE spacestation_creations ALTER COLUMN version SET DEFAULT NEXTVAL('spacestation_creations_version_seq')"

 

db/migrate/20211127145536_add_resource_type_enum.rb - 1 offense

Line #6convention: Rails/ReversibleMigration: drop_table(without block) is not reversible.
    drop_table :resource_types

 

db/migrate/20211128220650_create_good_jobs.rb - 2 offenses

Line #4convention: Metrics/AbcSize: Assignment Branch Condition size for change is too high. [<1, 21, 0> 21.02/17]
  def change ...
Line #4convention: Metrics/MethodLength: Method has too many lines. [24/20]
  def change ...

 

db/migrate/20211129141916_gameworld_name.rb - 1 offense

Line #5convention: Rails/BulkChangeTable: You can use change_table :gameworlds, bulk: true to combine alter queries.
    add_column :gameworlds, :name, :string

 

db/migrate/20220717112652_remove_version.rb - 3 offenses

Line #5convention: Rails/ReversibleMigration: remove_column(without type) is not reversible.
    remove_column :spacestation_creations, :version
Line #6convention: Rails/ReversibleMigration: remove_column(without type) is not reversible.
    remove_column :minings, :version
Line #7convention: Rails/ReversibleMigration: remove_column(without type) is not reversible.
    remove_column :replenishments, :version

 

db/migrate/20220717115428_remove_unused_events.rb - 2 offenses

Line #5convention: Rails/ReversibleMigration: drop_table(without block) is not reversible.
    drop_table :spawn_creations
Line #6convention: Rails/ReversibleMigration: drop_table(without block) is not reversible.
    drop_table :explorations

 

db/seeds.rb - 1 offense

Line #1warning: Lint/EmptyFile: Empty file detected.

 

lib/pages/pages.rb - 4 offenses

Line #1convention: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
module Pages
Line #5convention: Metrics/AbcSize: Assignment Branch Condition size for pages_from is too high. [<7, 19, 8> 21.77/17]
    def self.pages_from(collection) ...
Line #22convention: Naming/PredicateName: Rename is_paginated? to paginated?.
    def self.is_paginated?(collection)
Line #28convention: Naming/PredicateName: Rename is_countable? to countable?.
    def self.is_countable?(collection)

 

spec/models/gameworld_builder_spec.rb - 2 offenses

Line #82convention: Style/MethodCalledOnDoEndBlock: Avoid chaining a method call on a do...end block.
      end.count
Line #91warning: Lint/UselessAssignment: Useless assignment to variable - map_size.
      map_size = 20

 

spec/models/resource_spec.rb - 1 offense

Line #20convention: Style/MethodCalledOnDoEndBlock: Avoid chaining a method call on a do...end block.
    end.to raise_error(ActiveRecord::RecordNotUnique)

 

spec/rails_helper.rb - 3 offenses

Line #1convention: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
require "simplecov"
Line #41convention: Rails/FilePath: Prefer Rails.root.join('path/to').
  config.fixture_path = "#{::Rails.root}/spec/fixtures"
Line #41convention: Style/RedundantConstantBase: Remove redundant ::.
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

 

spec/requests/planets_spec.rb - 1 offense

Line #21warning: Lint/EmptyBlock: Empty block detected.
        let(:planet_type) {}

 

spec/spec_helper.rb - 1 offense

Line #21convention: Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.