Skip to content

Commit 3d639ce

Browse files
shacharPashchayim
andauthored
Lint checks in CI runs (#183)
* delete mock * coverage * fix test * indent * change to var - check * cluster test * add opthin to connect cluster with dotnet test * use key in topk tests * get env vars inside RedisFixture * skip if redis * add skip where needed * Execute broadcast * delete cluster tests * RedisFixture fix * add to contributing * run cluster on CI * wip * fix / * -d * delete restore * return restore * add -RC3 * add RC3 to docker-compose * try define both .net 6 and 7 * Skip if cluster where needed * add names * skip configOnTimeout if cluster * try to fix win tests * tests names +fix win version * fix versions * versions * win verer * wording * dotnet format * format * format * add linter.yaml * update linter * lint on push * change linter * create lint problems to see what happen * linter force and run * try to fix yml * dotnet format * tell the contributer to run dotnet format in the CONTRIBUTING.md * disable multi runs * fix warnings * chayom changes --------- Co-authored-by: Chayim <[email protected]> Co-authored-by: Chayim I. Kirshen <[email protected]>
1 parent 30dee6e commit 3d639ce

File tree

6 files changed

+40
-8
lines changed

6 files changed

+40
-8
lines changed

.github/workflows/linter.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Format check on pull request
2+
3+
on: pull_request
4+
5+
concurrency:
6+
group: ${{ github.event.pull_request.number || github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
dotnet-format:
11+
runs-on: windows-latest
12+
steps:
13+
- name: Install dotnet-format
14+
run: dotnet tool install -g dotnet-format
15+
16+
- name: Checkout repo
17+
uses: actions/checkout@v2
18+
with:
19+
ref: ${{ github.head_ref }}
20+
21+
- name: lint
22+
run: |
23+
dotnet format
24+
25+
- name: Check for modified files
26+
run: |
27+
if (git status | Select-String -Pattern 'modified') {
28+
Write-Host "Modified files found. Please run dotnet format and commit the changes."
29+
exit 1
30+
} else {
31+
Write-Host "No modified files found."
32+
}

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Here's how to get started with your code contribution:
3535
3. Write your tests
3636

3737
4. Use the `docker run -p 6379:6379 -it redis/redis-stack-server:edge` as your local environment for running the functional tests. You can also use Development Container as described below.
38-
5. Make sure your tests pass using `dotnet test`
39-
6. Push your changes to GitHub
38+
5. Run dotnet format to make sure your code is formatted
39+
6. Make sure your tests pass using `dotnet test`
4040
7. Open a pull request
4141

4242
## Development Container

tests/NRedisStack.Tests/Search/SearchTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2438,13 +2438,13 @@ public async Task TestAddAndGetSuggestionAsync()
24382438
Assert.True(await ft.SugAddAsync(key, noMatch, 1d) > 0);
24392439

24402440
// test that with a partial part of that string will have the entire word returned
2441-
Assert.Single((await ft.SugGetAsync(key, suggestion.Substring(0, 3), true, max: 5)));
2441+
Assert.Single(await ft.SugGetAsync(key, suggestion.Substring(0, 3), true, max: 5));
24422442

24432443
// turn off fuzzy start at second word no hit
24442444
Assert.Empty((await ft.SugGetAsync(key, noMatch.Substring(1, 6), false, max: 5)));
24452445

24462446
// my attempt to trigger the fuzzy by 1 character
2447-
Assert.Single((await ft.SugGetAsync(key, noMatch.Substring(1, 6), true, max: 5)));
2447+
Assert.Single(await ft.SugGetAsync(key, noMatch.Substring(1, 6), true, max: 5));
24482448
}
24492449

24502450
[Fact]

tests/NRedisStack.Tests/SkipIfRedisAttribute.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public override string? Skip
6666
break;
6767

6868
case Is.Standalone:
69+
6970
if (!redisFixture.isOSSCluster)
7071
{
7172
skipReason = skipReason + " Redis server is not OSS cluster.";
@@ -74,7 +75,7 @@ public override string? Skip
7475
break;
7576
}
7677
}
77-
// Version check (if Is.Standalone/Is.Cluster is set then )
78+
// Version check (if Is.Standalone/Is.OSSCluster is set then )
7879

7980
var serverVersion = redisFixture.Redis.GetServer(redisFixture.Redis.GetEndPoints()[0]).Version;
8081
var targetVersion = new Version(_targetVersion);

tests/NRedisStack.Tests/TopK/TopKTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public void CreateTopKFilter()
2222

2323
var res = topk.Add(key, "bb", "cc");
2424
Assert.True(res![0].IsNull && res[1].IsNull);
25-
2625
Assert.Equal(topk.Query(key, "bb", "gg", "cc"), new bool[] { true, false, true });
2726
Assert.False(topk.Query(key, "notExists"));
2827

tests/NRedisStack.Tests/TransactionsTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void TestJsonTransaction()
3030

3131
[SkipIfRedis(Comparison.GreaterThanOrEqual, "7.1.242")]
3232
[Obsolete]
33-
public async Task TestModulsTransaction()
33+
public void TestModulsTransaction()
3434
{
3535
IDatabase db = redisFixture.Redis.GetDatabase();
3636
db.Execute("FLUSHALL");
@@ -82,7 +82,7 @@ public async Task TestModulsTransaction()
8282

8383
[SkipIfRedis(Is.OSSCluster)]
8484
[Obsolete]
85-
public async Task TestModulsTransactionWithoutGraph()
85+
public void TestModulsTransactionWithoutGraph()
8686
{
8787
IDatabase db = redisFixture.Redis.GetDatabase();
8888
db.Execute("FLUSHALL");

0 commit comments

Comments
 (0)