Skip to content

Commit

Permalink
Add linter for examples (#55)
Browse files Browse the repository at this point in the history
* Add linter for examples
  • Loading branch information
XmasApple committed Nov 17, 2023
1 parent b0b0dc2 commit 84b25c7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ on:

jobs:
autoformatter:
strategy:
matrix:
source-dir: ["./src/", "./examples/src/"]
include:
- source-dir: "./src/"
solutionFile: "YdbSdk.sln"
- source-dir: "./examples/src/"
solutionFile: "YdbExamples.sln"
name: autoformat check
concurrency:
group: lint-autoformat-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -21,15 +26,18 @@ jobs:
with:
dotnet-version: '6.0.x'
- name: Restore
run: dotnet restore ./src/YdbSdk.sln
run: dotnet restore ${{ matrix.source-dir }}${{ matrix.solutionFile }}
- name: Install ReSharper
run: dotnet tool install -g JetBrains.ReSharper.GlobalTools --version 2023.2.1
- name: format all files with auto-formatter
run: bash ./.github/scripts/format-all-dotnet-code.sh ./src/ YdbSdk.sln "Custom Cleanup"
run: bash ./.github/scripts/format-all-dotnet-code.sh ${{ matrix.source-dir }} ${{ matrix.solutionFile }} "Custom Cleanup"
- name: Check repository diff
run: bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken"

inspection:
strategy:
matrix:
solutionPath: ["./src/YdbSdk.sln", "./examples/src/YdbExamples.sln"]
runs-on: ubuntu-latest
name: Inspection
steps:
Expand All @@ -40,11 +48,11 @@ jobs:
with:
dotnet-version: '6.0.x'
- name: Restore
run: dotnet restore ./src/YdbSdk.sln
run: dotnet restore ${{ matrix.solutionPath }}
- name: Inspect code
uses: muno92/resharper_inspectcode@v1
with:
solutionPath: ./src/YdbSdk.sln
solutionPath: ${{ matrix.solutionPath }}
version: 2023.2.1
include: |
**.cs
Expand Down
4 changes: 2 additions & 2 deletions examples/src/BasicExample/FillData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static Dictionary<string, YdbValue> GetDataParams()
new(2, 2, "Season 2", DateTime.Parse("2015-04-12"), DateTime.Parse("2015-06-14")),
new(2, 3, "Season 3", DateTime.Parse("2016-04-24"), DateTime.Parse("2016-06-26")),
new(2, 4, "Season 4", DateTime.Parse("2017-04-23"), DateTime.Parse("2017-06-25")),
new(2, 5, "Season 5", DateTime.Parse("2018-03-25"), DateTime.Parse("2018-05-13")),
new(2, 5, "Season 5", DateTime.Parse("2018-03-25"), DateTime.Parse("2018-05-13"))
};

var episodes = new Episode[]
Expand Down Expand Up @@ -162,7 +162,7 @@ private static Dictionary<string, YdbValue> GetDataParams()
new(2, 5, 5, "Facial Recognition", DateTime.Parse("2018-04-22")),
new(2, 5, 6, "Artificial Emotional Intelligence", DateTime.Parse("2018-04-29")),
new(2, 5, 7, "Initial Coin Offering", DateTime.Parse("2018-05-06")),
new(2, 5, 8, "Fifty-One Percent", DateTime.Parse("2018-05-13")),
new(2, 5, 8, "Fifty-One Percent", DateTime.Parse("2018-05-13"))
};

var seriesData = series.Select(s => YdbValue.MakeStruct(new Dictionary<string, YdbValue>
Expand Down

0 comments on commit 84b25c7

Please sign in to comment.