add cpplint (#773)

* add cpplint

* passes

* bump cereal

* here's a real hash
This commit is contained in:
Adeeb Shihadeh 2022-12-31 16:49:26 -08:00 committed by GitHub
parent e8e97fcf00
commit 06a3e7db6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 34 deletions

View File

@ -37,6 +37,15 @@ repos:
exclude: 'site_scons/'
args:
- --disable=C,R,W0613,W0511,W0212,W0201,W0311,W0106,W0603,W0621,W0703,E1136
- repo: https://github.com/cpplint/cpplint
rev: 1.6.1
hooks:
- id: cpplint
args:
- --quiet
- --counting=detailed
- --linelength=240
- --filter=-legal,-build/include_order,-readability/casting,-whitespace/braces,-whitespace/indent,-whitespace/operators,-build/c++11,-readability/todo,-runtime/explicit,-runtime/int,-whitespace/comments,-readability/braces,-runtime/arrays,-runtime/references
- repo: local
hooks:
- id: cppcheck

View File

@ -46,7 +46,9 @@ ENV PYTHONPATH=/project
WORKDIR /project
# TODO: Add tag to cereal
RUN git clone https://github.com/commaai/cereal.git /project/cereal && cd /project/cereal && git checkout d46f37c314bb92306207db44693b2f58c31f66b9
RUN git clone https://github.com/commaai/cereal.git /project/cereal && \
cd /project/cereal && \
git checkout 959ff79963b80829be9902d146c31fda44dbbd20
COPY SConstruct .
COPY ./site_scons /project/site_scons

View File

@ -11,9 +11,6 @@ cereal_dir = Dir('.')
python_path = sysconfig.get_paths()['include']
cpppath = [
'#',
'#cereal',
"#cereal/messaging",
"#opendbc/can",
'/usr/lib/include',
python_path
]

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "opendbc/can/common.h"
unsigned int honda_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
int s = 0;
@ -34,7 +35,7 @@ unsigned int subaru_checksum(uint32_t address, const Signal &sig, const std::vec
}
unsigned int chrysler_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
/* jeep chrysler canbus checksum from http://illmatics.com/Remote%20Car%20Hacking.pdf */
// jeep chrysler canbus checksum from http://illmatics.com/Remote%20Car%20Hacking.pdf
uint8_t checksum = 0xFF;
for (int j = 0; j < (d.size() - 1); j++) {
uint8_t shift = 0x80;
@ -221,7 +222,6 @@ unsigned int pedal_checksum(uint32_t address, const Signal &sig, const std::vect
}
unsigned int hkg_can_fd_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
uint16_t crc = 0;
for (int i = 2; i < d.size(); i++) {

View File

@ -1,10 +1,11 @@
#pragma once
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <unordered_map>
#include <vector>
#include "common_dbc.h"
#include <capnp/dynamic.h>
#include <capnp/serialize.h>
@ -12,6 +13,8 @@
#include "cereal/gen/cpp/log.capnp.h"
#endif
#include "opendbc/can/common_dbc.h"
#define INFO printf
#define WARN printf
#define DEBUG(...)

View File

@ -10,8 +10,8 @@
#include <cstring>
#include <iterator>
#include "common.h"
#include "common_dbc.h"
#include "opendbc/can/common.h"
#include "opendbc/can/common_dbc.h"
std::regex bo_regexp(R"(^BO_ (\w+) (\w+) *: (\w+) (\w+))");
std::regex sg_regexp(R"(^SG_ (\w+) : (\d+)\|(\d+)@(\d+)([\+|\-]) \(([0-9.+\-eE]+),([0-9.+\-eE]+)\) \[([0-9.+\-eE]+)\|([0-9.+\-eE]+)\] \"(.*)\" (.*))");

View File

@ -4,7 +4,7 @@
#include <map>
#include <cmath>
#include "common.h"
#include "opendbc/can/common.h"
void set_value(std::vector<uint8_t> &msg, const Signal &sig, int64_t ival) {

View File

@ -32,7 +32,6 @@ int64_t get_raw_value(const std::vector<uint8_t> &msg, const Signal &sig) {
bool MessageState::parse(uint64_t sec, const std::vector<uint8_t> &dat) {
for (int i = 0; i < parse_sigs.size(); i++) {
auto &sig = parse_sigs[i];
@ -94,7 +93,6 @@ CANParser::CANParser(int abus, const std::string& dbc_name,
const std::vector<MessageParseOptions> &options,
const std::vector<SignalParseOptions> &sigoptions)
: bus(abus), aligned_buf(kj::heapArray<capnp::word>(1024)) {
dbc = dbc_lookup(dbc_name);
assert(dbc);
init_crc_lookup_tables();