onceover-codequality 0.6.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +1 -1
- data/lib/onceover/codequality/cli.rb +1 -0
- data/lib/onceover/codequality/docs.rb +14 -12
- data/lib/onceover/codequality/environment.rb +34 -0
- data/lib/onceover/codequality/lint.rb +4 -3
- data/lib/onceover/codequality/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c3c08709d8f2e00c4a2df14806c6a8c87d510543aa23aaa95351df5c27fdaf
|
4
|
+
data.tar.gz: b2b2c9023c49a39365be2266c7c74d43e53d35fc13a492153d8720cda54132ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f03f53e1f1a475f1e7f93fdb17cf06b979661c684a092ea805d75fa07e32ce31794293c5a6a866c352175f729c0e4ebebf218a198107c36d24ff9f26423c4416
|
7
|
+
data.tar.gz: dbf6f562d7de09b0134d41330a5db2a0d6a306c0c9b6b92e1d8ffe262e85a44259379111787a35ef58087982bcc1e8ab0d6b492e15ea53aeea9b953a28b94001
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,7 @@ require "onceover/codequality/lint"
|
|
2
2
|
require "onceover/codequality/syntax"
|
3
3
|
require "onceover/codequality/docs"
|
4
4
|
require "onceover/codequality/puppetfile"
|
5
|
+
require "onceover/codequality/environment"
|
5
6
|
require "onceover/codequality/executor"
|
6
7
|
require "onceover/codequality/formatter"
|
7
8
|
class Onceover
|
@@ -1,24 +1,26 @@
|
|
1
1
|
# Support for generating documentation using Puppet Strings for each module
|
2
|
-
# listed in the
|
2
|
+
# listed in the environment.conf modulepath
|
3
3
|
class Onceover
|
4
4
|
module CodeQuality
|
5
5
|
module Docs
|
6
|
-
LOCAL_MOD_DIR = "site"
|
7
6
|
|
8
7
|
def self.puppet_strings(html_docs)
|
9
8
|
status = true
|
10
9
|
format = html_docs ? "--markup html" : "--format markdown"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
|
11
|
+
CodeQuality::Environment.get_site_dirs.each { |local_mod_dir|
|
12
|
+
if Dir.exist?(local_mod_dir)
|
13
|
+
Dir.glob("#{local_mod_dir}/*/") { |dir|
|
14
|
+
Dir.chdir(dir) {
|
15
|
+
CodeQuality::Formatter.start_test("Generate documentation in #{dir}")
|
16
|
+
# puppet strings prints useful metrics so don't swallow its output
|
17
|
+
output, ok = CodeQuality::Executor.run("puppet strings generate #{format}")
|
18
|
+
status &= ok
|
19
|
+
CodeQuality::Formatter.end_test(output, ok, true)
|
20
|
+
}
|
19
21
|
}
|
20
|
-
|
21
|
-
|
22
|
+
end
|
23
|
+
}
|
22
24
|
|
23
25
|
status
|
24
26
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class Onceover
|
2
|
+
module CodeQuality
|
3
|
+
module Environment
|
4
|
+
|
5
|
+
ENVIRONMENT_CONF = "environment.conf"
|
6
|
+
|
7
|
+
# Latest best practice is to change the name of `site` to be
|
8
|
+
# `site-modules`. This means we need to start processing `environment.conf`
|
9
|
+
# to extract this...
|
10
|
+
def self.get_site_dirs()
|
11
|
+
if File.exist?(ENVIRONMENT_CONF)
|
12
|
+
#modulepath = site-modules:modules:$basemodulepath
|
13
|
+
modulepath = open(ENVIRONMENT_CONF) { |f| f.each_line.find { |line| line.include?("modulepath") } }
|
14
|
+
|
15
|
+
begin
|
16
|
+
environments = modulepath.split("=")[1].split(":").reject { |e|
|
17
|
+
# reject any elements containing interpolation or referencing modules
|
18
|
+
# loaded by r10k
|
19
|
+
e =~ /\$/ || e == "modules" || e =~ /[\\.\/]/
|
20
|
+
}.map {
|
21
|
+
|e| e.strip
|
22
|
+
}
|
23
|
+
rescue NoMethodError => e
|
24
|
+
raise "Malformed environment configuration: #{ENVIRONMENT_CONF}"
|
25
|
+
end
|
26
|
+
else
|
27
|
+
raise "Missing environment configuration: #{ENVIRONMENT_CONF}"
|
28
|
+
end
|
29
|
+
|
30
|
+
environments
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -26,11 +26,12 @@ class Onceover
|
|
26
26
|
|
27
27
|
# wait until runtime to scan directories for unit tests
|
28
28
|
lint_paths = LINT_PATHS.concat(
|
29
|
-
|
30
|
-
|
29
|
+
CodeQuality::Environment.get_site_dirs.each { |site_dir|
|
30
|
+
Dir.glob("#{site_dir}/*").select { |f| File.directory? f}
|
31
|
+
}
|
31
32
|
)
|
32
33
|
lint_paths.each { |p|
|
33
|
-
if Dir.
|
34
|
+
if Dir.exist?(p)
|
34
35
|
CodeQuality::Formatter.start_test("lint in #{p}")
|
35
36
|
output, ok = CodeQuality::Executor.run("puppet-lint #{LINT_OPTIONS.join ' '} #{p}")
|
36
37
|
status &= ok
|
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.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Declarative Systems
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/onceover/codequality.rb
|
129
129
|
- lib/onceover/codequality/cli.rb
|
130
130
|
- lib/onceover/codequality/docs.rb
|
131
|
+
- lib/onceover/codequality/environment.rb
|
131
132
|
- lib/onceover/codequality/executor.rb
|
132
133
|
- lib/onceover/codequality/formatter.rb
|
133
134
|
- lib/onceover/codequality/lint.rb
|