fit-commit 3.3.0 → 3.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
  SHA1:
3
- metadata.gz: 8c1962d7ad212ab2d64654448e4ec61fa069636f
4
- data.tar.gz: c8942246016315fa610507e5e07ecb978caa4563
3
+ metadata.gz: 053fd82df69f6a201bc1c341874d19f93fc4d0d3
4
+ data.tar.gz: 896366baa5268106e54a6cb61d2bd4ee580174ed
5
5
  SHA512:
6
- metadata.gz: 5fa212d38361178174a815e1c26f899d4691c71d7bbb01b42a01397bda93db1a574b66ef591bc01d61bf7e6954834d39349e52cd111c8c6a7905c42c1e55d4bb
7
- data.tar.gz: 503e76de5b61998831d17a5d47c9da2166597c390f120fe8963b12fe94a9e840f5db25b891380a363bbc3f324ad2309bbcc7a59065c0b11579984938968dea1f
6
+ metadata.gz: c5c3aa65688d618f04095870d714d12175c8d44b3f91c17a49ca0f64164a5f7e52c32ac60469bca960cc41952d089daea751e8197931807ca003c2d1325fd4b8
7
+ data.tar.gz: 31771420bda1375395de7753d8dec5d6133ac7d07cb96a19a770ccbc8c59740a69e059855b3c115c1e89dfb3e856efeeafbcde828522575df55bf95e8e4d8c8c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ### v3.4.0 (2015-12-08)
4
+ - Skip capitalization check for autosquash commits
5
+
3
6
  ### v3.3.0 (2015-10-10)
4
7
  - Add support for custom validators
5
8
 
data/README.md CHANGED
@@ -82,7 +82,7 @@ Validators/Bar:
82
82
  - !ruby/regexp /\Afoo.+bar/
83
83
  ```
84
84
 
85
- ## Adding custom validators
85
+ ## Adding Custom Validators
86
86
 
87
87
  Create your custom validator as a `FitCommit::Validators::Base` subclass:
88
88
 
@@ -98,6 +98,19 @@ module FitCommit
98
98
  end
99
99
  end
100
100
  end
101
+
102
+ # A validator can also validate the commit message as a whole:
103
+ module FitCommit
104
+ module Validators
105
+ class MyCustomValidator < Base
106
+ def validate(lines)
107
+ if lines.none? { |line| line.text =~ /#\d+/ }
108
+ add_warning(lines.last.lineno, "Related issue not referenced.")
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
101
114
  ```
102
115
 
103
116
  `Require` the file and enable the validator in your config:
@@ -3,8 +3,10 @@ require "fit_commit/validators/base"
3
3
  module FitCommit
4
4
  module Validators
5
5
  class CapitalizeSubject < Base
6
+ AUTOSQUASH = /\A(fixup|squash)! /
7
+
6
8
  def validate_line(lineno, text)
7
- if lineno == 1 && text[0] =~ /[[:lower:]]/
9
+ if lineno == 1 && text[0] =~ /[[:lower:]]/ && text !~ AUTOSQUASH
8
10
  add_error(lineno, "Begin all subject lines with a capital letter.")
9
11
  end
10
12
  end
@@ -1,3 +1,3 @@
1
1
  module FitCommit
2
- VERSION = "3.3.0"
2
+ VERSION = "3.4.0"
3
3
  end
@@ -17,6 +17,22 @@ describe FitCommit::Validators::CapitalizeSubject do
17
17
  assert_empty validator.warnings
18
18
  end
19
19
  end
20
+ describe "subject is fixup commit" do
21
+ let(:commit_msg) { "fixup! foo bar" }
22
+ it "does not have errors/warnings" do
23
+ validator.validate(commit_lines)
24
+ assert_empty validator.errors
25
+ assert_empty validator.warnings
26
+ end
27
+ end
28
+ describe "subject is squash commit" do
29
+ let(:commit_msg) { "squash! foo bar" }
30
+ it "does not have errors/warnings" do
31
+ validator.validate(commit_lines)
32
+ assert_empty validator.errors
33
+ assert_empty validator.warnings
34
+ end
35
+ end
20
36
  describe "subject is capitalized" do
21
37
  let(:commit_msg) { "Foo bar" }
22
38
  it "does not have errors/warnings" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fit-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Foley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-10 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: swearjar