Skip to content

Commit

Permalink
Check formatting as part of the CI (#2193)
Browse files Browse the repository at this point in the history
Succeed if all source files are well formated. Fail otherwise, and
display ill-formatted files.

---------

Co-authored-by: Abdoulbari Zaher <[email protected]>
  • Loading branch information
flomnes and a-zakir authored Jun 26, 2024
1 parent b6c0185 commit 3ca9107
Show file tree
Hide file tree
Showing 77 changed files with 2,117 additions and 1,584 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check cpp formatting

on:
push:
branches:
- develop
- feature/*
- features/*
- fix/*

jobs:
build:
name: clang-format

runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Print version
run: clang-format --version

- name: clang-format
run: cd src && ./format-code.sh

- name: git diff
run: |
DIFF=`git status --porcelain`
if [[ $DIFF ]]; then
echo "The following files are not well formatted"
echo "$DIFF"
exit 1
else
echo "Code is well formatted, congrats !"
fi
3 changes: 0 additions & 3 deletions src/libs/antares/antlr-interface/ExprBaseVisitor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

// Generated from Expr.g4 by ANTLR 4.13.1


#include "ExprBaseVisitor.h"


144 changes: 77 additions & 67 deletions src/libs/antares/antlr-interface/ExprBaseVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,88 @@

#pragma once


#include "antlr4-runtime.h"
#include "ExprVisitor.h"

#include "antlr4-runtime.h"

/**
* This class provides an empty implementation of ExprVisitor, which can be
* extended to create a visitor which only needs to handle a subset of the available methods.
*/
class ExprBaseVisitor : public ExprVisitor {
class ExprBaseVisitor: public ExprVisitor
{
public:

virtual std::any visitFullexpr(ExprParser::FullexprContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitShift(ExprParser::ShiftContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitIdentifier(ExprParser::IdentifierContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitNegation(ExprParser::NegationContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitExpression(ExprParser::ExpressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitComparison(ExprParser::ComparisonContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitAddsub(ExprParser::AddsubContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitPortField(ExprParser::PortFieldContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitMuldiv(ExprParser::MuldivContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitNumber(ExprParser::NumberContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeIndex(ExprParser::TimeIndexContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeShift(ExprParser::TimeShiftContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitFunction(ExprParser::FunctionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeShiftRange(ExprParser::TimeShiftRangeContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeRange(ExprParser::TimeRangeContext *ctx) override {
return visitChildren(ctx);
}


virtual std::any visitFullexpr(ExprParser::FullexprContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitShift(ExprParser::ShiftContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitIdentifier(ExprParser::IdentifierContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitNegation(ExprParser::NegationContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitExpression(ExprParser::ExpressionContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitComparison(ExprParser::ComparisonContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitAddsub(ExprParser::AddsubContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitPortField(ExprParser::PortFieldContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitMuldiv(ExprParser::MuldivContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitNumber(ExprParser::NumberContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitTimeIndex(ExprParser::TimeIndexContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitTimeShift(ExprParser::TimeShiftContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitFunction(ExprParser::FunctionContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitTimeShiftRange(ExprParser::TimeShiftRangeContext* ctx) override
{
return visitChildren(ctx);
}

virtual std::any visitTimeRange(ExprParser::TimeRangeContext* ctx) override
{
return visitChildren(ctx);
}
};

Loading

0 comments on commit 3ca9107

Please sign in to comment.