Skip to content

format チェックの CI 追加 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 18, 2024
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
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "8.3.546805",
"commands": [
"dotnet-format"
],
"rollForward": false
}
}
}
16 changes: 16 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Format check
on:
push:

jobs:
format_check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Check formatting
run: dotnet format whitespace Assets/ArtNet --folder -v diagnostic --verify-no-changes
2 changes: 1 addition & 1 deletion Assets/ArtNet/Editor/DmxRecorder/ConvertAnimInspector.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UnityEditor;
using UnityEditor;
using UnityEngine;

namespace ArtNet.Editor.DmxRecorder
Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Editor/DmxRecorder/DmxTimelineSetting.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using UnityEngine;

Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Editor/DmxRecorder/RecordConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;

namespace ArtNet.Editor.DmxRecorder
{
Expand Down
20 changes: 10 additions & 10 deletions Assets/ArtNet/Editor/DmxRecorder/RecorderWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -147,9 +147,9 @@ private void InitializeRecordingConfig(VisualElement root)
});
_selectDirectoryButton = root.Q<Button>("selectFolderButton");
_selectDirectoryButton.Add(new Image()
{
image = EditorGUIUtility.IconContent("Folder Icon").image
}
{
image = EditorGUIUtility.IconContent("Folder Icon").image
}
);
_selectDirectoryButton.clicked += () =>
{
Expand All @@ -171,9 +171,9 @@ private void InitializeRecordingConfig(VisualElement root)
outputWarningIcon.image = EditorGUIUtility.IconContent("Warning@2x").image;
var openOutputFolderButton = root.Q<Button>("openOutputFolderButton");
openOutputFolderButton.Add(new Image()
{
image = EditorGUIUtility.IconContent("FolderOpened Icon").image
}
{
image = EditorGUIUtility.IconContent("FolderOpened Icon").image
}
);
openOutputFolderButton.clicked += () =>
{
Expand All @@ -182,9 +182,9 @@ private void InitializeRecordingConfig(VisualElement root)

_errorMessageArea = root.Q<VisualElement>("errorMessageArea");
_errorMessageArea.Add(new Image()
{
image = EditorGUIUtility.IconContent("console.erroricon@2x").image
}
{
image = EditorGUIUtility.IconContent("console.erroricon@2x").image
}
);
_errorMessageLabel = new Label();
_errorMessageArea.Add(_errorMessageLabel);
Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Editor/DmxRecorder/Sender.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Editor/DmxRecorder/SenderConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Net;
using System.Net;

namespace ArtNet.Editor.DmxRecorder
{
Expand Down
14 changes: 7 additions & 7 deletions Assets/ArtNet/Editor/DmxRecorder/SenderWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -56,9 +56,9 @@ private void InitializeSenderPanel(VisualElement root)

var selectPlayFileButton = root.Q<Button>("selectPlayFileButton");
selectPlayFileButton.Add(new Image()
{
image = EditorGUIUtility.IconContent("Folder Icon").image
}
{
image = EditorGUIUtility.IconContent("Folder Icon").image
}
);
selectPlayFileButton.clicked += () =>
{
Expand Down Expand Up @@ -177,9 +177,9 @@ private void InitializeSenderSettings(VisualElement root)

_senderErrorMessageArea = root.Q<VisualElement>("senderErrorMessageArea");
_senderErrorMessageArea.Add(new Image()
{
image = EditorGUIUtility.IconContent("console.erroricon@2x").image
}
{
image = EditorGUIUtility.IconContent("console.erroricon@2x").image
}
);
_senderErrorMessageLabel = new Label();
_senderErrorMessageArea.Add(_senderErrorMessageLabel);
Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Editor/DmxRecorder/TimelineConverter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using ArtNet.Packets;
Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Runtime/Scripts/ConvertAnim.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;

namespace ArtNet
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Runtime/Scripts/DmxData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public int this[int index]
_dmxValues[index] = newValue;
if (index is >= 1 and <= 512)
{
GetType().GetField($"Ch{index:D3}").SetValue(this, newValue);
GetType().GetField($"Ch{index:D3}").SetValue(this, newValue);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/ArtNet/Runtime/Scripts/UdpSender.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Net;
using System.Net;
using System.Net.Sockets;

namespace ArtNet
Expand Down
15 changes: 15 additions & 0 deletions Tools/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -e

# check dotnet command
if ! which dotnet > /dev/null; then
echo "error: dotnet command not found"
exit 1
fi

# check dotnet-format
if ! dotnet tool list | grep -q dotnet-format; then
echo "error: dotnet-format not found. Please run the 'dotnet tool restore' command to install dotnet-format"
exit 1
fi

dotnet format whitespace Assets/ArtNet --folder