@@ -20,15 +20,15 @@ def initialize(engine_config, language_strategy, io)
2020 end
2121
2222 def run
23- debug ( "Processing #{ language_strategy . files . count } #{ lang } files concurrency=#{ engine_config . concurrency } " )
23+ CC . logger . debug ( "Processing #{ language_strategy . files . count } #{ lang } files concurrency=#{ engine_config . concurrency } " )
2424
2525 process_files
2626
2727 if engine_config . dump_ast?
2828 dump_ast
2929 else
3030 report
31- debug ( "Reported #{ reports . size } violations..." )
31+ CC . logger . debug ( "Reported #{ reports . size } violations..." )
3232 end
3333 end
3434
@@ -39,11 +39,10 @@ def dump_ast
3939
4040 return if issues . empty?
4141
42- debug "Sexps for issues:"
43- debug
42+ CC . logger . debug ( "Sexps for issues:" )
4443
4544 issues . each_with_index do |issue , idx1 |
46- debug (
45+ CC . logger . debug (
4746 format (
4847 "#%2d) %s#%d mass=%d:" ,
4948 idx1 + 1 ,
@@ -52,20 +51,15 @@ def dump_ast
5251 issue . mass ,
5352 ) ,
5453 )
55- debug
5654
5755 locs = issue . locations . map . with_index do |loc , idx2 |
5856 format ( "# %d.%d) %s:%s" , idx1 + 1 , idx2 + 1 , loc . file , loc . line )
5957 end
6058
6159 locs . zip ( flay . hashes [ issue . structural_hash ] ) . each do |loc , sexp |
62- debug loc
63- debug
64- debug sexp . pretty_inspect
65- debug
60+ CC . logger . debug ( loc )
61+ CC . logger . debug ( sexp . pretty_inspect )
6662 end
67- 68- debug
6963 end
7064 end
7165
@@ -78,7 +72,7 @@ def process_files
7872 processed_files_count = Concurrent ::AtomicFixnum . new
7973
8074 pool . run do |file |
81- debug ( "Processing #{ lang } file: #{ file } " )
75+ CC . logger . debug ( "Processing #{ lang } file: #{ file } " )
8276
8377 sexp = language_strategy . run ( file )
8478
@@ -89,7 +83,7 @@ def process_files
8983
9084 pool . join
9185
92- debug ( "Processed #{ processed_files_count . value } #{ lang } files" )
86+ CC . logger . debug ( "Processed #{ processed_files_count . value } #{ lang } files" )
9387 end
9488
9589 def lang
@@ -102,7 +96,7 @@ def report
10296
10397 violations . each do |violation |
10498 next if ( violation . occurrences + 1 ) < language_strategy . count_threshold
105- debug ( "Violation name=#{ violation . report_name } mass=#{ violation . mass } " )
99+ CC . logger . debug ( "Violation name=#{ violation . report_name } mass=#{ violation . mass } " )
106100
107101 unless reports . include? ( violation . report_name )
108102 reports . add ( violation . report_name )
@@ -140,12 +134,6 @@ def flay_options
140134
141135 CCFlay . default_options . merge changes
142136 end
143- 144- def debug ( message = "" )
145- IO_M . synchronize do
146- $stderr. puts ( message ) if engine_config . debug?
147- end
148- end
149137 end
150138 end
151139 end
0 commit comments