Skip to content

Commit df07224

Browse files
committed
fix(clang-tidy): fixed all clang-tidy warnings within the library. Added exception for default destructor of special member functions in clang tidy.
1 parent 78629e4 commit df07224

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ CheckOptions:
140140
readability-suspicious-call-argument.DiceSimilarAbove: '70'
141141
readability-suspicious-call-argument.Dice: 'true'
142142
readability-suspicious-call-argument.Abbreviation: 'true'
143-
cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor: 'false'
143+
cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor: 'true'
144144
readability-identifier-length.IgnoredLoopCounterNames: '^[ijk_]$'
145145
cert-dcl37-c.Invert: 'false'
146146
cert-dcl37-c.AggressiveDependentMemberLookup: 'false'

include/libdbc/dbc.hpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,26 @@ class DbcParser : public Parser {
2323
public:
2424
DbcParser();
2525

26-
virtual ~DbcParser() = default;
27-
28-
virtual void parse_file(const std::string& file) final override;
26+
void parse_file(const std::string& file) override;
2927

3028
std::string get_version() const;
3129
std::vector<std::string> get_nodes() const;
3230
std::vector<libdbc::Message> get_messages() const;
3331

34-
Message::ParseSignalsStatus parseMessage(const uint32_t id, const std::vector<uint8_t>& data, std::vector<double>& out_values);
32+
Message::ParseSignalsStatus parseMessage(uint32_t message_id, const std::vector<uint8_t>& data, std::vector<double>& out_values);
3533

3634
private:
3735
std::string version;
3836
std::vector<std::string> nodes;
3937
std::vector<libdbc::Message> messages;
4038

41-
const std::regex version_re;
42-
const std::regex bit_timing_re;
43-
const std::regex name_space_re;
44-
const std::regex node_re;
45-
const std::regex message_re;
46-
const std::regex value_re;
47-
const std::regex signal_re;
39+
std::regex version_re;
40+
std::regex bit_timing_re;
41+
std::regex name_space_re;
42+
std::regex node_re;
43+
std::regex message_re;
44+
std::regex value_re;
45+
std::regex signal_re;
4846

4947
void parse_dbc_header(std::istream& file_stream);
5048
void parse_dbc_nodes(std::istream& file_stream);

include/libdbc/exceptions/error.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#ifndef ERROR_HPP
22
#define ERROR_HPP
33

4-
#include <sstream>
4+
#include <exception>
55

66
namespace libdbc {
77

88
class exception : public std::exception {
99
public:
10-
const char* what() const throw() {
10+
const char* what() const throw() override {
1111
return "libdbc exception occurred";
1212
}
1313
};
1414

1515
class validity_error : public exception {
1616
public:
17-
const char* what() const throw() {
17+
const char* what() const throw() override {
1818
return "Invalid DBC file";
1919
}
2020
};

include/libdbc/message.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace libdbc {
1111
struct Message {
1212
Message() = delete;
1313
virtual ~Message() = default;
14-
explicit Message(uint32_t id, const std::string& name, uint8_t size, const std::string& node);
14+
explicit Message(uint32_t message_id, const std::string& name, uint8_t size, const std::string& node);
1515

1616
enum class ParseSignalsStatus {
1717
Success,
@@ -39,7 +39,7 @@ struct Message {
3939
std::string m_node;
4040
std::vector<Signal> m_signals;
4141

42-
friend std::ostream& operator<<(std::ostream& os, const Message& dt);
42+
friend std::ostream& operator<<(std::ostream& out, const Message& msg);
4343
};
4444

4545
std::ostream& operator<<(std::ostream& out, const Message& msg);

include/libdbc/signal.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct Signal {
4141
double min,
4242
double max,
4343
std::string unit,
44-
std::vector<std::string> recievers);
44+
std::vector<std::string> receivers);
4545

4646
virtual bool operator==(const Signal& rhs) const;
4747
bool operator<(const Signal& rhs) const;

include/libdbc/utils/utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class String {
3535

3636
template<class Container>
3737
static void split(const std::string& str, Container& cont, char delim = ' ') {
38-
std::stringstream ss(str);
38+
std::stringstream stream(str);
3939
std::string token;
4040

41-
while (std::getline(ss, token, delim)) {
41+
while (std::getline(stream, token, delim)) {
4242
cont.push_back(token);
4343
}
4444
}

0 commit comments

Comments
 (0)