Repository navigation
[Feature] Add an .editorconfig so dotnet format and the build enforce the code conventions (#86) - #89
Merged
Merged
Conversation
… 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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Prerequisites
Description
Closes #86.
The code conventions were only written down in
CLAUDE.mdandCONTRIBUTING.md. This adds an.editorconfigthat states them as warnings, so the editor shows them,dotnet format --verify-no-changeschecks 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
6573a73adds the configuration and the documentation.6a10051is only the result ofdotnet format ArgusTransfer.sln.What is added
.editorconfig:usingdirectives inside the namespace,Systemfirst, a blank line between groups;this.for instance members; braces always; block-scoped namespaces; type keywords (int, notInt32); naming (Iprefix for interfaces,Tprefix for type parameters, camelCase private fields without underscore, PascalCase for the rest; test methods are exempt because ofVerify_that_...); the file header (IDE0073); UTF-8 without byte order mark, 4 spaces, final newline, CRLF for.csand project files.varstays a suggestion..gitattributes: pins.cs,.csproj,.propsand.slnto CRLF on every platform, so the format check gives the same result on Windows and Linux. Other text files stay as they were (release.ymleditsCITATION.cffwithsed).Directory.Build.props:EnforceCodeStyleInBuild, sodotnet build -warnaserrorfails on a code-style violation.CodeQuality.yml: adotnet format --verify-no-changesstep at the end of the Linux job.Decisions on the open points of the issue
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.varis a suggestion.ArgusTransfer.sln.DotSettings: kept, with the header template updated; the ReSharper note inCONTRIBUTING.mdis updated.What the clean-up commit changes
this.added in 8 places (ArgusRequest,ArgusPipeHostBackgroundService)usingorder inArgusClientTestFixtureVerification
dotnet build ArgusTransfer.sln: 0 warningsdotnet 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 withcore.autocrlf=falsedotnet build ArgusTransfer.sln -warnaserror: 0 warnings, 0 errorsNo
CHANGELOG.mdentry: nothing changes for a user of the library.🤖 Generated with Claude Code