Skip to content

Commit 6ba70f7

Browse files
committed
Updated based on CR comment
1 parent da625d9 commit 6ba70f7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Rules/UseBOMForUnicodeEncodedFile.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
4040
// Did not detect the presence of BOM
4141
// Make sure there is no byte > 127 (0x7F) to ensure file is ASCII encoded
4242
// Else emit rule violation
43-
44-
var byteList = byteStream.Where(o => o > 0x7F).ToList();
45-
if (0 != byteList.Count)
43+
44+
if (0 != byteStream.Count(o => o > 0x7F))
4645
{
4746
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseBOMForUnicodeEncodedFileError, System.IO.Path.GetFileName(fileName), null),
4847
null, GetName(), DiagnosticSeverity.Warning, fileName);
@@ -55,7 +54,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
5554
/// </summary>
5655
private Encoding GetByteStreamEncoding(byte[] byteStream)
5756
{
58-
//// Analyze BOM
57+
// Analyze BOM
5958
if (byteStream.Length >= 4 && byteStream[0] == 0x00 && byteStream[1] == 0x00 && byteStream[2] == 0xFE && byteStream[3] == 0xFF)
6059
{
6160
// UTF-32, big-endian
@@ -89,6 +88,7 @@ private Encoding GetByteStreamEncoding(byte[] byteStream)
8988

9089
// Did not detect BOM OR Unknown File encoding
9190
return null;
91+
9292
}
9393

9494
/// <summary>

0 commit comments

Comments
 (0)