git-lint 1.0.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ea240069467c66adef23372741330ebd90180d3099cceb9c096ae9575eb4475
4
- data.tar.gz: 8bec2e0c1d7348ee5af25a11641c8bd02d3773c055151c52252a69d5c2706daf
3
+ metadata.gz: fee007aea853b3ee86b0bbd66dc27b0debb3bdd69227cd693f989e470fdbaf25
4
+ data.tar.gz: a63392c0e6cf3dfa6cbd06bb361521327ea7326228c4b83163eba3d41435d762
5
5
  SHA512:
6
- metadata.gz: 33c49480b58f1e6b44d4246f8306b8d9ba0ce68ca4cc059fe19a403a1d08fd50370f45a917eba39dbe5bf664d1377d044c20155b86c763307bdbd725d1bb95da
7
- data.tar.gz: 598eb09a297689e9a930c01f46062fe9587fff7df02b430d74b69c9bd59af3e876a27e855b8d04cef3b4aec4ac8738a242797894a098c0bfcf28ee4a576d16c3
6
+ metadata.gz: 7c53d8b1657d48661796f82dba61954eb1f3ed17dac90d602ccd89147cae44efd3b9a1ed9b07bad5b5b53f61800f376f4f08053c4bbb76a3d287f2546e03536c
7
+ data.tar.gz: a5b6afdb80917dc75684878b0cd7679a240e76f6a8f17dc31d0b859aaeeba7d04e7d2bfe8ffe7175910c69f939391d0f0cf4001d5f0730b3af2cb7e31f9e69e5
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -150,7 +150,7 @@ additional liability.
150
150
 
151
151
  END OF TERMS AND CONDITIONS
152
152
 
153
- Copyright link:https://www.alchemists.io[Alchemists].
153
+ Copyright 2020 link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
154
154
 
155
155
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
156
156
  compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
@@ -2,24 +2,26 @@
2
2
  :toclevels: 5
3
3
  :figure-caption!:
4
4
 
5
- :git_rebase_workflow_link: link:https://www.alchemists.io/articles/git_commit_anatomy[Git Rebase Workflow]
5
+ :git_rebase_workflow_link: link:https://www.alchemists.io/articles/git_rebase[Git Rebase Workflow]
6
6
 
7
7
  = Git Lint
8
8
 
