This question is locked. New answers and comments are not allowed.
Hello,
Could you review your logic to apply the blocks to the single line statements?
What I don't like in the current implementation is how JC treats comments.
Compare the following code with the option "Always except for single line statements":
My suggestion is simple: define "single line statements" as a real single line no matter of what (code/comment/etc)
Could you review your logic to apply the blocks to the single line statements?
What I don't like in the current implementation is how JC treats comments.
Compare the following code with the option "Always except for single line statements":
My suggestion is simple: define "single line statements" as a real single line no matter of what (code/comment/etc)
// Case 1: no issues here
if
(System.Globalization.CultureInfo.InvariantCulture.Name ==
"en-CA"
)
language =
string
.Format(
"EN:{0}"
, someDescription);
else
language =
string
.Format(
"FR:{0}"
, someDescription);
// Case 2: no issues here.
if
(System.Globalization.CultureInfo.InvariantCulture.Name ==
"en-CA"
)
{
language =
string
.Format(
"EN:{0}"
,
someDescription);
}
else
{
language =
string
.Format(
"FR:{0}"
,
someDescription);
}
// Case 3: here is the issue! Visually, there is no difference from case 2!
if
(System.Globalization.CultureInfo.InvariantCulture.Name ==
"en-CA"
)
// Comment line 1
language =
string
.Format(
"EN:{0}"
, someDescription);
else
// Comment line 1
language =
string
.Format(
"FR:{0}"
, someDescription);
// Case 4: even worse!
if
(System.Globalization.CultureInfo.InvariantCulture.Name ==
"en-CA"
)
// Comment line 1
// Comment line 2
// Comment line 3
// Comment line 4
// Comment line 5
language =
string
.Format(
"EN:{0}"
, someDescription);
else
// Comment line 1
// Comment line 2
// Comment line 3
// Comment line 4
// Comment line 5
language =
string
.Format(
"FR:{0}"
, someDescription);