Skip to content

Commit a928928

Browse files
committed
ruff: format gitlint rules
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
1 parent 4c4e188 commit a928928

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed
Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
from gitlint.rules import LineRule, RuleViolation, CommitMessageTitle, CommitRule
22

3+
34
class BodyContainsOnBehalfOfSAPMarker(CommitRule):
4-
"""Enforce that each commit coming from an SAP contractor contains an
5-
"On-behalf-of SAP user@sap.com" marker.
6-
"""
5+
"""Enforce that each commit coming from an SAP contractor contains an
6+
"On-behalf-of SAP user@sap.com" marker.
7+
"""
78

8-
# A rule MUST have a human friendly name
9-
name = "body-requires-on-behalf-of-sap"
9+
# A rule MUST have a human friendly name
10+
name = "body-requires-on-behalf-of-sap"
1011

11-
# A rule MUST have a *unique* id
12-
# We recommend starting with UC (for User-defined Commit-rule).
13-
id = "UC-sap"
12+
# A rule MUST have a *unique* id
13+
# We recommend starting with UC (for User-defined Commit-rule).
14+
id = "UC-sap"
1415

15-
# Lower-case list of contractors
16-
contractors = [
17-
"@cyberus-technology.de"
18-
]
16+
# Lower-case list of contractors
17+
contractors = ["@cyberus-technology.de"]
1918

20-
# Marker followed by " name.surname@sap.com"
21-
marker = "On-behalf-of: SAP"
19+
# Marker followed by " name.surname@sap.com"
20+
marker = "On-behalf-of: SAP"
2221

23-
def validate(self, commit):
24-
if "@sap.com" in commit.author_email.lower():
25-
return
22+
def validate(self, commit):
23+
if "@sap.com" in commit.author_email.lower():
24+
return
2625

27-
# Allow third-party open-source contributions
28-
if not any(contractor in commit.author_email.lower() for contractor in self.contractors):
29-
return
26+
# Allow third-party open-source contributions
27+
if not any(
28+
contractor in commit.author_email.lower() for contractor in self.contractors
29+
):
30+
return
3031

31-
for line in commit.message.body:
32-
if line.startswith(self.marker) and "@sap.com" in line.lower():
33-
return
32+
for line in commit.message.body:
33+
if line.startswith(self.marker) and "@sap.com" in line.lower():
34+
return
3435

35-
msg = f"Body does not contain a '{self.marker} user@sap.com' line"
36-
return [RuleViolation(self.id, msg, line_nr=1)]
36+
msg = f"Body does not contain a '{self.marker} user@sap.com' line"
37+
return [RuleViolation(self.id, msg, line_nr=1)]

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
}
129129
''
130130
cp -r ${cleanSrc}/. .
131-
ruff format --check ./tests
131+
ruff format --check .
132132
mkdir $out
133133
'';
134134
pythonLint =

0 commit comments

Comments
 (0)