Skip to content

Replace vera with clang-format #4518

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

Merged
merged 1 commit into from
Nov 5, 2021
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
87 changes: 87 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
Language: Cpp
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
ColumnLimit: 120
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '<windows.h>'
Priority: 0
- Regex: '<[-.a-z]*>'
Priority: 1
- Regex: '"jerryscript[-.a-z]*"'
Priority: 2
- Regex: '"ecma[-.a-z]*"'
Priority: 3
- Regex: '.*'
Priority: 4
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Always
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
StatementMacros:
- JERRY_ASSERT
- JERRY_STATIC_ASSERT
- JERRY_UNREACHABLE
TabWidth: 0
UseCRLF: false
UseTab: Never
...
9 changes: 6 additions & 3 deletions .github/workflows/gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- run: sudo apt update
- run: sudo apt install doxygen vera++ cppcheck pylint python-serial
- run: sudo apt install doxygen clang-format-10 cppcheck pylint python-serial
- run: $RUNNER --check-signed-off=gh-actions
if: ${{ always() }}
- run: $RUNNER --check-doxygen
if: ${{ always() }}
- run: $RUNNER --check-vera
- run: $RUNNER --check-format
if: ${{ always() }}
- run: $RUNNER --check-license
if: ${{ always() }}
Expand Down Expand Up @@ -145,7 +148,7 @@ jobs:
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: $RUNNER -q --unittests
# clang has bug in supporting lto
# clang has bug in supporting lto
- run: $RUNNER -q --buildoption-test --buildoptions=--lto=off

ASAN_Tests:
Expand Down
8 changes: 4 additions & 4 deletions docs/00.GETTING-STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Several scripts and tools help the building and development process, thus it is

- `bash` >= `4.3.11`
- `cppcheck` >= `1.61`
- `vera++` >= `1.2.1`
- `clang-format-10` >= `10.0.0`
- `python` >= `2.7.6`

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

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

**To run vera check**
**To run format check**

```bash
python tools/run-tests.py --check-vera
python tools/run-tests.py --check-format
```

**To get a list of all the available test options**
Expand Down
2 changes: 1 addition & 1 deletion docs/08.CODING-STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ review.
* Tab characters are not allowed.
* Maximum line length is 120 characters (excluding newline).
* No trailing white space is allowed.
* Run `tools/run-tests.py --check-vera` to check several
* Run `tools/run-tests.py --check-format` to check several
of the coding conventions automatically.

## Comments
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ set(SOURCE_CORE_FILES
api/jerry-debugger-transport.c
api/jerry-debugger.c
api/jerry-snapshot.c
api/jerry.c
api/jerryscript.c
debugger/debugger.c
ecma/base/ecma-alloc.c
ecma/base/ecma-gc.c
Expand Down
12 changes: 5 additions & 7 deletions jerry-core/api/jerry-debugger-transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* limitations under the License.
*/

#include "jerryscript.h"

#include "debugger.h"
#include "jcontext.h"
#include "jerryscript.h"

#if JERRY_DEBUGGER

Expand Down Expand Up @@ -137,8 +138,7 @@ jerry_debugger_transport_close (void)
current_p->close (current_p);

current_p = next_p;
}
while (current_p != NULL);
} while (current_p != NULL);

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

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

do
{
size_t fragment_length = (message_length <= max_send_size ? message_length
: max_send_size);
size_t fragment_length = (message_length <= max_send_size ? message_length : max_send_size);

memcpy (payload_p, message_p, fragment_length);

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

message_p += fragment_length;
message_length -= fragment_length;
}
while (message_length > 0);
} while (message_length > 0);

return true;
} /* jerry_debugger_transport_send */
Expand Down
3 changes: 2 additions & 1 deletion jerry-core/api/jerry-debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* limitations under the License.
*/

#include "jerryscript.h"

#include "debugger.h"
#include "jcontext.h"
#include "jerryscript.h"

/**
* Checks whether the debugger is connected.
Expand Down
Loading