Skip to content
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

Bringing the tree up to formatting parity with clang-format, shellcheck, shfmt, yaml linting, and MD lint #432

Merged
merged 13 commits into from
Apr 21, 2020
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
8 changes: 7 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ RUN apt-get -fy install git vim emacs sudo \
iproute2 procps lsb-release \
bash-completion \
build-essential cmake cppcheck valgrind \
wget curl telnet bsdtar
wget curl telnet bsdtar \
docker.io
RUN groupadd --gid $USER_GID $USERNAME
RUN useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME
Expand All @@ -31,4 +32,9 @@ RUN cd /var/downloads
RUN curl -JL https://github.com/microsoft/vscode-cpptools/releases/download/0.27.0/cpptools-linux.vsix | bsdtar -xvf - extension
RUN mkdir -p /home/vscode/.vscode-server/extensions
RUN mv extension /home/vscode/.vscode-server/extensions/ms-vscode.cpptools-0.27.0
RUN mkdir -p /home/vscode/bin
RUN curl https://raw.githubusercontent.com/restyled-io/restyler/master/bin/restyle-path -o /home/vscode/bin/restyle-path
RUN chmod +x /home/vscode/bin/restyle-path
RUN chown -R vscode:vscode /home/vscode


12 changes: 5 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"name": "CHIP Ubuntu Development Environment",
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
"build": {
"dockerfile": "Dockerfile",
"args": {
// "BUILD_VERSION": "$(cat integrations/docker/images/chip-build/version)" // trying to get this to work
"BUILD_VERSION": "0.2.7"
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"remoteUser": "vscode",
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
Expand All @@ -23,9 +19,11 @@
"eamodio.gitlens",
"yuichinukiyama.vscode-preview-server",
"aaron-bond.better-comments",
"foxundermoon.shell-format"
"foxundermoon.shell-format",
"editorconfig.editorconfig",
"esbenp.prettier-vscode"
],
// Use 'settings' to set *default* container specific settings.json values on container create.
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
Expand Down
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trim_trailing_whitespace = true
insert_final_newline = false
indent_style = space
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"proseWrap": "always"
}
24 changes: 23 additions & 1 deletion .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ exclude:
- "third_party/**/*"
- "third_party/**"
- "third_party/*"
- "third_party"
- "**/third_party/**/*"
- "**/third_party/*"
- "**/third_party/**"
- "**/third_party/**/*"
- "examples/lock-app/efr32/third_party/**/*"
- "examples/lock-app/efr32/third_party/*"
- "examples/lock-app/efr32/third_party/**"
- "build/**/*"
- "autom4te.cache/**/*"

Expand Down Expand Up @@ -57,26 +65,40 @@ restylers:
- "**/*.js"
- "**/*.m"
interpreters: []
- name: jq
- name: prettier-json
image: restyled/restyler-prettier:v1.19.1-2
enabled: true
command:
- prettier
- "--write"
arguments: []
include:
- "**/*.json"
interpreters: []
- name: prettier-markdown
image: restyled/restyler-prettier:v1.19.1-2
command:
- prettier
- "--write"
arguments: []
enabled: true
include:
- "**/*.md"
- "**/*.markdown"
- name: prettier-yaml
image: restyled/restyler-prettier:v1.19.1-2
enabled: true
include:
- "**/*.yml"
- "**/*.yaml"
- name: shellharden
image: restyled/restyler-shellharden:v4.1.1-2
enabled: true
include:
- "**/*.sh"
- "**/*.bash"
- name: shfmt
image: restyled/restyler-shfmt:v3.0.1
enabled: true
include:
- "**/*.sh"
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: minimal

branches:
except:
- /^restyled.*$/

services:
- docker

Expand Down
3 changes: 0 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [


{
"name": "QRCode Tests",
"type": "cppdbg",
Expand All @@ -26,7 +24,6 @@
}
]
},

{
"name": "CHIP crypto Tests",
"type": "cppdbg",
Expand Down
18 changes: 16 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[properties]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.associations": {
"iostream": "cpp",
"array": "cpp",
Expand Down Expand Up @@ -66,7 +78,8 @@
"cinttypes": "cpp",
"typeinfo": "cpp",
"*.ipp": "cpp",
"aes.h": "c"
"aes.h": "c",
"stdio.h": "c"
},
"files.eol": "\n",
"editor.formatOnSave": true,
Expand Down Expand Up @@ -108,5 +121,6 @@
"backgroundColor": "transparent"
}
],
"clang-format.fallbackStyle": "WebKit"
"clang-format.fallbackStyle": "WebKit",
"files.trimFinalNewlines": true
}
56 changes: 15 additions & 41 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"reveal": "always",
"panel": "shared"
},
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Auto-enforce coding style",
Expand All @@ -30,115 +28,91 @@
"reveal": "always",
"panel": "shared"
},
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Verify coding style conformance",
"type": "shell",
"command": "make -C build/default pretty-check",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Run Unit and Functional Tests",
"type": "shell",
"command": "make -C build/default check",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Run Distribution Generation",
"type": "shell",
"command": "make -C build/default distcheck",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Run Code Coverage",
"type": "shell",
"command": "make -C build/default coverage; code -r build/default/src/chip.info/index.html",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Clean",
"type": "shell",
"command": "make -C build/default distclean",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Configure",
"type": "shell",
"command": "mkdir -p build/default && (cd build/default && ../../bootstrap-configure --enable-debug --enable-coverage)",
"group": "none",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Bootstrap",
"type": "shell",
"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",
"group": "none",
"problemMatcher": [
"$gcc"
],
"problemMatcher": ["$gcc"]
},
{
"label": "Clean Tree",
"type": "shell",
"command": "make -f Makefile-bootstrap clean-repos && git clean -Xdf",
"group": "none",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Run Setup Payload Tests",
"type": "shell",
"command": "make -C build/default/src/setup_payload check",
"group": "none",
"dependsOn": "Bootstrap",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Build & Run Crypto Tests",
"type": "shell",
"command": "make -C build/default/src/crypto check",
"group": "none",
"problemMatcher": [
"$gcc"
]
"problemMatcher": ["$gcc"]
},
{
"label": "Build nRF5 Lock App",
"type": "shell",
"command": "make -C examples/lock-app/nrf5",
"group": "none",
"dependsOn": "Clean Tree",
"problemMatcher": [
"$gcc"
]
},
],
"problemMatcher": ["$gcc"]
}
]
}
Loading