Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gitlint: de-duplicate defaults with zephyr_commit_rules.py #62876

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# All these sections are optional, edit this file as you like.
# Zephyr-specific defaults are located in scripts/gitlint/zephyr_commit_rules.py
[general]
ignore=title-trailing-punctuation, T3, title-max-length, T1, body-hard-tab, B3, B1
# verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this
Expand All @@ -16,13 +17,13 @@ debug = false
extra-path=scripts/gitlint

[title-max-length-no-revert]
line-length=75
# line-length=75

[body-min-line-count]
min-line-count=1
# min-line-count=1

[body-max-line-count]
max-line-count=200
# max-line-count=200

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

[max-line-length-with-exceptions]
# B1 = body-max-line-length
line-length=75
# line-length=75

[body-min-length]
min-length=3
Expand Down
12 changes: 6 additions & 6 deletions scripts/gitlint/zephyr_commit_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class BodyMinLineCount(CommitRule):
# A rule MUST have an *unique* id, we recommend starting with UC (for User-defined Commit-rule).
id = "UC6"

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

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

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

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

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

def validate(self, line, _commit):
Expand Down
Loading