codemonitor 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32f7be0ad2a196ea1dd1e420c56b9a2b1c87c2b7e0381f6e968fd1df706f86c0
4
- data.tar.gz: 5a88b2dec7531acc15f99085ee4f456ee18a0e535cec5f242feaabc718974c96
3
+ metadata.gz: 67bdedaed6063ea891d58825204d5dd31d60498325ee9b4b217d5981947282d7
4
+ data.tar.gz: 2cdf8289ed5be0af4dfbd1acbb0d7d6d77964b81427ae22edf3f4aff1b081d19
5
5
  SHA512:
6
- metadata.gz: d34229aa5e21856c951a9b707f5269cdffbe4c4c1839b741fdddadf672829e3c94a83a08075f3abeff2e414f33eaedbebdbb42a36ab3abfecd5d7165abc54657
7
- data.tar.gz: d6a0d476275b4738887fa4acf83948fac95700142fb3fbe0092a54dd778ee5da4182d7b8cba4f781678d4ae85d8fe34fa106dbe7c4db598f8b4baf9c3595f102
6
+ metadata.gz: 8fc80f0a516df374fa081ead8d3de1d3a9a58cd320b36ad867e106aa13c123fb9aed0bafa07f9958df4ce1a3a7c78c6451c49cd56fe9dcb225e1635eb61c5c86
7
+ data.tar.gz: 6bc644578c63a242697bea5d17949c610e2ca1b3d1ccda0fcf62999cd3dd77f6d15b44f4dc1dce0cbcd07620dde3bf49e3032f390bb47b91031291017f04b19b
data/Gemfile.lock CHANGED
@@ -1,25 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codemonitor (0.3.0)
4
+ codemonitor (0.4.0)
5
5
  dogapi (~> 1.45)
