Code smell clean-up

This commit is contained in:
Peter Camilleri 2016-03-28 12:03:51 -04:00
parent 80105271b7
commit ab2f270e97
6 changed files with 16 additions and 19 deletions

View file

@ -107,3 +107,6 @@ UtilityFunction:
enabled: true
exclude: []
max_helper_calls: 1
UnusedPrivateMethod:
enabled: false
exclude: []

View file

@ -27,6 +27,8 @@ module XfOOrth
end
#Process a backlash character found with a string in the source text.
#<br>Endemic Code Smells
#* :reek:TooManyStatements
def process_backslash(buffer)
next_char = @source.get

View file

@ -4,6 +4,8 @@
module XfOOrth
#* debug/display_abort.rb - Display diagnostic information on an error.
#<br>Endemic Code Smells
#* :reek:TooManyStatements
class VirtualMachine
#Display the diagnostic data required for a language abort error.

View file

@ -11,7 +11,7 @@ module XfOOrth
#Build up the bundle instance
def initialize(fibers=[])
@fibers = fibers.in_array.map {|f| f.to_foorth_fiber}
@fibers = fibers.in_array.map {|fiber| fiber.to_foorth_fiber}
@current = 0
rescue NoMethodError
error "F70: A bundle may only contain procedures, fibers, or bundles."
@ -19,7 +19,7 @@ module XfOOrth
#Add the fibers to this bundle.
def add_fibers(fibers)
fibers.in_array.each {|f| @fibers << f.to_foorth_fiber}
fibers.in_array.each {|fiber| @fibers << fiber.to_foorth_fiber}
rescue NoMethodError
error "F70: A bundle may only contain procedures, fibers, or bundles."
end
@ -40,6 +40,8 @@ module XfOOrth
end
#Let the fiber run for one step
#<br>Endemic Code Smells
#* :reek:DuplicateMethodCall
def step(vm)
if @current < @fibers.length
if @fibers[@current].step(vm)

View file

@ -36,6 +36,8 @@ module XfOOrth
end
#Let the fiber run for one step.
#<br>Endemic Code Smells
#* :reek:DuplicateMethodCall
def step(vm)
vm.data_stack, vm.fiber, @save = @stack, self, vm.data_stack
@status = @fiber.resume(vm)
@ -46,6 +48,8 @@ module XfOOrth
end
#Yield back to the thread.
#<br>Endemic Code Smells
#* :reek:UtilityFunction
def yield
Fiber.yield(ALIVE)
end

View file

@ -1,17 +1 @@
lib/fOOrth/compiler/parser/get_string.rb -- 1 warning:
[30]:TooManyStatements: XfOOrth::Parser#process_backslash has approx 9 statements [https://github.com/troessner/reek/blob/master/docs/Too-Many-Statements.md]
lib/fOOrth/compiler/process/procedure.rb -- 1 warning:
[15]:UnusedPrivateMethod: XfOOrth::VirtualMachine has the unused private instance method `procedure_parms` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
lib/fOOrth/compiler/process.rb -- 1 warning:
[19]:UnusedPrivateMethod: XfOOrth::VirtualMachine has the unused private instance method `process` [https://github.com/troessner/reek/blob/master/docs/Unused-Private-Method.md]
lib/fOOrth/debug/display_abort.rb -- 1 warning:
[13]:TooManyStatements: XfOOrth::VirtualMachine#display_abort has approx 9 statements [https://github.com/troessner/reek/blob/master/docs/Too-Many-Statements.md]
lib/fOOrth/library/bundle_library.rb -- 4 warnings:
[44, 52]:DuplicateMethodCall: XfOOrth::XfOOrth_Bundle#step calls @current < @fibers.length 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[44, 52]:DuplicateMethodCall: XfOOrth::XfOOrth_Bundle#step calls @fibers.length 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[22]:UncommunicativeVariableName: XfOOrth::XfOOrth_Bundle#add_fibers has the variable name 'f' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
[14]:UncommunicativeVariableName: XfOOrth::XfOOrth_Bundle#initialize has the variable name 'f' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md]
lib/fOOrth/library/fiber_library.rb -- 2 warnings:
[40, 45]:DuplicateMethodCall: XfOOrth::XfOOrth_Fiber#step calls vm.data_stack 2 times [https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md]
[49]:UtilityFunction: XfOOrth::XfOOrth_Fiber#yield doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/master/docs/Utility-Function.md]
10 total warnings
0 total warnings