Skip to content

Commit d86b038

Browse files
committed
DOC: describe using astyle within vscode
1 parent ca9f01f commit d86b038

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,20 @@ on WSL with Ubuntu, the command seems to be:
3434

3535
astyle --options=.astylerc src/*.cpp
3636

37-
#### Linting
37+
Astyle can also be used within VSCode as an extension. Install the "Astyle" extension (author: Chieh Yu). Then go to settings (the "Manage" wheel on the bottom left, then click on "settings"). Under "Extensions", click on "Astyle Configuration". Within that, you can set the location of the astylerc file. Click on "Edit in settings.json". Modify the file so it has the following line:
38+
"[cpp]": {
39+
"editor.defaultFormatter": "chiehyu.vscode-astyle",
40+
"editor.formatOnSave": true
41+
},
42+
"astyle.astylerc": "${workspaceRoot}/.astylerc"
3843

39-
For *C++* code make sure to use a static code checker like
40-
[cpplint](https://github.com/cpplint/cpplint) to check the code for
41-
any style issues before submitting. For *Python*,
42-
[flake8](https://flake8.pycqa.org/en/latest/) is a good option. Both
43-
of these may by installed using pip.
44+
This should then allow you to format the code using the defaults that we have set in the astyle file. This can be done with (Ctrl-Shift-I for Linux, Alt-Shift-F for Windows) and upon saving the file - this reformats the whole file to put it into the astyle format.
4445

45-
To install `cpplint`
46+
#### Linting
4647

47-
```sh
48-
# depending on your system one of these lines applies
49-
pip install --user cpplint
50-
pip install cpplint
51-
python3 -m pip cpplint
52-
python3 -m pip --user cpplint
53-
```
48+
For *Python*,
49+
[flake8](https://flake8.pycqa.org/en/latest/) is a good option. This may by installed using pip.
5450

55-
Using a linter in an editor is a good supplement, but not a replacement for the
56-
static linters. The linter in the 'atom' editor requires that you install the
57-
`linter` and `gcc-linter` packages. Atom also has additional packages
58-
`whitespaces` and `tabs-to-spaces` to automatically remove whitespaces at the
59-
end of the lines, and convert tabs to spaces.
6051

6152
## Commit Styling
6253

0 commit comments

Comments
 (0)