Skip to content

Commit

Permalink
Address RuboCop warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomthom committed Jan 3, 2024
1 parent 7f87609 commit bf81226
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 6 deletions.
14 changes: 14 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require:
AllCops:
DisabledByDefault: true # TODO: Reenable
DisplayStyleGuide: true
SuggestExtensions: false
SketchUp:
SourcePath: src
TargetSketchUpVersion: 2014
Expand Down Expand Up @@ -55,6 +56,19 @@ SketchupSuggestions:
SketchupBugs:
Enabled: true

# TestUp relies on Minitest gem and need to install it.
SketchupRequirements/GemInstall:
Enabled: false

# Need to modify the load path for Minitest to work within SketchUp.
SketchupRequirements/LoadPath:
Exclude:
- src/testup/minitest_setup.rb

# Lots of monkey patching of Minitest required in order for it to operate within SketchUp.
SketchupRequirements/RubyStdLibNamespace:
Enabled: false

SketchupSuggestions/FileEncoding:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion src/testup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
if defined?(Sketchup)
require 'sketchup.rb'
require 'extensions.rb'
elsif defined?(Layout)
elsif defined?(Layout) # rubocop:disable SketchupSuggestions/Compatibility
require 'layout.rb'
end

Expand Down
2 changes: 1 addition & 1 deletion src/testup/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module TestUp
# TODO(thomthom): Add LayOut console class.
if defined?(Sketchup)
APP_CONSOLE = SKETCHUP_CONSOLE
elsif defined?(Layout)
elsif defined?(Layout) # rubocop:disable SketchupSuggestions/Compatibility
APP_CONSOLE = LAYOUT_CONSOLE # TODO(thomthom): Correct?
end

Expand Down
2 changes: 1 addition & 1 deletion src/testup/debug_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
module Minitest
class Runnable

class << self
class << self # rubocop:disable Style/MultilineIfModifier
puts "Alias old_run_one_method..."
alias_method :old_run_one_method, :run_one_method
end unless respond_to?(:old_run_one_method)
Expand Down
2 changes: 2 additions & 0 deletions src/testup/sketchup_test_utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module SketchUpTestUtilities
SKETCHUP_RANGE_MAX = -1.0e30
SKETCHUP_RANGE_MIN = 1.0e30

# rubocop:disable SketchupSuggestions/ModelEntities
def start_with_empty_model
model = Sketchup.active_model
model.abort_operation # Incase any operation is left hanging open.
Expand Down Expand Up @@ -87,6 +88,7 @@ def start_with_empty_model
model.commit_operation
model
end
# rubocop:enable SketchupSuggestions/ModelEntities

def open_new_model
model = Sketchup.active_model
Expand Down
2 changes: 1 addition & 1 deletion src/testup/ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ module SystemUI

def self.select_directory(options)
if defined?(UI) && UI.respond_to?(:select_directory)
result = UI.select_directory(options)
result = UI.select_directory(options) # rubocop:disable SketchupSuggestions/Compatibility
return nil if result.nil?
if options && options[:select_multiple]
result.map! { |path| File.expand_path(path) }
Expand Down
2 changes: 1 addition & 1 deletion src/testup/ui/adapters/htmldialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ def register_callback(callback_name, &block)
add_action_callback(callback_name, &block)
end

end if defined?(UI::HtmlDialog)
end if defined?(UI::HtmlDialog) # rubocop:disable SketchupSuggestions/Compatibility
end # module
2 changes: 1 addition & 1 deletion src/testup/ui/window.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#-------------------------------------------------------------------------------

require 'testup/ui/adapters/webdialog'
require 'testup/ui/adapters/htmldialog' if defined?(UI::HtmlDialog)
require 'testup/ui/adapters/htmldialog' if defined?(UI::HtmlDialog) # rubocop:disable SketchupSuggestions/Compatibility
require 'testup/config'
require 'testup/log'

Expand Down

0 comments on commit bf81226

Please sign in to comment.