Skip to content

Commit 91acdb0

Browse files
Pre-Commit update
1 parent 96d77e9 commit 91acdb0

17 files changed

Lines changed: 60 additions & 58 deletions

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
args: ["--filter=-legal/copyright"]
1010

1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v4.6.0
12+
rev: v6.0.0
1313
hooks:
1414
- id: trailing-whitespace
1515
- id: check-added-large-files
@@ -29,9 +29,10 @@ repos:
2929
- id: mixed-line-ending
3030

3131
- repo: https://github.com/psf/black
32-
rev: 24.4.2
32+
rev: 25.12.0
3333
hooks:
3434
- id: black
35+
language_version: python3.13
3536

3637
- repo: local
3738
hooks:

src/include/CanDeviceConfiguration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct CanDeviceConfiguration {
9797
std::string to_string() const noexcept;
9898
};
9999

100-
std::ostream &operator<<(std::ostream &os,
101-
const CanDeviceConfiguration &config) noexcept;
100+
std::ostream& operator<<(std::ostream& os,
101+
const CanDeviceConfiguration& config) noexcept;
102102

103103
#endif // SRC_INCLUDE_CANDEVICECONFIGURATION_H_

src/include/CanVendorAnagate.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
* information.
1818
*/
1919
struct CanVendorAnagate : CanDevice {
20-
friend void anagate_receive(AnaInt32 nIdentifier, const char *pcBuffer,
20+
friend void anagate_receive(AnaInt32 nIdentifier, const char* pcBuffer,
2121
AnaInt32 nBufferLen, AnaInt32 nFlags,
2222
AnaInt32 hHandle) noexcept;
2323

24-
explicit CanVendorAnagate(const CanDeviceArguments &configuration);
24+
explicit CanVendorAnagate(const CanDeviceArguments& configuration);
2525
inline ~CanVendorAnagate() override { vendor_close(); }
2626

2727
private:
2828
CanReturnCode vendor_open() noexcept override;
2929
CanReturnCode vendor_close() noexcept override;
30-
CanReturnCode vendor_send(const CanFrame &frame) noexcept override;
30+
CanReturnCode vendor_send(const CanFrame& frame) noexcept override;
3131
CanDiagnostics vendor_diagnostics() noexcept override;
3232

3333
void print_anagate_error(AnaUInt32 r) noexcept;
3434
static std::mutex m_handles_lock;
35-
static std::map<int, CanVendorAnagate *> m_handles;
35+
static std::map<int, CanVendorAnagate*> m_handles;
3636

3737
AnaInt32 m_handle{0};
3838
};

src/include/CanVendorLoopback.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct CanVendorLoopback : CanDevice {
2020
* which contains configuration parameters for the CAN device.
2121
*/
2222
inline explicit CanVendorLoopback(
23-
const CanDeviceArguments &configuration) noexcept
23+
const CanDeviceArguments& configuration) noexcept
2424
: CanDevice("loopback", configuration) {}
2525

2626
private:
@@ -34,7 +34,7 @@ struct CanVendorLoopback : CanDevice {
3434
inline CanReturnCode vendor_close() noexcept override {
3535
return CanReturnCode::success;
3636
}
37-
CanReturnCode vendor_send(const CanFrame &frame) noexcept override;
37+
CanReturnCode vendor_send(const CanFrame& frame) noexcept override;
3838
inline CanDiagnostics vendor_diagnostics() noexcept override {
3939
return CanDiagnostics{};
4040
}

src/include/CanVendorSocketCan.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@
2222
* methods to open, close, and send CAN frames using the SocketCAN interface.
2323
*/
2424
struct CanVendorSocketCan : CanDevice {
25-
explicit CanVendorSocketCan(const CanDeviceArguments &args);
25+
explicit CanVendorSocketCan(const CanDeviceArguments& args);
2626

2727
~CanVendorSocketCan() { vendor_close(); }
2828

2929
private:
3030
CanReturnCode vendor_open() noexcept override;
3131
CanReturnCode vendor_close() noexcept override;
32-
CanReturnCode vendor_send(const CanFrame &frame) noexcept override;
32+
CanReturnCode vendor_send(const CanFrame& frame) noexcept override;
3333
CanDiagnostics vendor_diagnostics() noexcept override;
3434

3535
int subscriber() noexcept;
36-
static const CanFrame translate(const struct can_frame &message) noexcept;
37-
static struct can_frame translate(const CanFrame &frame) noexcept;
36+
static const CanFrame translate(const struct can_frame& message) noexcept;
37+
static struct can_frame translate(const CanFrame& frame) noexcept;
3838

3939
int m_socket_fd{-1}; // File descriptor for the SocketCAN device
4040
int m_epoll_fd{-1}; // File descriptor for the epoll instance

src/include/CanVendorSocketCanSystec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
* SocketCan due to a kernel-panic bug on Systec linux module.
1919
*/
2020
struct CanVendorSocketCanSystec : CanDevice {
21-
explicit CanVendorSocketCanSystec(const CanDeviceArguments &args);
21+
explicit CanVendorSocketCanSystec(const CanDeviceArguments& args);
2222
~CanVendorSocketCanSystec() { vendor_close(); }
2323

2424
private:
2525
CanReturnCode vendor_open() noexcept override;
2626
CanReturnCode vendor_close() noexcept override;
27-
CanReturnCode vendor_send(const CanFrame &frame) noexcept override;
27+
CanReturnCode vendor_send(const CanFrame& frame) noexcept override;
2828
CanDiagnostics vendor_diagnostics() noexcept override;
2929

3030
std::unique_ptr<CanDevice> m_can_vendor_socketcan;

src/main/CanDerivedStats.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* the current Rx and Tx values and will be updated with
1616
* the calculated rolling average rates.
1717
*/
18-
void CanDerivedStats::update(CanDiagnostics &diagnostics) noexcept {
18+
void CanDerivedStats::update(CanDiagnostics& diagnostics) noexcept {
1919
if (!m_init) {
2020
if (!diagnostics.rx.has_value() || !diagnostics.tx.has_value()) {
2121
m_enabled = false;
@@ -48,9 +48,9 @@ void CanDerivedStats::update(CanDiagnostics &diagnostics) noexcept {
4848
.count();
4949

5050
if (time_diff > 0) {
51-
const auto update_rate = [&](std::deque<float> &window,
52-
std::optional<uint32_t> &value,
53-
uint32_t &last_value, int64_t time_diff) {
51+
const auto update_rate = [&](std::deque<float>& window,
52+
std::optional<uint32_t>& value,
53+
uint32_t& last_value, int64_t time_diff) {
5454
float rate = static_cast<float>(value.value() - last_value) / time_diff;
5555
window.push_front(rate);
5656
if (window.size() > window_size) {
@@ -64,8 +64,8 @@ void CanDerivedStats::update(CanDiagnostics &diagnostics) noexcept {
6464

6565
m_last_update = current_time;
6666

67-
const auto update_per_second = [&](const std::deque<float> &window,
68-
std::optional<float> &per_second) {
67+
const auto update_per_second = [&](const std::deque<float>& window,
68+
std::optional<float>& per_second) {
6969
if (!window.empty()) {
7070
per_second =
7171
std::accumulate(window.begin(), window.end(), 0.0) / window.size();

src/main/CanDevice.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ CanReturnCode CanDevice::close() noexcept {
7272
* @param frame The CAN frame to be sent. It must be a valid frame.
7373
* @return int Returns 0 on success, or a non-zero error code on failure.
7474
*/
75-
CanReturnCode CanDevice::send(const CanFrame &frame) noexcept {
75+
CanReturnCode CanDevice::send(const CanFrame& frame) noexcept {
7676
LOG(Log::DBG, CanLogIt::h()) << "Sending CAN frame: " << frame;
7777

7878
CanReturnCode result = vendor_send(frame);
@@ -100,10 +100,10 @@ CanReturnCode CanDevice::send(const CanFrame &frame) noexcept {
100100
* success or a non-zero error code on failure for the corresponding frame.
101101
*/
102102
std::vector<CanReturnCode> CanDevice::send(
103-
const std::vector<CanFrame> &frames) noexcept {
103+
const std::vector<CanFrame>& frames) noexcept {
104104
std::vector<CanReturnCode> result(frames.size());
105105
std::transform(frames.begin(), frames.end(), result.begin(),
106-
[this](const CanFrame &frame) { return send(frame); });
106+
[this](const CanFrame& frame) { return send(frame); });
107107
return result;
108108
}
109109

@@ -144,7 +144,7 @@ CanDiagnostics CanDevice::diagnostics() noexcept {
144144
* provided.
145145
*/
146146
std::unique_ptr<CanDevice> CanDevice::create(
147-
std::string_view vendor, const CanDeviceArguments &configuration) {
147+
std::string_view vendor, const CanDeviceArguments& configuration) {
148148
LOG(Log::INF, CanLogIt::h()) << "Creating CAN device for vendor: " << vendor;
149149
LOG(Log::INF, CanLogIt::h()) << "Configuration: " << configuration.config;
150150

@@ -174,7 +174,7 @@ std::unique_ptr<CanDevice> CanDevice::create(
174174
return nullptr;
175175
}
176176

177-
std::ostream &operator<<(std::ostream &os, CanReturnCode code) {
177+
std::ostream& operator<<(std::ostream& os, CanReturnCode code) {
178178
switch (code) {
179179
case CanReturnCode::success:
180180
return os << "SUCCESS";

src/main/CanDeviceConfiguration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ std::string CanDeviceConfiguration::to_string() const noexcept {
8787
* @return The output stream (os) with the CanDeviceConfiguration object's
8888
* string representation inserted.
8989
*/
90-
std::ostream &operator<<(std::ostream &os,
91-
const CanDeviceConfiguration &config) noexcept {
90+
std::ostream& operator<<(std::ostream& os,
91+
const CanDeviceConfiguration& config) noexcept {
9292
return os << config.to_string();
9393
}

src/main/CanDiagnostics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ std::string CanDiagnostics::to_string() const noexcept {
8787
* @return The output stream (os) after the diagnostic information has been
8888
* printed.
8989
*/
90-
std::ostream &operator<<(std::ostream &os,
91-
const CanDiagnostics &diag) noexcept {
90+
std::ostream& operator<<(std::ostream& os,
91+
const CanDiagnostics& diag) noexcept {
9292
return os << diag.to_string();
9393
}

0 commit comments

Comments
 (0)