Class: PropertyGenerator::Linter
- Inherits:
-
Object
- Object
- PropertyGenerator::Linter
- Defined in:
- lib/linter/linter.rb
Instance Attribute Summary collapse
-
#config_linter ⇒ Object
Returns the value of attribute config_linter.
-
#globals_linter ⇒ Object
Returns the value of attribute globals_linter.
-
#ignored_tests ⇒ Object
Returns the value of attribute ignored_tests.
-
#report ⇒ Object
Returns the value of attribute report.
-
#services_linter ⇒ Object
Returns the value of attribute services_linter.
Instance Method Summary collapse
- #display_report ⇒ Object
- #fail_check ⇒ Object
-
#initialize(path) ⇒ Linter
constructor
A new instance of Linter.
- #run_tests ⇒ Object
Constructor Details
#initialize(path) ⇒ Linter
Returns a new instance of Linter.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/linter/linter.rb', line 9 def initialize(path) ignore_list = %w[README.md .cpsignore Jenkinsfile Gemfile Gemfile.lock] invalid_paths = PropertyGenerator.invalid_paths(path, ignore_list) begin @ignored_tests = YAML.load_file("#{path}/.cpsignore") rescue StandardError @ignored_tests = {} end @config_linter = PropertyGenerator::ConfigLinter.new("#{path}/config/config.yml", @ignored_tests['config'] || []) @globals_linter = PropertyGenerator::GlobalsLinter.new("#{path}/globals/", @config_linter.configs, @ignored_tests['globals'] || []) @services_linter = PropertyGenerator::ServicesLinter.new("#{path}/services/", @config_linter.configs, @ignored_tests['services'] || []) unless @ignored_tests['display_skipped_tests'].nil? if @ignored_tests['display_skipped_tests'] @ignored_tests.delete('display_skipped_tests') else @ignored_tests = [] end end @report = PropertyGenerator::Report.new(invalid_paths, @ignored_tests) end |
Instance Attribute Details
#config_linter ⇒ Object
Returns the value of attribute config_linter.
7 8 9 |
# File 'lib/linter/linter.rb', line 7 def config_linter @config_linter end |
#globals_linter ⇒ Object
Returns the value of attribute globals_linter.
7 8 9 |
# File 'lib/linter/linter.rb', line 7 def globals_linter @globals_linter end |
#ignored_tests ⇒ Object
Returns the value of attribute ignored_tests.
7 8 9 |
# File 'lib/linter/linter.rb', line 7 def ignored_tests @ignored_tests end |
#report ⇒ Object
Returns the value of attribute report.
7 8 9 |
# File 'lib/linter/linter.rb', line 7 def report @report end |
#services_linter ⇒ Object
Returns the value of attribute services_linter.
7 8 9 |
# File 'lib/linter/linter.rb', line 7 def services_linter @services_linter end |
Instance Method Details
#display_report ⇒ Object
49 50 51 |
# File 'lib/linter/linter.rb', line 49 def display_report @report.display_report end |
#fail_check ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/linter/linter.rb', line 41 def fail_check if @report.has_a_test_failed || @report.has_a_file_failed_to_load true else false end end |
#run_tests ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/linter/linter.rb', line 32 def run_tests config_report = @config_linter.run_config_tests globals_report = @globals_linter.run_globals_tests service_linter = @services_linter.run_services_tests @report.add_report(config_report) @report.add_report(globals_report) @report.add_report(service_linter) end |