netsoft-danger 0.6.0 → 0.7.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: '0981c81d0ae817b555ad494429d321ca25193ae0084b61fa1205a934ff3f6372'
4
+ data.tar.gz: '0991c0da27a9809734a3c5d6366d726bba8308fb33165f767645174676d60d4a'
5
5
  SHA512:
6
- metadata.gz: 9defe1928aaaa112b151d44f2bdacee0ac8b4821cf9b1e6b2ffd7d91b10dc889a9e1339705dad2d5c19bcafbc7ff5da30f07699e88c3f3d7a290a2d15acad9d5
7
- data.tar.gz: 85d7f668e2d38d708b11c2dde99c9b0608fcc1198506edb3065eed199d88fe0ad056667c3ffd30869e92db057631d05bd03d71e68b5dfcb345d8a7c5ded765b8
6
+ metadata.gz: 8537ad5a81b1cd8e028a5af2ae90fe1309d0794254a94b32b38b5560e842290940c77655e653774d718dcb6ff0802b332b0c47ed43d23c2f112886b29fe18fdd
7
+ data.tar.gz: c5c57afe569726883d54732717357415c76e9334f8f1c2e13cab3fdf6f7d8593353986da1510a9c685138ea754f6da1f20aeeadfade307d6ba84758b67ecf84d
data/CHANGELOG.md CHANGED
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
  ### Changed
10
10
  ### Fixed
11
11
 
12
+ ## [0.7.0]
13
+ ### Changed
14
+ - remove checks for migration and gemfile prefixes in commit messages
15
+
12
16
  ## [0.6.0]
13
17
  - remove the focus and print checks from the ruby danger (now handled by rubocop)
14
18
 
data/Dangerfile CHANGED
@@ -28,110 +28,10 @@ if github.branch_for_head.start_with?('security')
28
28
  toggle_label(github, 'security', true)
29
29
  end
30
30
 
31
- should_have_migration_label = false
32
-
33
31
  git.commits.each do |c|
34
- short = " ( #{c.sha[0..7]} )"
35
- has_migrations = c.diff_parent.any? { |f| f.path =~ %r{db/migrate/} }
32
+ has_migrations = c.diff_parent.any? { |f| f.path =~ %r{db/migrate/} }
36
33
  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
-
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
34
 
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
35
+ should_have_migration_label = true if has_migrations || has_schema_changes
36
+ toggle_label(github, 'run migration', should_have_migration_label)
137
37
  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.7.0'
5
5
  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.7.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-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger