netsoft-danger 0.6.0 → 0.8.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: d2d0604e13a2bbd095af7c03da769e5687fb97401441c45bb54d3a6e682bad16
4
- data.tar.gz: 1a37871ed405e809abf23acf518b99042e3e49bc2f1684d6941bf37b7e801e85
3
+ metadata.gz: 249c46e51ad363cf9770f85e9484d545050b10725ce69929752ade88c85a2e13
4
+ data.tar.gz: 0f8e84701944f0c155d57fb0bb9ed42bf95d9df5a58037877b22a680f5a48f7e
5
5
  SHA512:
6
- metadata.gz: 9defe1928aaaa112b151d44f2bdacee0ac8b4821cf9b1e6b2ffd7d91b10dc889a9e1339705dad2d5c19bcafbc7ff5da30f07699e88c3f3d7a290a2d15acad9d5
7
- data.tar.gz: 85d7f668e2d38d708b11c2dde99c9b0608fcc1198506edb3065eed199d88fe0ad056667c3ffd30869e92db057631d05bd03d71e68b5dfcb345d8a7c5ded765b8
6
+ metadata.gz: e36882413a1186a6595044e3702b5bad2e6b700de4b3c38566b15b099cc5fe68de4a62106a4cbe2a99185a76391dc8ba90be5cea55a0a62d80a9a8a4a8c82227
7
+ data.tar.gz: fdc96629d3928b82f4772d58005e90f5f5c1aad47121b3c570a9437d3c223210039862a79d9f2ecd5308e29f3f9bce42182067d65d26fc06d6ca3854fc1e11f0
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
  - config/default.yml
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 2.4
6
+ TargetRubyVersion: 2.5
7
7
 
8
8
  Style/SignalException:
9
9
  Exclude:
data/CHANGELOG.md CHANGED
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
  ### Changed
10
10
  ### Fixed
11
11
 
12
+ ## [0.8.0]
13
+ ### Added
14
+ - added check for bundler version in Gemfile.lock
15
+ ### Changed
16
+ - updated to bundler 2.3.9 for CI runs
17
+ ### Fixed
18
+ - silence intermittent error when removing a label
19
+
20
+ ## [0.7.0]
21
+ ### Changed
22
+ - remove checks for migration and gemfile prefixes in commit messages
23
+
12
24
  ## [0.6.0]
13
25
  - remove the focus and print checks from the ruby danger (now handled by rubocop)
14
26
 
data/Dangerfile CHANGED
@@ -10,6 +10,8 @@ def toggle_label(github, label, should_set)
10
10
  elsif !should_set && has_label
11
11
  github.api.remove_label(repo_name, pr_number, label)
12
12
  end
13
+ rescue
14
+ # noop
13
15
  end
14
16
 
15
17
  if File.exist?('Gemfile')
@@ -24,114 +26,20 @@ if File.exist?('Gemfile')
24
26
  end
25
27
  end
26
28
 
29
+ if File.exist?('Gemfile.lock')
30
+ if `grep -e "^BUNDLED WITH$" -A 1 Gemfile.lock | grep ' ' | grep -v "\(2\.3\.9\)"`.length > 1
31
+ fail('gemfile.lock: Gemfile was not bundled with approved bundler version. Please use 2.3.9')
32
+ end
33
+ end
34
+
27
35
  if github.branch_for_head.start_with?('security')
28
36
  toggle_label(github, 'security', true)
29
37
  end
30
38
 
31
- should_have_migration_label = false
32
-
33
39
  git.commits.each do |c|
34
- short = " ( #{c.sha[0..7]} )"
35
- has_migrations = c.diff_parent.any? { |f| f.path =~ %r{db/migrate/} }
40
+ has_migrations = c.diff_parent.any? { |f| f.path =~ %r{db/migrate/} }
36
41
  has_schema_changes = c.diff_parent.any? { |f| f.path =~ %r{db/schema\.rb} }
37
- has_migration_msg = c.message.match?(/\Amigration(\([A-Za-z]+\))?:/)
38
- no_schema_ok = ENV['DANGER_NO_SCHEMA_OK'] || false
39
- if has_migrations || has_schema_changes
40
- unless has_migration_msg
41
- fail 'migration: Schema migration commits needs to be tagged with (migration). e.g. migration(Module): ' + short
42
- end
43
- if has_migrations && !has_schema_changes && !no_schema_ok
44
- fail 'migration: Please checkin your schema.rb changes with your migration' + short
45
- end
46
- if !has_migrations && has_schema_changes
47
- warn 'migration: Please checkin your migrations with your schema.rb changes' + short
48
- end
49
- if c.diff_parent.any? { |f| f.path !~ %r{db/migrate/|db/schema\.rb} }
50
- fail 'migration: Migration commit contains non-migration changes' + short
51
- end
52
-
53
- should_have_migration_label = true
54
- elsif has_migration_msg
55
- fail '[migration] Migration commit with no migrations!' + short
56
- end
57
-
58
- has_hubstaff_icon_changes = c.diff_parent.any? { |f| f.path =~ /hubstaff(icons|font)|fontcustom-manifest/ }
59
- if has_hubstaff_icon_changes
60
- if c.diff_parent.any? { |f| !(f.path =~ /hubstaff-(icons|font)/ || f.path =~ /fontcustom-manifest/) }
61
- fail 'hubstaff-icons: Put hubstaff-icon changes into their own commit' + short
62
- end
63
- end
64
-
65
- has_gemfile_changes = c.diff_parent.any? { |f| f.path =~ /Gemfile|gemspec/ }
66
- has_gemfile_msg = c.message.match?(/\Agemfile(\([A-Za-z]+\))?:/)
67
- if has_gemfile_changes
68
- unless has_gemfile_msg
69
- fail 'gemfile: Gemfile commits needs to be tagged with (gemfile). e.g. gemfile(Module): ' + short
70
- end
71
- if c.diff_parent.any? { |f| f.path !~ /Gemfile|gemspec/ }
72
- fail 'gemfile: Gemfile commit contains non-gemfile changes' + short
73
- end
74
- if c.diff_parent.any? { |f| f.path == 'Gemfile.lock' }
75
- unless `grep -E -- '^BUNDLED WITH\s*\n\s+(1\\.15\\.2|1\\.17\\.3)$' Gemfile.lock`.length > 1
76
- fail('gemfile: Gemfile not bundled with bundler 1.15.2 or 1.17.3')
77
- end
78
- end
79
- elsif has_gemfile_msg
80
- fail 'gemfile: Gemfile commit has no gemfile changes!' + short
81
- end
82
42
 
