Skip to content

Commit badfdf4

Browse files
author
Robert Fancsik
authored
Replace vera++ with clang-format (jerryscript-project#4518)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent bc091e1 commit badfdf4

File tree

564 files changed

+10218
-15113
lines changed

Some content is hidden

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

564 files changed

+10218
-15113
lines changed

.clang-format

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
Language: Cpp
3+
AlignAfterOpenBracket: Align
4+
AlignConsecutiveMacros: true
5+
AlignConsecutiveAssignments: false
6+
AlignConsecutiveDeclarations: false
7+
AlignEscapedNewlines: Left
8+
AlignOperands: true
9+
AlignTrailingComments: false
10+
AllowAllArgumentsOnNextLine: false
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: Never
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None
15+
AllowShortIfStatementsOnASingleLine: Never
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterReturnType: AllDefinitions
18+
AlwaysBreakBeforeMultilineStrings: false
19+
BinPackArguments: false
20+
BinPackParameters: false
21+
BraceWrapping:
22+
AfterCaseLabel: true
23+
AfterControlStatement: Always
24+
AfterEnum: true
25+
AfterFunction: true
26+
AfterStruct: true
27+
AfterUnion: true
28+
AfterExternBlock: false
29+
BeforeElse: true
30+
IndentBraces: false
31+
SplitEmptyFunction: true
32+
BreakBeforeBinaryOperators: NonAssignment
33+
BreakBeforeBraces: Custom
34+
BreakBeforeTernaryOperators: true
35+
BreakStringLiterals: true
36+
ColumnLimit: 120
37+
ContinuationIndentWidth: 2
38+
Cpp11BracedListStyle: false
39+
DeriveLineEnding: true
40+
DerivePointerAlignment: true
41+
DisableFormat: false
42+
ExperimentalAutoDetectBinPacking: true
43+
IncludeBlocks: Regroup
44+
IncludeCategories:
45+
- Regex: '<windows.h>'
46+
Priority: 0
47+
- Regex: '<[-.a-z]*>'
48+
Priority: 1
49+
- Regex: '"jerryscript[-.a-z]*"'
50+
Priority: 2
51+
- Regex: '"ecma[-.a-z]*"'
52+
Priority: 3
53+
- Regex: '.*'
54+
Priority: 4
55+
IndentCaseLabels: true
56+
IndentGotoLabels: true
57+
IndentPPDirectives: None
58+
IndentWidth: 2
59+
IndentWrappedFunctionNames: false
60+
KeepEmptyLinesAtTheStartOfBlocks: false
61+
MacroBlockBegin: ''
62+
MacroBlockEnd: ''
63+
MaxEmptyLinesToKeep: 1
64+
PointerAlignment: Right
65+
ReflowComments: true
66+
SortIncludes: true
67+
SpaceAfterCStyleCast: true
68+
SpaceAfterLogicalNot: false
69+
SpaceBeforeAssignmentOperators: true
70+
SpaceBeforeParens: Always
71+
SpaceInEmptyBlock: false
72+
SpaceInEmptyParentheses: false
73+
SpacesBeforeTrailingComments: 1
74+
SpacesInConditionalStatement: false
75+
SpacesInCStyleCastParentheses: false
76+
SpacesInParentheses: false
77+
SpacesInSquareBrackets: false
78+
SpaceBeforeSquareBrackets: false
79+
Standard: Auto
80+
StatementMacros:
81+
- JERRY_ASSERT
82+
- JERRY_STATIC_ASSERT
83+
- JERRY_UNREACHABLE
84+
TabWidth: 0
85+
UseCRLF: false
86+
UseTab: Never
87+
...

.github/workflows/gh-actions.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ jobs:
1212
- uses: actions/checkout@v2
1313
with:
1414
fetch-depth: 0
15+
- uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.8'
1518
- run: sudo apt update
16-
- run: sudo apt install doxygen vera++ cppcheck pylint python-serial
19+
- run: sudo apt install doxygen clang-format-10 cppcheck pylint python-serial
1720
- run: $RUNNER --check-signed-off=gh-actions
1821
if: ${{ always() }}
1922
- run: $RUNNER --check-doxygen
2023
if: ${{ always() }}
21-
- run: $RUNNER --check-vera
24+
- run: $RUNNER --check-format
2225
if: ${{ always() }}
2326
- run: $RUNNER --check-license
2427
if: ${{ always() }}
@@ -145,7 +148,7 @@ jobs:
145148
- run: sudo apt update
146149
- run: sudo apt install gcc-multilib
147150
- run: $RUNNER -q --unittests
148-
# clang has bug in supporting lto
151+
# clang has bug in supporting lto
149152
- run: $RUNNER -q --buildoption-test --buildoptions=--lto=off
150153

151154
ASAN_Tests:

docs/00.GETTING-STARTED.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ Several scripts and tools help the building and development process, thus it is
1111

1212
- `bash` >= `4.3.11`
1313
- `cppcheck` >= `1.61`
14-
- `vera++` >= `1.2.1`
14+
- `clang-format-10` >= `10.0.0`
1515
- `python` >= `2.7.6`
1616

1717
```bash
18-
sudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck vera++ python
18+
sudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck clang-format-10 python
1919
```
2020

2121
To make our scripts run correctly, several shell utilities should be available on the system:
@@ -173,10 +173,10 @@ python tools/run-tests.py --check-signed-off
173173
python tools/run-tests.py --check-cppcheck
174174
```
175175

176-
**To run vera check**
176+
**To run format check**
177177

178178
```bash
179-
python tools/run-tests.py --check-vera
179+
python tools/run-tests.py --check-format
180180
```
181181

182182
**To get a list of all the available test options**

docs/08.CODING-STANDARDS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ review.
1212
* Tab characters are not allowed.
1313
* Maximum line length is 120 characters (excluding newline).
1414
* No trailing white space is allowed.
15-
* Run `tools/run-tests.py --check-vera` to check several
15+
* Run `tools/run-tests.py --check-format` to check several
1616
of the coding conventions automatically.
1717

1818
## Comments

jerry-core/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ set(SOURCE_CORE_FILES
132132
api/jerry-debugger-transport.c
133133
api/jerry-debugger.c
134134
api/jerry-snapshot.c
135-
api/jerry.c
135+
api/jerryscript.c
136136
debugger/debugger.c
137137
ecma/base/ecma-alloc.c
138138
ecma/base/ecma-gc.c

jerry-core/api/jerry-debugger-transport.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
* limitations under the License.
1414
*/
1515

16+
#include "jerryscript.h"
17+
1618
#include "debugger.h"
1719
#include "jcontext.h"
18-
#include "jerryscript.h"
1920

2021
#if JERRY_DEBUGGER
2122

@@ -137,8 +138,7 @@ jerry_debugger_transport_close (void)
137138
current_p->close (current_p);
138139

139140
current_p = next_p;
140-
}
141-
while (current_p != NULL);
141+
} while (current_p != NULL);
142142

143143
jerry_port_log (JERRY_LOG_LEVEL_DEBUG, "Debugger client connection closed.\n");
144144

@@ -164,8 +164,7 @@ jerry_debugger_transport_send (const uint8_t *message_p, /**< message to be sent
164164

165165
do
166166
{
167-
size_t fragment_length = (message_length <= max_send_size ? message_length
168-
: max_send_size);
167+
size_t fragment_length = (message_length <= max_send_size ? message_length : max_send_size);
169168

170169
memcpy (payload_p, message_p, fragment_length);
171170

@@ -176,8 +175,7 @@ jerry_debugger_transport_send (const uint8_t *message_p, /**< message to be sent
176175

177176
message_p += fragment_length;
178177
message_length -= fragment_length;
179-
}
180-
while (message_length > 0);
178+
} while (message_length > 0);
181179

182180
return true;
183181
} /* jerry_debugger_transport_send */

jerry-core/api/jerry-debugger.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
* limitations under the License.
1414
*/
1515

16+
#include "jerryscript.h"
17+
1618
#include "debugger.h"
1719
#include "jcontext.h"
18-
#include "jerryscript.h"
1920

2021
/**
2122
* Checks whether the debugger is connected.

0 commit comments

Comments
 (0)