Class: DontRepeatYourself::ProjectReporterBase
- Inherits:
-
Object
- Object
- DontRepeatYourself::ProjectReporterBase
- Defined in:
- lib/dont_repeat_yourself/reporter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#maximum_number_of_duplicate_lines_i_want_in_my_project ⇒ Object
readonly
Returns the value of attribute maximum_number_of_duplicate_lines_i_want_in_my_project.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#report_type ⇒ Object
readonly
Returns the value of attribute report_type.
Instance Method Summary collapse
- #basedir ⇒ Object
- #description ⇒ Object
- #failure_message ⇒ Object
- #ignoring_the_file(path) ⇒ Object
-
#initialize(name) ⇒ ProjectReporterBase
constructor
A new instance of ProjectReporterBase.
-
#is_dry? ⇒ Boolean
TODO Not very readable: you have to read the code of run_simian to understand.
- #patterns_of_directories_to_search_for_duplicate_lines ⇒ Object
- #report ⇒ Object
-
#with_threshold_of_duplicate_lines(threshold) ⇒ Object
Fluent interface methods.
Constructor Details
#initialize(name) ⇒ ProjectReporterBase
Returns a new instance of ProjectReporterBase.
15 16 17 18 19 20 21 22 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 15 def initialize(name) @name = name @simian_runner = DontRepeatYourself::SimianRunner.new # Default values @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 (readonly)
Returns the value of attribute maximum_number_of_duplicate_lines_i_want_in_my_project.
13 14 15 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 13 def maximum_number_of_duplicate_lines_i_want_in_my_project @maximum_number_of_duplicate_lines_i_want_in_my_project end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 13 def name @name end |
#report_type ⇒ Object (readonly)
Returns the value of attribute report_type.
13 14 15 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 13 def report_type @report_type end |
Instance Method Details
#basedir ⇒ Object
47 48 49 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 47 def basedir @simian_runner.basedir end |
#description ⇒ Object
60 61 62 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 60 def description "DRY\n" << " - with a threshold of #{@simian_runner.threshold} duplicate lines" end |
#failure_message ⇒ Object
64 65 66 67 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 64 def "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_file(path) ⇒ Object
42 43 44 45 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 42 def ignoring_the_file(path) @simian_runner.ignoring_file(path) self end |
#is_dry? ⇒ Boolean
TODO Not very readable: you have to read the code of run_simian to understand
56 57 58 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 56 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
24 25 26 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 24 def patterns_of_directories_to_search_for_duplicate_lines @simian_runner.patterns_of_directories_to_search_for_duplicate_lines end |
#report ⇒ Object
51 52 53 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 51 def report DontRepeatYourself::FormatterFactory.create_report(@report_type, run_simian) end |
#with_threshold_of_duplicate_lines(threshold) ⇒ Object
Fluent interface methods
29 30 31 32 |
# File 'lib/dont_repeat_yourself/reporter.rb', line 29 def with_threshold_of_duplicate_lines(threshold) @simian_runner.threshold = threshold return self end |