Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/reusable-lint-cs-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
reviewdog -f=sarif \
-name="StyleCop" \
-reporter=${{ inputs.review-reporter }} \
-filter-mode=file \
-filter-mode=nofilter \
-level=${{ inputs.review-level }} \
-fail-level=${{ inputs.review-exit-code }} \
< output.sarif
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/reusable-unity-cs-linter-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ on:
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'
required: false
type: string
default: 'error'
default: 'none'
max-log-lines:
description: 'Maximum number of lines to print from the log'
required: false
type: string
default: '50'

permissions:
checks: write

jobs:
branch-conf:
runs-on: ubuntu-22.04
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/test-unity-cs-linter-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ on:
type: string
default: ''

permissions:
contents: write
actions: read
checks: write
statuses: write

jobs:
unity-cs-linter:
uses: ./.github/workflows/reusable-unity-cs-linter-dispatch.yaml
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-unity-cs-linter-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ jobs:
head-branch: ${{ github.event.pull_request.head.ref }}
base-branch: ${{ github.event.pull_request.base.ref }}
editorconfig-branch: ${{ github.event.repository.default_branch }}
include-paths: 'Assets/Tests/StyleTest/.*'
include-paths: 'Assets/Tests/StyleTest/.*'
exclude-paths: 'Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs'
11 changes: 6 additions & 5 deletions Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;

using UnityEngine;

namespace CodeStyleExample
{
Expand All @@ -6,7 +7,7 @@
public class FileNameIssueStyleViolationTest
{
// メンバー変数の命名規則違反(推奨: _camelCase または PascalCase)
private int TestVariable = 10;

Check failure on line 10 in Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs

View workflow job for this annotation

GitHub Actions / release-notes / lint-cs-files / lint-cs-files

Naming rule violation: Missing prefix: '_'

// 正しい名前のフィールド
private string _exampleField = "Valid";
Expand All @@ -15,35 +16,35 @@
public static readonly string StaticExample = "Static Value";

// メソッド名の命名規則違反(PascalCaseが推奨される)
public void printmessage() // 【違反】PascalCaseでない

Check failure on line 19 in Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs

View workflow job for this annotation

GitHub Actions / release-notes / lint-cs-files / lint-cs-files

Naming rule violation: These words must begin with upper case characters: printmessage
{
Console.WriteLine("This should follow PascalCase.");
Debug.Log("This should follow PascalCase.");
}

// 正しいメソッド
public void DisplayMessage()
{
Console.WriteLine(_exampleField);
Debug.Log(_exampleField);
}

// if文に波括弧{}が無い(スタイル違反: IDE0011)
public void CheckCondition(int value)
{
if (value > 0) // 【違反】波括弧が無い

Check warning on line 33 in Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs

View workflow job for this annotation

GitHub Actions / release-notes / lint-cs-files / lint-cs-files

Add braces to 'if' statement.
Console.WriteLine("Value is positive.");
Debug.Log("Value is positive.");

Check warning on line 34 in Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs

View workflow job for this annotation

GitHub Actions / release-notes / lint-cs-files / lint-cs-files

Braces should not be omitted
}

// 正しい条件分岐
public void CorrectConditionCheck(int value)
{
if (value > 0)
{
Console.WriteLine("Value is positive.");
Debug.Log("Value is positive.");
}
}

// プロパティ定義ではPascalCaseが推奨
public int myProperty { get; set; } = 42; // 【違反】PascalCaseでない名前

Check failure on line 47 in Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs

View workflow job for this annotation

GitHub Actions / release-notes / lint-cs-files / lint-cs-files

Naming rule violation: These words must begin with upper case characters: myProperty

// 正しいプロパティ定義
public int MyProperty { get; set; } = 100;
Expand Down
Loading