Class: DontRepeatYourself::ProjectReporterBase
- Inherits:
-
Object
- Object
- DontRepeatYourself::ProjectReporterBase
show all
- Defined in:
- lib/dont_repeat_yourself/reporter.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ProjectReporterBase.
22
23
24
25
26
27
28
29
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 22
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.
20
21
22
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 20
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.
20
21
22
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 20
def name
@name
end
|
#report_type ⇒ Object
Returns the value of attribute report_type.
20
21
22
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 20
def report_type
@report_type
end
|
Instance Method Details
#basedir ⇒ Object
59
60
61
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 59
def basedir
@simian_runner.basedir
end
|
#description ⇒ Object
72
73
74
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 72
def description
"DRY\n" << " - with a threshold of #{@simian_runner.threshold} duplicate lines"
end
|
#failure_message ⇒ Object
76
77
78
79
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 76
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
54
55
56
57
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 54
def ignoring_the_directory(path)
@simian_runner.ignore_directory(path)
self
end
|
#ignoring_the_file(path) ⇒ Object
49
50
51
52
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 49
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
68
69
70
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 68
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
31
32
33
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 31
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
36
37
38
39
|
# File 'lib/dont_repeat_yourself/reporter.rb', line 36
def with_threshold_of_duplicate_lines(threshold)
@simian_runner.threshold = threshold
return self
end
|