83
- has_package_changes = c.diff_parent.any? { |f| f.path =~ /package\.json|yarn\.lock/ }
84
- has_package_msg = c.message.match?(/\Apackage(\([A-Za-z]+\))?:/)
85
- if has_package_changes
86
- unless has_package_msg
87
- fail 'package: Package.json commits needs to be tagged with package. e.g package(Module): ' + short
88
- end
89
- if c.diff_parent.any? { |f| f.path !~ /package\.json|yarn\.lock/ }
90
- fail 'package: Package.json commit contains non-package changes' + short
91
- end
92
- elsif has_package_msg
93
- fail 'package: Pacakge.json commit has no package changes!' + short
94
- end
95
- end
96
-
97
- toggle_label(github, 'run migration', should_have_migration_label)
98
-
99
- if ENV['CIRCLE_TOKEN']
100
- require 'open-uri'
101
-
102
- artifact_url = "https://circleci.com/api/v1.1/project/github/#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}/#{ENV['CIRCLE_BUILD_NUM']}/artifacts?circle-token=#{ENV['CIRCLE_TOKEN']}"
103
- artifacts = JSON.parse(URI.parse(artifact_url).read).map { |a| a['url'] }
104
-
105
- jest = artifacts.find { |artifact| artifact.end_with?('jest/index.html') }
106
- coverage = artifacts.find { |artifact| artifact.end_with?('coverage/index.html') }
107
- rubocop = artifacts.find { |artifact| artifact.end_with?('rubocop/report.html') }
108
- eslint = artifacts.find { |artifact| artifact.end_with?('eslint/report.html') }
109
- brakeman = artifacts.find { |artifact| artifact.end_with?('brakeman/report.html') }
110
- rspec_files = artifacts.select { |artifact| artifact =~ /rspec-(.+)\.html$/ }
111
-
112
- {}.tap do |hash|
113
- hash['Ruby coverage report'] = coverage if coverage
114
- hash['RSpec test report'] = rspec_files unless rspec_files.empty?
115
- hash['RuboCop inspection report'] = rubocop if rubocop
116
- hash['ESLint inspection report'] = eslint if eslint
117
- hash['Jest coverage report'] = jest if jest
118
- hash['Brakeman issues report'] = brakeman if brakeman
119
- end.each do |msg, links|
120
- links = [*links]
121
- if links.size == 1
122
- message("[#{msg}](#{links[0]})")
123
- else
124
- r = /rspec-(.+)\.html$/
125
- the_links = links.map { |l|
126
- m = r.match(l)
127
- if m
128
- "[#{m[1]}](#{l})"
129
- else
130
- "[link](#{l})"
131
- end
132
- }.join(', ')
133
-
134
- message("#{msg} - #{the_links}")
135
- end
136
- end
43
+ should_have_migration_label = true if has_migrations || has_schema_changes
44
+ toggle_label(github, 'run migration', should_have_migration_label)
137
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NetsoftDanger
4
- VERSION = '0.6.0'
4
+ VERSION = '0.8.0'
5
5
  end
@@ -13,12 +13,10 @@ Gem::Specification.new do |s|
13
13
  s.description = 'Packages a Dangerfile to be used with Danger.'
14
14
  s.executables << 'netsoft-circle'
15
15
 
16
- s.files = `git ls-files`.split("\n").reject { |f|
17
- f.match?(%r{^\.github/}i)
18
- }
16
+ s.files = `git ls-files`.split("\n").grep_v(%r{^\.github/}i)
19
17
  s.require_paths = ['lib']
20
18
 
21
- s.required_ruby_version = '>= 2.4'
19
+ s.required_ruby_version = '>= 2.5'
22
20
 
23
21
  s.add_runtime_dependency 'danger', '~> 8.0'
24
22
  s.add_runtime_dependency 'faraday'
@@ -27,5 +25,5 @@ Gem::Specification.new do |s|
27
25
 
28
26
  s.add_development_dependency 'rake'
29
27
 
30
- s.add_development_dependency 'netsoft-rubocop', '= 1.1.2'
28
+ s.add_development_dependency 'netsoft-rubocop', '= 1.1.5'
31
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.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - urkle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-04 00:00:00.000000000 Z
11
+ date: 2023-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 1.1.2
89
+ version: 1.1.5
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.1.2
96
+ version: 1.1.5
97
97
  description: Packages a Dangerfile to be used with Danger.
98
98
  email: []
99
99
  executables:
@@ -129,14 +129,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: '2.4'
132
+ version: '2.5'
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubygems_version: 3.0.3
139
+ rubygems_version: 3.1.6
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Danger.systems conventions for Netsoft projects.