Add and use clang-tidy for GrpcInterface

This commit is contained in:
Magne Sjaastad 2024-01-29 15:00:55 +01:00 committed by GitHub
parent bd644da236
commit e83b2e92f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 27 additions and 18 deletions

View File

@ -69,10 +69,13 @@ jobs:
run: |
cd build
run-clang-tidy-15 -config-file ../ApplicationLibCode/.clang-tidy -fix files ApplicationLibCode
run-clang-tidy-15 -config-file ../GrpcInterface/.clang-tidy -fix files GrpcInterface
- name: Run clang-format after clang-tidy
run: |
cd ApplicationLibCode
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
cd ../GrpcInterface
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
- uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
@ -82,3 +85,4 @@ jobs:
branch-suffix: random
add-paths: |
ApplicationLibCode/*
GrpcInterface/*

View File

@ -0,0 +1,5 @@
---
Checks: '-*,modernize-use-override,modernize-deprecated-headers,modernize-use-using,bugprone-bool-pointer-implicit-conversion,bugprone-parent-virtual-call,bugprone-redundant-branch-condition,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,modernize-redundant-void-arg,readability-static-accessed-through-instance,readability-simplify-boolean-expr,readability-container-size-empty'
WarningsAsErrors: ''
HeaderFilterRegex: 'GrpcInterface/*.*$'
FormatStyle: 'file'

View File

@ -81,7 +81,7 @@ class RiaGrpcServiceCallback : public RiaGrpcCallbackInterface
{
public:
RiaGrpcServiceCallback( ServiceT* service );
~RiaGrpcServiceCallback();
~RiaGrpcServiceCallback() override;
QString name() const override;
const RequestT& request() const;
@ -125,7 +125,7 @@ public:
void onProcessRequest() override;
protected:
virtual QString methodType() const override;
QString methodType() const override;
private:
ServerContext m_context;
@ -165,7 +165,7 @@ public:
void onProcessRequest() override;
protected:
virtual QString methodType() const override;
QString methodType() const override;
private:
ServerContext m_context;
@ -209,7 +209,7 @@ public:
void onFinishRequest() override;
protected:
virtual QString methodType() const override;
QString methodType() const override;
private:
ServerContext m_context;

View File

@ -43,7 +43,7 @@ class RiuEclipseSelectionItem;
//==================================================================================================
class RiaActiveCellInfoStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;
public:
RiaActiveCellInfoStateHandler();
@ -84,7 +84,7 @@ protected:
//==================================================================================================
class RiaSelectedCellsStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;
public:
RiaSelectedCellsStateHandler();
@ -109,7 +109,7 @@ class RiaGrpcCaseService final : public rips::Case::AsyncService, public RiaGrpc
{
public:
grpc::Status
GetGridCount( grpc::ServerContext* context, const rips::CaseRequest* request, rips::GridCount* reply ) override;
GetGridCount( grpc::ServerContext* context, const rips::CaseRequest* request, rips::GridCount* reply ) override;
grpc::Status GetCellCount( grpc::ServerContext* context,
const rips::CellInfoRequest* request,
rips::CellCount* reply ) override;
@ -121,7 +121,7 @@ public:
rips::DaysSinceStart* reply ) override;
grpc::Status GetCaseInfo( grpc::ServerContext* context, const rips::CaseRequest* request, rips::CaseInfo* reply ) override;
grpc::Status
GetPdmObject( grpc::ServerContext* context, const rips::CaseRequest* request, rips::PdmObject* reply ) override;
GetPdmObject( grpc::ServerContext* context, const rips::CaseRequest* request, rips::PdmObject* reply ) override;
grpc::Status GetCellInfoForActiveCells( grpc::ServerContext* context,
const rips::CellInfoRequest* request,
rips::CellInfoArray* reply,

View File

@ -45,7 +45,7 @@ using namespace google::protobuf;
//--------------------------------------------------------------------------------------------------
grpc::Status RiaGrpcCommandService::Execute( grpc::ServerContext* context, const CommandParams* request, CommandReply* reply )
{
auto requestDescriptor = request->GetDescriptor();
auto requestDescriptor = rips::CommandParams::GetDescriptor();
CommandParams::ParamsCase paramsCase = request->params_case();
if ( paramsCase != CommandParams::PARAMS_NOT_SET )
@ -379,7 +379,7 @@ void RiaGrpcCommandService::assignResultToReply( const caf::PdmObject* result, C
QString resultType = result->classKeyword();
auto replyDescriptor = reply->GetDescriptor();
auto replyDescriptor = rips::CommandReply::GetDescriptor();
auto oneofDescriptor = replyDescriptor->FindOneofByName( "result" );
const FieldDescriptor* matchingOneOf = nullptr;
for ( int fieldIndex = 0; fieldIndex < oneofDescriptor->field_count(); ++fieldIndex )
@ -393,7 +393,7 @@ void RiaGrpcCommandService::assignResultToReply( const caf::PdmObject* result, C
}
CAF_ASSERT( matchingOneOf );
Message* message = reply->GetReflection()->MutableMessage( reply, matchingOneOf );
Message* message = rips::CommandReply::GetReflection()->MutableMessage( reply, matchingOneOf );
CAF_ASSERT( message );
auto resultDescriptor = message->GetDescriptor();

View File

@ -49,7 +49,7 @@ class RiaGrpcCommandService : public rips::Commands::AsyncService, public RiaGrp
{
public:
grpc::Status
Execute( grpc::ServerContext* context, const rips::CommandParams* request, rips::CommandReply* reply ) override;
Execute( grpc::ServerContext* context, const rips::CommandParams* request, rips::CommandReply* reply ) override;
std::vector<RiaGrpcCallbackInterface*> createCallbacks() override;
private:

View File

@ -40,7 +40,7 @@ class GridDimensions;
//==================================================================================================
class RiaCellCenterStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;
public:
RiaCellCenterStateHandler();

View File

@ -34,7 +34,7 @@ class RimEclipseCase;
//==================================================================================================
class RiaNNCConnectionsStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;
public:
RiaNNCConnectionsStateHandler();
@ -54,7 +54,7 @@ protected:
//==================================================================================================
class RiaNNCValuesStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;
public:
RiaNNCValuesStateHandler();
@ -76,7 +76,7 @@ protected:
class RiaNNCInputValuesStateHandler
{
public:
typedef grpc::Status Status;
using Status = grpc::Status;
public:
RiaNNCInputValuesStateHandler( bool t = true );

View File

@ -42,7 +42,7 @@ public:
grpc::Status
GetSelectedCases( grpc::ServerContext* context, const rips::Empty* request, rips::CaseInfoArray* reply ) override;
grpc::Status
GetAllCaseGroups( grpc::ServerContext* context, const rips::Empty* request, rips::CaseGroups* reply ) override;
GetAllCaseGroups( grpc::ServerContext* context, const rips::Empty* request, rips::CaseGroups* reply ) override;
grpc::Status GetAllCases( grpc::ServerContext* context, const rips::Empty* request, rips::CaseInfoArray* reply ) override;
grpc::Status GetCasesInGroup( grpc::ServerContext* context,
const rips::CaseGroup* request,

View File

@ -53,7 +53,7 @@ using namespace rips;
class RiaCellResultsStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;
public:
//--------------------------------------------------------------------------------------------------