Skip to content

Commit 1525687

Browse files
authored
Update reviewdog configs, and improve Unity logging (#195)
* feat: update GitHub Actions permissions for pull requests * fix: adjust permissions configuration in workflow files * refactor: replace Console.WriteLine with Debug.Log * feat: update permissions in GitHub Actions workflow * fix: adjust reviewdog filter mode in lint workflow * fix: update default exit code and remove unused permissions * feat: add exclude paths to Unity CS linter workflow
1 parent 5c462f4 commit 1525687

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

.github/workflows/reusable-lint-cs-files.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ jobs:
203203
reviewdog -f=sarif \
204204
-name="StyleCop" \
205205
-reporter=${{ inputs.review-reporter }} \
206-
-filter-mode=file \
206+
-filter-mode=nofilter \
207207
-level=${{ inputs.review-level }} \
208208
-fail-level=${{ inputs.review-exit-code }} \
209209
< output.sarif

.github/workflows/reusable-unity-cs-linter-dispatch.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ on:
3232
description: 'Exit code string based on reviewdog exit codes. [none,any,info,warning,error] https://github.com/reviewdog/reviewdog?tab=readme-ov-file#exit-codes'
3333
required: false
3434
type: string
35-
default: 'error'
35+
default: 'none'
3636
max-log-lines:
3737
description: 'Maximum number of lines to print from the log'
3838
required: false
3939
type: string
4040
default: '50'
4141

42+
permissions:
43+
checks: write
44+
4245
jobs:
4346
branch-conf:
4447
runs-on: ubuntu-22.04

.github/workflows/test-unity-cs-linter-dispatch.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ on:
2222
type: string
2323
default: ''
2424

25-
permissions:
26-
contents: write
27-
actions: read
28-
checks: write
29-
statuses: write
30-
3125
jobs:
3226
unity-cs-linter:
3327
uses: ./.github/workflows/reusable-unity-cs-linter-dispatch.yaml

.github/workflows/test-unity-cs-linter-pull-request.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ jobs:
1212
head-branch: ${{ github.event.pull_request.head.ref }}
1313
base-branch: ${{ github.event.pull_request.base.ref }}
1414
editorconfig-branch: ${{ github.event.repository.default_branch }}
15-
include-paths: 'Assets/Tests/StyleTest/.*'
15+
include-paths: 'Assets/Tests/StyleTest/.*'
16+
exclude-paths: 'Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs'

Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
2+
using UnityEngine;
23

34
namespace CodeStyleExample
45
{
@@ -17,28 +18,28 @@ public class FileNameIssueStyleViolationTest
1718
// メソッド名の命名規則違反(PascalCaseが推奨される)
1819
public void printmessage() // 【違反】PascalCaseでない
1920
{
20-
Console.WriteLine("This should follow PascalCase.");
21+
Debug.Log("This should follow PascalCase.");
2122
}
2223

2324
// 正しいメソッド
2425
public void DisplayMessage()
2526
{
26-
Console.WriteLine(_exampleField);
27+
Debug.Log(_exampleField);
2728
}
2829

2930
// if文に波括弧{}が無い(スタイル違反: IDE0011)
3031
public void CheckCondition(int value)
3132
{
3233
if (value > 0) // 【違反】波括弧が無い
33-
Console.WriteLine("Value is positive.");
34+
Debug.Log("Value is positive.");
3435
}
3536

3637
// 正しい条件分岐
3738
public void CorrectConditionCheck(int value)
3839
{
3940
if (value > 0)
4041
{
41-
Console.WriteLine("Value is positive.");
42+
Debug.Log("Value is positive.");
4243
}
4344
}
4445

0 commit comments

Comments
 (0)