Skip to content

Commit 06b5ff5

Browse files
committed
lowercase UDA TOLINT --> tolint
1 parent 39757e1 commit 06b5ff5

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

src/dscanner/analysis/base.d

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,14 @@ mixin template AnalyzerInfo(string checkName)
374374

375375
auto isNoLintUDAForCurrentCheck(in string udaContent, in string check)
376376
{
377-
import std.algorithm: map;
378-
import std.ascii: toUpper;
379-
import std.conv: to;
380-
381-
auto re = regex(`\w+`, "gi");
377+
auto re = regex(`\w+`, "g");
382378
auto matches = matchAll(udaContent, re);
383379

384380
if(!matches)
385381
return false;
386382

387383
const udaName = matches.hit;
388-
if(udaName.map!(c => c.toUpper).to!string != "NOLINT")
384+
if(udaName != "nolint")
389385
return false;
390386

391387
matches.popFront;
@@ -403,11 +399,10 @@ auto isNoLintUDAForCurrentCheck(in string udaContent, in string check)
403399

404400
unittest
405401
{
406-
const s1 = "NOLINT(abc)";
407-
const s2 = "NOLINT(abc, efg, hij)";
408-
const s3 = "nolint(abc)";
409-
const s4 = " NOLINT ( abc , efg ) ";
410-
const s5 = "OtherUda(abc)";
402+
const s1 = "nolint(abc)";
403+
const s2 = "nolint(abc, efg, hij)";
404+
const s3 = " nolint ( abc , efg ) ";
405+
const s4 = "OtherUda(abc)";
411406

412407
assert(isNoLintUDAForCurrentCheck(s1, "abc"));
413408
assert(!isNoLintUDAForCurrentCheck(s1, "efg"));
@@ -418,13 +413,10 @@ unittest
418413
assert(!isNoLintUDAForCurrentCheck(s2, "kel"));
419414

420415
assert(isNoLintUDAForCurrentCheck(s3, "abc"));
421-
assert(!isNoLintUDAForCurrentCheck(s3, "efg"));
422-
423-
assert(isNoLintUDAForCurrentCheck(s4, "abc"));
424-
assert(isNoLintUDAForCurrentCheck(s4, "efg"));
425-
assert(!isNoLintUDAForCurrentCheck(s4, "hij"));
416+
assert(isNoLintUDAForCurrentCheck(s3, "efg"));
417+
assert(!isNoLintUDAForCurrentCheck(s3, "hij"));
426418

427-
assert(!isNoLintUDAForCurrentCheck(s5, "abc"));
419+
assert(!isNoLintUDAForCurrentCheck(s4, "abc"));
428420
}
429421

430422

@@ -577,7 +569,7 @@ protected:
577569
return this.errorMsgDisabled == 0;
578570
}
579571

580-
// Disable error message if declaration contains UDA : @("NOLINT(..)")
572+
// Disable error message if declaration contains UDA : @("nolint(..)")
581573
// that indicates to skip linting on this declaration
582574
// Return wheter the message is actually disabled or not
583575
bool maybeDisableErrorMessage(const Declaration decl)

src/dscanner/analysis/useless_initializer.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,12 @@ public:
370370

371371
// passes
372372
assertAnalyzerWarnings(q{
373-
@("NOLINT(useless_initializer)")
373+
@("nolint(useless_initializer)")
374374
int a = 0;
375375
ubyte a = 0x0; /+
376376
^^^ [warn]: X +/
377377

378-
@("NOLINT(useless_initializer)")
378+
@("nolint(useless_initializer)")
379379
int f() {
380380
int[] a = null;
381381
}

0 commit comments

Comments
 (0)