Class: Lois::CLI
- Inherits:
-
Thor
- Object
- Thor
- Lois::CLI
- Defined in:
- lib/lois/cli.rb
Instance Method Summary collapse
- #brakeman ⇒ Object
- #bundler_audit ⇒ Object
- #i18n_tasks ⇒ Object
- #reek ⇒ Object
- #rubocop ⇒ Object
- #simplecov ⇒ Object
Instance Method Details
#brakeman ⇒ Object
109 110 111 112 113 114 115 116 117 |
# File 'lib/lois/cli.rb', line 109 def brakeman puts 'Checking brakeman' configure() if system('brakeman -o lois/brakeman.html -o /dev/stdout') Lois.config.github.success('brakeman', 'No rails vulnerabilities found.') else Lois.config.github.failure('brakeman', 'Rails vulnerabilities found.') end end |
#bundler_audit ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/lois/cli.rb', line 60 def bundler_audit puts 'Checking bundler-audit' configure() ignore = " --ignore #{[:ignore]}" command = 'bundle-audit check --verbose --update' command += ignore if [:ignore] output = `#{command}` result = $CHILD_STATUS File.write('lois/bundler-audit.log', output) puts output if result.success? Lois.config.github.success('bundler-audit', 'No gem vulnerabilities found.') else Lois.config.github.failure('bundler-audit', 'Gem vulnerabilities detected!') end end |
#i18n_tasks ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lois/cli.rb', line 18 def i18n_tasks puts 'Checking i18n-tasks' configure() locale_param = (" -l #{[:locale]}" if [:locale].to_s.length.positive?) if system("i18n-tasks health#{locale_param}") Lois.config.github.success('i18n-tasks', 'The translation files are healthy.') else Lois.config.github.failure('i18n-tasks', 'The translation files are not healthy') end end |
#reek ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/lois/cli.rb', line 88 def reek puts 'Checking reek' configure() system('reek -f html > lois/reek.html') if system('reek -n --sort-by smelliness') Lois.config.github.success('reek', 'No code smells.') else Lois.config.github.failure('reek', 'Code smells found.') end end |
#rubocop ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/lois/cli.rb', line 38 def rubocop puts 'Checking Rubocop' configure() if system('rubocop -f html -o lois/rubocop.html -f p') Lois.config.github.success('rubocop', 'Rubocop passed') else Lois.config.github.failure('rubocop', 'Rubocop failed') end end |
#simplecov ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/lois/cli.rb', line 134 def simplecov puts 'Checking simplecov' configure() actual = [:actual].to_f actual_formatted = format('%.2f%%', actual) if actual >= [:minimum].to_f Lois.config.github.success('simplecov', "#{actual_formatted} coverage.") else Lois.config.github.failure('simplecov', "#{actual_formatted} is too low.") end end |