11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/onceover/codequality/cli.rb', line 11
def self.command
@cmd ||= Cri::Command.define do
name 'codequality'
usage 'codequality [--no-syntax] [--no-lint] [--no-docs] [--html-docs] [--no-puppetfile]'
summary "Code Quality checking for onceover"
description " Check files in your Control Repository for Lint and Syntax errors\n DESCRIPTION\n\n flag nil, :no_lint, 'Do not check for lint errors', :argument => :optional\n flag nil, :no_puppetfile, 'Do not check Puppetfile for syntax errors', :argument => :optional\n flag nil, :no_syntax, 'Do not check for syntax errors', :argument => :optional\n flag nil, :no_docs, 'Do not generate documentation (puppet-strings) for local modules', :argument => :optional\n flag nil, :html_docs, 'Generate docs in HTML format instead of markdown', :argument => :optional\n\n run do |opts, args, cmd|\n no_lint = opts[:no_lint] || false\n no_syntax = opts[:no_syntax] || false\n no_docs = opts[:no_docs] || false\n no_puppetfile = opts[:no_puppetfile] || false\n html_docs = opts[:html_docs] || false\n status = true\n\n logger.info \"Running Code Quality tests\"\n\n if !no_puppetfile\n status &= Onceover::CodeQuality::Puppetfile.puppetfile\n end\n\n if !no_syntax\n status &= Onceover::CodeQuality::Syntax.puppet\n end\n\n if !no_lint\n status &= Onceover::CodeQuality::Lint.puppet\n end\n\n if !no_docs\n status &= Onceover::CodeQuality::Docs.puppet_strings(html_docs)\n end\n\n if status\n logger.info \"Code Quality tests PASSED, have a nice day\"\n else\n logger.error \"Code Quality tests FAILED, see previous error(s)\"\n exit 1\n end\n end\n end\nend\n"
|