-
-
Notifications
You must be signed in to change notification settings - Fork 158
Coding guidelines cibuild #962
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
Merged
Merged
Conversation
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
67dd09b
to
151f631
Compare
151f631
to
441a235
Compare
maurei
approved these changes
Mar 8, 2021
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.
This PR contains an automated reformat of the entire codebase. From here on, we intend to follow stricter coding style rules. During cibuild, we run validations to verify compliance. These intentionally break the build on violations (examples here and here).
For local development, we've added
inspectcode.ps1
andcleanupcode.ps1
scripts to help with that. See updated contributing guidelines, which is part of this PR.How it works
We're using the open-source command-line runners from ReSharper for this. Code layout rules and severities are stored in JsonApiDotNetCore.sln.DotSettings (compatible settings are in .editorconfig too, for users not using Resharper or Rider). Where
inspectcode
scans for violations,cleanupcode
just reformats the solution based on layout settings. During cibuild, we run cleanupcode against the changed files from the merge and fail the build if it alters any files.Fixes #290.
Fixes #835.
I've tried to enable nullable reference types on the solution, but this turned out to be painful for the reasons below, so I reverted that.
Using multi-targeting Net5/NetCore31 (in that order!) would give us the framework annotations from .NET 5. But multi-targeting has its downsides. We'd produce a NuGet with two binaries, we'd run all our tests twice, we'll need to deal with the fact that EF Core 3.x does not run on .NET 5 etc. All-in-all, I don't think this is the right time to make the transition and we should wait until JADNC vNext where we can drop support for NetCore3.1.
I've thought to just annotate the public surface area of our API as recommended here. But due to historical reasons, almost all code is public, so this requires nearly the same amount of effort compared to annotating the entire codebase.