Project
ReSharper
Priority
Show-stopper
Type
Bug
Fix versions
2.5.1, 3.0
State
Fixed
Assignee
Andrey Simanovsky
Subsystem
Context actions
Affected versions
No Affected versions
Fixed in build
No Fixed in build
  • Created by   Serge Baltic
    5 years ago (04 Oct 2006 23:16)
  • Updated by   Serge Baltic
    5 years ago (13 Dec 2006 22:03)
  • Jira: RSRP-29352
    (history, comments)
 
RSRP-29352 "Check if variable not equals null" ContextAction/QuickFix Should Respect Formatting Rules
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
An if clause is prepended to the current statement. Should be added on a new line, with braces inserted as appropriate.

string smth = "";
if(DateTime.Now.Second == 0)
  smth = null;
foreach(char c in smth)
{

}


In the foreach statement, use the "Check for 'null'" conetxt action on "smth". You get:

string smth = "";
if(DateTime.Now.Second == 0)
  smth = null;
if(smth != null) foreach(char c in smth)
{

}


After doing Reformat, it becomes:

string smth = "";
if(DateTime.Now.Second == 0)
  smth = null;
if(smth != null)
{
  foreach(char c in smth)
  {
  }
}


Should look this way right after applying the action.

Issue was closed
Comments (1)
 
History
 
Linked Issues (?)
 
TeamCity Changes (0)
 
Andrey Simanovsky
  Andrey Simanovsky
09 Oct 2006 22:06
5 years ago
Please, provide example and settings when it does not work.