Skip to content

[Feature] Add an .editorconfig so dotnet format and the build enforce the code conventions (#86) - #89

Merged
samgerene merged 2 commits into
developmentfrom
feature/86-editorconfig
Oct 11, 2026
Merged

samgerene merged 2 commits into
developmentfrom
feature/86-editorconfig

Conversation

@samgerene

@samgerene samgerene commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the ArgusTransfer code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

Closes #86.

The code conventions were only written down in CLAUDE.md and CONTRIBUTING.md. This adds an .editorconfig that states them as warnings, so the editor shows them, dotnet format --verify-no-changes checks them and the build reports them.

The rules were chosen by measuring the existing code here and in uml4net, SysML2.NET, ReqIFSharp, Auriga, EcoreNetto, Kalliope, Mercurio and mycelium-forge, so the same file can be used in those repositories.

Two commits, to keep the diff reviewable

  1. 6573a73 adds the configuration and the documentation.
  2. 6a10051 is only the result of dotnet format ArgusTransfer.sln.

What is added

  • .editorconfig: using directives inside the namespace, System first, a blank line between groups; this. for instance members; braces always; block-scoped namespaces; type keywords (int, not Int32); naming (I prefix for interfaces, T prefix for type parameters, camelCase private fields without underscore, PascalCase for the rest; test methods are exempt because of Verify_that_...); the file header (IDE0073); UTF-8 without byte order mark, 4 spaces, final newline, CRLF for .cs and project files. var stays a suggestion.
  • .gitattributes: pins .cs, .csproj, .props and .sln to CRLF on every platform, so the format check gives the same result on Windows and Linux. Other text files stay as they were (release.yml edits CITATION.cff with sed).
  • Directory.Build.props: EnforceCodeStyleInBuild, so dotnet build -warnaserror fails on a code-style violation.
  • CodeQuality.yml: a dotnet format --verify-no-changes step at the end of the Linux job.

Decisions on the open points of the issue

  • File header: changed to the short SPDX form that Auriga, EcoreNetto and mycelium-forge use. The full Apache text cannot be a file_header_template: the ; in (the "License"); starts a comment in .editorconfig, and the IDE0073 fixer then deletes the rest of the header. The copyright line is unchanged.
  • LicenseHeaderTestFixture: removed. IDE0073 checks the header text, that it is at the top of the file and the file name in it. I verified that the build fails for a header that names another file and for a missing header.
  • Severities: the rules the code already follows are warnings; var is a suggestion.
  • ArgusTransfer.sln.DotSettings: kept, with the header template updated; the ReSharper note in CONTRIBUTING.md is updated.

What the clean-up commit changes

  • the header in all 120 source files
  • this. added in 8 places (ArgusRequest, ArgusPipeHostBackgroundService)
  • the byte order mark removed from 4 files
  • the using order in ArgusClientTestFixture

Verification

  • dotnet build ArgusTransfer.sln: 0 warnings
  • dotnet test ArgusTransfer.sln: 723 passed (the 16 test cases of the removed fixture are gone)
  • dotnet format ArgusTransfer.sln --verify-no-changes: no changes, also in a clone checked out with core.autocrlf=false
  • dotnet build ArgusTransfer.sln -warnaserror: 0 warnings, 0 errors

No CHANGELOG.md entry: nothing changes for a user of the library.

🤖 Generated with Claude Code

… the code conventions (#86)

- .editorconfig: states the conventions of CONTRIBUTING.md as warnings (usings inside the
  namespace, System first, 'this.', braces, block-scoped namespaces, type keywords, naming)
  and the file header (IDE0073), plus charset, indentation and line endings
- .gitattributes: pins .cs and project files to CRLF on every platform
- Directory.Build.props: EnforceCodeStyleInBuild, so 'dotnet build -warnaserror' reports
  code-style violations
- CodeQuality.yml: 'dotnet format --verify-no-changes' step
- the file header becomes the short SPDX form; the full Apache text cannot be a
  file_header_template because ';' starts a comment in .editorconfig
- LicenseHeaderTestFixture is removed: IDE0073 checks the header and its file name

The source files are brought in line by the next commit, which only applies 'dotnet format'.
Only the result of 'dotnet format ArgusTransfer.sln': the short SPDX file header in every source file, 'this.' in 8 places, the byte order mark removed from 4 files and the using order in 1 file.
@sonarqubecloud

Copy link
Copy Markdown

@samgerene
samgerene merged commit 6dd8b06 into development Oct 11, 2026
5 checks passed
@samgerene
samgerene deleted the feature/86-editorconfig branch October 11, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add an .editorconfig so dotnet format enforces the code conventions

1 participant