浏览代码
Add linter (#227)
Add linter (#227)
* Add linter and pre-commit hooks * Formatting * Remove setting up ruby/dev-backup
GitHub
4 年前
当前提交
ce803d3b
共有 38 个文件被更改,包括 366 次插入 和 240 次删除
-
2.github/PULL_REQUEST_TEMPLATE.md
-
2.gitignore
-
14CONTRIBUTING.md
-
10README.md
-
2faq.md
-
28tutorials/pick_and_place/0_ros_setup.md
-
22tutorials/pick_and_place/1_urdf.md
-
58tutorials/pick_and_place/2_ros_tcp.md
-
30tutorials/pick_and_place/3_pick_and_place.md
-
34tutorials/pick_and_place/4_pick_and_place.md
-
4tutorials/pick_and_place/PickAndPlaceProject/Assets/Tests/EditMode/PickAndPlaceMessageGenerationtests.cs
-
2tutorials/pick_and_place/PickAndPlaceProject/Assets/URDF/niryo_one/niryo_one_urdf/README.md
-
8tutorials/pick_and_place/README.md
-
6tutorials/pick_and_place/ROS/src/niryo_moveit/README.md
-
2tutorials/pick_and_place/ROS/src/niryo_one_urdf/README.md
-
16tutorials/pick_and_place/Scripts/SourceDestinationPublisher.cs
-
30tutorials/pick_and_place/Scripts/TrajectoryPlanner.cs
-
26tutorials/pick_and_place/Scripts_Part4/RealSimPickAndPlace.cs
-
12tutorials/pick_and_place/moveit_file_descriptions.md
-
10tutorials/pick_and_place/quick_demo.md
-
6tutorials/quick_setup.md
-
2tutorials/ros_unity_integration/network.md
-
8tutorials/ros_unity_integration/publisher.md
-
8tutorials/ros_unity_integration/server_endpoint.md
-
2tutorials/ros_unity_integration/service.md
-
10tutorials/ros_unity_integration/setup.md
-
4tutorials/ros_unity_integration/subscriber.md
-
4tutorials/ros_unity_integration/unity_scripts/RosPublisherExample.cs
-
4tutorials/ros_unity_integration/unity_scripts/RosServiceExample.cs
-
36tutorials/ros_unity_integration/unity_scripts/RosSubscriberExample.cs
-
4tutorials/ros_unity_integration/unity_scripts/RosUnityServiceExample.cs
-
22tutorials/ros_unity_integration/unity_service.md
-
42tutorials/urdf_importer/urdf_appendix.md
-
10tutorials/urdf_importer/urdf_tutorial.md
-
75.editorconfig
-
32.pre-commit-config.yaml
-
19.github/workflows/pre-commit.yaml
|
|||
using UnityEngine; |
|||
using Unity.Robotics.ROSTCPConnector; |
|||
using RosColor = RosMessageTypes.RoboticsDemo.MUnityColor; |
|||
|
|||
public class RosSubscriberExample : MonoBehaviour |
|||
{ |
|||
public GameObject cube; |
|||
|
|||
void Start() |
|||
{ |
|||
ROSConnection.instance.Subscribe<RosColor>("color", ColorChange); |
|||
} |
|||
|
|||
void ColorChange(RosColor colorMessage) |
|||
{ |
|||
cube.GetComponent<Renderer>().material.color = new Color32((byte)colorMessage.r, (byte)colorMessage.g, (byte)colorMessage.b, (byte)colorMessage.a); |
|||
} |
|||
} |
|||
using UnityEngine; |
|||
using Unity.Robotics.ROSTCPConnector; |
|||
using RosColor = RosMessageTypes.RoboticsDemo.MUnityColor; |
|||
|
|||
public class RosSubscriberExample : MonoBehaviour |
|||
{ |
|||
public GameObject cube; |
|||
|
|||
void Start() |
|||
{ |
|||
ROSConnection.instance.Subscribe<RosColor>("color", ColorChange); |
|||
} |
|||
|
|||
void ColorChange(RosColor colorMessage) |
|||
{ |
|||
cube.GetComponent<Renderer>().material.color = new Color32((byte)colorMessage.r, (byte)colorMessage.g, (byte)colorMessage.b, (byte)colorMessage.a); |
|||
} |
|||
} |
|
|||
; see http://editorconfig.org/ for docs on this file |
|||
; See https://github.com/dotnet/format for dotnet format |
|||
|
|||
root = true |
|||
|
|||
[*] |
|||
ignore_if_in_header = This code was generated by a tool|<auto-generated> |
|||
indent_style = space |
|||
indent_size = 4 |
|||
; uncomment to help with sharing files across os's (i.e. network share or through local vm) |
|||
#end_of_line = lf |
|||
; avoid a bom, which causes endless problems with naive text tooling |
|||
charset = utf-8 |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = true |
|||
; keeping auto-format enabled helps avoid merge hell for projects without CI-based format validation |
|||
#disable_auto_format = true |
|||
|
|||
[*.cs] |
|||
; uncomment to enable full formatting of c# files |
|||
formatters = generic, uncrustify |
|||
|
|||
[*.asmdef] |
|||
scrape_api = true |
|||
|
|||
[**/Tests/**.asmdef] |
|||
scrape_api = false |
|||
|
|||
[*.Tests.asmdef] |
|||
scrape_api = false |
|||
|
|||
[*.md] |
|||
indent_size = 2 |
|||
; trailing whitespace is unfortunately significant in markdown |
|||
trim_trailing_whitespace = false |
|||
; uncomment to enable basic formatting of markdown files |
|||
#formatters = generic |
|||
|
|||
[{Makefile,makefile}] |
|||
; tab characters are part of the Makefile format |
|||
indent_style = tab |
|||
|
|||
[*.asmdef] |
|||
indent_size = 4 |
|||
|
|||
[*.json] |
|||
indent_size = 2 |
|||
|
|||
[*.{vcproj,bat,cmd,xaml,tt,t4,ttinclude}] |
|||
end_of_line = crlf |
|||
|
|||
; this VS-specific stuff is based on experiments to see how VS will modify a file after it has been manually edited. |
|||
; the settings are meant to closely match what VS does to minimize unnecessary diffs. |
|||
[*.{vcxproj,vcxproj.filters}] |
|||
indent_style = space |
|||
indent_size = 2 |
|||
end_of_line = crlf |
|||
charset = utf-8-bom |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = false |
|||
; must be broken out because of 51-char bug (https://github.com/editorconfig/editorconfig-visualstudio/issues/21) |
|||
[*.{csproj,pyproj,props,targets}] |
|||
indent_style = space |
|||
indent_size = 2 |
|||
end_of_line = crlf |
|||
charset = utf-8-bom |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = false |
|||
[*.{sln,sln.template}] |
|||
indent_style = tab |
|||
indent_size = 4 |
|||
end_of_line = crlf |
|||
charset = utf-8 |
|||
trim_trailing_whitespace = true |
|||
insert_final_newline = false |
|
|||
repos: |
|||
- repo: https://github.com/pre-commit/pre-commit-hooks |
|||
rev: v4.0.1 |
|||
hooks: |
|||
- id: mixed-line-ending |
|||
exclude: > |
|||
(?x)^( |
|||
.*cs.meta| |
|||
.*.css| |
|||
.*.meta| |
|||
.*.mat| |
|||
.*.preset| |
|||
.*.lighting| |
|||
.*.dae |
|||
)$ |
|||
args: [--fix=lf] |
|||
|
|||
- id: trailing-whitespace |
|||
name: trailing-whitespace-markdown |
|||
types: [markdown] |
|||
- id: check-merge-conflict |
|||
args: [--assume-in-merge] |
|||
- id: check-yaml |
|||
# Won't handle the templating in yamato |
|||
exclude: \.yamato/.* |
|||
|
|||
|
|||
- repo: https://github.com/dotnet/format |
|||
rev: "7e343070a0355c86f72bdee226b5e19ffcbac931" |
|||
hooks: |
|||
- id: dotnet-format |
|||
args: [--folder, --include] |
|
|||
name: pre-commit |
|||
|
|||
on: |
|||
pull_request: |
|||
push: |
|||
branches: [dev] |
|||
|
|||
jobs: |
|||
pre-commit: |
|||
runs-on: ubuntu-latest |
|||
steps: |
|||
- uses: actions/checkout@v2 |
|||
- uses: actions/setup-python@v2 |
|||
with: |
|||
python-version: 3.7.x |
|||
- uses: actions/setup-dotnet@v1 |
|||
with: |
|||
dotnet-version: '3.1.x' |
|||
- uses: pre-commit/action@v2.0.0 |
撰写
预览
正在加载...
取消
保存
Reference in new issue