@@ -82,13 +82,13 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
8282 }
8383
8484 AddToDiagnosticRecords (
85- GetViolationForBraceOnSameLine ( tokens , k , openBracePos , fileName ) ,
85+ GetViolationForBraceShouldBeOnNewLine ( tokens , k , openBracePos , fileName ) ,
8686 ref diagnosticRecords ) ;
8787
8888 if ( NoEmptyLineBefore )
8989 {
9090 AddToDiagnosticRecords (
91- GetViolationForEmptyLineBeforeBrace ( tokens , k , openBracePos , fileName ) ,
91+ GetViolationForBraceShouldNotFollowEmptyLine ( tokens , k , openBracePos , fileName ) ,
9292 ref diagnosticRecords ) ;
9393 }
9494 }
@@ -102,7 +102,11 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
102102 return diagnosticRecords ;
103103 }
104104
105- private DiagnosticRecord GetViolationForEmptyLineBeforeBrace ( Token [ ] tokens , int closeBracePos , int openBracePos , string fileName )
105+ private DiagnosticRecord GetViolationForBraceShouldNotFollowEmptyLine (
106+ Token [ ] tokens ,
107+ int closeBracePos ,
108+ int openBracePos ,
109+ string fileName )
106110 {
107111 if ( tokens . Length > 2 && tokens . Length > closeBracePos )
108112 {
@@ -113,20 +117,28 @@ private DiagnosticRecord GetViolationForEmptyLineBeforeBrace(Token[] tokens, int
113117 && extraNewLineToken . Kind == TokenKind . NewLine )
114118 {
115119 return new DiagnosticRecord (
116- "Extra new line before close brace" ,
120+ GetError ( Strings . PlaceCloseBraceErrorShouldNotFollowEmptyLine ) ,
117121 closeBraceToken . Extent ,
118122 GetName ( ) ,
119123 GetDiagnosticSeverity ( ) ,
120124 fileName ,
121125 null ,
122- GetSuggestedCorrectionsForEmptyLineBeforeBrace ( tokens , closeBracePos , openBracePos , fileName ) ) ;
126+ GetCorrectionsForBraceShouldNotFollowEmptyLine (
127+ tokens ,
128+ closeBracePos ,
129+ openBracePos ,
130+ fileName ) ) ;
123131 }
124132 }
125133
126134 return null ;
127135 }
128136
129- private List < CorrectionExtent > GetSuggestedCorrectionsForEmptyLineBeforeBrace ( Token [ ] tokens , int closeBracePos , int openBracePos , string fileName )
137+ private List < CorrectionExtent > GetCorrectionsForBraceShouldNotFollowEmptyLine (
138+ Token [ ] tokens ,
139+ int closeBracePos ,
140+ int openBracePos ,
141+ string fileName )
130142 {
131143 var corrections = new List < CorrectionExtent > ( ) ;
132144 var newLineToken = tokens [ closeBracePos - 2 ] ;
@@ -168,28 +180,28 @@ private string GetIndentation(Token[] tokens, int closeBracePos, int openBracePo
168180 return new String ( ' ' , firstTokenOnOpenBraceLine . Extent . StartColumnNumber - 1 ) ;
169181 }
170182
171- private DiagnosticRecord GetViolationForBraceOnSameLine ( Token [ ] tokens , int closeBracePos , int openBracePos , string fileName )
183+ private DiagnosticRecord GetViolationForBraceShouldBeOnNewLine ( Token [ ] tokens , int closeBracePos , int openBracePos , string fileName )
172184 {
173185 if ( tokens . Length > 1 && tokens . Length > closeBracePos )
174186 {
175187 var closeBraceToken = tokens [ closeBracePos ] ;
176188 if ( tokens [ closeBracePos - 1 ] . Kind != TokenKind . NewLine )
177189 {
178190 return new DiagnosticRecord (
179- GetError ( ) ,
191+ GetError ( Strings . PlaceCloseBraceErrorShouldBeOnNewLine ) ,
180192 closeBraceToken . Extent ,
181193 GetName ( ) ,
182194 GetDiagnosticSeverity ( ) ,
183195 fileName ,
184196 null ,
185- GetSuggestedCorrectionsForBraceOnSameLine ( tokens , closeBracePos , openBracePos , fileName ) ) ;
197+ GetCorrectionsForBraceShouldBeOnNewLine ( tokens , closeBracePos , openBracePos , fileName ) ) ;
186198 }
187199 }
188200
189201 return null ;
190202 }
191203
192- private List < CorrectionExtent > GetSuggestedCorrectionsForBraceOnSameLine (
204+ private List < CorrectionExtent > GetCorrectionsForBraceShouldBeOnNewLine (
193205 Token [ ] tokens ,
194206 int closeBracePos ,
195207 int openBracePos ,
@@ -249,9 +261,9 @@ private List<Token> GetTokens(Ast ast, List<Token> tokens, ref Dictionary<Ast, L
249261 /// <summary>
250262 /// Retrieves the error message of this rule
251263 /// </summary>
252- private string GetError ( )
264+ private string GetError ( string errorString )
253265 {
254- return string . Format ( CultureInfo . CurrentCulture , Strings . PlaceCloseBraceError ) ;
266+ return string . Format ( CultureInfo . CurrentCulture , errorString ) ;
255267 }
256268
257269 /// <summary>
0 commit comments