Class: Danger::DangerShellcheck
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerShellcheck
- Defined in:
- lib/shellcheck/plugin.rb
Overview
Shows the warnings and suggestions for shell scripts generated from ShellCheck. You need [ShellCheck](github.com/koalaman/shellcheck) installed and generating a json file to use this plugin.
Instance Attribute Summary collapse
-
#project_root ⇒ String
The project root, which will be used to make the paths relative.
-
#sticky_summary ⇒ Boolean
Defines if the test summary will be sticky or not Defaults to ‘false’.
Instance Method Summary collapse
-
#report(file_path) ⇒ void
Reads a file with JSON ShellCheck summary and reports it.
Instance Attribute Details
#project_root ⇒ String
The project root, which will be used to make the paths relative. Defaults to ‘pwd’.
20 21 22 |
# File 'lib/shellcheck/plugin.rb', line 20 def project_root @project_root end |
#sticky_summary ⇒ Boolean
Defines if the test summary will be sticky or not Defaults to ‘false’
25 26 27 |
# File 'lib/shellcheck/plugin.rb', line 25 def sticky_summary @sticky_summary end |
Instance Method Details
#report(file_path) ⇒ void
This method returns an undefined value.
Reads a file with JSON ShellCheck summary and reports it.
41 42 43 44 45 |
# File 'lib/shellcheck/plugin.rb', line 41 def report(file_path) raise 'ShellCheck summary file not found' unless File.file?(file_path) shellcheck_summary = JSON.parse(File.read(file_path), symbolize_names: true) run_summary(shellcheck_summary) end |