diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 4ced492630..2d8e6ab09a 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -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/* diff --git a/GrpcInterface/.clang-tidy b/GrpcInterface/.clang-tidy new file mode 100644 index 0000000000..43a4e6b10e --- /dev/null +++ b/GrpcInterface/.clang-tidy @@ -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' diff --git a/GrpcInterface/RiaGrpcCallbacks.h b/GrpcInterface/RiaGrpcCallbacks.h index f778d7e785..bb7254a15c 100644 --- a/GrpcInterface/RiaGrpcCallbacks.h +++ b/GrpcInterface/RiaGrpcCallbacks.h @@ -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; diff --git a/GrpcInterface/RiaGrpcCaseService.h b/GrpcInterface/RiaGrpcCaseService.h index f7fcb50c35..f21b3ef29c 100644 --- a/GrpcInterface/RiaGrpcCaseService.h +++ b/GrpcInterface/RiaGrpcCaseService.h @@ -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, diff --git a/GrpcInterface/RiaGrpcCommandService.cpp b/GrpcInterface/RiaGrpcCommandService.cpp index a668b130aa..2f3be12f44 100644 --- a/GrpcInterface/RiaGrpcCommandService.cpp +++ b/GrpcInterface/RiaGrpcCommandService.cpp @@ -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(); diff --git a/GrpcInterface/RiaGrpcCommandService.h b/GrpcInterface/RiaGrpcCommandService.h index 4b3fef61c8..3b7edcf134 100644 --- a/GrpcInterface/RiaGrpcCommandService.h +++ b/GrpcInterface/RiaGrpcCommandService.h @@ -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 createCallbacks() override; private: diff --git a/GrpcInterface/RiaGrpcGridService.h b/GrpcInterface/RiaGrpcGridService.h index 93f3af5f6e..a3bf1f657d 100644 --- a/GrpcInterface/RiaGrpcGridService.h +++ b/GrpcInterface/RiaGrpcGridService.h @@ -40,7 +40,7 @@ class GridDimensions; //================================================================================================== class RiaCellCenterStateHandler { - typedef grpc::Status Status; + using Status = grpc::Status; public: RiaCellCenterStateHandler(); diff --git a/GrpcInterface/RiaGrpcNNCPropertiesService.h b/GrpcInterface/RiaGrpcNNCPropertiesService.h index cf863e32dc..de5ac7d283 100644 --- a/GrpcInterface/RiaGrpcNNCPropertiesService.h +++ b/GrpcInterface/RiaGrpcNNCPropertiesService.h @@ -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 ); diff --git a/GrpcInterface/RiaGrpcProjectService.h b/GrpcInterface/RiaGrpcProjectService.h index 1a33b9f543..fbb7b1e283 100644 --- a/GrpcInterface/RiaGrpcProjectService.h +++ b/GrpcInterface/RiaGrpcProjectService.h @@ -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, diff --git a/GrpcInterface/RiaGrpcPropertiesService.cpp b/GrpcInterface/RiaGrpcPropertiesService.cpp index a2ae751ff8..469ab22124 100644 --- a/GrpcInterface/RiaGrpcPropertiesService.cpp +++ b/GrpcInterface/RiaGrpcPropertiesService.cpp @@ -53,7 +53,7 @@ using namespace rips; class RiaCellResultsStateHandler { - typedef grpc::Status Status; + using Status = grpc::Status; public: //--------------------------------------------------------------------------------------------------