diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3515025e..2a9be8ed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: run: platformio run --environment esp32doit-devkit-v1-usb - name: Perform static checks on target esp32doit-devkit-v1-usb - run: platformio check --environment esp32doit-devkit-v1-usb --skip-packages + run: platformio check --environment esp32doit-devkit-v1-usb - name: Perform static checks on native environment run: platformio check --environment test diff --git a/lib/Gfx/LampWidget.h b/lib/Gfx/LampWidget.h index 80f89d70..4a731d2a 100644 --- a/lib/Gfx/LampWidget.h +++ b/lib/Gfx/LampWidget.h @@ -119,10 +119,13 @@ class LampWidget : public Widget */ LampWidget& operator=(const LampWidget& widget) { - m_isOn = widget.m_isOn; - m_colorOff = widget.m_colorOff; - m_colorOn = widget.m_colorOn; - m_width = widget.m_width; + if (&widget != this) + { + m_isOn = widget.m_isOn; + m_colorOff = widget.m_colorOff; + m_colorOn = widget.m_colorOn; + m_width = widget.m_width; + } return *this; } diff --git a/lib/Gfx/ProgressBar.h b/lib/Gfx/ProgressBar.h index 992b9831..20f8c8dd 100644 --- a/lib/Gfx/ProgressBar.h +++ b/lib/Gfx/ProgressBar.h @@ -110,9 +110,12 @@ class ProgressBar : public Widget */ ProgressBar& operator=(const ProgressBar& widget) { - m_progress = widget.m_progress; - m_color = widget.m_color; - m_algorithm = widget.m_algorithm; + if (&widget != this) + { + m_progress = widget.m_progress; + m_color = widget.m_color; + m_algorithm = widget.m_algorithm; + } return *this; } diff --git a/lib/Gfx/Widget.hpp b/lib/Gfx/Widget.hpp index 45fdb64c..0bda5ee6 100644 --- a/lib/Gfx/Widget.hpp +++ b/lib/Gfx/Widget.hpp @@ -80,10 +80,13 @@ class Widget */ Widget& operator=(const Widget& widget) { - m_type = widget.m_type; - m_posX = widget.m_posX; - m_posY = widget.m_posY; - /* m_name is not assigned! */ + if (&widget != this) + { + m_type = widget.m_type; + m_posX = widget.m_posX; + m_posY = widget.m_posY; + /* m_name is not assigned! */ + } return *this; } diff --git a/lib/LinkedList/LinkedList.hpp b/lib/LinkedList/LinkedList.hpp index 7dad2717..3614b2db 100644 --- a/lib/LinkedList/LinkedList.hpp +++ b/lib/LinkedList/LinkedList.hpp @@ -646,13 +646,16 @@ class DLinkedList */ DLinkedList& operator=(const DLinkedList& list) { - ListElement* listElement = list.m_head; - - clear(); - while(nullptr != listElement) + if (&list != this) { - append(listElement->getElement()); - listElement = listElement->getNext(); + ListElement* listElement = list.m_head; + + clear(); + while(nullptr != listElement) + { + append(listElement->getElement()); + listElement = listElement->getNext(); + } } return *this; diff --git a/lib/Utilities/SimpleTimer.hpp b/lib/Utilities/SimpleTimer.hpp index fe98569c..90ee496a 100644 --- a/lib/Utilities/SimpleTimer.hpp +++ b/lib/Utilities/SimpleTimer.hpp @@ -99,10 +99,13 @@ class SimpleTimer */ SimpleTimer& operator=(const SimpleTimer& sTimer) { - m_isRunning = sTimer.m_isRunning; - m_isTimeout = sTimer.m_isTimeout; - m_duration = sTimer.m_duration; - m_start = sTimer.m_start; + if (&sTimer != this) + { + m_isRunning = sTimer.m_isRunning; + m_isTimeout = sTimer.m_isTimeout; + m_duration = sTimer.m_duration; + m_start = sTimer.m_start; + } return *this; } diff --git a/platformio.ini b/platformio.ini index cd425aab..1bea8a5f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -49,8 +49,9 @@ check_patterns = lib/StateMachine lib/Utilities check_flags = - cppcheck: --std=c++11 --inline-suppr --suppress=noExplicitConstructor --suppress=unreadVariable --suppress=unusedFunction + cppcheck: --std=c++11 --inline-suppr --suppress=noExplicitConstructor --suppress=unreadVariable --suppress=unusedFunction --suppress=*:*/libdeps/* clangtidy: --checks=-*,clang-analyzer-*,performance-* +check_skip_packages = yes ; Check for the compatibility with frameworks and dev/platforms lib_compat_mode = strict ; Parses ALL C/C++ source files of the project and follows only by nested includes (#include ..., chain…) from the libraries. @@ -68,6 +69,7 @@ check_tool = ${esp32_env_data.check_tool} check_severity = ${esp32_env_data.check_severity} check_patterns = ${esp32_env_data.check_patterns} check_flags = ${esp32_env_data.check_flags} +check_skip_packages = ${esp32_env_data.check_skip_packages} lib_compat_mode = ${esp32_env_data.lib_compat_mode} lib_ldf_mode = ${esp32_env_data.lib_ldf_mode} build_flags = ${esp32_env_data.build_flags} @@ -93,6 +95,7 @@ check_tool = ${esp32_env_data.check_tool} check_severity = ${esp32_env_data.check_severity} check_patterns = ${esp32_env_data.check_patterns} check_flags = ${esp32_env_data.check_flags} +check_skip_packages = ${esp32_env_data.check_skip_packages} lib_compat_mode = ${esp32_env_data.lib_compat_mode} lib_ldf_mode = ${esp32_env_data.lib_ldf_mode} build_flags = ${esp32_env_data.build_flags} @@ -125,3 +128,4 @@ check_tool = ${esp32_env_data.check_tool} check_severity = ${esp32_env_data.check_severity} check_patterns = ${esp32_env_data.check_patterns} check_flags = ${esp32_env_data.check_flags} +check_skip_packages = ${esp32_env_data.check_skip_packages}