Skip to content

Commit 8e7c7c6

Browse files
marc-hbcarlescufi
authored andcommittedSep 21, 2023
.gitlint: de-duplicate defaults with zephyr_commit_rules.py
We don't need to have two different sets of Zephyr-specific default values overriding one another, it's confusing. Note this commit makes NO functional change, the effective defaults stay the same. It does however make it easier to change defaults in the future. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent b0303f5 commit 8e7c7c6

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed
 

‎.gitlint

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# All these sections are optional, edit this file as you like.
2+
# Zephyr-specific defaults are located in scripts/gitlint/zephyr_commit_rules.py
23
[general]
34
ignore=title-trailing-punctuation, T3, title-max-length, T1, body-hard-tab, B3, B1
45
# verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this
@@ -16,13 +17,13 @@ debug = false
1617
extra-path=scripts/gitlint
1718

1819
[title-max-length-no-revert]
19-
line-length=75
20+
# line-length=75
2021

2122
[body-min-line-count]
22-
min-line-count=1
23+
# min-line-count=1
2324

2425
[body-max-line-count]
25-
max-line-count=200
26+
# max-line-count=200
2627

2728
[title-starts-with-subsystem]
2829
regex = ^(?!subsys:)(([^:]+):)(\s([^:]+):)*\s(.+)$
@@ -42,7 +43,7 @@ words=wip
4243

4344
[max-line-length-with-exceptions]
4445
# B1 = body-max-line-length
45-
line-length=75
46+
# line-length=75
4647

4748
[body-min-length]
4849
min-length=3

‎scripts/gitlint/zephyr_commit_rules.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class BodyMinLineCount(CommitRule):
2424
# A rule MUST have an *unique* id, we recommend starting with UC (for User-defined Commit-rule).
2525
id = "UC6"
2626

27-
# A rule MAY have an option_spec if its behavior should be configurable.
28-
options_spec = [IntOption('min-line-count', 2, "Minimum body line count excluding Signed-off-by")]
27+
# A rule MAY have an options_spec if its behavior should be configurable.
28+
options_spec = [IntOption('min-line-count', 1, "Minimum body line count excluding Signed-off-by")]
2929

3030
def validate(self, commit):
3131
filtered = [x for x in commit.message.body if not x.lower().startswith("signed-off-by") and x != '']
@@ -42,8 +42,8 @@ class BodyMaxLineCount(CommitRule):
4242
# A rule MUST have an *unique* id, we recommend starting with UC (for User-defined Commit-rule).
4343
id = "UC1"
4444

45-
# A rule MAY have an option_spec if its behavior should be configurable.
46-
options_spec = [IntOption('max-line-count', 3, "Maximum body line count")]
45+
# A rule MAY have an options_spec if its behavior should be configurable.
46+
options_spec = [IntOption('max-line-count', 200, "Maximum body line count")]
4747

4848
def validate(self, commit):
4949
line_count = len(commit.message.body)
@@ -78,7 +78,7 @@ class TitleMaxLengthRevert(LineRule):
7878
name = "title-max-length-no-revert"
7979
id = "UC5"
8080
target = CommitMessageTitle
81-
options_spec = [IntOption('line-length', 72, "Max line length")]
81+
options_spec = [IntOption('line-length', 75, "Max line length")]
8282
violation_message = "Commit title exceeds max length ({0}>{1})"
8383

8484
def validate(self, line, _commit):
@@ -103,7 +103,7 @@ class MaxLineLengthExceptions(LineRule):
103103
name = "max-line-length-with-exceptions"
104104
id = "UC4"
105105
target = CommitMessageBody
106-
options_spec = [IntOption('line-length', 80, "Max line length")]
106+
options_spec = [IntOption('line-length', 75, "Max line length")]
107107
violation_message = "Commit message body line exceeds max length ({0}>{1})"
108108

109109
def validate(self, line, _commit):

0 commit comments

Comments
 (0)
Please sign in to comment.