netsoft-danger 0.3.9 → 0.4.3

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: ca4dcd0963df60b652e45e3bba8ef8262b350e52c0f659b5ec6660cf6f107ffa
4
- data.tar.gz: 351f00d2d1f090c7a97e4385adc5c40af0284055b9d5a7676bdb1aec2bc99588
3
+ metadata.gz: e6d63752b34b78d9c1c5f2527140833504efec1a06f2b1d28addfb24f2e403b6
4
+ data.tar.gz: 329482a85420c77b166e255ef01e8fe080c40acdfe00d8e86c86b3b1af80aeb0
5
5
  SHA512:
6
- metadata.gz: 6a29a7f5ffc53604bbbde1214b6ff006b7ead9d38cfee18fc843b2f5d8df467e1c77ed8e914895bc0e0a7e0eebb85808f5d5b5f1a23500c850c9738723ec5b4c
7
- data.tar.gz: c7ceb9f06a2815b36ae58e540197aaa7866daa3168c741dcc4ea862eb52b3496612593e9c5ff3e7ea1791be89dc99cac995d66f1f401c4243bdcf30f27e48300
6
+ metadata.gz: 1a4ffb45c808ad945619ddae8d5805e02066fbc1006d3bf31ba23581312840819f4868f2fcbb2bf7557c68954005299a6d496e5ddf106329b0c8a3afe51aaa16
7
+ data.tar.gz: 3908944e5a0f1c246b83caaf40c73db44a1b9672b191cb022d59c34fff7f8b2e913f14c2abaf12942bf75065bb68e78f74cad86c896cce397fe590f6f284808e
data/.circleci/config.yml CHANGED
@@ -3,11 +3,11 @@ version: 2
3
3
  defaults: &defaults
4
4
  docker: &ruby_image
5
5
  - &ruby_image
6
- image: circleci/ruby:2.4.4-stretch
6
+ image: circleci/ruby:2.5.5-stretch
7
7
  environment:
8
8
  RUBYOPT: '-KU -E utf-8:utf-8'
9
9
  BUNDLE_PATH: vendor/bundle
10
- BUNDLE_VERSION: 1.15.2
10
+ BUNDLE_VERSION: 1.17.3
11
11
  BUNDLE_JOBS: 4
12
12
  BUNDLE_RETRY: 3
13
13
 
@@ -82,7 +82,7 @@ jobs:
82
82
 
83
83
  - restore_cache:
84
84
  keys:
85
- - netsoft-danger-bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "netsoft-danger.gemspec" }}
85
+ - netsoft-danger-bundle-v3-{{ checksum "Gemfile" }}-{{ checksum "netsoft-danger.gemspec" }}
86
86
  - run:
87
87
  name: Install bundler
88
88
  command: gem install bundler --version=$BUNDLE_VERSION
@@ -91,7 +91,7 @@ jobs:
91
91
  command: |-
92
92
  bundle _${BUNDLE_VERSION}_ check || bundle _${BUNDLE_VERSION}_ install --retry=$BUNDLE_RETRY
93
93
  - save_cache:
94
- key: netsoft-danger-bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "netsoft-danger.gemspec" }}
94
+ key: netsoft-danger-bundle-v3-{{ checksum "Gemfile" }}-{{ checksum "netsoft-danger.gemspec" }}
95
95
  paths:
96
96
  - vendor/bundle
97
97
  - Gemfile.lock
@@ -0,0 +1,25 @@
1
+ ## Change description
2
+
3
+ > Please include a summary of the change and which issue is fixed. Please also include
4
+ relevant motivation and context. List any dependencies that are required for this change.
5
+
6
+ ## Related issues
7
+
8
+ - Source: <Issue link or Spec Link>
9
+ - UAT: <UAT Link>
10
+ - QA: <QA Task Link here>
11
+ - Review app: <Link to Heroku>
12
+
13
+ ## Checklists
14
+
15
+ ### Development
16
+
17
+ - [ ] The commit message follows our guidelines
18
+ - [ ] I have performed a self-review of my own code
19
+ - [ ] I have thoroughly tested the changes
20
+ - [ ] I have added tests that prove my fix is effective or that my feature works
21
+
22
+ ### Security
23
+
24
+ - [ ] Security impact of change has been considered
25
+
data/.rubocop.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  inherit_gem:
2
2
  netsoft-rubocop:
3
- - default.yml
3
+ - config/default.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.4
4
7
 
5
8
  Style/SignalException:
6
9
  Exclude:
@@ -10,6 +13,19 @@ Style/IfUnlessModifier:
10
13
  Exclude:
11
14
  - Dangerfile
12
15
 
