onceover-codequality 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0fd0fa7b9afbcebd806a148ee5f9550f7d0fb240
4
- data.tar.gz: 1751c2747cd62a34dc3e49f253eaa2ac14e49929
2
+ SHA256:
3
+ metadata.gz: 05b4b045d5c1f2c0629b1491cbb69b297e0cf81febbc48e9ea0f0a3257f94ca5
4
+ data.tar.gz: d185ea9bdb68f25b039c0fa075029af670e74b53269d44618b14bdca75e60b54
5
5
  SHA512:
6
- metadata.gz: 829ea5f9e914b9a4527c975ec9db4832f60c91eb8c6f7ccc9afd7a73de46032c40afc7f40599bc6fd35712c7f95415e4dabb9659c65ea786c270d1784f7ba95f
7
- data.tar.gz: 39cec48a3ff533236403f183badcaccedae5c6c20ad6229685177d998607291e4daca7c7d893ea2b9b66fe4036337485fb121058176d597bcb26c34d30e5aa5d
6
+ metadata.gz: ffca9f5955db6be466d3d62400c07123bf00c07f05685263abd3f269604f872ab83907a22dac60f87a0c24f12ccfb6ff9571d83d7b60f2e5295a095b1c891390
7
+ data.tar.gz: d282f5b85bb63312bd89747f3c1c64a317830405b368c3faf44057f18c137d01ba3c7bbce444db34dc56051942eb160e239d71b784f6f7ad284a5ee145ed2d5c
data/README.md CHANGED
@@ -39,12 +39,18 @@ $ onceover run codequality
39
39
  $onceover run codequality --no_lint
40
40
  ```
41
41
 
42
- **Skip syntax check**
42
+ **Skip Puppet syntax check**
43
43
 
44
44
  ```shell
45
45
  $ onceover run codequality --no_syntax
46
46
  ```
47
47
 
48
+ **Skip Puppetfile syntax check**
49
+
50
+ ```shell
51
+ $ onceover run codequality --no_puppetfile
52
+ ```
53
+
48
54
  **Skip documentation generation**
49
55
 
50
56
  ```shell
