Skip to content

Update to JADNC v5.1 #16

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 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2021.3.4",
"version": "2022.2.3",
"commands": [
"jb"
]
},
"regitlint": {
"version": "6.0.8",
"version": "6.1.1",
"commands": [
"regitlint"
]
Expand All @@ -21,7 +21,7 @@
]
},
"dotnet-reportgenerator-globaltool": {
"version": "5.1.4",
"version": "5.1.3",
"commands": [
"reportgenerator"
]
Expand Down
62 changes: 33 additions & 29 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.{csproj,json}]
[*.{config,csproj,css,js,json,props,ruleset,xslt}]
indent_size = 2

[*.{cs}]
#### .NET Coding Conventions ####
#### C#/.NET Coding Conventions ####

# Organize usings
# 'using' directive preferences
dotnet_sort_system_directives_first = true
csharp_using_directive_placement = outside_namespace:suggestion

# Namespace declarations
csharp_style_namespace_declarations = file_scoped:suggestion

# this. preferences
dotnet_style_qualification_for_field = false:suggestion
Expand All @@ -30,13 +33,15 @@ dotnet_style_predefined_type_for_member_access = true:suggestion

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
csharp_style_pattern_local_over_anonymous_function = false:silent

# Expression-level preferences
dotnet_style_operator_placement_when_wrapping = end_of_line
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion

# Parameter preferences
dotnet_code_quality_unused_parameters = non_public:suggestion
Expand All @@ -54,38 +59,38 @@ csharp_style_expression_bodied_properties = true:suggestion
# Code-block preferences
csharp_prefer_braces = true:suggestion

# Expression-level preferences
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:suggestion


#### C# Formatting Rules ####

# Indentation preferences
csharp_indent_case_contents_when_block = false

# Wrapping preferences
csharp_preserve_single_line_statements = false

# 'var' usage preferences
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion

#### Naming styles ####
#### Naming Style ####

dotnet_diagnostic.IDE1006.severity = warning

# Naming rules
dotnet_naming_rule.private_const_fields_should_be_pascal_case.symbols = private_const_fields
dotnet_naming_rule.private_const_fields_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.private_const_fields_should_be_pascal_case.severity = warning
dotnet_naming_rule.const_fields_should_be_pascal_case.symbols = const_fields
dotnet_naming_rule.const_fields_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.const_fields_should_be_pascal_case.severity = warning

dotnet_naming_rule.private_static_readonly_fields_should_be_pascal_case.symbols = private_static_readonly_fields
dotnet_naming_rule.private_static_readonly_fields_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.private_static_readonly_fields_should_be_pascal_case.severity = warning

dotnet_naming_rule.private_static_or_readonly_fields_should_start_with_underscore.symbols = private_static_or_readonly_fields
dotnet_naming_rule.private_static_or_readonly_fields_should_start_with_underscore.style = camel_case_prefix_with_underscore
dotnet_naming_rule.private_static_or_readonly_fields_should_start_with_underscore.severity = warning
dotnet_naming_rule.private_fields_should_start_with_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_should_start_with_underscore.style = camel_case_prefix_with_underscore
dotnet_naming_rule.private_fields_should_start_with_underscore.severity = warning

dotnet_naming_rule.locals_and_parameters_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_and_parameters_should_be_camel_case.style = camel_case
Expand All @@ -96,25 +101,24 @@ dotnet_naming_rule.types_and_members_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.types_and_members_should_be_pascal_case.severity = warning

# Symbol specifications
dotnet_naming_symbols.private_const_fields.applicable_kinds = field
dotnet_naming_symbols.private_const_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_const_fields.required_modifiers = const
dotnet_naming_symbols.const_fields.applicable_kinds = field
dotnet_naming_symbols.const_fields.applicable_accessibilities = *
dotnet_naming_symbols.const_fields.required_modifiers = const

dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static,readonly
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly

dotnet_naming_symbols.private_static_or_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_or_readonly_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_static_or_readonly_fields.required_modifiers = static readonly
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_symbols.locals_and_parameters.applicable_kinds = local,parameter
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = local, parameter
dotnet_naming_symbols.locals_and_parameters.applicable_accessibilities = *

dotnet_naming_symbols.types_and_members.applicable_kinds = *
dotnet_naming_symbols.types_and_members.applicable_accessibilities = *

# Naming styles
# Style specifications
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.camel_case_prefix_with_underscore.required_prefix = _
Expand Down
72 changes: 64 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# User-specific files
*.rsuser
Expand Down Expand Up @@ -90,16 +90,14 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# MacOS file systems
**/.DS_STORE

# Chutzpah Test files
_Chutzpah*

Expand Down Expand Up @@ -134,9 +132,6 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JetBrains Rider
.idea/

# TeamCity is a build add-in
_TeamCity*

Expand All @@ -148,7 +143,9 @@ _TeamCity*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
coverage*.json
coverage*.xml
coverage*.info

# Visual Studio code coverage results
*.coverage
Expand Down Expand Up @@ -297,6 +294,17 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -353,6 +361,9 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

