Skip to content

Commit

Permalink
Fix Rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangarha committed Jan 8, 2024
1 parent d7ec85e commit f2185b1
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def add_base_gems_to_gemfile
end

def add_yarn_dependencies
major_minor_patch_only = /\A\d+\.\d+\.\d+\z/.freeze
major_minor_patch_only = /\A\d+\.\d+\.\d+\z/
if ReactOnRails::VERSION.match?(major_minor_patch_only)
run "yarn add react-on-rails@#{ReactOnRails::VERSION} --exact"
else
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/packs_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module ReactOnRails
# rubocop:disable Metrics/ClassLength
class PacksGenerator
CONTAINS_CLIENT_OR_SERVER_REGEX = /\.(server|client)($|\.)/.freeze
CONTAINS_CLIENT_OR_SERVER_REGEX = /\.(server|client)($|\.)/
MINIMUM_SHAKAPACKER_VERSION = [6, 5, 1].freeze

def self.instance
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def self.smart_trim(str, max_length = 1000)
to_remove = str.length - max_length
lstrip = (to_remove / 2.0).ceil
rstrip = to_remove - lstrip
str[0..(midpoint - lstrip - 1)] + TRUNCATION_FILLER + str[(midpoint + rstrip)..-1]
str[0..(midpoint - lstrip - 1)] + TRUNCATION_FILLER + str[(midpoint + rstrip)..]
end

def self.find_most_recent_mtime(files)
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/version_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module ReactOnRails
class VersionChecker
attr_reader :node_package_version

MAJOR_MINOR_PATCH_VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/.freeze
MAJOR_MINOR_PATCH_VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/

def self.build
new(NodePackageVersion.build)
Expand Down
2 changes: 1 addition & 1 deletion rakelib/examples.rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace :examples do # rubocop:disable Metrics/BlockLength
include ReactOnRails::TaskHelpers
# Loads data from examples_config.yml and instantiates corresponding ExampleType objects
examples_config_file = File.expand_path("examples_config.yml", __dir__)
examples_config = symbolize_keys(YAML.safe_load(File.read(examples_config_file)))
examples_config = symbolize_keys(YAML.safe_load_file(examples_config_file))
examples_config[:example_type_data].each { |example_type_data| ExampleType.new(**symbolize_keys(example_type_data)) }

# Define tasks for each example type
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/spec/packs_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# rubocop:disable Metrics/ModuleLength
module ReactOnRails
GENERATED_PACKS_CONSOLE_OUTPUT_REGEX = /Generated Packs:/.freeze
GENERATED_PACKS_CONSOLE_OUTPUT_REGEX = /Generated Packs:/

# rubocop:disable Metrics/BlockLength
describe PacksGenerator do
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir[Rails.root.join("spec", "support", "**", "*.rb")].sort.each { |f| require f }
Dir[Rails.root.join("spec", "support", "**", "*.rb")].each { |f| require f }

RSpec.configure do |config|
# Ensure that if we are running js tests, we are using latest webpack assets
Expand Down
4 changes: 2 additions & 2 deletions spec/react_on_rails/support/generator_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require_relative "../simplecov_helper"
require "generator_spec/test_case"

Dir["#{File.expand_path('../support/shared_examples', __dir__)}/*.rb"].sort.each { |file| require file }
Dir["#{File.expand_path('../support/shared_examples', __dir__)}/*.rb"].each { |file| require file }
generators_glob = File.expand_path("../../../lib/generators/react_on_rails/*_generator.rb", __dir__)
Dir[generators_glob.to_s].sort.each { |file| require file }
Dir[generators_glob.to_s].each { |file| require file }
include ReactOnRails::Generators # rubocop:disable Style/MixinUsage

RSpec.configure do |config|
Expand Down

0 comments on commit f2185b1

Please sign in to comment.