fit-commit 2.0.1 → 2.0.2

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: cb4ffe45a0ad53675d49f2cd52490915a181cded
4
- data.tar.gz: 0706dcac90051c43fb56ad9912833f5dfee28667
3
+ metadata.gz: aabcc0d7d9ae18205dc7f0ffc39b7b6bff65e031
4
+ data.tar.gz: d844c683caef5cbb416b386c8c59b0f59000dcb0
5
5
  SHA512:
6
- metadata.gz: 149f64e1b74901d17697a54e5675aad9b7269f4a5016424a3fb144b88cc935a8fbfc87b98375a75d852724ad5899c251acd3b3bac5fd30c2286c7afad591d314
7
- data.tar.gz: b22509e397f85f26bb3df60b697c49e7437f925eae05c6bb38e8f4e2f7a059196c2939062807b505f7d7efe98d0116a9a0659dfa0ede8943ffe199e2bc3b1c8a
6
+ metadata.gz: 9151e4ed2c5e082b43cdd7acbfd19ac11bf6829aba734f505f3402a96686414800c9a0c820d03a5812aa5ddb39b04841d1f8c9be6e9c2b48d97d98ce5245026a
7
+ data.tar.gz: 9fdc57be60a116531a48fd88aa5d1d7d0ff232d6b01b47a255390b25f99bcec7c92a8ded4b2c82aeb32656f0e629378723ff7494f4d185077e5080a6076fa7b3
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  # Fit Commit
2
3
 
3
4
  A Git hook to validate your commit messages, based largely on Tim Pope's [authoritative guide](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
@@ -10,7 +11,7 @@ Adding a cool feature
10
11
  foobar foobar foobar,
11
12
  foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar
12
13
 
13
- 1: Error: Message must use present imperative tense.
14
+ 1: Error: Message must use imperative present tense.
14
15
  2: Error: Second line must be blank.
15
16
  3: Error: Lines should be <= 72 chars. (76)
16
17
 
@@ -36,11 +37,38 @@ This creates a `.git/hooks/commit-msg` script which will automatically check you
36
37
  ## Validations
37
38
 
38
39
  * **Line Length**: All lines must be <= 72 chars (URLs excluded). First line should be <= 50 chars. Second line must be blank.
39
- * **Tense**: Message must use present imperative tense.
40
+ * **Tense**: Message must use imperative present tense: "Fix bug" and not "Fixed bug" or "Fixes bug."
40
41
  * **Summary Period**: Do not end your summary with a period.
41
42
  * **WIP**: Do not commit WIPs to master.
42
43
  * **Frat House**: No frat house commit messages in master.
43
44
 
45
+
46
+ ## FAQ
47
+
48
+ ### Can Fit Commit run in all my repos without having to install it each time?
49
+ First set your global Git template directory:
50
+
51
+ ```
52
+ $ git config --global init.templatedir '~/.git_template'
53
+ ```
54
+
55
+ Now you can copy the hooks you want installed in new repos by default:
56
+
57
+ ```
58
+ # From a repo where Fit Commit is already installed
59
+ $ cp .git/hooks/commit-msg ~/.git_templates/hooks/commit-msg
60
+ ```
61
+
62
+ To copy your default hooks into existing repos:
63
+
64
+ ```
65
+ $ git init
66
+ ```
67
+
68
+ ### Fit Commit is too opinionated for me. What can I do?
69
+ Fit Commit aims to be useful to everyone. If you can suggest an improvement to make it useful to more people, please open a GitHub Issue or Pull Request.
70
+
71
+
44
72
  ## Credits
45
73
 
46
74
  Author: [Mike Foley](https://github.com/m1foley)
@@ -64,12 +64,12 @@ module FitCommit
64
64
  )
65
65
 
66
66
  def validate_line(lineno, text, _branch_name)
67
- if lineno == 1 && wrong_tense?(text)
68
- add_error(lineno, "Message must use present imperative tense.")
67
+ if lineno == 1 && starts_with_blacklisted_verb?(text)
68
+ add_error(lineno, "Message must use imperative present tense.")
69
69
  end
70
70
  end
71
71
 
72
- def wrong_tense?(text)
72
+ def starts_with_blacklisted_verb?(text)
73
73
  first_word = text.split.first(2).detect { |w| w =~ /\A\w/ }
74
74
  first_word && VERB_BLACKLIST.include?(first_word.downcase)
75
75
  end
@@ -1,3 +1,3 @@
1
1
  module FitCommit
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -8,7 +8,7 @@ describe FitCommit::Validators::Tense do
8
8
  let(:branch_name) { "anybranch" }
9
9
 
10
10
  describe "uses incorrect tense on first line" do
11
- let(:commit_msg) { "Changed something\nhi" }
11
+ let(:commit_msg) { "Changed something" }
12
12
  it "has error" do
13
13
  validator.validate
14
14
  assert_equal 1, validator.errors[1].size
@@ -16,8 +16,26 @@ describe FitCommit::Validators::Tense do
16
16
  end
17
17
  end
18
18
 
19
+ describe "uses incorrect tense on first line" do
20
+ let(:commit_msg) { "[#ticketno] Changed something" }
21
+ it "has error" do
22
+ validator.validate
23
+ assert_equal 1, validator.errors[1].size
24
+ assert_empty validator.warnings
25
+ end
26
+ end
27
+
28
+ describe "has incorrect tense after the first word" do
29
+ let(:commit_msg) { "Document fixes to bug" }
30
+ it "does not have errors/warnings" do
31
+ validator.validate
32
+ assert_empty validator.errors
33
+ assert_empty validator.warnings
34
+ end
35
+ end
36
+
19
37
  describe "uses incorrect tense on a line other than first line" do
20
- let(:commit_msg) { "hi\nChanged something" }
38
+ let(:commit_msg) { "Fix bug\n\nChanged something" }
21
39
  it "does not have errors/warnings" do
22
40
  validator.validate
23
41
  assert_empty validator.errors
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fit-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Foley
@@ -68,7 +68,6 @@ files:
68
68
  - LICENSE
69
69
  - README.md
70
70
  - Rakefile
71
- - TODO.txt
72
71
  - bin/fit-commit
73
72
  - fit-commit.gemspec
74
73
  - lib/fit-commit.rb
data/TODO.txt DELETED
@@ -1,4 +0,0 @@
1
- - Document adding fit-commit to ~/.git_template
2
- - Customize which are "business" branches (not just master)
3
- - Configuration to disable validations.
4
- - `fit-commit uninstall`