Expand All @@ -365,5 +376,50 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
*.sln.iml

#############################################
### Additions specific to this repository ###
#############################################

# MacOS file systems
**/.DS_STORE

# Sqlite example databases
*.db

# JetBrains IDEs Rider/IntelliJ (based on https://intellij-support.jetbrains.com/hc/en-us/articles/206544839)
**/.idea/**/*.xml
**/.idea/**/*.iml
**/.idea/**/*.ids
**/.idea/**/*.ipr
**/.idea/**/*.iws
**/.idea/**/*.name
**/.idea/**/*.properties
**/.idea/**/*.ser
**/.idea/**/shelf/
**/.idea/**/dictionaries/
**/.idea/**/libraries/
**/.idea/**/artifacts/
**/.idea/**/httpRequests/
**/.idea/**/dataSources/
!**/.idea/**/codeStyles/*
1 change: 1 addition & 0 deletions .idea/.idea.JsonApiDotNetCore.MongoDb/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/.idea.JsonApiDotNetCore.MongoDb/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 17 additions & 10 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ function CheckLastExitCode {

function RunInspectCode {
$outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml')
# passing --build instead of --no-build as workaround for https://youtrack.jetbrains.com/issue/RSRP-487054
dotnet jb inspectcode JsonApiDotNetCore.MongoDb.sln --build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
dotnet jb inspectcode JsonApiDotNetCore.MongoDb.sln --no-build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
CheckLastExitCode

[xml]$xml = Get-Content "$outputPath"
Expand Down Expand Up @@ -40,16 +39,21 @@ function RunCleanupCode {
# When running in cibuild for a pull request, this reformats only the files changed in the PR and fails if the reformat produces changes.

if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) {
Write-Output "Running code cleanup on changed files in pull request"

# In the past, we used $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT for the merge commit hash. That is the pinned hash at the time the build is enqueued.
# When a force-push happens after that, while the build hasn't yet started, this hash becomes invalid during the build, resulting in a lookup error.
# To prevent failing the build for unobvious reasons we use HEAD, which is always the latest version.
$mergeCommitHash = git rev-parse "HEAD"
$targetCommitHash = git rev-parse "$env:APPVEYOR_REPO_BRANCH"
# To prevent failing the build for unobvious reasons we use HEAD, which is always a detached head (the PR merge result).

$headCommitHash = git rev-parse HEAD
CheckLastExitCode

dotnet regitlint -s JsonApiDotNetCore.MongoDb.sln --print-command --disable-jb-path-hack --jb --profile='\"JADNC Full Cleanup\"' --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $mergeCommitHash -b $targetCommitHash --fail-on-diff --print-diff
$baseCommitHash = git rev-parse "$env:APPVEYOR_REPO_BRANCH"
CheckLastExitCode

if ($baseCommitHash -ne $headCommitHash) {
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
dotnet regitlint -s JsonApiDotNetCore.MongoDb.sln --print-command --skip-tool-check --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
CheckLastExitCode
}
}
}

Expand Down Expand Up @@ -100,8 +104,11 @@ CheckLastExitCode
dotnet build -c Release
CheckLastExitCode

RunInspectCode
RunCleanupCode
# https://youtrack.jetbrains.com/issue/RSRP-488628/Breaking-InspectCode-fails-with-Roslyn-Worker-process-exited-unexpectedly-after-update
if ($IsWindows) {
RunInspectCode
RunCleanupCode
}

dotnet test -c Release --no-build --collect:"XPlat Code Coverage"
CheckLastExitCode
Expand Down
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<PropertyGroup>
<TargetFrameworkName>net6.0</TargetFrameworkName>
<AspNetVersion>6.0.*</AspNetVersion>
<JsonApiDotNetCoreVersion>5.0.1</JsonApiDotNetCoreVersion>
<JsonApiDotNetCoreVersion>5.1.0</JsonApiDotNetCoreVersion>
<MongoDBDriverVersion>2.15.0</MongoDBDriverVersion>
<JsonApiDotNetCoreMongoDbVersionPrefix>5.0.2</JsonApiDotNetCoreMongoDbVersionPrefix>
<JsonApiDotNetCoreMongoDbVersionPrefix>5.1.0</JsonApiDotNetCoreMongoDbVersionPrefix>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
<WarningLevel>9999</WarningLevel>
<Nullable>enable</Nullable>
Expand All @@ -14,8 +14,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.2" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CSharpGuidelinesAnalyzer.config" Visible="False" />
</ItemGroup>

Expand All @@ -31,8 +31,8 @@

<!-- Test Project Dependencies -->
<PropertyGroup>
<CoverletVersion>3.1.2</CoverletVersion>
<CoverletVersion>3.2.0</CoverletVersion>
<MoqVersion>4.16.1</MoqVersion>
<TestSdkVersion>17.1.0</TestSdkVersion>
<TestSdkVersion>17.4.0</TestSdkVersion>
</PropertyGroup>
</Project>
Loading