Class: DontRepeatYourself::ProjectReporterBase
- Inherits:
-
Object
- Object
- DontRepeatYourself::ProjectReporterBase
show all
- Defined in:
- lib/dont_repeat_yourself/reporter.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ProjectReporterBase.
25
26
27
28
29
30
31
32
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 25
def initialize(name)
@name = name
@simian_runner = DontRepeatYourself::SimianRunner.new
@maximum_number_of_duplicate_lines_i_want_in_my_project = 0
@report_type = DontRepeatYourself::DEFAULT_REPORT
end
|
Instance Attribute Details
#maximum_number_of_duplicate_lines_i_want_in_my_project ⇒ Object
Returns the value of attribute maximum_number_of_duplicate_lines_i_want_in_my_project.
23
24
25
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 23
def maximum_number_of_duplicate_lines_i_want_in_my_project
@maximum_number_of_duplicate_lines_i_want_in_my_project
end
|
#name ⇒ Object
Returns the value of attribute name.
23
24
25
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 23
def name
@name
end
|
#report_type ⇒ Object
Returns the value of attribute report_type.
23
24
25
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 23
def report_type
@report_type
end
|
Class Method Details
.build_reporter(reporter, basedir) ⇒ Object
Instance Method Details
#basedir ⇒ Object
62
63
64
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 62
def basedir
@simian_runner.basedir
end
|
#description ⇒ Object
75
76
77
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 75
def description
"DRY\n" << " - with a threshold of #{@simian_runner.threshold} duplicate lines"
end
|
#failure_message ⇒ Object
79
80
81
82
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 79
def failure_message
"expected #{@name} to have less or equal #{@maximum_number_of_duplicate_lines_i_want_in_my_project} duplicate lines :\n
DRY Report:\n#{report}\n"
end
|
#ignoring_the_directory(path) ⇒ Object
57
58
59
60
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 57
def ignoring_the_directory(path)
@simian_runner.ignore_directory(path)
self
end
|
#ignoring_the_file(path) ⇒ Object
52
53
54
55
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 52
def ignoring_the_file(path)
@simian_runner.ignore_file(path)
self
end
|
#is_dry? ⇒ Boolean
TODO Not very readable: you have to read the code of run_simian to understand
71
72
73
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 71
def is_dry?
run_simian.duplicate_line_count <= @maximum_number_of_duplicate_lines_i_want_in_my_project
end
|
#patterns_of_directories_to_search_for_duplicate_lines ⇒ Object
34
35
36
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 34
def patterns_of_directories_to_search_for_duplicate_lines
@simian_runner.patterns_of_directories_to_search_for_duplicate_lines
end
|
#with_threshold_of_duplicate_lines(threshold) ⇒ Object
39
40
41
42
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 39
def with_threshold_of_duplicate_lines(threshold)
@simian_runner.threshold = threshold
return self
end
|