Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8cba830
feat: add StyleTest2 for style-related testing
IShix-g Feb 28, 2025
46df322
refactor: improve code naming conventions
IShix-g Feb 28, 2025
0e4d747
Merge branch 'main' into develop/unity-lint-head
IShix-g Feb 28, 2025
6bc52a2
Merge branch 'main' into develop/unity-lint-head
IShix-g Feb 28, 2025
b25274c
feat: add StyleTest3 class for style testing
IShix-g Feb 28, 2025
a937c33
refactor: rename static field for consistency
IShix-g Feb 28, 2025
05cba49
refactor: standardize private field naming convention
IShix-g Feb 28, 2025
a64921e
Merge branch 'main' into develop/unity-lint-head
IShix-g Feb 28, 2025
974ff39
feat: add new StyleTest4 class for testing styles
IShix-g Feb 28, 2025
5000512
refactor: rename field for consistency with naming convention
IShix-g Feb 28, 2025
65e30af
Merge branch 'main' into develop/unity-lint-head
IShix-g Feb 28, 2025
2f40b41
refactor: fix indentation in StyleTest4.cs
IShix-g Feb 28, 2025
15ff281
Merge remote-tracking branch 'origin/main' into develop/unity-lint-head
IShix-g Mar 1, 2025
9f96836
refactor: fix indentation in StyleTest4.cs
IShix-g Mar 1, 2025
37c278a
Merge branch 'main' into develop/unity-lint-head
IShix-g Mar 1, 2025
12131fe
fix: correct indentation in StyleTest4.cs
IShix-g Mar 1, 2025
c0d3f9b
Merge branch 'main' into develop/unity-lint-head
IShix-g Mar 1, 2025
5072461
fix: correct indentation in StyleTest4.cs
IShix-g Mar 1, 2025
983f3ab
Merge remote-tracking branch 'origin/main' into develop/unity-lint-head
IShix-g Mar 1, 2025
9ffeac4
refactor: fix code styling issues in StyleTest classes
IShix-g Mar 1, 2025
3de996b
Merge branch 'main' into develop/unity-lint-head
IShix-g Mar 1, 2025
2217e2b
refactor: fix code style inconsistencies in test files
IShix-g Mar 1, 2025
ca8d4e8
Merge branch 'main' into develop/unity-lint-head
IShix-g Mar 1, 2025
dc5e24a
refactor: fix code indentation in StyleTest files
IShix-g Mar 1, 2025
dac7123
Merge branch 'main' into develop/unity-lint-head
IShix-g Mar 1, 2025
2820ac5
refactor: improve code formatting and naming consistency
IShix-g Mar 1, 2025
668e0ce
Merge branch 'main' into develop/unity-lint-head
IShix-g Mar 1, 2025
270c825
refactor: improve code style and naming consistency
IShix-g Mar 1, 2025
e6eeeb2
Merge branch 'feature/unity-lint' into develop/unity-lint-head
IShix-g Mar 1, 2025
f98ee32
refactor: fix coding style and rename variable for clarity
IShix-g Mar 1, 2025
cee7642
Add reusable Unity C# linter workflows (#193)
IShix-g Mar 1, 2025
8c6350b
feat: update linter workflow to require include-paths input
IShix-g Mar 1, 2025
289e0a8
feat: update workflow name for clarity
IShix-g Mar 1, 2025
5845941
feat: add style violation test and update linter workflows
IShix-g Mar 1, 2025
98fde76
feat: update permissions for GitHub Actions workflow
IShix-g Mar 1, 2025
46a37b9
feat: update permissions in workflow file
IShix-g Mar 1, 2025
6756994
fix: correct permissions in test-unity-cs-linter workflow
IShix-g Mar 1, 2025
09dd9bd
feat: update permissions in GitHub Actions workflow
IShix-g Mar 1, 2025
fa2dba2
refactor: update permissions config in GitHub workflows
IShix-g Mar 1, 2025
add0426
feat: enhance lint workflows with new configuration inputs
IShix-g Mar 1, 2025
3f7ebc9
fix: update review-reporter to github-pr-check
IShix-g Mar 1, 2025
0a69fa2
fix: update permissions and adjust review-reporter
IShix-g Mar 1, 2025
04be864
fix: set correct review-exit-code for linter dispatch
IShix-g Mar 1, 2025
80569db
fix: update permissions to allow contents write access
IShix-g Mar 1, 2025
3346bed
fix: adjust permissions and update reviewdog exit code default
IShix-g Mar 1, 2025
09f1dc9
feat: update workflow defaults and add permissions
IShix-g Mar 1, 2025
977fb43
fix: adjust permissions in Unity CI workflows
IShix-g Mar 1, 2025
7754f0a
fix: adjust permissions in reusable workflow
IShix-g Mar 1, 2025
ba9518e
fix: adjust permissions in GitHub Actions workflow
IShix-g Mar 1, 2025
52476d6
fix: correct GitHub Actions permissions configuration
IShix-g Mar 1, 2025
5c462f4
fix: correct permissions in GitHub Actions workflows
IShix-g Mar 1, 2025
8ca9818
feat: update GitHub Actions permissions for pull requests
IShix-g Mar 1, 2025
db39994
fix: adjust permissions configuration in workflow files
IShix-g Mar 1, 2025
3a27b55
refactor: replace Console.WriteLine with Debug.Log
IShix-g Mar 1, 2025
c3513db
feat: update permissions in GitHub Actions workflow
IShix-g Mar 1, 2025
b8b67f5
fix: adjust reviewdog filter mode in lint workflow
IShix-g Mar 1, 2025
a9e8bcf
fix: update default exit code and remove unused permissions
IShix-g Mar 1, 2025
55faa15
Merge branch 'feature/unity-lint' into develop/unity-lint-head
IShix-g Mar 1, 2025
a1a4e06
refactor: standardize private field naming convention
IShix-g Mar 1, 2025
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
12 changes: 9 additions & 3 deletions .github/workflows/reusable-unity-cs-linter-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ on:
type: string
default: 'warning'
review-exit-code:
description: 'Exit code string based on reviewdog exit codes. [any,info,warning,error] https://github.com/reviewdog/reviewdog?tab=readme-ov-file#exit-codes'
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 Expand Up @@ -155,4 +158,7 @@ jobs:
ref: ${{ needs.branch-conf.outputs.head-branch || needs.branch-conf.outputs.base-branch }}
editorconfig-branch: ${{ needs.branch-conf.outputs.editorconfig-branch }}
files: ${{ needs.detect-cs-files.outputs.files }}
review-reporter: 'github-check'
max-log-lines: ${{ inputs.max-log-lines }}
review-reporter: 'github-check'
review-level: ${{ inputs.review-level }}
review-exit-code: ${{ inputs.review-exit-code }}
7 changes: 5 additions & 2 deletions .github/workflows/reusable-unity-cs-linter-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
type: string
default: 'warning'
review-exit-code:
description: 'Exit code string based on reviewdog exit codes. [any,info,warning,error] https://github.com/reviewdog/reviewdog?tab=readme-ov-file#exit-codes'
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'
Expand Down Expand Up @@ -166,4 +166,7 @@ jobs:
ref: ${{ needs.branch-conf.outputs.head-branch || needs.branch-conf.outputs.base-branch }}
editorconfig-branch: ${{ needs.branch-conf.outputs.editorconfig-branch }}
files: ${{ needs.detect-cs-files.outputs.files }}
review-reporter: 'github-pr-review'
max-log-lines: ${{ inputs.max-log-lines }}
review-reporter: 'github-pr-review'
review-level: ${{ inputs.review-level }}
review-exit-code: ${{ inputs.review-exit-code }}
3 changes: 3 additions & 0 deletions .github/workflows/reusable-unity-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ on:
UNITY_SERIAL:
required: false