6
+ octokit (~> 4.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
11
+ addressable (2.8.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
10
13
  ast (2.4.2)
11
14
  coderay (1.1.3)
12
15
  diff-lcs (1.3)
13
16
  dogapi (1.45.0)
14
17
  multi_json
18
+ faraday (1.9.3)
19
+ faraday-em_http (~> 1.0)
20
+ faraday-em_synchrony (~> 1.0)
21
+ faraday-excon (~> 1.1)
22
+ faraday-httpclient (~> 1.0)
23
+ faraday-multipart (~> 1.0)
24
+ faraday-net_http (~> 1.0)
25
+ faraday-net_http_persistent (~> 1.0)
26
+ faraday-patron (~> 1.0)
27
+ faraday-rack (~> 1.0)
28
+ faraday-retry (~> 1.0)
29
+ ruby2_keywords (>= 0.0.4)
30
+ faraday-em_http (1.0.0)
31
+ faraday-em_synchrony (1.0.0)
32
+ faraday-excon (1.1.0)
33
+ faraday-httpclient (1.0.1)
34
+ faraday-multipart (1.0.3)
35
+ multipart-post (>= 1.2, < 3)
36
+ faraday-net_http (1.0.1)
37
+ faraday-net_http_persistent (1.2.0)
38
+ faraday-patron (1.0.0)
39
+ faraday-rack (1.0.0)
40
+ faraday-retry (1.0.3)
15
41
  method_source (1.0.0)
16
42
  multi_json (1.15.0)
43
+ multipart-post (2.1.1)
44
+ octokit (4.22.0)
45
+ faraday (>= 0.9)
46
+ sawyer (~> 0.8.0, >= 0.5.3)
17
47
  parallel (1.20.1)
18
48
  parser (3.0.1.1)
19
49
  ast (~> 2.4.1)
20
50
  pry (0.13.1)
21
51
  coderay (~> 1.1)
22
52
  method_source (~> 1.0)
53
+ public_suffix (4.0.6)
23
54
  rainbow (3.0.0)
24
55
  rake (13.0.3)
25
56
  regexp_parser (2.1.1)
@@ -49,6 +80,10 @@ GEM
49
80
  rubocop-ast (1.5.0)
50
81
  parser (>= 3.0.1.1)
51
82
  ruby-progressbar (1.11.0)
83
+ ruby2_keywords (0.0.5)
84
+ sawyer (0.8.2)
85
+ addressable (>= 2.3.5)
86
+ faraday (> 0.8, < 2.0)
52
87
  unicode-display_width (1.7.0)
53
88
 
54
89
  PLATFORMS
@@ -4,17 +4,15 @@ module Engines
4
4
  module Custom
5
5
  class Extractor
6
6
  def call(provider)
7
- return unless requirements?
8
-
9
7
  provider.emit(metrics)
10
8
  end
11
9
 
12
- private
13
-
14
10
  def requirements?
15
11
  custom_files.length.positive?
16
12
  end
17
13
 
14
+ private
15
+
18
16
  def custom_files
19
17
  Dir.glob('./.codemonitor/*.rb')
20
18
  end
@@ -8,8 +8,6 @@ module Engines
8
8
  ].freeze
9
9
 
10
10
  def call(provider)
11
- return unless requirements?
12
-
13
11
  metrics = METRICS.map do |metric|
14
12
  [metric, send(metric) || 0]
15
13
  end.to_h
@@ -17,12 +15,12 @@ module Engines
17
15
  provider.emit(metrics)
18
16
  end
19
17
 
20
- private
21
-
22
18
  def requirements?
23
19
  true
24
20
  end
25
21
 
22
+ private
23
+
26
24
  def debug_random
27
25
  rand(0..100)
28
26
  end
@@ -16,8 +16,6 @@ module Engines
16
16
  end
17
17
 
18
18
  def call(provider)
19
- return unless requirements?
20
-
21
19
  metrics = METRICS.map do |metric|
22
20
  [metric, send(metric)]
23
21
  end.to_h
@@ -29,16 +27,14 @@ module Engines
29
27
  provider.emit(metrics)
30
28
  end
31
29
 
30
+ def requirements?
31
+ File.exist?('eslint.output.json')
32
+ end
33
+
32
34
  private
33
35
 
34
36
  attr_reader :threshold
35
37
 
36
- def requirements?
37
- # FIXME: Review if this is the only check we can do or there are more.
38
- File.exist?('.eslintrc.js')
39
- end
40
-
41
- # NOTE: This output file must be created by an external command
42
38
  def eslint
43
39
  @eslint ||= JSON.parse(File.read('eslint.output.json'))
44
40
  end
@@ -20,8 +20,6 @@ module Engines
20
20
  end
21
21
 
22
22
  def call(provider)
23
- return unless requirements?
24
-
25
23
  metrics = METRICS.map do |metric|
26
24
  [metric, send(metric)]
27
25
  end.to_h
@@ -32,14 +30,14 @@ module Engines
32
30
  provider.emit(metrics)
33
31
  end
34
32
 
35
- private
36
-
37
- attr_reader :threshold
38
-
39
33
  def requirements?
40
34
  File.exist?('.git')
41
35
  end
42
36
 
37
+ private
38
+
39
+ attr_reader :threshold
40
+
43
41
  def git_number_of_commits
44
42
  Shell.run("git log --format='%h'").lines.count
45
43
  end
@@ -22,8 +22,6 @@ module Engines
22
22
  end
23
23
 
24
24
  def call(provider)
25
- return unless requirements?
26
-
27
25
  metrics = METRICS.map do |metric|
28
26
  [metric, send(metric)]
29
27
  end.to_h
@@ -31,6 +29,10 @@ module Engines
31
29
  provider.emit(metrics)
32
30
  end
33
31
 
32
+ def requirements?
33
+ !access_token.nil? && !repository.nil?
34
+ end
35
+
34
36
  private
35
37
 
36
38
  attr_reader :access_token, :repository, :since_days
@@ -39,10 +41,6 @@ module Engines
39
41
  @github ||= Octokit::Client.new(access_token: access_token)
40
42
  end
41
43
 
42
- def requirements?
43
- !access_token.nil? && !repository.nil?
44
- end
45
-
46
44
  def since
47
45
  (Date.today - since_days).to_time.iso8601
48
46
  end
@@ -18,8 +18,6 @@ module Engines
18
18
  ].freeze
19
19
 
20
20
  def call(provider)
21
- return unless requirements?
22
-
23
21
  metrics = METRICS.map do |metric|
24
22
  [metric, send(metric) || 0]
25
23
  end.to_h
@@ -27,12 +25,12 @@ module Engines
27
25
  provider.emit(metrics)
28
26
  end
29
27
 
30
- private
31
-
32
28
  def requirements?
33
29
  File.exist?('package.json')
34
30
  end
35
31
 
32
+ private
33
+
36
34
  def npm_number_of_dependencies
37
35
  npm_package['dependencies'].keys.length
38
36
  end
@@ -13,8 +13,6 @@ module Engines
13
13
  def initialize; end
