Skip to content

Commit 879b12b

Browse files
committed
feat: added the GitHub Actions and cleaned up some code
2 parents ecf6c11 + 2a1142b commit 879b12b

File tree

6 files changed

+50
-9
lines changed

6 files changed

+50
-9
lines changed

.github/workflows/build_and_test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- main
8+
- dev
9+
10+
jobs:
11+
build_and_test:
12+
name: Build and Test
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v2
18+
19+
- name: Setup .NET SDK
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: '8.0.x' # You can specify the version you need
23+
24+
- name: Restore Dependencies
25+
run: dotnet restore CodeJoyRide.sln
26+
27+
- name: Build Solution
28+
run: dotnet build CodeJoyRide.sln --configuration Release
29+
30+
- name: Run Tests
31+
run: dotnet test CodeJoyRide.sln --configuration Release --no-restore --verbosity normal

CodeJoyRide.Fx.Analyzer/CodeJoyRide.Fx.Analyzer/AnalyzerReleases.Shipped.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
### New Rules
44

5-
| Rule ID | Category | Severity | Notes |
6-
|---------|----------|----------|--------------------------------------------------|
7-
| AB0002 | Usage | Warning | The speed must be lower than the Speed of Light. |
5+
Rule ID | Category | Severity | Notes
6+
--------|----------|----------|--------------------
7+
CJR001 | Usage | Error | The speed must be lower than the Speed of Light.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
### New Rules
22

3-
| Rule ID | Category | Severity | Notes |
4-
|---------|----------|----------|-------|
3+
Rule ID | Category | Severity | Notes
4+
--------|----------|----------|--------------------

CodeJoyRide.Fx.Analyzer/CodeJoyRide.Fx.Analyzer/MaybeSemanticAnalyzer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public class MaybeSemanticAnalyzer : DiagnosticAnalyzer
3333
private const string Category = "Usage";
3434

3535
private static readonly DiagnosticDescriptor Rule = new(DiagnosticId, Title, MessageFormat, Category,
36-
DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);
36+
DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description
37+
, customTags: [WellKnownDiagnosticTags.NotConfigurable]
38+
);
3739

3840
// Keep in mind: you have to list your rules here.
3941
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =

CodeJoyRide.Fx/Maybe.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public IEnumerable<T> AsEnumerable()
6969
yield return this._value;
7070
}
7171

72-
public T Unwrap(T defaultValue = default) => this.IsNone ? defaultValue : this._value;
72+
public T Unwrap(T defaultValue) => this.IsNone ? defaultValue : this._value;
7373
public T Unwrap(Func<T> defaultValueFunc) => this.IsNone ? defaultValueFunc() : this._value;
7474

7575
public Task<T> UnwrapAsync(Func<Task<T>> defaultValueFuncAsync)
@@ -83,7 +83,7 @@ public Task<T> UnwrapAsync(Func<Task<T>> defaultValueFuncAsync)
8383
public bool Equals(Maybe<T> other)
8484
=> IsSome == other.IsSome && (IsNone || this._value!.Equals(other._value));
8585

86-
public override bool Equals(object obj)
86+
public override bool Equals(object? obj)
8787
{
8888
return obj is Maybe<T> other && Equals(other);
8989
}
@@ -92,7 +92,7 @@ public override int GetHashCode()
9292
{
9393
unchecked
9494
{
95-
return (IsSome.GetHashCode() * 397) ^ EqualityComparer<T>.Default.GetHashCode(_value);
95+
return (IsSome.GetHashCode() * 397) ^ EqualityComparer<T>.Default.GetHashCode(_value!);
9696
}
9797
}
9898

CodeJoyRide.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{D3C4A25F-0
1717
README.md = README.md
1818
EndProjectSection
1919
EndProject
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{A6A1F426-676D-4413-93B2-B9DD6A25736A}"
21+
EndProject
22+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{F37F6912-F8AE-4B03-8EB0-966358BC757B}"
23+
ProjectSection(SolutionItems) = preProject
24+
.github\workflows\build_and_test.yaml = .github\workflows\build_and_test.yaml
25+
EndProjectSection
26+
EndProject
2027
Global
2128
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2229
Debug|Any CPU = Debug|Any CPU
@@ -45,5 +52,6 @@ Global
4552
{3D0FED8B-0509-4407-B66C-AFC7971956C3} = {1B62324C-07F0-45FA-A1F5-C5CAD91A6AC5}
4653
{906D80E7-ED31-4D3E-A47D-7ABF8F6153FB} = {1B62324C-07F0-45FA-A1F5-C5CAD91A6AC5}
4754
{5508C6E9-856E-4B08-8BFD-D05803BAE144} = {85459589-7B8D-43F5-977D-64D13E685F71}
55+
{F37F6912-F8AE-4B03-8EB0-966358BC757B} = {A6A1F426-676D-4413-93B2-B9DD6A25736A}
4856
EndGlobalSection
4957
EndGlobal

0 commit comments

Comments
 (0)