@@ -114,15 +120,7 @@ $ bundle exec onceover run codequality
114
120
  * [puppet-lint](https://github.com/rodjek/puppet-lint)
115
121
  * [puppet-syntax](https://github.com/voxpupuli/puppet-syntax)
116
122
  * [puppet-strings](https://github.com/puppetlabs/puppet-strings/)
117
-
118
-
119
- **My docs change a ton of files every time I run?**
120
- This is because the timestamp is embedded inside the generated docs by default. This is fixed in the master branch of Puppet Strings which has not been released as a gem yet. You can reference the fixed version in your control repository Gemfile, like this:
121
-
122
- ```ruby
123
- gem 'puppet-strings',
124
- :git => 'https://github.com/puppetlabs/puppet-strings'
125
- ```
123
+ * [r10k](https://github.com/puppetlabs/r10k/)
126
124
 
127
125
  ## Development
128
126
 
@@ -1,6 +1,7 @@
1
1
  require "onceover/codequality/lint"
2
2
  require "onceover/codequality/syntax"
3
3
  require "onceover/codequality/docs"
4
+ require "onceover/codequality/puppetfile"
4
5
  class Onceover
5
6
  module CodeQuality
6
7
  class CLI
@@ -8,20 +9,24 @@ class Onceover
8
9
  def self.command
9
10
  @cmd ||= Cri::Command.define do
10
11
  name 'codequality'
11
- usage 'codequality [--no-syntax] [--no-lint] [--no-docs]'
12
+ usage 'codequality [--no-syntax] [--no-lint] [--no-docs] [--html-docs] [--no-puppetfile]'
12
13
  summary "Code Quality checking for onceover"
13
14
  description <<-DESCRIPTION
14
- Check files in your Control Repository for Lint and Syntax errors
15
+ Check files in your Control Repository for Lint and Syntax errors
15
16
  DESCRIPTION
16
17
 
17
- option :l, :no_lint, 'Do not check for lint errors', :argument => :optional
18
- option :x, :no_syntax, 'Do not check for syntax errors', :argument => :optional
19
- option :d, :no_docs, 'Do not generate documentation (puppet-strings) for local modules', :argument => :optional
18
+ option :no_lint, 'Do not check for lint errors', :argument => :optional
19
+ option :no_puppetfile, 'Do not check Puppetfile for syntax errors', :argument => :optional
20
+ option :no_syntax, 'Do not check for syntax errors', :argument => :optional
21
+ option :no_docs, 'Do not generate documentation (puppet-strings) for local modules', :argument => :optional
22
+ option :html_docs, 'Generate docs in HTML format instead of markdown', :argument => :optional
20
23
 
21
24
  run do |opts, args, cmd|
22
25
  no_lint = opts[:no_lint] || false
23
26
  no_syntax = opts[:no_syntax] || false
24
27
  no_docs = opts[:no_docs] || false
28
+ no_puppetfile = opts[:no_puppetfile] || false
29
+ html_docs = opts[:html_docs] || false
25
30
  status = true
26
31
  if ! no_lint
27
32
  logger.info "Checking for lint..."
@@ -31,6 +36,14 @@ Check files in your Control Repository for Lint and Syntax errors
31
36
  end
32
37
  end
33
38
 
39
+ if ! no_puppetfile
40
+ logger.info "Checking Puppetfile"
41
+ if ! Onceover::CodeQuality::Puppetfile.puppetfile
42
+ status = false
43
+ logger.error "puppetfile syntax failed, see previous errors"
44
+ end
45
+ end
46
+
34
47
  if ! no_syntax
35
48
  logger.info "Checking syntax..."
36
49
  if ! Onceover::CodeQuality::Syntax.puppet
@@ -41,7 +54,7 @@ Check files in your Control Repository for Lint and Syntax errors
41
54
 
42
55
  if ! no_docs
43
56
  logger.info "Generating documentation..."
44
- if ! Onceover::CodeQuality::Docs.puppet_strings
57
+ if ! Onceover::CodeQuality::Docs.puppet_strings(html_docs)
45
58
  status = false
46
59
  logger.error "Documentation generation failed, see previous errors"
47
60
  end
@@ -5,12 +5,13 @@ class Onceover
5
5
  module Docs
6
6
  LOCAL_MOD_DIR = "site"
7
7
 
8
- def self.puppet_strings
8
+ def self.puppet_strings(html_docs)
9
9
  status = true
10
+ format = html_docs ? "html" : "markdown"
10
11
  if Dir.exist?(LOCAL_MOD_DIR)
11
12
  Dir.glob("#{LOCAL_MOD_DIR}/*/") { |dir|
12
13
  Dir.chdir(dir) {
13
- status &= system("puppet strings")
14
+ status &= system("puppet strings generate --format #{format}")
14
15
  }
15
16
  }
16
17
  end
@@ -0,0 +1,21 @@
1
+ # Support for checking syntax of Puppetfile
2
+ class Onceover
3
+ module CodeQuality
4
+ module Puppetfile
5
+
6
+ def self.puppetfile
7
+ if File.exists? "Puppetfile"
8
+ status = system("bundle exec r10k puppetfile check")
9
+ else
10
+ puts "No Puppetfile found!"
11
+ status = false
12
+ end
13
+
14
+ status
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+
21
+
@@ -1,5 +1,5 @@
1
1
  class Onceover
2
2
  module CodeQuality
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency 'onceover', '~> 3'
28
28
  spec.add_runtime_dependency 'puppet-syntax', '~> 2'
29
29
  spec.add_runtime_dependency 'puppet-lint', '~> 2'
30
- spec.add_runtime_dependency 'puppet-strings', '~> 1'
30
+ spec.add_runtime_dependency 'puppet-strings', '~> 2'
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onceover-codequality
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Declarative Systems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-22 00:00:00.000000000 Z
11
+ date: 2018-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1'
103
+ version: '2'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1'
110
+ version: '2'
111
111
  description:
112
112
  email:
113
113
  - sales@declarativesystems.com
@@ -128,6 +128,7 @@ files:
128
128
  - lib/onceover/codequality/cli.rb
129
129
  - lib/onceover/codequality/docs.rb
130
130
  - lib/onceover/codequality/lint.rb
131
+ - lib/onceover/codequality/puppetfile.rb
131
132
  - lib/onceover/codequality/syntax.rb
132
133
  - lib/onceover/codequality/version.rb
133
134
  - onceover-codequality.gemspec
@@ -151,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  version: '0'
152
153
  requirements: []
153
154
  rubyforge_project:
154
- rubygems_version: 2.5.2
155
+ rubygems_version: 2.7.6
155
156
  signing_key:
156
157
  specification_version: 4
157
158
  summary: Lint and syntax validation for onceover