Skip to content

Commit 2f3a289

Browse files
committed
Allow a few cases to be on one line.
1 parent 5ab1310 commit 2f3a289

File tree

3 files changed

+14
-26
lines changed

3 files changed

+14
-26
lines changed

puma_motor_driver/.clang-format

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
BasedOnStyle: Google
33
AccessModifierOffset: -2
4+
AlignArrayOfStructures: Right
45
AlignConsecutiveAssignments:
56
Enabled: true
67
AlignCompound: true
@@ -14,15 +15,14 @@ AlignConsecutiveMacros:
1415
AlignTrailingComments:
1516
OverEmptyLines: 1
1617
AllowAllParametersOfDeclarationOnNextLine: false
17-
AllowShortFunctionsOnASingleLine: None
18-
AllowShortIfStatementsOnASingleLine: false
19-
AllowShortLoopsOnASingleLine: false
18+
AllowShortBlocksOnASingleLine: Empty
19+
AllowShortFunctionsOnASingleLine: InlineOnly
2020
BinPackArguments: false
2121
BinPackParameters: false
2222
BraceWrapping:
2323
AfterCaseLabel: false
2424
AfterClass: "true"
25-
AfterControlStatement: "true"
25+
AfterControlStatement: Always
2626
AfterEnum: "true"
2727
AfterFunction: "true"
2828
AfterNamespace: "true"
@@ -35,9 +35,9 @@ BraceWrapping:
3535
BeforeLambdaBody: false
3636
BeforeWhile: false
3737
IndentBraces: "false"
38-
SplitEmptyFunction: true
39-
SplitEmptyRecord: true
40-
SplitEmptyNamespace: true
38+
SplitEmptyFunction: false
39+
SplitEmptyRecord: false
40+
SplitEmptyNamespace: false
4141
BreakAfterReturnType: Automatic
4242
BreakBeforeBinaryOperators: false
4343
BreakBeforeBraces: Custom
@@ -47,7 +47,8 @@ BreakTemplateDeclarations: MultiLine
4747
ColumnLimit: 120
4848
ConstructorInitializerIndentWidth: 2
4949
Cpp11BracedListStyle: false
50-
PackConstructorInitializers: NextLine
50+
DerivePointerAlignment: false
51+
InsertNewlineAtEOF: true
5152
PenaltyBreakBeforeFirstCallParameter: 19
5253
PenaltyBreakComment: 60
5354
PenaltyBreakFirstLessLess: 1000

puma_motor_driver/include/puma_motor_driver/driver.hpp

+4-16
Original file line numberDiff line numberDiff line change
@@ -437,31 +437,19 @@ class Driver
437437
*/
438438
double statusPositionGet();
439439

440-
std::string deviceName() const
441-
{
442-
return device_name_;
443-
}
440+
std::string deviceName() const { return device_name_; }
444441

445-
uint8_t deviceNumber() const
446-
{
447-
return device_number_;
448-
}
442+
uint8_t deviceNumber() const { return device_number_; }
449443

450444
// Only used internally but is used for testing.
451445
struct Field
452446
{
453447
uint8_t data[4];
454448
bool received;
455449

456-
float interpretFixed8x8()
457-
{
458-
return *(reinterpret_cast<int16_t*>(data)) / static_cast<float>(1 << 8);
459-
}
450+
float interpretFixed8x8() { return *(reinterpret_cast<int16_t*>(data)) / static_cast<float>(1 << 8); }
460451

461-
double interpretFixed16x16()
462-
{
463-
return *(reinterpret_cast<int32_t*>(data)) / static_cast<double>(1 << 16);
464-
}
452+
double interpretFixed16x16() { return *(reinterpret_cast<int32_t*>(data)) / static_cast<double>(1 << 16); }
465453
};
466454

467455
private:

puma_motor_driver/src/driver.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ Driver::Driver(const std::shared_ptr<clearpath_ros2_socketcan_interface::SocketC
7272
, gain_d_(0)
7373
, encoder_cpr_(1)
7474
, gear_ratio_(1)
75-
{
76-
}
75+
{}
7776

7877
void Driver::processMessage(const can_msgs::msg::Frame::SharedPtr received_msg)
7978
{

0 commit comments

Comments
 (0)