Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and use clang-tidy for GrpcInterface #11129

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -82,3 +85,4 @@ jobs:
branch-suffix: random
add-paths: |
ApplicationLibCode/*
GrpcInterface/*
5 changes: 5 additions & 0 deletions GrpcInterface/.clang-tidy
Original file line number Diff line number Diff line change
@@ -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'
8 changes: 4 additions & 4 deletions GrpcInterface/RiaGrpcCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class RiaGrpcServiceCallback : public RiaGrpcCallbackInterface
{
public:
RiaGrpcServiceCallback( ServiceT* service );
~RiaGrpcServiceCallback();
~RiaGrpcServiceCallback() override;

QString name() const override;
const RequestT& request() const;
Expand Down Expand Up @@ -127,7 +127,7 @@ class RiaGrpcUnaryCallback : public RiaGrpcServiceCallback<ServiceT, RequestT, R
void onProcessRequest() override;

protected:
virtual QString methodType() const override;
QString methodType() const override;

private:
ServerContext m_context;
Expand Down Expand Up @@ -167,7 +167,7 @@ class RiaGrpcServerToClientStreamCallback : public RiaGrpcServiceCallback<Servic
void onProcessRequest() override;

protected:
virtual QString methodType() const override;
QString methodType() const override;

private:
ServerContext m_context;
Expand Down Expand Up @@ -211,7 +211,7 @@ class RiaGrpcClientToServerStreamCallback : public RiaGrpcServiceCallback<Servic
void onFinishRequest() override;

protected:
virtual QString methodType() const override;
QString methodType() const override;

private:
ServerContext m_context;
Expand Down
8 changes: 4 additions & 4 deletions GrpcInterface/RiaGrpcCaseService.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RiuEclipseSelectionItem;
//==================================================================================================
class RiaActiveCellInfoStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;

public:
RiaActiveCellInfoStateHandler();
Expand Down Expand Up @@ -84,7 +84,7 @@ class RiaActiveCellInfoStateHandler
//==================================================================================================
class RiaSelectedCellsStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;

public:
RiaSelectedCellsStateHandler();
Expand All @@ -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;
Expand All @@ -121,7 +121,7 @@ class RiaGrpcCaseService final : public rips::Case::AsyncService, public RiaGrpc
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,
Expand Down
6 changes: 3 additions & 3 deletions GrpcInterface/RiaGrpcCommandService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 )
Expand All @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion GrpcInterface/RiaGrpcCommandService.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion GrpcInterface/RiaGrpcGridService.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class GridDimensions;
//==================================================================================================
class RiaCellCenterStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;

public:
RiaCellCenterStateHandler();
Expand Down
2 changes: 1 addition & 1 deletion GrpcInterface/RiaGrpcNNCPropertiesService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ grpc::Status RiaNNCInputValuesStateHandler::init( const NNCValuesInputRequest* r
m_timeStep = request->time_step();
m_propertyName = QString::fromStdString( request->property_name() );

RigNNCData* nncData = m_eclipseCase->eclipseCaseData()->mainGrid()->nncData();
RigNNCData* nncData = m_eclipseCase->eclipseCaseData()->mainGrid()->nncData();
std::vector<double>* resultsToAdd = getOrCreateConnectionScalarResultByName( nncData, m_propertyName, m_timeStep );
if ( !resultsToAdd )
{
Expand Down
6 changes: 3 additions & 3 deletions GrpcInterface/RiaGrpcNNCPropertiesService.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RimEclipseCase;
//==================================================================================================
class RiaNNCConnectionsStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;

public:
RiaNNCConnectionsStateHandler();
Expand All @@ -54,7 +54,7 @@ class RiaNNCConnectionsStateHandler
//==================================================================================================
class RiaNNCValuesStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;

public:
RiaNNCValuesStateHandler();
Expand All @@ -76,7 +76,7 @@ class RiaNNCValuesStateHandler
class RiaNNCInputValuesStateHandler
{
public:
typedef grpc::Status Status;
using Status = grpc::Status;

public:
RiaNNCInputValuesStateHandler( bool t = true );
Expand Down
4 changes: 2 additions & 2 deletions GrpcInterface/RiaGrpcPdmObjectService.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PdmProxyFieldHandle;

struct AbstractDataHolder
{
virtual ~AbstractDataHolder() = default;
virtual ~AbstractDataHolder() = default;
virtual size_t dataCount() const = 0;
virtual size_t dataSizeOf() const = 0;
virtual void reserveReplyStorage( rips::PdmObjectGetterReply* reply ) const = 0;
Expand All @@ -47,7 +47,7 @@ struct AbstractDataHolder
//==================================================================================================
class RiaPdmObjectMethodStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;

public:
RiaPdmObjectMethodStateHandler( bool clientToServerStreamer = false );
Expand Down
2 changes: 1 addition & 1 deletion GrpcInterface/RiaGrpcProjectService.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RiaGrpcProjectService final : public rips::Project::AsyncService, public R
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,
Expand Down
2 changes: 1 addition & 1 deletion GrpcInterface/RiaGrpcPropertiesService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ using namespace rips;

class RiaCellResultsStateHandler
{
typedef grpc::Status Status;
using Status = grpc::Status;

public:
//--------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion GrpcInterface/RiaGrpcServiceInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ class RiaGrpcServiceInterface
};

#include "cafFactory.h"
typedef caf::Factory<RiaGrpcServiceInterface, size_t> RiaGrpcServiceFactory;
using RiaGrpcServiceFactory = caf::Factory<RiaGrpcServiceInterface, size_t>;
Loading