16
+ Style/SoleNestedConditional:
17
+ Exclude:
18
+ - Dangerfile
19
+
13
20
  Layout/EmptyLineAfterGuardClause:
14
21
  Exclude:
15
- - Dangerfile
22
+ - Dangerfile
23
+
24
+ Layout/LineLength:
25
+ Exclude:
26
+ - Dangerfile
27
+
28
+ Performance/StringInclude:
29
+ Exclude:
30
+ - Dangerfile
31
+
data/CHANGELOG.md CHANGED
@@ -9,6 +9,27 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
  ### Changed
10
10
  ### Fixed
11
11
 
12
+ ## [0.4.3]
13
+ ### Added
14
+ - add brakeman artifact extraction
15
+ ### Changed
16
+ - updated netsoft-rubocop and rubocop config
17
+ - remove old commit message style from checks
18
+ - update PR template
19
+
20
+ ## [0.4.2]
21
+ ### Fixed
22
+ - restrict simplecov version
23
+
24
+ ## [0.4.1]
25
+ ### Changed
26
+ - exclude binary files in the grep calls
27
+ - make PR base ~= master a hard error
28
+
29
+ ## [0.4.0]
30
+ ### Fixed
31
+ - correct simplecov merge on newer simplecov release
32
+
12
33
  ## [0.3.9]
13
34
  ### Fixed
14
35
  - correct API call to github for adding labels and fix logic in determining if we should or should not add the label
data/Dangerfile CHANGED
@@ -4,7 +4,7 @@ def toggle_label(github, label, should_set)
4
4
  repo_name = github.pr_json['head']['repo']['full_name']
5
5
  pr_number = github.pr_json['number']
6
6
  has_label = github.pr_labels.include?(label)
7
- puts repo_name: repo_name, pr_number: pr_number, labels: github.pr_labels, has_label: has_label, label: label, should_set: should_set
7
+
8
8
  if should_set && !has_label
9
9
  github.api.add_labels_to_an_issue(repo_name, pr_number, [label])
10
10
  elsif !should_set && has_label
@@ -14,11 +14,11 @@ end
14
14
 
15
15
  # Don't let testing shortcuts get into master by accident
16
16
  if Dir.exist?('spec')
17
- fail('fdescribe left in tests') if `grep -r -e '\\bfdescribe\\b' spec/ |grep -v 'danger ok' `.length > 1
18
- fail('fcontext left in tests') if `grep -r -e '\\bfcontext\\b' spec/ |grep -v 'danger ok' `.length > 1
19
- fail('fit left in tests') if `grep -r -e '\\bfit\\b' spec/ | grep -v 'danger ok' `.length > 1
20
- fail('ap left in tests') if `grep -r -e '\\bap\\b' spec/ | grep -v 'danger ok' `.length > 1
21
- fail('puts left in tests') if `grep -r -e '\\bputs\\b' spec/ | grep -v 'danger ok' `.length > 1
17
+ fail('fdescribe left in tests') if `grep -r -I -e '\\bfdescribe\\b' spec/ |grep -v 'danger ok' `.length > 1
18
+ fail('fcontext left in tests') if `grep -r -I -e '\\bfcontext\\b' spec/ |grep -v 'danger ok' `.length > 1
19
+ fail('fit left in tests') if `grep -r -I -e '\\bfit\\b' spec/ | grep -v 'danger ok' `.length > 1
20
+ fail('ap left in tests') if `grep -r -I -e '\\bap\\b' spec/ | grep -v 'danger ok' `.length > 1
21
+ fail('puts left in tests') if `grep -r -I -e '\\bputs\\b' spec/ | grep -v 'danger ok' `.length > 1
22
22
  end
23
23
 
24
24
  if File.exist?('Gemfile')
@@ -43,16 +43,12 @@ git.commits.each do |c|
43
43
  short = " ( #{c.sha[0..7]} )"
44
44
  has_migrations = c.diff_parent.any? { |f| f.path =~ %r{db/migrate/} }
45
45
  has_schema_changes = c.diff_parent.any? { |f| f.path =~ %r{db/schema\.rb} }
46
- old_migration_msg = c.message.start_with?('[migration]')
47
- has_migration_msg = old_migration_msg || c.message.match?(/\Amigration(\([A-Za-z]+\))?:/)
46
+ has_migration_msg = c.message.match?(/\Amigration(\([A-Za-z]+\))?:/)
48
47
  no_schema_ok = ENV['DANGER_NO_SCHEMA_OK'] || false
49
48
  if has_migrations || has_schema_changes
50
49
  unless has_migration_msg
51
50
  fail 'migration: Schema migration commits needs to be tagged with (migration). e.g. migration(Module): ' + short
52
51
  end