14
14
 
15
15
  def call(provider)
16
- return unless requirements?
17
-
18
16
  metrics = METRICS.map do |metric|
19
17
  [metric, send(metric)]
20
18
  end.to_h
@@ -22,12 +20,12 @@ module Engines
22
20
  provider.emit(metrics)
23
21
  end
24
22
 
25
- private
26
-
27
23
  def requirements?
28
24
  packwerk_files.length.positive?
29
25
  end
30
26
 
27
+ private
28
+
31
29
  # NOTE: This output file must be created by an external command
32
30
  def packwerk_files
33
31
  Dir.glob('./**/deprecated_references.yml')
@@ -15,8 +15,6 @@ module Engines
15
15
  end
16
16
 
17
17
  def call(provider)
18
- return unless requirements?
19
-
20
18
  metrics = METRICS.map do |metric|
21
19
  [metric, send(metric)]
22
20
  end.to_h
@@ -28,15 +26,14 @@ module Engines
28
26
  provider.emit(metrics)
29
27
  end
30
28
 
29
+ def requirements?
30
+ File.exist?('rubocop.output.json')
31
+ end
32
+
31
33
  private
32
34
 
33
35
  attr_reader :threshold
34
36
 
35
- def requirements?
36
- File.exist?('.rubocop.yml')
37
- end
38
-
39
- # NOTE: This output file must be created by an external command
40
37
  def rubocop
41
38
  @rubocop ||= JSON.parse(File.read('rubocop.output.json'))
42
39
  end
@@ -11,8 +11,6 @@ module Engines
11
11
  def initialize; end
12
12
 
13
13
  def call(provider)
14
- return unless requirements?
15
-
16
14
  metrics = METRICS.map do |metric|
17
15
  [metric, send(metric)]
18
16
  end.to_h
@@ -24,13 +22,12 @@ module Engines
24
22
  provider.emit(metrics)
25
23
  end
26
24
 
27
- private
28
-
29
25
  def requirements?
30
26
  File.exist?('scc.output.json')
31
27
  end
32
28
 
33
- # NOTE: This output file must be created by an external command
29
+ private
30
+
34
31
  def scc
35
32
  @scc ||= JSON.parse(File.read('scc.output.json'))
36
33
  end
@@ -15,8 +15,6 @@ module Engines
15
15
  end
16
16
 
17
17
  def call(provider)
18
- return unless requirements?
19
-
20
18
  metrics = METRICS.map do |metric|
21
19
  [metric, send(metric)]
22
20
  end.to_h
@@ -26,15 +24,14 @@ module Engines
26
24
  provider.emit(metrics)
27
25
  end
28
26
 
27
+ def requirements?
28
+ File.exist?('semgrep.output.json')
29
+ end
30
+
29
31
  private
30
32
 
31
33
  attr_reader :threshold
32
34
 
33
- def requirements?
34
- File.exist?('.semgrep.yml')
35
- end
36
-
37
- # NOTE: This output file must be created by an external command
38
35
  def semgrep
39
36
  @semgrep ||= JSON.parse(File.read('semgrep.output.json'))
40
37
  end
@@ -24,8 +24,6 @@ module Engines
24
24
  def initialize; end
25
25
 
26
26
  def call(provider)
27
- return unless requirements?
28
-
29
27
  metrics = METRICS.map do |metric|
30
28
  [metric, send(metric)]
31
29
  end.to_h
@@ -33,13 +31,12 @@ module Engines
33
31
  provider.emit(metrics)
34
32
  end
35
33
 
36
- private
37
-
38
34
  def requirements?
39
35
  File.exist?('sorbet.output.json')
40
36
  end
41
37
 
42
- # NOTE: This output file must be created by an external command
38
+ private
39
+
43
40
  def sorbet
44
41
  @sorbet ||= JSON.parse(File.read('sorbet.output.json'))
45
42
  end
data/exe/codemonitor CHANGED
@@ -51,6 +51,8 @@ puts '# process start'
51
51
  extractors
52
52
  .map(&:new)
53
53
  .map do |extractor|
54
+ raise "Requirements not fullfiled in #{extractor.class.name}" unless extractor.requirements?
55
+
54
56
  extractor.call(provider)
55
57
  end
56
58
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CodeMonitor
4
- VERSION = '0.3.6'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codemonitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferran Basora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-29 00:00:00.000000000 Z
11
+ date: 2022-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dogapi