Skip to content

Commit 0a9545e

Browse files
authored
Bringing the tree up to formatting parity with clang-format, shellcheck, shfmt, yaml linting, and MD lint (#432)
* Initial restyle * Updating json and pretty * Adding editorconfig * Forcing us to use common pretty-ify versions * Manually moving this up, fixing more pinning * restyle devcontainer * Pulling upstream * Keeping travis off restyled * Testing fix for codecov
1 parent b3cd438 commit 0a9545e

File tree

140 files changed

+3907
-3652
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+3907
-3652
lines changed

.devcontainer/Dockerfile

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ RUN apt-get -fy install git vim emacs sudo \
1818
iproute2 procps lsb-release \
1919
bash-completion \
2020
build-essential cmake cppcheck valgrind \
21-
wget curl telnet bsdtar
21+
wget curl telnet bsdtar \
22+
docker.io
2223
RUN groupadd --gid $USER_GID $USERNAME
2324
RUN useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME
2425
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME
@@ -31,4 +32,9 @@ RUN cd /var/downloads
3132
RUN curl -JL https://github.com/microsoft/vscode-cpptools/releases/download/0.27.0/cpptools-linux.vsix | bsdtar -xvf - extension
3233
RUN mkdir -p /home/vscode/.vscode-server/extensions
3334
RUN mv extension /home/vscode/.vscode-server/extensions/ms-vscode.cpptools-0.27.0
35+
RUN mkdir -p /home/vscode/bin
36+
RUN curl https://raw.githubusercontent.com/restyled-io/restyler/master/bin/restyle-path -o /home/vscode/bin/restyle-path
37+
RUN chmod +x /home/vscode/bin/restyle-path
3438
RUN chown -R vscode:vscode /home/vscode
39+
40+

.devcontainer/devcontainer.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
{
22
"name": "CHIP Ubuntu Development Environment",
3+
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
34
"build": {
45
"dockerfile": "Dockerfile",
56
"args": {
67
// "BUILD_VERSION": "$(cat integrations/docker/images/chip-build/version)" // trying to get this to work
78
"BUILD_VERSION": "0.2.7"
89
}
910
},
10-
"runArgs": [
11-
"--cap-add=SYS_PTRACE",
12-
"--security-opt",
13-
"seccomp=unconfined"
14-
],
1511
"remoteUser": "vscode",
1612
// Add the IDs of extensions you want installed when the container is created in the array below.
1713
"extensions": [
@@ -23,9 +19,11 @@
2319
"eamodio.gitlens",
2420
"yuichinukiyama.vscode-preview-server",
2521
"aaron-bond.better-comments",
26-
"foxundermoon.shell-format"
22+
"foxundermoon.shell-format",
23+
"editorconfig.editorconfig",
24+
"esbenp.prettier-vscode"
2725
],
28-
// Use 'settings' to set *default* container specific settings.json values on container create.
26+
// Use 'settings' to set *default* container specific settings.json values on container create.
2927
// You can edit these settings after create using File > Preferences > Settings > Remote.
3028
"settings": {
3129
"terminal.integrated.shell.linux": "/bin/bash"

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
trim_trailing_whitespace = true
2+
insert_final_newline = false
3+
indent_style = space

.prettierrc.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "http://json.schemastore.org/prettierrc",
3+
"printWidth": 80,
4+
"tabWidth": 4,
5+
"useTabs": false,
6+
"semi": true,
7+
"trailingComma": "all",
8+
"bracketSpacing": true,
9+
"jsxBracketSameLine": false,
10+
"arrowParens": "avoid",
11+
"proseWrap": "always"
12+
}

.restyled.yaml

+23-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ exclude:
2727
- "third_party/**/*"
2828
- "third_party/**"
2929
- "third_party/*"
30+
- "third_party"
31+
- "**/third_party/**/*"
32+
- "**/third_party/*"
33+
- "**/third_party/**"
34+
- "**/third_party/**/*"
35+
- "examples/lock-app/efr32/third_party/**/*"
36+
- "examples/lock-app/efr32/third_party/*"
37+
- "examples/lock-app/efr32/third_party/**"
3038
- "build/**/*"
3139
- "autom4te.cache/**/*"
3240

@@ -57,26 +65,40 @@ restylers:
5765
- "**/*.js"
5866
- "**/*.m"
5967
interpreters: []
60-
- name: jq
68+
- name: prettier-json
69+
image: restyled/restyler-prettier:v1.19.1-2
6170
enabled: true
71+
command:
72+
- prettier
73+
- "--write"
74+
arguments: []
6275
include:
6376
- "**/*.json"
77+
interpreters: []
6478
- name: prettier-markdown
79+
image: restyled/restyler-prettier:v1.19.1-2
80+
command:
81+
- prettier
82+
- "--write"
83+
arguments: []
6584
enabled: true
6685
include:
6786
- "**/*.md"
6887
- "**/*.markdown"
6988
- name: prettier-yaml
89+
image: restyled/restyler-prettier:v1.19.1-2
7090
enabled: true
7191
include:
7292
- "**/*.yml"
7393
- "**/*.yaml"
7494
- name: shellharden
95+
image: restyled/restyler-shellharden:v4.1.1-2
7596
enabled: true
7697
include:
7798
- "**/*.sh"
7899
- "**/*.bash"
79100
- name: shfmt
101+
image: restyled/restyler-shfmt:v3.0.1
80102
enabled: true
81103
include:
82104
- "**/*.sh"

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
language: minimal
22

3+
branches:
4+
except:
5+
- /^restyled.*$/
6+
37
services:
48
- docker
59

.vscode/launch.json

-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
8-
97
{
108
"name": "QRCode Tests",
119
"type": "cppdbg",
@@ -26,7 +24,6 @@
2624
}
2725
]
2826
},
29-
3027
{
3128
"name": "CHIP crypto Tests",
3229
"type": "cppdbg",

.vscode/settings.json

+16-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222
"[dockerfile]": {
2323
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
2424
},
25+
"[jsonc]": {
26+
"editor.defaultFormatter": "esbenp.prettier-vscode"
27+
},
28+
"[shellscript]": {
29+
"editor.defaultFormatter": "foxundermoon.shell-format"
30+
},
31+
"[properties]": {
32+
"editor.defaultFormatter": "foxundermoon.shell-format"
33+
},
34+
"[markdown]": {
35+
"editor.defaultFormatter": "esbenp.prettier-vscode"
36+
},
2537
"files.associations": {
2638
"iostream": "cpp",
2739
"array": "cpp",
@@ -66,7 +78,8 @@
6678
"cinttypes": "cpp",
6779
"typeinfo": "cpp",
6880
"*.ipp": "cpp",
69-
"aes.h": "c"
81+
"aes.h": "c",
82+
"stdio.h": "c"
7083
},
7184
"files.eol": "\n",
7285
"editor.formatOnSave": true,
@@ -108,5 +121,6 @@
108121
"backgroundColor": "transparent"
109122
}
110123
],
111-
"clang-format.fallbackStyle": "WebKit"
124+
"clang-format.fallbackStyle": "WebKit",
125+
"files.trimFinalNewlines": true
112126
}

