git-lint 1.3.0 → 2.2.1
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.adoc +42 -122
- data/lib/git/lint.rb +1 -3
- data/lib/git/lint/analyzers/abstract.rb +3 -3
- data/lib/git/lint/analyzers/commit_author_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_leading_line.rb +3 -3
- data/lib/git/lint/analyzers/commit_subject_prefix.rb +1 -1
- data/lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb +2 -2
- data/lib/git/lint/analyzers/commit_trailer_collaborator_duplication.rb +3 -3
- data/lib/git/lint/analyzers/commit_trailer_collaborator_email.rb +2 -2
- data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +2 -2
- data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +2 -2
- data/lib/git/lint/branches/environments/circle_ci.rb +6 -6
- data/lib/git/lint/branches/environments/git_hub_action.rb +6 -6
- data/lib/git/lint/branches/environments/local.rb +6 -6
- data/lib/git/lint/branches/environments/netlify_ci.rb +8 -8
- data/lib/git/lint/branches/environments/travis_ci.rb +10 -10
- data/lib/git/lint/branches/feature.rb +6 -7
- data/lib/git/lint/cli.rb +10 -15
- data/lib/git/lint/collector.rb +2 -2
- data/lib/git/lint/identity.rb +1 -1
- data/lib/git/lint/parsers/trailers/collaborator.rb +2 -2
- data/lib/git/lint/reporters/branch.rb +14 -14
- data/lib/git/lint/runner.rb +5 -4
- data/lib/git/lint/validators/capitalization.rb +1 -1
- data/lib/git/lint/validators/name.rb +1 -1
- metadata +30 -215
- metadata.gz.sig +0 -0
- data/lib/git/kit/repo.rb +0 -30
- data/lib/git/lint/commits/saved.rb +0 -104
- data/lib/git/lint/commits/unsaved.rb +0 -120
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 432f1e46b50a5ae86dc268318ea2a2cf720e68d57a00cbdc274d50379bbee24f
|
4
|
+
data.tar.gz: 5ca784153ebd07153c70b4e7452a7ef0e141b32789e5d4f1c0fb95d861d698b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f53f339560363704e3f35560d3ee5dc6b43012c9eadbf088cd580ddbd0738f6933a16f963406eeb882d2f0d951b95894f7c25a581582c3058074879ab12e3ba
|
7
|
+
data.tar.gz: b5cbe2dbe299a0f3690d64ceb6b2df00074d2112bdbb7bf93c031268705289db782118f19411f0083b592407fc071c84a5311deab01d6afd13e17592a03cb4de
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -14,27 +14,23 @@ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchem
|
|
14
14
|
image::https://circleci.com/gh/bkuhlmann/git-lint.svg?style=svg[Circle CI Status]
|
15
15
|
|
16
16
|
[link=https://travis-ci.org/bkuhlmann/git-lint]
|
17
|
-
image::https://travis-ci.org/bkuhlmann/git-lint.svg?branch=
|
17
|
+
image::https://travis-ci.org/bkuhlmann/git-lint.svg?branch=main[Travis CI Status]
|
18
18
|
[link=https://app.netlify.com/sites/git-lint/deploys]
|
19
19
|
image::https://api.netlify.com/api/v1/badges/7e23b422-3412-4e7f-b654-65c0417a0b1f/deploy-status[Netlify CI Status]
|
20
20
|
|
21
21
|
A command line interface for linting Git commits. Ensures you maintain a clean, easy to read,
|
22
22
|
debuggable, and maintainable project history.
|
23
23
|
|
24
|
-
*Git Lint is the official port of the original Git Cop project that avoids references to violence or
|
25
|
-
violent terminology that might make anyone feel unwelcome. The name change was necessary in order to
|
26
|
-
better support the link:https://blacklivesmatter.com[Black Lives Matter] and
|
27
|
-
link:https://8cantwait.org[Defund Police] movements.*
|
28
|
-
|
29
24
|
toc::[]
|
30
25
|
|
31
26
|
== Features
|
32
27
|
|
33
28
|
* Enforces a {git_rebase_workflow_link}.
|
34
29
|
* Enforces a clean and consistent Git commit history.
|
30
|
+
* Supports Git default branch configuration.
|
35
31
|
* Provides a customizable suite of analyzers.
|
36
32
|
* Provides Git Hook support for local use.
|
37
|
-
* Provides Continuous Integration (CI)
|
33
|
+
* Provides Continuous Integration (CI) support.
|
38
34
|
|
39
35
|
== Screencasts
|
40
36
|
|
@@ -71,9 +67,9 @@ git-lint -v, [--version] # Show gem version.
|
|
71
67
|
To check if your Git commit history is clean, run: `git-lint --analyze`. It will exit with a failure
|
72
68
|
if at least one issue with error severity is detected.
|
73
69
|
|
74
|
-
This gem does not check commits on `
|
75
|
-
to rewrite or fix commits on `
|
76
|
-
detects all commits made since
|
70
|
+
This gem does not check commits on your default branch (i.e. `main`). This is intentional as you
|
71
|
+
would, generally, not want to rewrite or fix commits on the `main` branch. This gem is best used on
|
72
|
+
feature branches as it automatically detects all commits made since creation of the feature branch.
|
77
73
|
|
78
74
|
Here is an example workflow, using gem defaults with issues detected:
|
79
75
|
|
@@ -115,6 +111,21 @@ Now, when running `bundle exec rake -T`, you'll see `git_lint` included in the l
|
|
115
111
|
|
116
112
|
If you need a concrete example, check out the link:Rakefile[Rakefile] of this project for details.
|
117
113
|
|
114
|
+
=== Default Branch
|
115
|
+
|
116
|
+
Your default branch configuration is respected no matter if it is set globally or locally. If the
|
117
|
+
default branch is _not set_ then Git Lint will fall back to `master` for backwards compatibility.
|
118
|
+
When the next major version is released, the default branch fallback will change from `master` to
|
119
|
+
`main`. You can set your default branch at any time by running the following from the command line:
|
120
|
+
|
121
|
+
[source,bash]
|
122
|
+
----
|
123
|
+
git config --add init.defaultBranch main
|
124
|
+
----
|
125
|
+
|
126
|
+
💡 When setting your default branch, ensure you use a consistent Git configuration across all of
|
127
|
+
your environments.
|
128
|
+
|
118
129
|
=== Configuration
|
119
130
|
|
120
131
|
This gem can be configured via a global configuration:
|
@@ -293,7 +304,7 @@ maintenance costs for you. To configure global Git Hooks, add the following to y
|
|
293
304
|
....
|
294
305
|
|
295
306
|
Then you can customize Git Hooks for all of your projects.
|
296
|
-
link:https://github.com/bkuhlmann/dotfiles/tree/
|
307
|
+
link:https://github.com/bkuhlmann/dotfiles/tree/main/home_files/.config/git/hooks[Check out these
|
297
308
|
examples].
|
298
309
|
|
299
310
|
If a global configuration is not desired, you can add Git Hooks at a per project level by editing
|
@@ -378,7 +389,7 @@ have a build server that is not listed, please log an issue or provide an implem
|
|
378
389
|
support.
|
379
390
|
|
380
391
|
Calculation of commits is done by reviewing all commits made on the feature branch since branching
|
381
|
-
from `
|
392
|
+
from `main`.
|
382
393
|
|
383
394
|
==== link:https://circleci.com[Circle CI]
|
384
395
|
|
@@ -736,9 +747,12 @@ Ensures the commit subject uses consistent prefixes that explain _what_ is being
|
|
736
747
|
* *Updated* - Identifies what was updated. The commit should be as small as possible and _not add
|
737
748
|
or fix_ existing behavior. This can sometimes be a grey area but is typically reserved for updates
|
738
749
|
to documentation, code comments, dependencies, etc.
|
739
|
-
* *Refactored* - Identifies what was refactored.
|
740
|
-
|
741
|
-
|
750
|
+
* *Refactored* - Identifies what was refactored.
|
751
|
+
link:https://thoughtbot.com/blog/lets-not-misuse-refactoring[_Refactoring is for changing code
|
752
|
+
structure without changing observable behavior_]. The commit should be as small as possible and
|
753
|
+
not mix multiple kinds of changes at once. Refactored code should never break existing
|
754
|
+
implementation behavior or corresponding specs because, if that happens, then one of the other
|
755
|
+
four prefixes is what you want to use instead.
|
742
756
|
|
743
757
|
In practice, using a prefix other than what has been detailed above to explain _what_ is being
|
744
758
|
committed is never needed. These prefixes are not only short and easy to remember but also have the
|
@@ -870,7 +884,7 @@ worth considering:
|
|
870
884
|
blindly combine multiple commit messages without editing them into a single, coherent message._
|
871
885
|
* Use `git rebase --interactive` when cleaning up commit history, order, messages, etc. This should
|
872
886
|
be done prior to submitting a code review or when code review feedback has been addressed and
|
873
|
-
you are ready to rebase onto `
|
887
|
+
you are ready to rebase onto `main`.
|
874
888
|
* Use `git push --force-with-lease` instead of `git push --force` when pushing changes after an
|
875
889
|
interactive rebasing session.
|
876
890
|
* Avoid checking in development-specific configuration files (add to `.gitignore` instead).
|
@@ -915,23 +929,28 @@ configuration disabled.
|
|
915
929
|
* Use small, atomic commits:
|
916
930
|
** Easier to review and provide feedback.
|
917
931
|
** Easier to review implementation and corresponding tests.
|
918
|
-
** Easier to document with detailed
|
919
|
-
request).
|
932
|
+
** Easier to document with detailed subjects (especially when grouped together in a pull request).
|
920
933
|
** Easier to reword, edit, squash, fix, or drop when interactively rebasing.
|
921
934
|
** Easier to combine together versus tearing apart a larger commit into smaller commits.
|
922
935
|
* Use logically ordered commits:
|
923
936
|
** Each commit should tell a story and be a logical building block to the next commit.
|
937
|
+
** Each commit should, ideally, be the implementation plus corresponding test. Avoid committing
|
938
|
+
changes that are a jumble of mixed ideas as they are hard to decipher and a huge insult not only
|
939
|
+
to the reviewer but your future self.
|
924
940
|
** Each commit, when reviewed in order, should be able to explain _how_ the feature or bug fix was
|
925
941
|
completed and implemented properly.
|
942
|
+
* Keep refactored code separate from behavioral changes. This makes the review process easier
|
943
|
+
because you don't have to sift through all the line and format changes to figure out what is new
|
944
|
+
or changed.
|
926
945
|
|
927
946
|
=== Branches
|
928
947
|
|
929
948
|
* Use feature branches for new work.
|
930
|
-
* Maintain branches by rebasing upon `
|
949
|
+
* Maintain branches by rebasing upon `main` on a regular basis.
|
931
950
|
|
932
951
|
=== Tags
|
933
952
|
|
934
|
-
* Use tags to denote milestones/releases:
|
953
|
+
* Use tags to denote link:https://www.alchemists.io/projects/milestoner[milestones]/releases:
|
935
954
|
** Makes it easier to record milestones and capture associated release notes.
|
936
955
|
** Makes it easier to compare differences between versions.
|
937
956
|
** Provides a starting point for debugging production issues (if any).
|
@@ -949,114 +968,15 @@ configuration disabled.
|
|
949
968
|
* Use hooks globally rather than locally per project. Doing this applies the same functionality
|
950
969
|
across all projects automatically, reduces maintenance per project, and provides consistency
|
951
970
|
across all projects. This can best be managed via your
|
952
|
-
link:https://github.com/bkuhlmann/dotfiles/tree/
|
971
|
+
link:https://github.com/bkuhlmann/dotfiles/tree/main/home_files/.config/git/hooks[Dotfiles].
|
953
972
|
* Avoid forcing global or local project hooks as a team-wide mandate. Hooks are a personal tool much
|
954
973
|
like editors or other tools one choose to do their work. For team consistency, use a continuous
|
955
974
|
integration build server instead.
|
956
975
|
|
957
976
|
=== Code Reviews
|
958
977
|
|
959
|
-
|
960
|
-
|
961
|
-
. *Quality*: Ensures changes are of highest quality that adhere to team standards while enhancing
|
962
|
-
the customer experience and not disrupting their workflow.
|
963
|
-
. *Education*: Provides a chance for everyone on the team to learn more about the architecture,
|
964
|
-
product/service, and how each member of the team implements a solution. This is your chance to
|
965
|
-
ask questions and learn how to be a better engineer so take advantage of it.
|
966
|
-
|
967
|
-
In addition to the objectives above, the following guidelines are worth following:
|
968
|
-
|
969
|
-
* Keep code reviews short and easy to review:
|
970
|
-
** Provide a high level overview that answers _why_ the code review is necessary.
|
971
|
-
** Provide a link to the issue/task that prompted the code review (if any).
|
972
|
-
** Provide screenshots/screencasts if possible.
|
973
|
-
** Ensure commits within the code review are related to the purpose of the code review.
|
974
|
-
** Prefer code reviews at about 250 lines in order to keep the quality of the code review and defect
|
975
|
-
detection high.
|
976
|
-
** Avoid working on a large issue without getting feedback first in order to not overwhelm/surprise
|
977
|
-
the maintainers. More discussion up front will help ensure your work has a faster chance of
|
978
|
-
acceptance.
|
979
|
-
* Review and rebase code reviews quickly:
|
980
|
-
** Maintain a consistent but reasonable pace -- Review morning, noon, and night.
|
981
|
-
** Avoid letting code reviews linger more than a day. Otherwise, you risk hampering moral and
|
982
|
-
diminishing the productivity of the team.
|
983
|
-
* Use emojis, with a format of `<emoji> <feedback>`, to identify the kinds of feedback used during
|
984
|
-
the review process:
|
985
|
-
** 🍵 (`:tea:`) - Signifies you are starting the code review. This is _non-blocking_ and
|
986
|
-
informational. Useful when reading over a code review with a large number of commits, complex
|
987
|
-
code, requires additional testing by the reviewer, etc.
|
988
|
-
** ⭐️ (`:star:`) - Signifies code that is liked, favorited, remarkable, etc. This feedback is
|
989
|
-
_non-blocking_ and is always meant to be positive/uplifting.
|
990
|
-
** ℹ️ (`:information_source:`) - Signifies informational feedback that is
|
991
|
-
_non-blocking_. Can also be used to let one know you are done reviewing but haven't approved yet
|
992
|
-
(due to feedback that needs addressing), rebasing a code review and then merging, waiting for a
|
993
|
-
blocking code review to be resolved, status updates to the code review, etc.
|
994
|
-
** 💭 (`:thought_balloon:`) - Signifies inquisitive intent that is _non-blocking_.
|
995
|
-
Useful when asking questions and/or probing deeper into implementation details to learn more.
|
996
|
-
** 🔤 (`:abc:`) - Signifies detection of a misspelling with suggested correction. This is
|
997
|
-
_blocking_ feedback that is easy to correct.
|
998
|
-
** 🎨 (`:art:`) - Signifies an issue with code style and/or code quality. This can be _blocking_
|
999
|
-
or _non-blocking_ feedback. It is up to the discretion of the author on how to address the
|
1000
|
-
feedback but encouraged that the feedback is incorporated or at least discussed. Generally,
|
1001
|
-
these situations are automatically detected via code linters but there are occasions where
|
1002
|
-
there is ambiguity in which linters can't catch.
|
1003
|
-
** 🏛 (`:classical_building:`) - Signifies an issue with the architecture of the
|
1004
|
-
implementation. This is _blocking_ and requires immediate correction. The reviewer should
|
1005
|
-
provide a suggested solution and/or links to patterns, articles, etc. that might help the author
|
1006
|
-
fix the implementation. Pairing is encouraged if feedback is vast and/or complex.
|
1007
|
-
** 🔒 (`:lock:`) - Signifies a security violation that would damage us and/or our customers. This is
|
1008
|
-
_blocking_ feedback and must be addressed immediately.
|
1009
|
-
** 💡 (`:bulb:`) - Indicates a helpful tip or trick for improving the code. This can be
|
1010
|
-
_blocking_ or _non-blocking_ feedback and is left up to the author to decide. Generally, it is a
|
1011
|
-
good idea to address and resolve the feedback.
|
1012
|
-
** 🙇 (`:bow:`) - Indicates thankfulness of the feedback received. This is _non-blocking_ and
|
1013
|
-
always meant as a response to helpful feedback.
|
1014
|
-
** ✅ (`:white_check_mark:`) - Signifies code review approval. The author can
|
1015
|
-
rebase onto `master` and delete the feature branch at this point.
|
1016
|
-
* Use face-to-face communication if a code review's written discussion gets lengthy/noisy.
|
1017
|
-
* Create new tasks/actions if additional features are discovered during a code review to avoid
|
1018
|
-
delaying code review acceptance. Return to the code review once tasks have been logged.
|
1019
|
-
* The author, not the reviewer, should rebase the feature branch onto `master` upon approval.
|
1020
|
-
* Avoid reviewing your own code review before rebasing onto `master`. Have another pair of eyes
|
1021
|
-
review your code first.
|
1022
|
-
* Ensure the following criteria is met before rebasing your feature branch to `master`:
|
1023
|
-
** Ensure all `fixup!` and `squash!` commits are interactively rebased. _Avoid rebasing these onto
|
1024
|
-
the `master` branch!_
|
1025
|
-
** Ensure your feature branch is rebased upon `master`.
|
1026
|
-
** Ensure all tests and code quality checks are passing.
|
1027
|
-
** Ensure the feature branch is deleted after being successfully rebased.
|
1028
|
-
|
1029
|
-
=== GitHub
|
1030
|
-
|
1031
|
-
When using GitHub, enforce a rebase workflow for all of your GitHub projects (_highly recommended_).
|
1032
|
-
You can do this via your project options (i.e. `https://github.com/<username/<project>/settings`)
|
1033
|
-
and editing your merge options for code reviews as follows:
|
1034
|
-
|
1035
|
-
image::https://www.alchemists.io/images/projects/git-lint/screenshots/github-settings-options.png[GitHub Merge Options]
|
1036
|
-
|
1037
|
-
In addition to the above, you'll want to add _branch_ protection rules for your `master` branch. To
|
1038
|
-
do this, follow these steps:
|
1039
|
-
|
1040
|
-
. Visit your branch settings (i.e. `https://github.com/<username>/<project>/settings/branches`).
|
1041
|
-
. Click the _Add rule_ button.
|
1042
|
-
. For _branch name pattern_, enter: `master`.
|
1043
|
-
. Check _Require pull request reviews before merging_.
|
1044
|
-
. Set _Required approving reviews_ to `2` as a minimum.
|
1045
|
-
. Check _Dismiss stale pull request approvals when new commits are pushed_.
|
1046
|
-
. Check _Require review from Code Owners_.
|
1047
|
-
. Check _Require status checks to pass before merging_.
|
1048
|
-
. Check _Require branches to be up to date before merging_.
|
1049
|
-
. Check _Require signed commits_.
|
1050
|
-
. Check _Require linear history_ (pairs well with the merge options mentioned above).
|
1051
|
-
. Check _Include administrators_.
|
1052
|
-
. Uncheck _Allow force pushes_.
|
1053
|
-
. Uncheck _Allow deletions_.
|
1054
|
-
|
1055
|
-
With the above applied, you should have the following result:
|
1056
|
-
|
1057
|
-
image::https://www.alchemists.io/images/projects/git-lint/screenshots/github-settings-branch_protections.png[GitHub Branch Protections]
|
1058
|
-
|
1059
|
-
Applying the above changes will help maintain a clean Git history.
|
978
|
+
For an in depth look at how to conduct code reviews, please read my
|
979
|
+
link:https://www.alchemists.io/articles/code_reviews[article] on this subject to learn more.
|
1060
980
|
|
1061
981
|
== Development
|
1062
982
|
|
data/lib/git/lint.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "git_plus"
|
3
4
|
require "git/lint/identity"
|
4
|
-
require "git/kit/repo"
|
5
5
|
require "git/lint/refinements/strings"
|
6
6
|
require "git/lint/errors/base"
|
7
7
|
require "git/lint/errors/severity"
|
@@ -11,8 +11,6 @@ require "git/lint/validators/email"
|
|
11
11
|
require "git/lint/validators/name"
|
12
12
|
require "git/lint/validators/capitalization"
|
13
13
|
require "git/lint/parsers/trailers/collaborator"
|
14
|
-
require "git/lint/commits/saved"
|
15
|
-
require "git/lint/commits/unsaved"
|
16
14
|
require "git/lint/branches/environments/local"
|
17
15
|
require "git/lint/branches/environments/circle_ci"
|
18
16
|
require "git/lint/branches/environments/git_hub_action"
|
@@ -91,10 +91,10 @@ module Git
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
95
|
-
commit.
|
94
|
+
def affected_commit_trailers
|
95
|
+
commit.trailers
|
96
96
|
.each.with_object([])
|
97
|
-
.with_index(commit.
|
97
|
+
.with_index(commit.trailers_index) do |(line, lines), index|
|
98
98
|
yield if block_given?
|
99
99
|
lines << self.class.build_issue_line(index, line) if invalid_line? line
|
100
100
|
end
|
@@ -12,12 +12,12 @@ module Git
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def valid?
|
15
|
-
|
16
|
-
subject, body =
|
15
|
+
message = commit.message
|
16
|
+
subject, body = message.split "\n", 2
|
17
17
|
|
18
18
|
return true if !String(subject).empty? && String(body).strip.empty?
|
19
19
|
|
20
|
-
|
20
|
+
message.match?(/\A.+(\n\n|\#).+/m)
|
21
21
|
end
|
22
22
|
|
23
23
|
def issue
|
@@ -23,7 +23,7 @@ module Git
|
|
23
23
|
# rubocop:enable Metrics/ParameterLists
|
24
24
|
|
25
25
|
def valid?
|
26
|
-
|
26
|
+
affected_commit_trailers.empty?
|
27
27
|
end
|
28
28
|
|
29
29
|
def issue
|
@@ -31,7 +31,7 @@ module Git
|
|
31
31
|
|
32
32
|
{
|
33
33
|
hint: "Name must be capitalized.",
|
34
|
-
lines:
|
34
|
+
lines: affected_commit_trailers
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
@@ -20,7 +20,7 @@ module Git
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def valid?
|
23
|
-
|
23
|
+
affected_commit_trailers.empty?
|
24
24
|
end
|
25
25
|
|
26
26
|
def issue
|
@@ -28,7 +28,7 @@ module Git
|
|
28
28
|
|
29
29
|
{
|
30
30
|
hint: "Avoid duplication.",
|
31
|
-
lines:
|
31
|
+
lines: affected_commit_trailers
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -47,7 +47,7 @@ module Git
|
|
47
47
|
zeros = Hash.new { |new_hash, missing_key| new_hash[missing_key] = 0 }
|
48
48
|
|
49
49
|
zeros.tap do |collection|
|
50
|
-
commit.
|
50
|
+
commit.trailers.each { |line| collection[line] += 1 if parser.new(line).match? }
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -24,7 +24,7 @@ module Git
|
|
24
24
|
# rubocop:enable Metrics/ParameterLists
|
25
25
|
|
26
26
|
def valid?
|
27
|
-
|
27
|
+
affected_commit_trailers.empty?
|
28
28
|
end
|
29
29
|
|
30
30
|
def issue
|
@@ -32,7 +32,7 @@ module Git
|
|
32
32
|
|
33
33
|
{
|
34
34
|
hint: %(Email must follow name and use format: "<name@server.domain>".),
|
35
|
-
lines:
|
35
|
+
lines: affected_commit_trailers
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
@@ -20,7 +20,7 @@ module Git
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def valid?
|
23
|
-
|
23
|
+
affected_commit_trailers.empty?
|
24
24
|
end
|
25
25
|
|
26
26
|
def issue
|
@@ -28,7 +28,7 @@ module Git
|
|
28
28
|
|
29
29
|
{
|
30
30
|
hint: "Use format: #{filter_list.to_hint}.",
|
31
|
-
lines:
|
31
|
+
lines: affected_commit_trailers
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -25,7 +25,7 @@ module Git
|
|
25
25
|
# rubocop:enable Metrics/ParameterLists
|
26
26
|
|
27
27
|
def valid?
|
28
|
-
|
28
|
+
affected_commit_trailers.empty?
|
29
29
|
end
|
30
30
|
|
31
31
|
def issue
|
@@ -33,7 +33,7 @@ module Git
|
|
33
33
|
|
34
34
|
{
|
35
35
|
hint: "Name must follow key and consist of #{minimum} parts (minimum).",
|
36
|
-
lines:
|
36
|
+
lines: affected_commit_trailers
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
@@ -6,21 +6,21 @@ module Git
|
|
6
6
|
module Environments
|
7
7
|
# Provides Circle CI build environment feature branch information.
|
8
8
|
class CircleCI
|
9
|
-
def initialize
|
10
|
-
@
|
9
|
+
def initialize repository: GitPlus::Repository.new
|
10
|
+
@repository = repository
|
11
11
|
end
|
12
12
|
|
13
13
|
def name
|
14
|
-
"origin/#{
|
14
|
+
"origin/#{repository.branch_name}"
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def commits
|
18
|
+
repository.commits "origin/#{repository.branch_default}..#{name}"
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
attr_reader :
|
23
|
+
attr_reader :repository
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|