53
- if old_migration_msg
54
- warn 'migration: Please switch to the new conventional commit format.'
55
- end
56
52
  if has_migrations && !has_schema_changes && !no_schema_ok
57
53
  fail 'migration: Please checkin your schema.rb changes with your migration' + short
58
54
  end
@@ -76,15 +72,11 @@ git.commits.each do |c|
76
72
  end
77
73
 
78
74
  has_gemfile_changes = c.diff_parent.any? { |f| f.path =~ /Gemfile|gemspec/ }
79
- old_gemfile_msg = c.message.start_with?('[gemfile]')
80
- has_gemfile_msg = old_gemfile_msg || c.message.match?(/\Agemfile(\([A-Za-z]+\))?:/)
75
+ has_gemfile_msg = c.message.match?(/\Agemfile(\([A-Za-z]+\))?:/)
81
76
  if has_gemfile_changes
82
77
  unless has_gemfile_msg
83
78
  fail 'gemfile: Gemfile commits needs to be tagged with (gemfile). e.g. gemfile(Module): ' + short
84
79
  end
85
- if old_migration_msg
86
- warn 'gemfile: Please switch to the new conventional commit format.'
87
- end
88
80
  if c.diff_parent.any? { |f| f.path !~ /Gemfile|gemspec/ }
89
81
  fail 'gemfile: Gemfile commit contains non-gemfile changes' + short
90
82
  end
@@ -98,15 +90,11 @@ git.commits.each do |c|
98
90
  end
99
91
 
100
92
  has_package_changes = c.diff_parent.any? { |f| f.path =~ /package\.json|yarn\.lock/ }
101
- old_package_msg = c.message.start_with?('[package.json]')
102
- has_package_msg = old_package_msg || c.message.match?(/\Apackage(\([A-Za-z]+\))?:/)
93
+ has_package_msg = c.message.match?(/\Apackage(\([A-Za-z]+\))?:/)
103
94
  if has_package_changes
104
95
  unless has_package_msg
105
96
  fail 'package: Package.json commits needs to be tagged with package. e.g package(Module): ' + short
106
97
  end
107
- if old_package_msg
108
- warn 'package: Please switch to the new conventional commit format.'
109
- end
110
98
  if c.diff_parent.any? { |f| f.path !~ /package\.json|yarn\.lock/ }
111
99
  fail 'package: Package.json commit contains non-package changes' + short
112
100
  end
@@ -127,6 +115,7 @@ if ENV['CIRCLE_TOKEN']
127
115
  coverage = artifacts.find { |artifact| artifact.end_with?('coverage/index.html') }
128
116
  rubocop = artifacts.find { |artifact| artifact.end_with?('rubocop/report.html') }
129
117
  eslint = artifacts.find { |artifact| artifact.end_with?('eslint/report.html') }
118
+ brakeman = artifacts.find { |artifact| artifact.end_with?('brakeman/report.html') }
130
119
  rspec_files = artifacts.select { |artifact| artifact =~ /rspec-(.+)\.html$/ }
131
120
 
132
121
  {}.tap do |hash|
@@ -135,6 +124,7 @@ if ENV['CIRCLE_TOKEN']
135
124
  hash['RuboCop inspection report'] = rubocop if rubocop
136
125
  hash['ESLint inspection report'] = eslint if eslint
137
126
  hash['Jest coverage report'] = jest if jest
127
+ hash['Brakeman issues report'] = brakeman if brakeman
138
128
  end.each do |msg, links|
139
129
  links = [*links]
140
130
  if links.size == 1
data/bin/netsoft-circle CHANGED
@@ -34,7 +34,9 @@ class NetsoftCircle < Thor # :nodoc:
34
34
  end
35
35
 
36
36
  desc 'merge', 'Merges several simplecov json result files'
37
- option :output, type: :string, aliases: '-o', desc: 'Specify an alternate output directory for the produced coverage data'
37
+ option :output, type: :string, aliases: '-o',
38
+ desc: 'Specify an alternate output directory for the produced coverage data'
39
+
38
40
  def merge(*files)
39
41
  require 'simplecov'
40
42
  return if files.empty?
@@ -45,7 +47,7 @@ class NetsoftCircle < Thor # :nodoc:
45
47
  json = JSON.parse(File.read(file))
46
48
  json.each do |command_name, data|
47
49
  result = SimpleCov::Result.from_hash(command_name => data)
48
- results << result
50
+ results.concat [*result]
49
51
  end
50
52
  end
51
53
 
@@ -81,6 +83,15 @@ class NetsoftCircle < Thor # :nodoc:
81
83
  exit(1) unless $CHILD_STATUS.success?
82
84
  end
83
85
 
