Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: INTL0003 Failing on Top Level Statements #268

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading