Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into generic-number-se…
Browse files Browse the repository at this point in the history
…quence

Conflicts resolved:

- MoreLinq/MoreLinq.csproj
  • Loading branch information
atifaziz committed Sep 22, 2024
2 parents 8917f27 + 5dc9e18 commit 8e2c587
Show file tree
Hide file tree
Showing 283 changed files with 11,998 additions and 4,999 deletions.
26 changes: 21 additions & 5 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,32 @@
"isRoot": true,
"tools": {
"dotnet-t4": {
"version": "2.3.0",
"version": "3.0.0",
"commands": [
"t4"
]
],
"rollForward": false
},
"dotnet-reportgenerator-globaltool": {
"version": "5.1.11",
"version": "5.3.9",
"commands": [
"reportgenerator"
]
],
"rollForward": false
},
"meziantou.framework.nugetpackagevalidation.tool": {
"version": "1.0.16",
"commands": [
"meziantou.validate-nuget-package"
],
"rollForward": false
},
"powershell": {
"version": "7.4.5",
"commands": [
"pwsh"
],
"rollForward": false
}
}
}
}
107 changes: 92 additions & 15 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,69 @@ indent_size = 4
max_line_length = 100

[*.cs]
dotnet_analyzer_diagnostic.category-Style.severity = warning

# IDE0022: Use expression/block body for methods
dotnet_diagnostic.IDE0022.severity = suggestion

# IDE1006: Naming rule violation
dotnet_diagnostic.IDE1006.severity = warning

# Naming capitalization styles
dotnet_naming_style.camel_case_style.capitalization = camel_case
dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# Naming rule that private instance fields must use camel case
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_rule.camel_case_private_fields.severity = warning
dotnet_naming_rule.camel_case_private_fields.symbols = private_fields
dotnet_naming_rule.camel_case_private_fields.style = camel_case_style

# Naming rule that static read-only fields must use Pascal case
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = *
dotnet_naming_symbols.static_readonly_fields.required_modifiers = readonly, static
dotnet_naming_rule.pascal_case_static_readonly_fields.severity = warning
dotnet_naming_rule.pascal_case_static_readonly_fields.symbols = static_readonly_fields
dotnet_naming_rule.pascal_case_static_readonly_fields.style = pascal_case_style

# Naming rule that const fields must use Pascal case
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_rule.pascal_case_const_fields.severity = warning
dotnet_naming_rule.pascal_case_const_fields.symbols = const_fields
dotnet_naming_rule.pascal_case_const_fields.style = pascal_case_style

# this. preferences
dotnet_style_qualification_for_event = false
dotnet_style_qualification_for_field = true
dotnet_style_qualification_for_method = false
dotnet_style_qualification_for_property = false

# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_methods = true
csharp_style_expression_bodied_constructors = true
csharp_style_expression_bodied_operators = true

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
csharp_style_expression_bodied_properties = true
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_accessors = true

# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_inlined_variable_declaration = true
csharp_style_throw_expression = true
csharp_style_conditional_delegate_call = true
csharp_prefer_simple_default_expression = true

# Spacing
csharp_space_after_cast = false
Expand All @@ -57,3 +98,39 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
# Wrapping
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true

# Indentation
csharp_indent_case_contents_when_block = false

# Modifier preferences
dotnet_style_require_accessibility_modifiers = omit_if_default

# IDE0011: Add braces
csharp_prefer_braces = when_multiline

# IDE0061: Use block body for local functions
csharp_style_expression_bodied_local_functions = true

# IDE0065: Misplaced using directive
csharp_using_directive_placement = inside_namespace

# IDE0048: Add parentheses for clarity
dotnet_diagnostic.IDE0048.severity = suggestion

# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = suggestion

# IDE0046: Convert to conditional expression
dotnet_diagnostic.IDE0046.severity = suggestion

# CA1510: Use 'ArgumentNullException.ThrowIfNull' instead of explicitly throwing a new exception instance
# TODO: Remove post https://github.com/morelinq/MoreLINQ/issues/903
dotnet_diagnostic.CA1510.severity = suggestion