.vscode/tasks.json

+15-41
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
"reveal": "always",
1616
"panel": "shared"
1717
},
18-
"problemMatcher": [
19-
"$gcc"
20-
]
18+
"problemMatcher": ["$gcc"]
2119
},
2220
{
2321
"label": "Auto-enforce coding style",
@@ -30,115 +28,91 @@
3028
"reveal": "always",
3129
"panel": "shared"
3230
},
33-
"problemMatcher": [
34-
"$gcc"
35-
]
31+
"problemMatcher": ["$gcc"]
3632
},
3733
{
3834
"label": "Verify coding style conformance",
3935
"type": "shell",
4036
"command": "make -C build/default pretty-check",
4137
"group": "none",
4238
"dependsOn": "Bootstrap",
43-
"problemMatcher": [
44-
"$gcc"
45-
]
39+
"problemMatcher": ["$gcc"]
4640
},
4741
{
4842
"label": "Run Unit and Functional Tests",
4943
"type": "shell",
5044
"command": "make -C build/default check",
5145
"group": "none",
5246
"dependsOn": "Bootstrap",
53-
"problemMatcher": [
54-
"$gcc"
55-
]
47+
"problemMatcher": ["$gcc"]
5648
},
5749
{
5850
"label": "Run Distribution Generation",
5951
"type": "shell",
6052
"command": "make -C build/default distcheck",
6153
"group": "none",
6254
"dependsOn": "Bootstrap",
63-
"problemMatcher": [
64-
"$gcc"
65-
]
55+
"problemMatcher": ["$gcc"]
6656
},
6757
{
6858
"label": "Run Code Coverage",
6959
"type": "shell",
7060
"command": "make -C build/default coverage; code -r build/default/src/chip.info/index.html",
7161
"group": "none",
7262
"dependsOn": "Bootstrap",
73-
"problemMatcher": [
74-
"$gcc"
75-
]
63+
"problemMatcher": ["$gcc"]
7664
},
7765
{
7866
"label": "Clean",
7967
"type": "shell",
8068
"command": "make -C build/default distclean",
8169
"group": "none",
8270
"dependsOn": "Bootstrap",
83-
"problemMatcher": [
84-
"$gcc"
85-
]
71+
"problemMatcher": ["$gcc"]
8672
},
8773
{
8874
"label": "Configure",
8975
"type": "shell",
9076
"command": "mkdir -p build/default && (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage)",
9177
"group": "none",
92-
"problemMatcher": [
93-
"$gcc"
94-
]
78+
"problemMatcher": ["$gcc"]
9579
},
9680
{
9781
"label": "Bootstrap",
9882
"type": "shell",
9983
"command": "if [[ ! -f build/default/config.status ]]; then mkdir -p build/default; (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage); else ./bootstrap -w make; fi",
10084
"group": "none",
101-
"problemMatcher": [
102-
"$gcc"
103-
],
85+
"problemMatcher": ["$gcc"]
10486
},
10587
{
10688
"label": "Clean Tree",
10789
"type": "shell",
10890
"command": "make -f Makefile-bootstrap clean-repos && git clean -Xdf",
10991
"group": "none",
110-
"problemMatcher": [
111-
"$gcc"
112-
]
92+
"problemMatcher": ["$gcc"]
11393
},
11494
{
11595
"label": "Run Setup Payload Tests",
11696
"type": "shell",
11797
"command": "make -C build/default/src/setup_payload check",
11898
"group": "none",
11999
"dependsOn": "Bootstrap",
120-
"problemMatcher": [
121-
"$gcc"
122-
]
100+
"problemMatcher": ["$gcc"]
123101
},
124102
{
125103
"label": "Build & Run Crypto Tests",
126104
"type": "shell",
127105
"command": "make -C build/default/src/crypto check",
128106
"group": "none",
129-
"problemMatcher": [
130-
"$gcc"
131-
]
107+
"problemMatcher": ["$gcc"]
132108
},
133109
{
134110
"label": "Build nRF5 Lock App",
135111
"type": "shell",
136112
"command": "make -C examples/lock-app/nrf5",
137113
"group": "none",
138114
"dependsOn": "Clean Tree",
139-
"problemMatcher": [
140-
"$gcc"
141-
]
142-
},
143-
],
115+
"problemMatcher": ["$gcc"]
116+
}
117+
]
144118
}

0 commit comments

Comments
 (0)