Skip to content

Commit

Permalink
Brayns 543 upgrade clang format (#1177)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien4193 committed May 2, 2023
1 parent 199980f commit 81ab66f
Show file tree
Hide file tree
Showing 261 changed files with 1,057 additions and 978 deletions.
51 changes: 30 additions & 21 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
# AlignArrayOfStructures: None
AlignArrayOfStructures: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
Expand All @@ -28,45 +28,54 @@ BinPackParameters: false
BitFieldColonSpacing: Both
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
# BreakBeforeConceptDeclarations: true
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: true
ColumnLimit: 120
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false # Deprecated
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: false
DerivePointerAlignment: false
# EmptyLineAfterAccessModifier: Never
# EmptyLineBeforeAccessModifier: Always
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
FixNamespaceComments: false
IncludeBlocks: Preserve
# IndentAccessModifiers: false
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: true
IndentGotoLabels: false
IndentPPDirectives: BeforeHash
# IndentRequires: true
IndentRequires: true
IndentWidth: 4
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false
# LambdaBodyIndentation: OuterScope
LambdaBodyIndentation: Signature
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
# PackConstructorInitializers: Never
PackConstructorInitializers: Never
PenaltyBreakAssignment: 1
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 1
PenaltyBreakFirstLessLess: 1
PenaltyBreakOpenParenthesis: 1
PenaltyBreakString: 2
PenaltyBreakTemplateDeclaration: 1
PenaltyExcessCharacter: 100
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 100000
PointerAlignment: Right
# QualifierAlignment: Leave
# QualifierOrder: ['static', 'inline', 'const', 'volatile', 'type']
# ReferenceAlignment: Right
QualifierAlignment: Custom
QualifierOrder: ["static", "inline", "const", "volatile", "type"]
ReferenceAlignment: Right
ReflowComments: true
# SeparateDefinitionBlocks: true
# ShortNamespaceLines: 1
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 1
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
Expand All @@ -76,21 +85,21 @@ SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
# SpacesInAngles: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
# SpacesInLineCommentPrefix:
# Minimum: 1
# Maximum: 1
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
Expand Down
10 changes: 5 additions & 5 deletions .gitlab-ci.viz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ include:
ubuntu-clangformat-check:
stage: test
image:
name: ubuntu:20.04
name: ubuntu:22.04
entrypoint: [""]
script:
- apt update && apt install -y git clang-format-12
- apt update && apt install -y git clang-format-15
- cd $CI_PROJECT_DIR
- CLANG_FORMAT_EXTENSIONS="\.[cmh]$|\.[chi]pp$"
- if [ -f .clang-format ]; then
- if find . | grep -E "$CLANG_FORMAT_EXTENSIONS" | xargs -n1 clang-format-12 -style=file -fallback-style=none -output-replacements-xml | grep "<replacement " >/dev/null ; then
- if find . | grep -E "$CLANG_FORMAT_EXTENSIONS" | xargs -n1 clang-format-15 -style=file -fallback-style=none -output-replacements-xml | grep "<replacement " >/dev/null ; then
- echo "clang-format check failed - commit does not match coding style"
- find . | grep -E "$CLANG_FORMAT_EXTENSIONS" | xargs -n1 clang-format-12 -i -style=file -fallback-style=none
- find . | grep -E "$CLANG_FORMAT_EXTENSIONS" | xargs -n1 clang-format-15 -i -style=file -fallback-style=none
- git diff
- exit 1
- else
Expand Down Expand Up @@ -119,7 +119,7 @@ ubuntu-cpp-release-build:
stage: test
variables:
CMAKE_BUILD_TYPE: Release

ubuntu-cpp-debug-build:
extends: .ubuntu-cpp-build
stage: test
Expand Down
12 changes: 6 additions & 6 deletions brayns/Brayns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class NetworkStartup
class RateLimiter
{
public:
explicit RateLimiter(brayns::Duration period)
: _period(period)
explicit RateLimiter(brayns::Duration period):
_period(period)
{
}

Expand All @@ -112,10 +112,10 @@ class RateLimiter

namespace brayns
{
Brayns::Brayns(int argc, const char **argv)
: _parametersManager(argc, argv)
, _engine(_parametersManager)
, _pluginManager(*this)
Brayns::Brayns(int argc, const char **argv):
_parametersManager(argc, argv),
_engine(_parametersManager),
_pluginManager(*this)
{
LoggingStartup::run(_parametersManager);

Expand Down
6 changes: 3 additions & 3 deletions brayns/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ std::string CommandLine::getVersion()
return VersionFormatter::format();
}

CommandLine::CommandLine(int argc, const char **argv)
: _argc(argc)
, _argv(argv)
CommandLine::CommandLine(int argc, const char **argv):
_argc(argc),
_argv(argv)
{
}

Expand Down
4 changes: 2 additions & 2 deletions brayns/PluginManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class PluginLoader

namespace brayns
{
PluginManager::PluginManager(PluginAPI &api)
: _api(api)
PluginManager::PluginManager(PluginAPI &api):
_api(api)
{
}

Expand Down
12 changes: 6 additions & 6 deletions brayns/engine/camera/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ namespace
{
struct CameraParameters
{
inline static const std::string position = "position";
inline static const std::string direction = "direction";
inline static const std::string up = "up";
inline static const std::string aspect = "aspect";
inline static const std::string imageStart = "imageStart";
inline static const std::string imageEnd = "imageEnd";
static inline const std::string position = "position";
static inline const std::string direction = "direction";
static inline const std::string up = "up";
static inline const std::string aspect = "aspect";
static inline const std::string imageStart = "imageStart";
static inline const std::string imageEnd = "imageEnd";
};

class ViewIntegrity
Expand Down
2 changes: 1 addition & 1 deletion brayns/engine/camera/ProjectionTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ template<typename T>
class ProjectionTraits
{
public:
inline static const std::string name;
static inline const std::string name;

static void checkParameters(const T &data)
{
Expand Down
2 changes: 1 addition & 1 deletion brayns/engine/camera/projections/Orthographic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace
{
struct OrhtographicParameters
{
inline static const std::string height = "height";
static inline const std::string height = "height";
};
}

Expand Down
2 changes: 1 addition & 1 deletion brayns/engine/camera/projections/Orthographic.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ template<>
class ProjectionTraits<Orthographic>
{
public:
inline static const std::string name = "orthographic";
static inline const std::string name = "orthographic";

static void checkParameters(const Orthographic &data);
static void updateData(ospray::cpp::Camera &handle, Orthographic &data);
Expand Down
6 changes: 3 additions & 3 deletions brayns/engine/camera/projections/Perspective.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ namespace
{
struct PerspectiveParameters
{
inline static const std::string fovy = "fovy";
inline static const std::string aperture = "apertureRadius";
inline static const std::string focus = "focusDistance";
static inline const std::string fovy = "fovy";
static inline const std::string aperture = "apertureRadius";
static inline const std::string focus = "focusDistance";
};
}

Expand Down
6 changes: 3 additions & 3 deletions brayns/engine/colormethods/PrimitiveColorMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ class Painter

namespace brayns
{
PrimitiveColorMethod::PrimitiveColorMethod(std::string name, size_t primitiveCount)
: _name(std::move(name))
, _primitiveCount(primitiveCount)
PrimitiveColorMethod::PrimitiveColorMethod(std::string name, size_t primitiveCount):
_name(std::move(name)),
_primitiveCount(primitiveCount)
{
assert(_primitiveCount > 0);
}
Expand Down
4 changes: 2 additions & 2 deletions brayns/engine/colormethods/SolidColorMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace
{
struct SolidMethodNames
{
inline static const std::string name = "solid";
inline static const std::string value = "color";
static inline const std::string name = "solid";
static inline const std::string value = "color";
};

class ColorFiller
Expand Down
8 changes: 4 additions & 4 deletions brayns/engine/common/DataWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ template<typename DataType, typename OsprayHandle, template<typename> typename T
class DataWrapper final : public IDataWrapper<OsprayHandle>
{
public:
explicit DataWrapper(DataType value)
: data(std::move(value))
explicit DataWrapper(DataType value):
data(std::move(value))
{
}

Expand Down Expand Up @@ -73,8 +73,8 @@ class SpatialDataWrapper final : public ISpatialDataWrapper<OsprayHandle>
public:
using Type = std::decay_t<DataType>;

explicit SpatialDataWrapper(Type value)
: data(std::move(value))
explicit SpatialDataWrapper(Type value):
data(std::move(value))
{
}

Expand Down
6 changes: 3 additions & 3 deletions brayns/engine/components/Bounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

namespace brayns
{
Bounds::Bounds(const Vector3f &minB, const Vector3f &maxB)
: _min(minB)
, _max(maxB)
Bounds::Bounds(const Vector3f &minB, const Vector3f &maxB):
_min(minB),
_max(maxB)
{
if (glm::min(_min, _max) != _min)
{
Expand Down
6 changes: 3 additions & 3 deletions brayns/engine/components/ColorRamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

namespace brayns
{
ColorRamp::ColorRamp()
: _colors({{0, 0, 0, 0}, {1, 1, 1, 1}})
, _valuesRange({0, 255})
ColorRamp::ColorRamp():
_colors({{0, 0, 0, 0}, {1, 1, 1, 1}}),
_valuesRange({0, 255})
{
}

Expand Down
12 changes: 6 additions & 6 deletions brayns/engine/core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ Engine::OsprayModuleHandler::~OsprayModuleHandler()
ospShutdown();
}

Engine::Engine(ParametersManager &parameters)
: _params(parameters)
, _osprayDevice(OsprayDeviceInitializer::init(parameters))
, _frameBuffer(std::make_unique<StaticFrameHandler>())
, _camera(Perspective())
, _renderer(Interactive())
Engine::Engine(ParametersManager &parameters):
_params(parameters),
_osprayDevice(OsprayDeviceInitializer::init(parameters)),
_frameBuffer(std::make_unique<StaticFrameHandler>()),
_camera(Perspective()),
_renderer(Interactive())
{
EngineFactoriesInitializer::init(_factories);
}
Expand Down
7 changes: 5 additions & 2 deletions brayns/engine/core/FrameRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ class FrameRenderer
* @param renderer
* @param scene
*/
static void
synchronous(const Camera &camera, const Framebuffer &framebuffer, const Renderer &renderer, const Scene &scene);
static void synchronous(
const Camera &camera,
const Framebuffer &framebuffer,
const Renderer &renderer,
const Scene &scene);

/**
* @brief Renders a frame asynchronously. The function returns inmediatly with an OSPFuture, which can be used
Expand Down
16 changes: 8 additions & 8 deletions brayns/engine/framebuffer/ToneMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ namespace
{
struct ToneMappingParameters
{
inline static const std::string osprayName = "tonemapper";
inline static const std::string exposure = "exposure";
inline static const std::string contrast = "contrast";
inline static const std::string shoulder = "shoulder";
inline static const std::string midIn = "midIn";
inline static const std::string midOut = "midOut";
inline static const std::string hdrMax = "hdrMax";
inline static const std::string acesColor = "acesColor";
static inline const std::string osprayName = "tonemapper";
static inline const std::string exposure = "exposure";
static inline const std::string contrast = "contrast";
static inline const std::string shoulder = "shoulder";
static inline const std::string midIn = "midIn";
static inline const std::string midOut = "midOut";
static inline const std::string hdrMax = "hdrMax";
static inline const std::string acesColor = "acesColor";
};
}

Expand Down
4 changes: 2 additions & 2 deletions brayns/engine/framebuffer/types/ProgressiveFrameHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class FrameSizeScaler

namespace brayns
{
ProgressiveFrameHandler::ProgressiveFrameHandler(uint32_t scale)
: _scale(scale)
ProgressiveFrameHandler::ProgressiveFrameHandler(uint32_t scale):
_scale(scale)
{
if (_scale == 0)
{
Expand Down

0 comments on commit 81ab66f

Please sign in to comment.