permissions:
checks: write

jobs:
print-unity-version:
runs-on: ubuntu-22.04
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-unity-cs-linter-dispatch.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: (Test) Unity C# Linter
name: (Test) Unity C# Linter for Dispatch

on:
workflow_dispatch:
inputs:
include-paths:
description: 'Comma-separated regex patterns for files or directories to include. More info: https://www.gnu.org/software/grep/manual/'
required: false
required: true
type: string
default: 'Assets/.*'
default: 'Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs'
exclude-paths:
description: 'Exclude files or directories (regex, comma-separated)'
required: false
Expand All @@ -17,7 +17,7 @@ on:
inputs:
include-paths:
type: string
default: 'Assets/.*'
default: 'Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs'
exclude-paths:
type: string
default: ''
Expand Down
54 changes: 54 additions & 0 deletions Assets/Tests/StyleTest/FileNameIssueStyleViolationTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

using UnityEngine;

namespace CodeStyleExample
{
// クラス名はPascalCaseが推奨されているが、lowercase名を使った例(スタイル違反)
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 / unity-cs-linter / lint-cs-files / lint-cs-files

Naming rule violation: Missing prefix: '_'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [StyleCop] reported by reviewdog 🐶
Naming rule violation: Missing prefix: '_'


// 正しい名前のフィールド
private string _exampleField = "Valid";

// Staticメンバー配置順序の違反(推奨: 静的要素 → インスタンスメンバーの順序)
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 / unity-cs-linter / lint-cs-files / lint-cs-files

Naming rule violation: These words must begin with upper case characters: printmessage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [StyleCop] reported by reviewdog 🐶
Naming rule violation: These words must begin with upper case characters: printmessage

{
Debug.Log("This should follow PascalCase.");
}

// 正しいメソッド
public void DisplayMessage()
{
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 / unity-cs-linter / lint-cs-files / lint-cs-files

Add braces to 'if' statement.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [StyleCop] reported by reviewdog 🐶
Add braces to 'if' statement.

Debug.Log("Value is positive.");

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

View workflow job for this annotation

GitHub Actions / unity-cs-linter / lint-cs-files / lint-cs-files

Braces should not be omitted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [StyleCop] reported by reviewdog 🐶
Braces should not be omitted

}

// 正しい条件分岐
public void CorrectConditionCheck(int value)
{
if (value > 0)
{
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 / unity-cs-linter / lint-cs-files / lint-cs-files

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [StyleCop] reported by reviewdog 🐶
Naming rule violation: These words must begin with upper case characters: myProperty


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

// 最後に改行がない(スタイル違反: `insert_final_newline=true`)
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Assets/Tests/StyleTest/StyleTest2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Tests.StyleTest
{
public sealed class StyleTest2
{
static string s_staticField = string.Empty;
string test;

Check failure on line 6 in Assets/Tests/StyleTest/StyleTest2.cs

View workflow job for this annotation

GitHub Actions / unity-cs-linter / lint-cs-files / lint-cs-files

Naming rule violation: Missing prefix: '_'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [StyleCop] reported by reviewdog 🐶
Naming rule violation: Missing prefix: '_'

string _test2;

void Test()
{
var test = this._test2;

}
}
}
3 changes: 3 additions & 0 deletions Assets/Tests/StyleTest/StyleTest2.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Assets/Tests/StyleTest/StyleTest3.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Tests.StyleTest
{
public sealed class StyleTest3
{
public static readonly string TestStaticReadonly = "TestStaticReadonly";
static string s_staticField = string.Empty;
string _test;
string _test2;

void Test()
{
}
}
}
3 changes: 3 additions & 0 deletions Assets/Tests/StyleTest/StyleTest3.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Assets/Tests/StyleTest/StyleTest4.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Tests.StyleTest
{
public sealed class StyleTest4
{
static string s_staticField = string.Empty;
string _test;
string _test2;

void Test()
{
var test = this._test2;

}
}
}
3 changes: 3 additions & 0 deletions Assets/Tests/StyleTest/StyleTest4.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading