D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20343 - false positive in style checker, checking casts
Summary: false positive in style checker, checking casts
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-31 21:43 UTC by berni44
Modified: 2020-04-09 09:05 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description berni44 2019-10-31 21:43:30 UTC
The following unittest (in std.format) was rejected by the style checker:

@safe pure unittest
{
    enum A { one, two, three }
    
    string t2 = format("[%10s] [%-10s]", cast(A) 10, cast(A) 10);
    assert(t2 == "[ cast(A)10] [cast(A)10 ]");
}

The problem is the cast(A)10 inside the string.
Comment 1 Seb 2019-10-31 23:23:06 UTC
Sorry to hear this, but this issue should be moved to the Dscanner repository. BTW for a spurious detection, you can selective disable a test for a module via the .dscanner.ini file in phobos.
Comment 2 berni44 2019-11-07 10:24:50 UTC
Sorry, moved back. According to the discussion in the Dscanner repository [1], it's not related to Dscanner but just a wrong grep.

[1] https://github.com/dlang-community/D-Scanner/issues/781

But maybe, "tools" is the wrong component and it should be "phobos"?
Comment 3 Mathias LANG 2020-04-09 09:05:38 UTC
Not a tools issue, closing