GodotSharpAnalyzers 0.1.0
dotnet add package GodotSharpAnalyzers --version 0.1.0
NuGet\Install-Package GodotSharpAnalyzers -Version 0.1.0
<PackageReference Include="GodotSharpAnalyzers" Version="0.1.0" />
<PackageVersion Include="GodotSharpAnalyzers" Version="0.1.0" />
<PackageReference Include="GodotSharpAnalyzers" />
paket add GodotSharpAnalyzers --version 0.1.0
#r "nuget: GodotSharpAnalyzers, 0.1.0"
#:package GodotSharpAnalyzers@0.1.0
#addin nuget:?package=GodotSharpAnalyzers&version=0.1.0
#tool nuget:?package=GodotSharpAnalyzers&version=0.1.0
GodotSharpAnalyzers
Roslyn analyzers for Godot C# projects to catch common pitfalls and enforce best practices.
Features
- Detect common Godot C# anti-patterns
- Provide code fixes for common issues
- Help enforce Godot best practices
- Support for Godot 4.x projects using .NET 8.0+
Installation
Via NuGet Package Manager
dotnet add package GodotSharpAnalyzers
Via PackageReference
<PackageReference Include="GodotSharpAnalyzers" Version="0.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>analyzers; build</IncludeAssets>
</PackageReference>
Analyzer Rules
- GD0001 (Memory): Signal connections should be disconnected to prevent memory leaks
- GD0001a (Memory): Signal connected to lambda expression (informational)
Configuration
You can customize the analyzer behavior by setting MSBuild properties in your project file:
Disable All Analyzers
<PropertyGroup>
<EnableGodotSharpAnalyzers>false</EnableGodotSharpAnalyzers>
</PropertyGroup>
Disable Specific Rules
<PropertyGroup>
<GodotSharpAnalyzersDisableSignalConnectionLeak>true</GodotSharpAnalyzersDisableSignalConnectionLeak>
<GodotSharpAnalyzersDisableSignalLambdaConnectionLeak>true</GodotSharpAnalyzersDisableSignalLambdaConnectionLeak>
</PropertyGroup>
Treat Signal Connection Leak Rule as Error
<PropertyGroup>
<GodotSharpAnalyzersSignalConnectionLeakAsError>true</GodotSharpAnalyzersSignalConnectionLeakAsError>
</PropertyGroup>
Suppress Singleton Signal Warnings
Option 1: Using MSBuild properties (recommended)
<PropertyGroup>
<GodotSharpAnalyzersSuppressSingletonSignals>true</GodotSharpAnalyzersSuppressSingletonSignals>
</PropertyGroup>
Option 2: Using .editorconfig
[*.cs]
godot_analyzer.suppress_singleton_signals = true
Show Information Messages
<PropertyGroup>
<GodotSharpAnalyzersShowInfo>true</GodotSharpAnalyzersShowInfo>
</PropertyGroup>
Known Limitations
GD0001 - Signal Connection Leak Detection:
- Only analyzes within single class scope
- May produce false positives for temporary objects or valid persistent connections
- Doesn't track cross-method signal flows or complex object lifetimes
- Conditional connections (e.g., in loops or if statements) may not be fully analyzed
Building from Source
Prerequisites
- .NET 8.0 SDK or later
- Visual Studio 2022 or VS Code with C# extensions
Build
dotnet build
Run Tests
dotnet test
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-analyzer) - Commit your changes (
git commit -m 'Add amazing analyzer') - Push to the branch (
git push origin feature/amazing-analyzer) - Open a Pull Request
Setting up CI/CD for Releases
To enable automatic publishing of NuGet packages when tags are created:
Generate a NuGet API Key:
- Go to nuget.org and sign in
- Navigate to your account settings → API Keys
- Create a new API key with "Push new packages and package versions" permissions
- Optionally scope it to specific packages or use global permissions
Add the API Key to GitHub Secrets:
- Go to your repository on GitHub
- Navigate to Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
NUGET_API_KEY - Value: Paste your NuGet API key
- Click "Add secret"
Create a Release:
- Tag your release with a version number:
git tag v0.1.0 - Push the tag:
git push origin v0.1.0 - The GitHub Actions workflow will automatically build, test, and publish to NuGet
- Tag your release with a version number:
Note: The GITHUB_TOKEN secret is automatically provided by GitHub Actions and doesn't need manual setup.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built for the Godot Engine community
- Inspired by common issues found in Godot C# projects
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 2,155 | 7/22/2025 |