Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
24 changes: 15 additions & 9 deletions .github/workflows/reusable-lint-cs-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,30 @@ jobs:
dotnet tool install dotnet-format
dotnet add package StyleCop.Analyzers

- name: Ensure UTF-8 Encoding
run: |
for file in $(echo "${{ inputs.files }}" | tr ',|;' ' '); do
if file -i "$file" | grep -qv 'utf-8'; then
echo "Converting $file to UTF-8"
iconv -f $(file -bi "$file" | awk -F'=' '{print $2}') -t utf-8 "$file" -o "$file"
fi

if [ "$(head -c 3 "$file" | od -An -tx1 | tr -d ' ')" != "efbbbf" ]; then
echo "Adding BOM to $file"
echo -e '\xEF\xBB\xBF' | cat - "$file" > tmpfile && mv tmpfile "$file"
fi
done

- name: Collect Style Violations Log
id: violations-log
run: |
output=$(dotnet format TempProject.csproj --verify-no-changes 2>&1 || echo "Style violation detected")

if [ -z "$output" ]; then
echo "::notice::No issues were found in the code"
exit 0
fi

echo "$output" > output.log
dotnet format TempProject.csproj --verbosity diagnostic || true
echo "exits=1" >> "$GITHUB_OUTPUT"

- name: Generate Git Diff
id: generate-diff
if: ${{ steps.violations-log.outputs.exits == '1' }}
run: |
# Check for uncommitted changes
if [[ -n "$(git status --porcelain)" ]]; then
git diff > reviewdog.diff
echo "has_changes=1" >> "$GITHUB_OUTPUT"
Expand Down
15 changes: 15 additions & 0 deletions Assets/Tests/StyleTest/StyleTest18.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Tests.StyleTest

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 🐶

Suggested change




{
public sealed class StyleTest18
{
private int TestVariable = 10;

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

void Test(){}

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

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

Loading