Skip to content

Commit f4f54f9

Browse files
committed
Edit rationales.
1 parent c469110 commit f4f54f9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Scripts/o2_linter.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def run(self, path: str, content) -> bool:
234234
# print(f"Running test {self.name} for {path} with {len(content)} lines")
235235
if self.per_line:
236236
for i, line in enumerate(content):
237-
if not isinstance(self, TestUsingDirectives): # Keep the indentation if needed.
237+
if not isinstance(self, TestUsingDirective): # Keep the indentation if needed.
238238
line = line.strip()
239239
if not line:
240240
continue
@@ -260,12 +260,12 @@ def run(self, path: str, content) -> bool:
260260
# Bad practice
261261

262262

263-
class TestIOStream(TestSpec):
263+
class TestIoStream(TestSpec):
264264
"""Detect included iostream."""
265265

266266
name = "include-iostream"
267267
message = "Do not include iostream. Use O2 logging instead."
268-
rationale = "Avoid injection of static constructors. Use common logging framework."
268+
rationale = "Performance. Avoid injection of static constructors. Consistent logging."
269269
references = [Reference.LLVM, Reference.LINTER]
270270
suffixes = [".h", ".cxx"]
271271

@@ -280,7 +280,7 @@ class TestUsingStd(TestSpec):
280280

281281
name = "import-std-name"
282282
message = "Do not import names from the std namespace in headers."
283-
rationale = "Avoid namespace pollution with common names."
283+
rationale = "Code safety. Avoid namespace pollution with common names."
284284
references = [Reference.LINTER]
285285
suffixes = [".h"]
286286

@@ -290,12 +290,12 @@ def test_line(self, line: str) -> bool:
290290
return not line.startswith("using std::")
291291

292292

293-
class TestUsingDirectives(TestSpec):
293+
class TestUsingDirective(TestSpec):
294294
"""Detect using directives in headers."""
295295

296296
name = "using-directive"
297297
message = "Do not put using directives at global scope in headers."
298-
rationale = "Avoid namespace pollution."
298+
rationale = "Code safety. Avoid namespace pollution."
299299
references = [Reference.O2, Reference.ISO_CPP, Reference.LLVM, Reference.GOOGLE, Reference.LINTER]
300300
suffixes = [".h"]
301301

@@ -565,7 +565,7 @@ class TestLogging(TestSpec):
565565

566566
name = "logging"
567567
message = "Use O2 logging (LOG, LOGF, LOGP)."
568-
rationale = "Logs easier to read and process."
568+
rationale = "Logs easy to read and process."
569569
references = [Reference.LINTER]
570570
suffixes = [".h", ".cxx"]
571571

@@ -585,7 +585,7 @@ class TestConstRefInForLoop(TestSpec):
585585

586586
name = "const-ref-in-for-loop"
587587
message = "Use constant references for non-modified iterators in range-based for loops."
588-
rationale = "Performance, code safety."
588+
rationale = "Performance, code comprehensibility and safety."
589589
references = [Reference.O2, Reference.ISO_CPP, Reference.LLVM]
590590
suffixes = [".h", ".cxx", ".C"]
591591

@@ -606,7 +606,7 @@ class TestConstRefInSubscription(TestSpec):
606606

607607
name = "const-ref-in-process"
608608
message = "Use constant references for table subscriptions in process functions."
609-
rationale = "Performance, code safety."
609+
rationale = "Performance, code comprehensibility and safety."
610610
references = [Reference.O2, Reference.ISO_CPP, Reference.LINTER]
611611
suffixes = [".cxx"]
612612
per_line = False
@@ -1614,9 +1614,9 @@ def main():
16141614
# Bad practice
16151615
enable_bad_practice = True
16161616
if enable_bad_practice:
1617-
tests.append(TestIOStream())
1617+
tests.append(TestIoStream())
16181618
tests.append(TestUsingStd())
1619-
tests.append(TestUsingDirectives())
1619+
tests.append(TestUsingDirective())
16201620
tests.append(TestStdPrefix())
16211621
tests.append(TestRootEntity())
16221622
tests.append(TestRootLorentzVector())

0 commit comments

Comments
 (0)