9
9
  [link=http://badge.fury.io/rb/git-lint]
10
10
  image::https://badge.fury.io/rb/git-lint.svg[Gem Version]
11
+ [link=https://www.alchemists.io/projects/code_quality]
12
+ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
11
13
  [link=https://circleci.com/gh/bkuhlmann/git-lint]
12
14
  image::https://circleci.com/gh/bkuhlmann/git-lint.svg?style=svg[Circle CI Status]
13
15
 
14
16
  [link=https://travis-ci.org/bkuhlmann/git-lint]
15
17
  image::https://travis-ci.org/bkuhlmann/git-lint.svg?branch=master[Travis CI Status]
16
18
  [link=https://app.netlify.com/sites/git-lint/deploys]
17
- image::https://api.netlify.com/api/v1/badges/d4a15c9c-46ba-49db-9f31-33f389ee3259/deploy-status[Netlify CI Status]
19
+ image::https://api.netlify.com/api/v1/badges/7e23b422-3412-4e7f-b654-65c0417a0b1f/deploy-status[Netlify CI Status]
18
20
 
19
21
  A command line interface for linting Git commits. Ensures you maintain a clean, easy to read,
20
22
  debuggable, and maintainable project history.
21
23
 
22
- *Git Lint is the offical port of the original Git Cop project that avoids references to violence or
24
+ *Git Lint is the official port of the original Git Cop project that avoids references to violence or
23
25
  violent terminology that might make anyone feel unwelcome. The name change was necessary in order to
24
26
  better support the link:https://blacklivesmatter.com[Black Lives Matter] and
25
27
  link:https://8cantwait.org[Defund Police] movements.*
@@ -37,16 +39,14 @@ toc::[]
37
39
  == Screencasts
38
40
 
39
41
  [link=https://www.alchemists.io/screencasts/git_lint]
40
- image::https://www.alchemists.io/images/screencasts/git_lint/cover-original.png[Screencast,role=focal_point]
42
+ image::https://www.alchemists.io/images/screencasts/git_lint/cover.svg[Screencast,600,240,role=focal_point]
41
43
 
42
44
  == Requirements
43
45
 
44
- . link:https://www.ruby-lang.org[Ruby 2.7.0] (or higher)
46
+ . link:https://www.ruby-lang.org[Ruby]
45
47
 
46
48
  == Setup
47
49
 
48
- === Production
49
-
50
50
  To install, run:
51
51
 
52
52
  [source,bash]
@@ -54,24 +54,6 @@ To install, run:
54
54
  gem install git-lint
55
55
  ----
56
56
 
57
- === Development
58
-
59
- To contribute, run:
60
-
61
- [source,bash]
62
- ----
63
- git clone https://github.com/bkuhlmann/git-lint.git
64
- cd git-lint
65
- bin/setup
66
- ----
67
-
68
- You can also use the IRB console for direct access to all objects:
69
-
70
- [source,bash]
71
- ----
72
- bin/console
73
- ----
74
-
75
57
  == Usage
76
58
 
77
59
  === Command Line Interface (CLI)
@@ -171,7 +153,7 @@ variables. The default configuration is:
171
153
  :severity: :error
172
154
  :includes: "\\-"
173
155
  :commit_body_issue_tracker_link:
174
- :enabled: true,
156
+ :enabled: true
175
157
  :severity: :error
176
158
  :excludes:
177
159
  - "(f|F)ix(es|ed)?\\s\\#\\d+"
@@ -403,6 +385,36 @@ from `master`.
403
385
  Detection and configuration happens automatically by checking the `CIRCLECI` environment variable.
404
386
  No additional setup required!
405
387
 
388
+ ==== link:https://docs.github.com/en/free-pro-team@latest/actions[GitHub Actions]
389
+
390
+ Detection happens automatically by checking the `GITHUB_ACTIONS` environment variable as supplied by
391
+ the GitHub environment. The only configuration required is to add a `.github/workflows/git_lint.yml`
392
+ to your repository with the following contents:
393
+
394
+ [source,yaml]
395
+ ----
396
+ name: Git Lint
397
+
398
+ on: pull_request
399
+
400
+ jobs:
401
+ run:
402
+ runs-on: ubuntu-latest
403
+ container:
404
+ image: ruby:latest
405
+ steps:
406
+ - uses: actions/checkout@v2
407
+ with:
408
+ fetch-depth: '0'
409
+ ref: ${{github.head_ref}}
410
+ - name: Install
411
+ run: gem install git-lint
412
+ - name: Analyze
413
+ run: git-lint --analyze
414
+ ----
415
+
416
+ The above will ensure Git Lint runs as an additional check on each Pull Request.
417
+
406
418
  ==== link:https://www.netlify.com[Netlify CI]
407
419
 
408
420
  Detection and configuration happens automatically by checking the `NETLIFY` environment variable. No
@@ -849,7 +861,7 @@ worth considering:
849
861
 
850
862
  === General
851
863
 
852
- * Use a {git_rebase_workflow_link} instead of a Git merge workflow.
864
+ * Use a {git_rebase_workflow_link} instead of a Git Merge Workflow.
853
865
  * Use `git commit --amend` when fixing a previous commit, addressing code review feedback, etc.
854
866
  * Use `git commit --fixup` when fixing an earlier commit, addressing code review feedback, etc., and
855
867
  don't need to modify the original commit message.
@@ -869,13 +881,30 @@ worth considering:
869
881
  * Avoid using link:https://git-scm.com/book/en/v2/Git-Tools-Submodules[Git Submodules]. This
870
882
  practice leads to complicated project cloning, deployments, maintenance, etc. Use separate
871
883
  repositories to better organize and split out this work. Sophisticated package managers, like
872
- link:https://bundler.io[Bundler] for example, exist to manage these dependencies better than what
873
- multiple Git Submodules can accomplish.
884
+ link:https://bundler.io[Bundler], exist to manage these dependencies better than what multiple Git
885
+ Submodules can accomplish.
874
886
  * Avoid using link:https://git-lfs.github.com[Git LFS] for tracking binary artifacts/resources.
875
887
  These files are not meant for version control and lead to large repositories that are time
876
888
  consuming to clone/deploy. Use storage managers, like link:https://aws.amazon.com/s3[Amazon S3]
877
889
  for example, that are better suited for binary assets that don't change often.
878
890
 
891
+ === Security
892
+
893
+ Ensure signed commits, pushes, and tags are enabled within your global Git Configuration to reduce
894
+ an
895
+ link:https://blog.gruntwork.io/how-to-spoof-any-user-on-github-and-what-to-do-to-prevent-it-e237e95b8deb[attack
896
+ vector]. Run the following commands to enable:
897
+
898
+ [source,bash]
899
+ ----
900
+ git config --global commit.gpgSign true
901
+ git config --global push.gpgSign true
902
+ git config --global tag.gpgSign true
903
+ ----
904
+
905
+ ⚠️ GitHub, unfortunately, doesn't support signed pushes so you might need to leave that
906
+ configuration disabled.
907
+
879
908
  === Commits
880
909
 
881
910
  * Use a commit subject that explains _what_ is being committed.
@@ -1017,9 +1046,9 @@ do this, follow these steps:
1017
1046
  . Check _Require review from Code Owners_.
1018
1047
  . Check _Require status checks to pass before merging_.
1019
1048
  . Check _Require branches to be up to date before merging_.
1049
+ . Check _Require signed commits_.
1020
1050
  . Check _Require linear history_ (pairs well with the merge options mentioned above).
1021
1051
  . Check _Include administrators_.
1022
- . Uncheck _Require signed commits_ (only necessary for tags).
1023
1052
  . Uncheck _Allow force pushes_.
1024
1053
  . Uncheck _Allow deletions_.
1025
1054
 
@@ -1029,6 +1058,24 @@ image::https://www.alchemists.io/images/projects/git-lint/screenshots/github-set
1029
1058
 
1030
1059
  Applying the above changes will help maintain a clean Git history.
1031
1060
 
1061
+ == Development
1062
+
1063
+ To contribute, run:
1064
+
1065
+ [source,bash]
1066
+ ----
1067
+ git clone https://github.com/bkuhlmann/git-lint.git
1068
+ cd git-lint
1069
+ bin/setup
1070
+ ----
1071
+
1072
+ You can also use the IRB console for direct access to all objects:
1073
+
1074
+ [source,bash]
1075
+ ----
1076
+ bin/console
1077
+ ----
1078
+
1032
1079
  == Tests
1033
1080
 
1034
1081
  To test, run:
@@ -15,6 +15,7 @@ require "git/lint/commits/saved"
15
15
  require "git/lint/commits/unsaved"
16
16
  require "git/lint/branches/environments/local"
17
17
  require "git/lint/branches/environments/circle_ci"
18
+ require "git/lint/branches/environments/git_hub_action"
18
19
  require "git/lint/branches/environments/netlify_ci"
19
20
  require "git/lint/branches/environments/travis_ci"
20
21
  require "git/lint/branches/feature"
@@ -13,6 +13,7 @@ module Git
13
13
  ISSUE_LINE_OFFSET = 2
14
14
 
15
15
  def self.inherited klass
16
+ super
16
17
  @descendants ||= []
17
18
  @descendants << klass unless klass.to_s.start_with? "#<Class" # Ignore anonymous classes.
18
19
  end
@@ -32,7 +32,11 @@ module Git
32
32
  end
33
33
 
34
34
  def invalid_line? line
35
- line.match?(/\A\s*#{Regexp.union filter_list.to_regexp}(?!\s).+\Z/)
35
+ line.match?(/\A\s*#{pattern}(?!(#{pattern}|\s)).+\Z/)
36
+ end
37
+
38
+ def pattern
39
+ Regexp.union filter_list.to_regexp
36
40
  end
37
41
  end
38
42
  end
@@ -14,9 +14,10 @@ module Git
14
14
  def valid?
15
15
  raw_body = commit.raw_body
16
16
  subject, body = raw_body.split "\n", 2
17
+
17
18
  return true if !String(subject).empty? && String(body).strip.empty?
18
19
 
19
- raw_body.match?(/\A.+\n\n.+/)
20
+ raw_body.match?(/\A.+(\n\n|\#).+/m)
20
21
  end
21
22
 
22
23
  def issue
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Git
4
+ module Lint
5
+ module Branches
6
+ module Environments
7
+ # Provides GitHub Action build environment feature branch information.
8
+ class GitHubAction
9
+ def initialize repo: Git::Kit::Repo.new
10
+ @repo = repo
11
+ end
12
+
13
+ def name
14
+ "origin/#{repo.branch_name}"
15
+ end
16
+
17
+ def shas
18
+ repo.shas start: "origin/master", finish: name
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :repo
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -29,6 +29,7 @@ module Git
29
29
 
30
30
  def load_environment
31
31
  if key? "CIRCLECI" then Environments::CircleCI.new
32
+ elsif key? "GITHUB_ACTIONS" then Environments::GitHubAction.new
32
33
  elsif key? "NETLIFY" then Environments::NetlifyCI.new environment: current_environment
33
34
  elsif key? "TRAVIS" then Environments::TravisCI.new environment: current_environment
34
35
  else Environments::Local.new
@@ -6,7 +6,7 @@ module Git
6
6
  module Identity
7
7
  NAME = "git-lint"
8
8
  LABEL = "Git Lint"
9
- VERSION = "1.0.0"
9
+ VERSION = "1.3.0"
10
10
  VERSION_LABEL = "#{LABEL} #{VERSION}"
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
29
  QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-06-13 00:00:00.000000000 Z
31
+ date: 2020-11-15 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pastel
@@ -50,28 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '7.5'
53
+ version: '7.14'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '7.5'
60
+ version: '7.14'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: runcom
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '6.0'
67
+ version: '6.4'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '6.0'
74
+ version: '6.4'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: thor
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,42 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0.6'
95
+ version: '0.7'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0.6'
102
+ version: '0.7'
103
+ - !ruby/object:Gem::Dependency
104
+ name: bundler-leak
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.2'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.2'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: gemsmith
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - "~>"
108
122
  - !ruby/object:Gem::Version
109
- version: '14.0'
123
+ version: '14.8'
110
124
  type: :development
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '14.0'
130
+ version: '14.8'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: guard-rspec
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -190,42 +204,42 @@ dependencies:
190
204
  requirements:
191
205
  - - "~>"
192
206
  - !ruby/object:Gem::Version
193
- version: '3.9'
207
+ version: '3.10'
194
208
  type: :development
195
209
  prerelease: false
196
210
  version_requirements: !ruby/object:Gem::Requirement
197
211
  requirements:
198
212
  - - "~>"
199
213
  - !ruby/object:Gem::Version
200
- version: '3.9'
214
+ version: '3.10'
201
215
  - !ruby/object:Gem::Dependency
202
216
  name: rubocop
203
217
  requirement: !ruby/object:Gem::Requirement
204
218
  requirements:
205
219
  - - "~>"
206
220
  - !ruby/object:Gem::Version
207
- version: '0.83'
221
+ version: '1.3'
208
222
  type: :development
209
223
  prerelease: false
210
224
  version_requirements: !ruby/object:Gem::Requirement
211
225
  requirements:
212
226
  - - "~>"
213
227
  - !ruby/object:Gem::Version
214
- version: '0.83'
228
+ version: '1.3'
215
229
  - !ruby/object:Gem::Dependency
216
230
  name: rubocop-performance
217
231
  requirement: !ruby/object:Gem::Requirement
218
232
  requirements:
219
233
  - - "~>"
220
234
  - !ruby/object:Gem::Version
221
- version: '1.5'
235
+ version: '1.8'
222
236
  type: :development
223
237
  prerelease: false
224
238
  version_requirements: !ruby/object:Gem::Requirement
225
239
  requirements:
226
240
  - - "~>"
227
241
  - !ruby/object:Gem::Version
228
- version: '1.5'
242
+ version: '1.8'
229
243
  - !ruby/object:Gem::Dependency
230
244
  name: rubocop-rake
231
245
  requirement: !ruby/object:Gem::Requirement
@@ -246,28 +260,28 @@ dependencies:
246
260
  requirements:
247
261
  - - "~>"
248
262
  - !ruby/object:Gem::Version
249
- version: '1.39'
263
+ version: '2.0'
250
264
  type: :development
251
265
  prerelease: false
252
266
  version_requirements: !ruby/object:Gem::Requirement
253
267
  requirements:
254
268
  - - "~>"
255
269
  - !ruby/object:Gem::Version
256
- version: '1.39'
270
+ version: '2.0'
257
271
  - !ruby/object:Gem::Dependency
258
272
  name: simplecov
259
273
  requirement: !ruby/object:Gem::Requirement
260
274
  requirements:
261
275
  - - "~>"
262
276
  - !ruby/object:Gem::Version
263
- version: '0.18'
277
+ version: '0.19'
264
278
  type: :development
265
279
  prerelease: false
266
280
  version_requirements: !ruby/object:Gem::Requirement
267
281
  requirements:
268
282
  - - "~>"
269
283
  - !ruby/object:Gem::Version
270
- version: '0.18'
284
+ version: '0.19'
271
285
  description:
272
286
  email:
273
287
  - brooke@alchemists.io
@@ -306,6 +320,7 @@ files:
306
320
  - lib/git/lint/analyzers/commit_trailer_collaborator_key.rb
307
321
  - lib/git/lint/analyzers/commit_trailer_collaborator_name.rb
308
322
  - lib/git/lint/branches/environments/circle_ci.rb
323
+ - lib/git/lint/branches/environments/git_hub_action.rb
309
324
  - lib/git/lint/branches/environments/local.rb
310
325
  - lib/git/lint/branches/environments/netlify_ci.rb
311
326
  - lib/git/lint/branches/environments/travis_ci.rb
metadata.gz.sig CHANGED
Binary file