Skip to content

[Style] Enforce a .. b opSlice style #5179

Merged
andralex merged 3 commits intodlang:masterfrom
wilzbach:style-space-opslice
Feb 22, 2017
Merged

[Style] Enforce a .. b opSlice style #5179
andralex merged 3 commits intodlang:masterfrom
wilzbach:style-space-opslice

Conversation

@wilzbach
Copy link
Contributor

Yet another check & automatic conversion.

@andralex I mainly did this because you keep nagging about this on PR reviews and there's really no point in wasting time during a review with such easily to check nits.
(for the record I prefer the a..b)

There were a few false positives with this very naive approach, hence I excluded the std.string and std.uni for the start.
Moreover, I hope you are aware of the following:

import std.conv, std.uni;
assert(unicode.ASCII.to!string == "[0..128)");

Commands:

sed -E "s/([[:alnum:]])[.][.]([[:alnum:]])/\1 .. \2/g" -i **/*.d
sed -E "s/([[:alnum:]])[.][.] ([[:alnum:]])/\1 .. \2/g" -i **/*.d
sed -E "s/([[:alnum:]]) [.][.]([[:alnum:]])/\1 .. \2/g" -i **/*.d
@wilzbach wilzbach force-pushed the style-space-opslice branch from 1162173 to 6c9b626 Compare February 22, 2017 05:33
Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilzbach I'm getting increasingly worried about false positives due to the regex-based enforcement. Are you considering rolling these into dscanner?

@andralex andralex merged commit b628836 into dlang:master Feb 22, 2017
@wilzbach wilzbach deleted the style-space-opslice branch February 22, 2017 16:39
@wilzbach
Copy link
Contributor Author

@wilzbach I'm getting increasingly worried about false positives due to the regex-based enforcement.

I am worried about that as well (this is only intended to be an intermediate solution).
In the worst case we can exclude specific files from a specific regex as done here.

Are you considering rolling these into dscanner?

Of course, but the PR is pending since quite a while: dlang-community/D-Scanner#348

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants