Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f17213ac
Commit
f17213ac
authored
Jul 02, 2020
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove commit message 50 character soft limit
parent
4733ce3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
22 deletions
+2
-22
doc/development/contributing/merge_request_workflow.md
doc/development/contributing/merge_request_workflow.md
+1
-2
lib/gitlab/danger/commit_linter.rb
lib/gitlab/danger/commit_linter.rb
+0
-9
spec/lib/gitlab/danger/commit_linter_spec.rb
spec/lib/gitlab/danger/commit_linter_spec.rb
+1
-11
No files found.
doc/development/contributing/merge_request_workflow.md
View file @
f17213ac
...
...
@@ -119,8 +119,7 @@ document from the Kubernetes team also has some great points regarding this.
When writing commit messages, please follow the guidelines below:
-
The commit subject must contain at least 3 words.
-
The commit subject should ideally contain up to 50 characters,
and must not be longer than 72 characters.
-
The commit subject must not be longer than 72 characters.
-
The commit subject must start with a capital letter.
-
The commit subject must not end with a period.
-
The commit subject and body must be separated by a blank line.
...
...
lib/gitlab/danger/commit_linter.rb
View file @
f17213ac
...
...
@@ -8,8 +8,6 @@ module Gitlab
class
CommitLinter
MIN_SUBJECT_WORDS_COUNT
=
3
MAX_LINE_LENGTH
=
72
WARN_SUBJECT_LENGTH
=
50
URL_LIMIT_SUBJECT
=
"https://chris.beams.io/posts/git-commit/#limit-50"
MAX_CHANGED_FILES_IN_COMMIT
=
3
MAX_CHANGED_LINES_IN_COMMIT
=
30
SHORT_REFERENCE_REGEX
=
%r{([
\w\-\/
]+)?(#|!|&|%)
\d
+
\b
}
.
freeze
...
...
@@ -18,7 +16,6 @@ module Gitlab
PROBLEMS
=
{
subject_too_short:
"The %s must contain at least
#{
MIN_SUBJECT_WORDS_COUNT
}
words"
,
subject_too_long:
"The %s may not be longer than
#{
MAX_LINE_LENGTH
}
characters"
,
subject_above_warning:
"The %s length is acceptable, but please try to [reduce it to
#{
WARN_SUBJECT_LENGTH
}
characters](
#{
URL_LIMIT_SUBJECT
}
)"
,
subject_starts_with_lowercase:
"The %s must start with a capital letter"
,
subject_ends_with_a_period:
"The %s must not end with a period"
,
separator_missing:
"The commit subject and body must be separated by a blank line"
,
...
...
@@ -88,8 +85,6 @@ module Gitlab
if
subject_too_long?
add_problem
(
:subject_too_long
,
subject_description
)
elsif
subject_above_warning?
add_problem
(
:subject_above_warning
,
subject_description
)
end
if
subject_starts_with_lowercase?
...
...
@@ -195,10 +190,6 @@ module Gitlab
line_too_long?
(
subject
)
end
def
subject_above_warning?
subject
.
length
>
WARN_SUBJECT_LENGTH
end
def
subject_starts_with_lowercase?
first_char
=
subject
.
sub
(
/\A\[.+\]\s/
,
''
)[
0
]
first_char_downcased
=
first_char
.
downcase
...
...
spec/lib/gitlab/danger/commit_linter_spec.rb
View file @
f17213ac
...
...
@@ -156,7 +156,7 @@ RSpec.describe Gitlab::Danger::CommitLinter do
context
'when subject is a WIP'
do
let
(
:final_message
)
{
'A B C'
}
# commit message with prefix will be over max length. commit message without prefix will be of maximum size
let
(
:commit_message
)
{
described_class
::
WIP_PREFIX
+
final_message
+
'D'
*
(
described_class
::
WARN_SUBJECT
_LENGTH
-
final_message
.
size
)
}
let
(
:commit_message
)
{
described_class
::
WIP_PREFIX
+
final_message
+
'D'
*
(
described_class
::
MAX_LINE
_LENGTH
-
final_message
.
size
)
}
it
'does not have any problems'
do
commit_linter
.
lint
...
...
@@ -176,16 +176,6 @@ RSpec.describe Gitlab::Danger::CommitLinter do
end
end
context
'when subject is above warning'
do
let
(
:commit_message
)
{
'A B '
+
'C'
*
described_class
::
WARN_SUBJECT_LENGTH
}
it
'adds a problem'
do
expect
(
commit_linter
).
to
receive
(
:add_problem
).
with
(
:subject_above_warning
,
described_class
::
DEFAULT_SUBJECT_DESCRIPTION
)
commit_linter
.
lint
end
end
context
'when subject starts with lowercase'
do
let
(
:commit_message
)
{
'a B C'
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment