From 5a806223e724d1e03e4a4fa44dc8046f972e9acf Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sat, 10 Oct 2026 15:56:34 +0200 Subject: [PATCH] refactor(sonar): document intentionally empty functions (cpp:S1186) Co-Authored-By: Claude Opus 5.5 --- McZapkie/Oerlikon_ESt.cpp | 1 + McZapkie/hamulce.cpp | 6 +++--- McZapkie/hamulce.h | 12 ++++++------ global_include/interfaces/IMaterial.h | 2 +- global_include/interfaces/ITexture.h | 10 +++++----- launcher/launchermode.cpp | 2 +- network/message.h | 4 ++-- rendering/nullrenderer.h | 28 +++++++++++++-------------- rendering/opengl33light.cpp | 2 +- scripting/PyInt.cpp | 2 +- 10 files changed, 35 insertions(+), 34 deletions(-) diff --git a/McZapkie/Oerlikon_ESt.cpp b/McZapkie/Oerlikon_ESt.cpp index cbf5ab94..8c0cbb3c 100644 --- a/McZapkie/Oerlikon_ESt.cpp +++ b/McZapkie/Oerlikon_ESt.cpp @@ -296,6 +296,7 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr void TNESt3::EStParams( double const /*i_crc*/ ) const // parametry charakterystyczne dla ESt { + // no effect for this device type } void TNESt3::Init( double const PP, double const HPP, double const LPP, double const BP, int const BDF ) diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index 856cd740..1230408a 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -558,7 +558,7 @@ bool TBrake::Releaser() const /// support the EP brake (TWest, TEStEP1/2, ...). /// /// EP intensity. -void TBrake::SetEPS(double const nEPS) {} +void TBrake::SetEPS(double const nEPS) { /* no effect for this device type */ } /// /// Sets the anti-slip brake state flags. Bit 1 of @@ -1083,7 +1083,7 @@ void TESt::Init(double const PP, double const HPP, double const LPP, double cons /// derived variants and currently a no-op. /// /// Characteristic value. -void TESt::EStParams(double const /*i_crc*/) const {} +void TESt::EStParams(double const /*i_crc*/) const { /* no effect for this device type */ } /// Returns the control reservoir (ZS) pressure. double TESt::GetCRP() @@ -2868,7 +2868,7 @@ void TDriverHandle::Init(double Press) /// Default reductor adjustment — no-op. /// Pressure correction. -void TDriverHandle::SetReductor(double nAdj) {} +void TDriverHandle::SetReductor(double nAdj) { /* no effect for this device type */ } /// Default cab-gauge pressure — 0. double TDriverHandle::GetCP() diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index dea32c16..dbadb29a 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -442,7 +442,7 @@ class TBrake virtual void SetEPS(double const nEPS); // hamulec EP /// Sets the rapid step ratio. Default no-op; overridden where supported. /// Rapid ratio. - virtual void SetRM(double const RMR) {}; // ustalenie przelozenia rapida + virtual void SetRM(double const RMR) { /* no effect for this device type */ } // ustalenie przelozenia rapida /// Sets the velocity threshold for the rapid step. /// Velocity threshold (same unit as Vel passed to GetPF). virtual void SetRV(double const RVR) @@ -456,13 +456,13 @@ class TBrake /// Tare (empty) mass. /// Loaded mass. /// Brake cylinder pressure for the tare mass. - virtual void SetLP(double const TM, double const LM, double const TBP) {}; // parametry przystawki wazacej + virtual void SetLP(double const TM, double const LM, double const TBP) { /* no effect for this device type */ } // parametry przystawki wazacej /// Sets the auxiliary (local) brake target pressure. /// Local brake pressure [bar]. - virtual void SetLBP(double const P) {}; // cisnienie z hamulca pomocniczego + virtual void SetLBP(double const P) { /* no effect for this device type */ } // cisnienie z hamulca pomocniczego /// Updates the load-weighing pressure coefficient based on current vehicle mass. /// Current vehicle mass. - virtual void PLC(double const mass) {}; // wspolczynnik cisnienia przystawki wazacej + virtual void PLC(double const mass) { /* no effect for this device type */ } // wspolczynnik cisnienia przystawki wazacej /// /// Engages the anti-slip brake function (set hold and/or release flags). /// @@ -498,7 +498,7 @@ class TBrake /// brake when ED braking is sufficient. Default no-op; overridden where supported. /// /// ED brake intensity (0..1). - virtual void SetED(double const EDstate) {}; // stan hamulca ED do luzowania + virtual void SetED(double const EDstate) { /* no effect for this device type */ } // stan hamulca ED do luzowania /// Sets the universal-button flags (see TUniversalBrake). /// Combined ub_* flags. virtual void SetUniversalFlag(int flag) @@ -1076,7 +1076,7 @@ class TDriverHandle /// Unbrake over-pressure [bar]. /// Overload (assimilation) max pressure [bar]. /// Overload pressure decay rate [bar/s]. - virtual void SetParams(bool AO, bool MO, double, double, double OMP, double OPD) {}; // ustawianie jakichs parametrow dla zaworu + virtual void SetParams(bool AO, bool MO, double, double, double OMP, double OPD) { /* no effect for this device type */ } // ustawianie jakichs parametrow dla zaworu /// Sets the manual overcharge button state. /// True while the button is pressed. virtual void OvrldButton(bool Active); // przycisk recznego przeladowania/asymilacji diff --git a/global_include/interfaces/IMaterial.h b/global_include/interfaces/IMaterial.h index 874e77d0..92a8043e 100644 --- a/global_include/interfaces/IMaterial.h +++ b/global_include/interfaces/IMaterial.h @@ -21,7 +21,7 @@ struct IMaterial { static struct NullMaterial : public IMaterial { - void finalize(bool Loadnow) override {} + void finalize(bool Loadnow) override { /* null implementation, nothing to do */ } bool update() override { return false; diff --git a/global_include/interfaces/ITexture.h b/global_include/interfaces/ITexture.h index 8e4c1955..187d99b1 100644 --- a/global_include/interfaces/ITexture.h +++ b/global_include/interfaces/ITexture.h @@ -45,8 +45,8 @@ struct ITexture { return 0; } - void release() override {} - void make_stub() override {} + void release() override { /* null implementation, nothing to do */ } + void make_stub() override { /* null implementation, nothing to do */ } std::string_view get_traits() const override { return ""; @@ -67,9 +67,9 @@ struct ITexture { return false; } - void set_components_hint(int hint) override {} - void make_from_memory(size_t width, size_t height, const uint8_t *data) override {} - void update_from_memory(size_t width, size_t height, const uint8_t *data) override {} + void set_components_hint(int hint) override { /* null implementation, nothing to do */ } + void make_from_memory(size_t width, size_t height, const uint8_t *data) override { /* null implementation, nothing to do */ } + void update_from_memory(size_t width, size_t height, const uint8_t *data) override { /* null implementation, nothing to do */ } } null_texture{}; return &null_texture; } diff --git a/launcher/launchermode.cpp b/launcher/launchermode.cpp index 08c4c101..5059fa37 100644 --- a/launcher/launchermode.cpp +++ b/launcher/launchermode.cpp @@ -29,7 +29,7 @@ void launcher_mode::enter() void launcher_mode::exit() { - + // nothing to do } void launcher_mode::on_key(const int Key, const int Scancode, const int Action, const int Mods) diff --git a/network/message.h b/network/message.h index 2424309f..b6a1bc9d 100644 --- a/network/message.h +++ b/network/message.h @@ -19,8 +19,8 @@ struct message type_e type; message(type_e t) : type(t) {} - virtual void serialize(std::ostream &stream) const {} - virtual void deserialize(std::istream &stream) {} + virtual void serialize(std::ostream &stream) const { /* message carries no payload */ } + virtual void deserialize(std::istream &stream) { /* message carries no payload */ } virtual ~message() = default; }; diff --git a/rendering/nullrenderer.h b/rendering/nullrenderer.h index ccd1c272..0b21580b 100644 --- a/rendering/nullrenderer.h +++ b/rendering/nullrenderer.h @@ -23,16 +23,16 @@ private: // methods: // create() subclass details void - create_( gfx::geometry_handle const &Geometry ) override {} + create_( gfx::geometry_handle const &Geometry ) override { /* null implementation, nothing to do */ } // replace() subclass details void - replace_( gfx::geometry_handle const &Geometry ) override {} + replace_( gfx::geometry_handle const &Geometry ) override { /* null implementation, nothing to do */ } // draw() subclass details auto draw_( gfx::geometry_handle const &Geometry, gfx::stream_units const &Units, unsigned int const Streams ) -> std::size_t override { return 0; } // release() subclass details void - release_() override {} + release_() override { /* null implementation, nothing to do */ } }; // bare-bones render controller, in lack of anything better yet @@ -51,14 +51,14 @@ public: bool Render() override { return true; } void - SwapBuffers() override {} + SwapBuffers() override { /* null implementation, nothing to do */ } inline float Framerate() override { return 10.0f; } bool AddViewport(const global_settings::extraviewport_config &conf) override { return false; } bool Debug_Ui_State(std::optional) override { return false; } - void Shutdown() override {} + void Shutdown() override { /* null implementation, nothing to do */ } // geometry methods // NOTE: hands-on geometry management is exposed as a temporary measure; ultimately all visualization data should be generated/handled automatically by the renderer itself @@ -103,7 +103,7 @@ public: return static_cast(m_materials.size()); } void - Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override {} + Bind_Material( material_handle const Material, TSubModel const *sm = nullptr, lighting_data const *lighting = nullptr ) override { /* null implementation, nothing to do */ } IMaterial const * Material( material_handle const Material ) const override { return m_materials.at(Material - 1).get(); } // shader methods @@ -112,18 +112,18 @@ public: texture_handle Fetch_Texture( std::string const &Filename, bool const Loadnow = true, GLint format_hint = GL_SRGB_ALPHA ) override { throw std::runtime_error("not impl"); } void - Bind_Texture( texture_handle const Texture ) override {} + Bind_Texture( texture_handle const Texture ) override { /* null implementation, nothing to do */ } void - Bind_Texture( std::size_t const Unit, texture_handle const Texture ) override {} + Bind_Texture( std::size_t const Unit, texture_handle const Texture ) override { /* null implementation, nothing to do */ } opengl_texture & Texture( texture_handle const Texture ) override { throw std::runtime_error("not impl"); } opengl_texture const & Texture( texture_handle const Texture ) const override { throw std::runtime_error("not impl"); } // utility methods void - Pick_Control_Callback( std::function Callback ) override {} + Pick_Control_Callback( std::function Callback ) override { /* null implementation, nothing to do */ } void - Pick_Node_Callback( std::function Callback ) override {} + Pick_Node_Callback( std::function Callback ) override { /* null implementation, nothing to do */ } TSubModel const * Pick_Control() const override { return nullptr; } scene::basic_node const * @@ -132,11 +132,11 @@ public: Mouse_Position() const override { return glm::dvec3(); } // maintenance methods void - Update( double const Deltatime ) override {} + Update( double const Deltatime ) override { /* null implementation, nothing to do */ } void - Update_Pick_Control() override {} + Update_Pick_Control() override { /* null implementation, nothing to do */ } void - Update_Pick_Node() override {} + Update_Pick_Node() override { /* null implementation, nothing to do */ } glm::dvec3 Update_Mouse_Position() override { return glm::dvec3(); } // debug methods @@ -144,7 +144,7 @@ public: info_times() const override { return empty_str; } std::string const & info_stats() const override { return empty_str; } - void MakeScreenshot() override {} + void MakeScreenshot() override { /* null implementation, nothing to do */ } static std::unique_ptr create_func(); diff --git a/rendering/opengl33light.cpp b/rendering/opengl33light.cpp index 5b6334eb..dddb3236 100644 --- a/rendering/opengl33light.cpp +++ b/rendering/opengl33light.cpp @@ -16,7 +16,7 @@ void opengl33_light::apply_intensity(float const Factor) { factor = Factor; } -void opengl33_light::apply_angle() const {} +void opengl33_light::apply_angle() const { /* nothing to do */ } //--------------------------------------------------------------------------- diff --git a/scripting/PyInt.cpp b/scripting/PyInt.cpp index e970de18..4e4050c4 100644 --- a/scripting/PyInt.cpp +++ b/scripting/PyInt.cpp @@ -232,7 +232,7 @@ void render_task::upload() const } } -void render_task::cancel() const {} +void render_task::cancel() const { /* nothing to do */ } // initializes the module. returns true on success auto python_taskqueue::init() -> bool