Skip to content

Commit

Permalink
fix: INTL 0003 Failing on Top Level Statements (#268)
Browse files Browse the repository at this point in the history
Fixes #267
  • Loading branch information
BenjaminMichaelis authored Jan 10, 2024
1 parent 8b3eb47 commit 2da3b30
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ public string MyMethod()
VerifyCSharpDiagnostic(test);
}

[TestMethod]
public void ProperlyNamedMethod_TopLevelStatements_NoDiagnosticInformationReturned()
{
string test = @"
Console.WriteLine(""Hello World!"");";

VerifyCSharpDiagnostic(test);
}

[TestMethod]
public void AutoProperty_PascalCasedMethod_NoDiagnosticInformationReturned()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Xml.Linq;
using IntelliTect.Analyzer.Naming;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
Expand Down Expand Up @@ -77,6 +78,12 @@ private static void AnalyzeSymbol(SymbolAnalysisContext context)
default: return;
}

// Common symbols for generated code to use, including the main method for top-level statements.
if (name.Contains('<') || name.Contains('>'))
{
return;
}

if (Casing.IsPascalCase(name))
{
return;
Expand Down

0 comments on commit 2da3b30

Please sign in to comment.