# CA1512: Use 'ArgumentOutOfRangeException.ThrowIfNegativeOrZero' instead of explicitly throwing a new exception instance
# TODO: Remove post https://github.com/morelinq/MoreLINQ/issues/903
dotnet_diagnostic.CA1512.severity = suggestion

# CA1513: Use 'ObjectDisposedException.ThrowIf' instead of explicitly throwing a new exception instance
# TODO: Remove post https://github.com/morelinq/MoreLINQ/issues/903
dotnet_diagnostic.CA1513.severity = suggestion
117 changes: 117 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build

on:
push:
paths-ignore:
- '*.md'
- '*.txt'
- appveyor.yml
branches:
- master
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
SKIP_TEST_BUILD: true

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, ubuntu-22.04]

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '14'

- name: Install ECLint
run: npm install -g eclint

- name: Delete EditorConfig file
run: git rm .editorconfig

- name: Check Final New-Line
run: eclint check -n "**/*.{cs,tt,cmd,sh,md,txt,yml}"

- name: Check Trailing Whitespace
run: eclint check -w "**/*.{cs,tt,cmd,sh,md,txt,yml,json,sln,csproj,shfbproj}"

- name: Restore Checkout
run: git reset --hard

- name: Setup .NET SDK per "global.json"
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json

- name: Setup .NET SDK 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: .NET Information
run: dotnet --info

- name: Check Unit Tests Never Import "System.Linq"
shell: pwsh
run: |
grep --extended-regexp '^[[:space:]]*using[[:space:]]+System\.Linq;' (dir -Recurse -File -Filter *Test.cs MoreLinq.Test)
if ($LASTEXITCODE -eq 0) {
throw 'Unit tests should not import System.Linq'
} else {
$LASTEXITCODE = 0
}
- name: Build & Pack (Windows)
shell: cmd
if: runner.os == 'Windows'
run: call pack.cmd

- name: Build & Pack (Linux)
if: runner.os != 'Windows'
run: ./pack.sh

- name: Check Uncommitted Changes
shell: pwsh
run: |
$diff = git diff --ignore-all-space --exit-code 2>&1
$diff | % { if ($_ -is [string]) { $_ } else { [string]$_ } } | echo
if ($LASTEXITCODE -ne 0) {
throw "New code was generated during build that's not been committed."
}
- name: Validate NuGet Packages
shell: pwsh
run: |
dir dist\*.nupkg | % {
dotnet meziantou.validate-nuget-package --excluded-rules IconMustBeSet $_
if ($LASTEXITCODE) {
throw "Package validation failed: $_"
}
}
- name: Test (Windows)
shell: cmd
if: runner.os == 'Windows'
run: call test.cmd

- name: Test (Linux)
if: runner.os != 'Windows'
run: ./test.sh

- name: Publish Coverage to Codecov
uses: codecov/codecov-action@v3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.opencover.xml
**/TestResults/
.actrc

### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
Expand Down
7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<Project>
<PropertyGroup>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AnalysisLevel>8.0-all</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<!-- Workaround for IDE0005 (Remove unnecessary usings/imports); see https://github.com/dotnet/roslyn/issues/41640 -->
<NoWarn>EnableGenerateDocumentationFile</NoWarn>
</PropertyGroup>
</Project>
32 changes: 32 additions & 0 deletions MoreLinq.Test.Aot/MoreLinq.Test.Aot.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>exe</OutputType>
<IsPackable>false</IsPackable>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest.Engine" Version="1.0.0-alpha.24460.4" />
<PackageReference Include="MSTest.SourceGeneration" Version="1.0.0-alpha.24460.4" />
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Version="17.12.4" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.12.4" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.4.0" />
<PackageReference Include="Microsoft.Testing.Platform.MSBuild" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
<PackageReference Include="MSTest.Analyzers" Version="3.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MoreLinq\MoreLinq.csproj" />
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>

</Project>
Loading

0 comments on commit 8e2c587

Please sign in to comment.