mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Finish clang-tidy cleanups (#3003)
* Add .clang-tidy configuration. * A separate .clang-tidy is used for hal includes to suppress modernize-use-using (as these are C headers). * Add NOLINT where necessary for a clean run. * Add clang-tidy job to lint-format workflow. This workflow is now only run on PRs. To reduce runtime, clang-tidy is only run on files changed in the PR. Two wpilibc changes; both are unlikely to break user code: * BuiltInAccelerometer: Make SetRange() final * Counter: Make SetMaxPeriod() final After these cleanups, the only file that does not run cleanly is cscore_raw_cv.h due to it not being standalone.
This commit is contained in:
@@ -13,7 +13,7 @@ int SocketErrno();
|
||||
|
||||
std::string SocketStrerror(int code);
|
||||
|
||||
static inline std::string SocketStrerror() {
|
||||
inline std::string SocketStrerror() {
|
||||
return SocketStrerror(SocketErrno());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class TCPStream : public NetworkStream {
|
||||
size_t send(const char* buffer, size_t len, Error* err) override;
|
||||
size_t receive(char* buffer, size_t len, Error* err,
|
||||
int timeout = 0) override;
|
||||
void close() override;
|
||||
void close() final;
|
||||
|
||||
StringRef getPeerIP() const override;
|
||||
int getPeerPort() const override;
|
||||
|
||||
@@ -76,7 +76,7 @@ class WebSocket : public std::enable_shared_from_this<WebSocket> {
|
||||
ClientOptions() : handshakeTimeout{(uv::Timer::Time::max)()} {}
|
||||
|
||||
/** Timeout for the handshake request. */
|
||||
uv::Timer::Time handshakeTimeout;
|
||||
uv::Timer::Time handshakeTimeout; // NOLINT
|
||||
|
||||
/** Additional headers to include in handshake. */
|
||||
ArrayRef<std::pair<StringRef, StringRef>> extraHeaders;
|
||||
|
||||
@@ -23,11 +23,8 @@
|
||||
#include "wpi/mutex.h"
|
||||
#include "wpi/raw_ostream.h"
|
||||
|
||||
/** WPILib C++ utilities (wpiutil) namespace */
|
||||
namespace wpi {
|
||||
|
||||
/** Java Native Interface (JNI) utility functions */
|
||||
namespace java {
|
||||
namespace wpi::java {
|
||||
|
||||
// Gets a Java stack trace. Also provides the last function
|
||||
// in the stack trace not starting with excludeFuncPrefix (useful for e.g.
|
||||
@@ -89,7 +86,7 @@ class JGlobal {
|
||||
|
||||
explicit operator bool() const { return m_cls; }
|
||||
|
||||
operator T() const { return m_cls; }
|
||||
operator T() const { return m_cls; } // NOLINT
|
||||
|
||||
protected:
|
||||
T m_cls = nullptr;
|
||||
@@ -117,7 +114,7 @@ class JLocal {
|
||||
m_env->DeleteLocalRef(m_obj);
|
||||
}
|
||||
}
|
||||
operator T() { return m_obj; }
|
||||
operator T() { return m_obj; } // NOLINT
|
||||
T obj() { return m_obj; }
|
||||
|
||||
private:
|
||||
@@ -151,7 +148,7 @@ class JStringRef {
|
||||
m_str.pop_back();
|
||||
}
|
||||
|
||||
operator StringRef() const { return m_str; }
|
||||
operator StringRef() const { return m_str; } // NOLINT
|
||||
StringRef str() const { return m_str; }
|
||||
const char* c_str() const { return m_str.data(); }
|
||||
size_t size() const { return m_str.size(); }
|
||||
@@ -187,7 +184,7 @@ class JArrayRefBase : public JArrayRefInner<JArrayRefBase<T>, T> {
|
||||
public:
|
||||
explicit operator bool() const { return this->m_elements != nullptr; }
|
||||
|
||||
operator ArrayRef<T>() const { return array(); }
|
||||
operator ArrayRef<T>() const { return array(); } // NOLINT
|
||||
|
||||
ArrayRef<T> array() const {
|
||||
if (!this->m_elements) {
|
||||
@@ -501,7 +498,7 @@ inline jobjectArray MakeJStringArray(JNIEnv* env, ArrayRef<std::string> arr) {
|
||||
template <typename T>
|
||||
class JCallbackThread : public SafeThread {
|
||||
public:
|
||||
void Main();
|
||||
void Main() override;
|
||||
|
||||
std::queue<T> m_queue;
|
||||
jobject m_func = nullptr;
|
||||
@@ -710,7 +707,6 @@ struct JExceptionInit {
|
||||
JException* cls;
|
||||
};
|
||||
|
||||
} // namespace java
|
||||
} // namespace wpi
|
||||
} // namespace wpi::java
|
||||
|
||||
#endif // WPIUTIL_WPI_JNI_UTIL_H_
|
||||
|
||||
@@ -155,7 +155,7 @@ class SimpleBufferPool {
|
||||
|
||||
private:
|
||||
SmallVector<Buffer, DEPTH> m_pool;
|
||||
size_t m_size;
|
||||
size_t m_size; // NOLINT
|
||||
};
|
||||
|
||||
} // namespace wpi::uv
|
||||
|
||||
Reference in New Issue
Block a user