86
+ desc 'brakeman', 'Run brakeman'
87
+ def brakeman
88
+ system <<~COMMAND
89
+ bundle _${BUNDLE_VERSION}_ exec brakeman \
90
+ -o $CIRCLE_ARTIFACTS/brakeman/report.html
91
+ COMMAND
92
+ exit(1) unless $CHILD_STATUS.success?
93
+ end
94
+
84
95
  def self.exit_on_failure?
85
96
  true
86
97
  end
data/dangerfiles/pr.js CHANGED
@@ -28,7 +28,7 @@ if (!labels.includes('QA passed')) {
28
28
  }
29
29
 
30
30
  if (!danger.github.pr.base.ref.includes('master')) {
31
- warn("PR base is not set to master!");
31
+ fail("PR base is not set to master!");
32
32
  }
33
33
 
34
34
  // Warn when there is a big PR
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NetsoftDanger
4
- VERSION = '0.3.9'
4
+ VERSION = '0.4.3'
5
5
  end
@@ -16,15 +16,14 @@ Gem::Specification.new do |s|
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.require_paths = ['lib']
18
18
 
19
+ s.required_ruby_version = '>= 2.4'
20
+
19
21
  s.add_runtime_dependency 'danger', '~> 5.0'
20
22
  s.add_runtime_dependency 'faraday'
23
+ s.add_runtime_dependency 'simplecov', '~> 0.20.0'
21
24
  s.add_runtime_dependency 'thor'
22
25
 
23
26
  s.add_development_dependency 'rake'
24
27
 
25
- s.add_development_dependency 'netsoft-rubocop', '= 1.0.1'
26
- s.add_development_dependency 'rubocop', '= 0.74.0'
27
- s.add_development_dependency 'rubocop-performance', '= 1.5.2'
28
- s.add_development_dependency 'rubocop-rails', '= 2.4.2'
29
- s.add_development_dependency 'rubocop-rspec', '= 1.38.1'
28
+ s.add_development_dependency 'netsoft-rubocop', '= 1.1.2'
30
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netsoft-danger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - urkle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-02 00:00:00.000000000 Z
11
+ date: 2021-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger
@@ -39,27 +39,27 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: thor
42
+ name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.20.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.20.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- type: :development
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
@@ -67,75 +67,33 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: netsoft-rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: 1.0.1
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: 1.0.1
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: 0.74.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 0.74.0
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-performance
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 1.5.2
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 1.5.2
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-rails
70
+ name: rake
113
71
  requirement: !ruby/object:Gem::Requirement
114
72
  requirements:
115
- - - '='
73
+ - - ">="
116
74
  - !ruby/object:Gem::Version
117
- version: 2.4.2
75
+ version: '0'
118
76
  type: :development
119
77
  prerelease: false
120
78
  version_requirements: !ruby/object:Gem::Requirement
121
79
  requirements:
122
- - - '='
80
+ - - ">="
123
81
  - !ruby/object:Gem::Version
124
- version: 2.4.2
82
+ version: '0'
125
83
  - !ruby/object:Gem::Dependency
126
- name: rubocop-rspec
84
+ name: netsoft-rubocop
127
85
  requirement: !ruby/object:Gem::Requirement
128
86
  requirements:
129
87
  - - '='
130
88
  - !ruby/object:Gem::Version
131
- version: 1.38.1
89
+ version: 1.1.2
132
90
  type: :development
133
91
  prerelease: false
134
92
  version_requirements: !ruby/object:Gem::Requirement
135
93
  requirements:
136
94
  - - '='
137
95
  - !ruby/object:Gem::Version
138
- version: 1.38.1
96
+ version: 1.1.2
139
97
  description: Packages a Dangerfile to be used with Danger.
140
98
  email: []
141
99
  executables:
@@ -144,6 +102,7 @@ extensions: []
144
102
  extra_rdoc_files: []
145
103
  files:
146
104
  - ".circleci/config.yml"
105
+ - ".github/PULL_REQUEST_TEMPLATE.txt"
147
106
  - ".gitignore"
148
107
  - ".rubocop.yml"
149
108
  - CHANGELOG.md
@@ -172,15 +131,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
131
  requirements:
173
132
  - - ">="
174
133
  - !ruby/object:Gem::Version
175
- version: '0'
134
+ version: '2.4'
176
135
  required_rubygems_version: !ruby/object:Gem::Requirement
177
136
  requirements:
178
137
  - - ">="
179
138
  - !ruby/object:Gem::Version
180
139
  version: '0'
181
140
  requirements: []
182
- rubyforge_project:
183
- rubygems_version: 2.7.7
141
+ rubygems_version: 3.0.3
184
142
  signing_key:
185
143
  specification_version: 4
186
144
  summary: Danger.systems conventions for Netsoft projects.