From dotnet
Fix SA1518 StyleCop violations by removing trailing newlines from .cs, .xaml, .axaml, .csproj, .props, .targets, .editorconfig, .slnx, .sln, and .json files. Targets projects where .editorconfig has insert_final_newline = false. Use when SA1518 violations appear, trailing newline issues occur, or to enforce insert_final_newline = false across the repository.
npx claudepluginhub atc-net/atc-agentic-toolkit --plugin dotnetThis skill uses the workspace's default tool permissions.
**SA1518: File may not end with a newline character.**
Validates C#, Python, PowerShell, JavaScript code against .editorconfig, StyleCop.json, Directory.Build.props rules. Detects line endings, naming conventions, indentation, charset issues. JSON output for pre-commit hooks and CI.
Validates code style in C#, Python, PowerShell, JavaScript against .editorconfig, StyleCop.json, Directory.Build.props. Detects line endings, naming, indentation, charset issues; outputs JSON for pre-commit/CI.
Adds Roslynator and Meziantou analyzers plus a comprehensive .editorconfig with 80+ diagnostic rules, naming conventions, and performance warnings to .NET/C# projects/solutions for strict code quality enforcement.
Share bugs, ideas, or general feedback.
SA1518: File may not end with a newline character.
When .editorconfig has insert_final_newline = false, files must NOT end with trailing \r\n or \n characters. This skill scans all relevant files and strips any trailing newline bytes.
| Extension | Description |
|---|---|
.cs | C# source files |
.xaml | XAML markup files |
.axaml | Avalonia XAML files |
.csproj | C# project files |
.props | MSBuild property files |
.targets | MSBuild target files |
.editorconfig | Editor configuration files |
.slnx | Solution XML files |
.sln | Solution files |
.json | JSON configuration files |
The following directories are always skipped:
bin - Build outputobj - Intermediate build output.vs - Visual Studio metadata.git - Git repository datanode_modules - Node.js dependenciesBefore running, confirm the project uses insert_final_newline = false:
grep -r "insert_final_newline" .editorconfig
If insert_final_newline = true or not set, warn the user that removing trailing newlines may conflict with their editor configuration.
Execute the bundled Python script to scan and fix all files:
python scripts/fix_trailing_newlines.py [directory]
The script outputs:
After fixing, run:
dotnet build
Ensure the build succeeds and SA1518 warnings are resolved.
If the Python script is unavailable, perform the fix manually:
\n or \r\n.editorconfig before running to confirm insert_final_newline = false