diff --git a/src/StaticAnalysis.ruleset b/src/StaticAnalysis.ruleset index 776c72bf8..6b88f0dbf 100644 --- a/src/StaticAnalysis.ruleset +++ b/src/StaticAnalysis.ruleset @@ -11,6 +11,9 @@ + + + diff --git a/src/buffer/out/AttrRowIterator.cpp b/src/buffer/out/AttrRowIterator.cpp index 590e8c93d..17cd8241d 100644 --- a/src/buffer/out/AttrRowIterator.cpp +++ b/src/buffer/out/AttrRowIterator.cpp @@ -21,12 +21,12 @@ AttrRowIterator::AttrRowIterator(const ATTR_ROW* const attrRow) noexcept : { } -AttrRowIterator::operator bool() const +AttrRowIterator::operator bool() const noexcept { return !_exceeded && _run < _pAttrRow->_list.cend(); } -bool AttrRowIterator::operator==(const AttrRowIterator& it) const +bool AttrRowIterator::operator==(const AttrRowIterator& it) const noexcept { return (_pAttrRow == it._pAttrRow && _run == it._run && @@ -34,18 +34,18 @@ bool AttrRowIterator::operator==(const AttrRowIterator& it) const _exceeded == it._exceeded); } -bool AttrRowIterator::operator!=(const AttrRowIterator& it) const +bool AttrRowIterator::operator!=(const AttrRowIterator& it) const noexcept { return !(*this == it); } -AttrRowIterator& AttrRowIterator::operator++() +AttrRowIterator& AttrRowIterator::operator++() noexcept { _increment(1); return *this; } -AttrRowIterator AttrRowIterator::operator++(int) +AttrRowIterator AttrRowIterator::operator++(int) noexcept { auto copy = *this; _increment(1); @@ -74,13 +74,13 @@ AttrRowIterator& AttrRowIterator::operator-=(const ptrdiff_t& movement) return this->operator+=(-movement); } -AttrRowIterator& AttrRowIterator::operator--() +AttrRowIterator& AttrRowIterator::operator--() noexcept { _decrement(1); return *this; } -AttrRowIterator AttrRowIterator::operator--(int) +AttrRowIterator AttrRowIterator::operator--(int) noexcept { auto copy = *this; _decrement(1); @@ -103,7 +103,7 @@ const TextAttribute& AttrRowIterator::operator*() const // - increments the index the iterator points to // Arguments: // - count - the amount to increment by -void AttrRowIterator::_increment(size_t count) +void AttrRowIterator::_increment(size_t count) noexcept { while (count > 0) { @@ -126,7 +126,7 @@ void AttrRowIterator::_increment(size_t count) // - decrements the index the iterator points to // Arguments: // - count - the amount to decrement by -void AttrRowIterator::_decrement(size_t count) +void AttrRowIterator::_decrement(size_t count) noexcept { while (count > 0) { diff --git a/src/buffer/out/AttrRowIterator.hpp b/src/buffer/out/AttrRowIterator.hpp index 3dbd4fa69..025be4517 100644 --- a/src/buffer/out/AttrRowIterator.hpp +++ b/src/buffer/out/AttrRowIterator.hpp @@ -33,19 +33,19 @@ public: AttrRowIterator(const ATTR_ROW* const attrRow) noexcept; - operator bool() const; + operator bool() const noexcept; - bool operator==(const AttrRowIterator& it) const; - bool operator!=(const AttrRowIterator& it) const; + bool operator==(const AttrRowIterator& it) const noexcept; + bool operator!=(const AttrRowIterator& it) const noexcept; - AttrRowIterator& operator++(); - AttrRowIterator operator++(int); + AttrRowIterator& operator++() noexcept; + AttrRowIterator operator++(int) noexcept; AttrRowIterator& operator+=(const ptrdiff_t& movement); AttrRowIterator& operator-=(const ptrdiff_t& movement); - AttrRowIterator& operator--(); - AttrRowIterator operator--(int); + AttrRowIterator& operator--() noexcept; + AttrRowIterator operator--(int) noexcept; const TextAttribute* operator->() const; const TextAttribute& operator*() const; @@ -56,7 +56,7 @@ private: size_t _currentAttributeIndex; // index of TextAttribute within the current TextAttributeRun bool _exceeded; - void _increment(size_t count); - void _decrement(size_t count); + void _increment(size_t count) noexcept; + void _decrement(size_t count) noexcept; void _setToEnd() noexcept; }; diff --git a/src/buffer/out/CharRow.cpp b/src/buffer/out/CharRow.cpp index cf3bed4d8..c5442e1d7 100644 --- a/src/buffer/out/CharRow.cpp +++ b/src/buffer/out/CharRow.cpp @@ -139,7 +139,7 @@ typename CharRow::const_iterator CharRow::cend() const noexcept // - // Return Value: // - The calculated left boundary of the internal string. -size_t CharRow::MeasureLeft() const +size_t CharRow::MeasureLeft() const noexcept { std::vector::const_iterator it = _data.cbegin(); while (it != _data.cend() && it->IsSpace()) diff --git a/src/buffer/out/CharRow.hpp b/src/buffer/out/CharRow.hpp index f3ccd3dc5..24866875f 100644 --- a/src/buffer/out/CharRow.hpp +++ b/src/buffer/out/CharRow.hpp @@ -62,7 +62,7 @@ public: size_t size() const noexcept; void Reset() noexcept; [[nodiscard]] HRESULT Resize(const size_t newSize) noexcept; - size_t MeasureLeft() const; + size_t MeasureLeft() const noexcept; size_t MeasureRight() const noexcept; void ClearCell(const size_t column); bool ContainsText() const noexcept; diff --git a/src/buffer/out/textBuffer.cpp b/src/buffer/out/textBuffer.cpp index 24ef10da5..3879ce2b2 100644 --- a/src/buffer/out/textBuffer.cpp +++ b/src/buffer/out/textBuffer.cpp @@ -2322,7 +2322,7 @@ uint16_t TextBuffer::GetHyperlinkId(std::wstring_view uri, std::wstring_view id) // user defined id from the custom id map (if there is one) // Arguments: // - The ID of the hyperlink to be removed -void TextBuffer::RemoveHyperlinkFromMap(uint16_t id) +void TextBuffer::RemoveHyperlinkFromMap(uint16_t id) noexcept { _hyperlinkMap.erase(id); for (const auto& customIdPair : _hyperlinkCustomIdMap) diff --git a/src/buffer/out/textBuffer.hpp b/src/buffer/out/textBuffer.hpp index b1e0be1c7..833c249a3 100644 --- a/src/buffer/out/textBuffer.hpp +++ b/src/buffer/out/textBuffer.hpp @@ -144,7 +144,7 @@ public: void AddHyperlinkToMap(std::wstring_view uri, uint16_t id); std::wstring GetHyperlinkUriFromId(uint16_t id) const; uint16_t GetHyperlinkId(std::wstring_view uri, std::wstring_view id); - void RemoveHyperlinkFromMap(uint16_t id); + void RemoveHyperlinkFromMap(uint16_t id) noexcept; std::wstring GetCustomIdFromId(uint16_t id) const; void CopyHyperlinkMaps(const TextBuffer& OtherBuffer); diff --git a/src/buffer/out/textBufferCellIterator.cpp b/src/buffer/out/textBufferCellIterator.cpp index 9cc6deaec..7ab512c72 100644 --- a/src/buffer/out/textBufferCellIterator.cpp +++ b/src/buffer/out/textBufferCellIterator.cpp @@ -65,7 +65,7 @@ TextBufferCellIterator::operator bool() const noexcept // - it - The other iterator to compare to this one. // Return Value: // - True if it's the same text buffer and same cell position. False otherwise. -bool TextBufferCellIterator::operator==(const TextBufferCellIterator& it) const +bool TextBufferCellIterator::operator==(const TextBufferCellIterator& it) const noexcept { return _pos == it._pos && &_buffer == &it._buffer && @@ -81,7 +81,7 @@ bool TextBufferCellIterator::operator==(const TextBufferCellIterator& it) const // - it - The other iterator to compare to this one. // Return Value: // - True if it's the same text buffer and different cell position or if they're different buffers. False otherwise. -bool TextBufferCellIterator::operator!=(const TextBufferCellIterator& it) const +bool TextBufferCellIterator::operator!=(const TextBufferCellIterator& it) const noexcept { return !(*this == it); } diff --git a/src/buffer/out/textBufferCellIterator.hpp b/src/buffer/out/textBufferCellIterator.hpp index d647bd701..07fe9b4f4 100644 --- a/src/buffer/out/textBufferCellIterator.hpp +++ b/src/buffer/out/textBufferCellIterator.hpp @@ -30,8 +30,8 @@ public: operator bool() const noexcept; - bool operator==(const TextBufferCellIterator& it) const; - bool operator!=(const TextBufferCellIterator& it) const; + bool operator==(const TextBufferCellIterator& it) const noexcept; + bool operator!=(const TextBufferCellIterator& it) const noexcept; TextBufferCellIterator& operator+=(const ptrdiff_t& movement); TextBufferCellIterator& operator-=(const ptrdiff_t& movement); diff --git a/src/cascadia/TerminalConnection/ConptyConnection.cpp b/src/cascadia/TerminalConnection/ConptyConnection.cpp index b05dd7442..1b96cc92c 100644 --- a/src/cascadia/TerminalConnection/ConptyConnection.cpp +++ b/src/cascadia/TerminalConnection/ConptyConnection.cpp @@ -84,7 +84,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation std::wstring cmdline{ wil::ExpandEnvironmentStringsW(_commandline.c_str()) }; // mutable copy -- required for CreateProcessW Utils::EnvironmentVariableMapW environment; - auto zeroEnvMap = wil::scope_exit([&] { + auto zeroEnvMap = wil::scope_exit([&]() noexcept { // Can't zero the keys, but at least we can zero the values. for (auto& [name, value] : environment) { diff --git a/src/renderer/dx/DxRenderer.cpp b/src/renderer/dx/DxRenderer.cpp index a5575a05f..78d323d12 100644 --- a/src/renderer/dx/DxRenderer.cpp +++ b/src/renderer/dx/DxRenderer.cpp @@ -1516,13 +1516,13 @@ try // offset by half the stroke width. For the start coordinate we add half // the stroke width, and for the end coordinate we subtract half the width. - if (lines & (GridLines::Left | GridLines::Right)) + if (WI_IsAnyFlagSet(lines, (GridLines::Left | GridLines::Right))) { const auto halfGridlineWidth = _lineMetrics.gridlineWidth / 2.0f; const auto startY = target.y + halfGridlineWidth; const auto endY = target.y + font.height - halfGridlineWidth; - if (lines & GridLines::Left) + if (WI_IsFlagSet(lines, GridLines::Left)) { auto x = target.x + halfGridlineWidth; for (size_t i = 0; i < cchLine; i++, x += font.width) @@ -1531,7 +1531,7 @@ try } } - if (lines & GridLines::Right) + if (WI_IsFlagSet(lines, GridLines::Right)) { auto x = target.x + font.width - halfGridlineWidth; for (size_t i = 0; i < cchLine; i++, x += font.width) @@ -1541,19 +1541,19 @@ try } } - if (lines & (GridLines::Top | GridLines::Bottom)) + if (WI_IsAnyFlagSet(lines, GridLines::Top | GridLines::Bottom)) { const auto halfGridlineWidth = _lineMetrics.gridlineWidth / 2.0f; const auto startX = target.x + halfGridlineWidth; const auto endX = target.x + fullRunWidth - halfGridlineWidth; - if (lines & GridLines::Top) + if (WI_IsFlagSet(lines, GridLines::Top)) { const auto y = target.y + halfGridlineWidth; DrawLine(startX, y, endX, y, _lineMetrics.gridlineWidth); } - if (lines & GridLines::Bottom) + if (WI_IsFlagSet(lines, GridLines::Bottom)) { const auto y = target.y + font.height - halfGridlineWidth; DrawLine(startX, y, endX, y, _lineMetrics.gridlineWidth); @@ -1563,24 +1563,24 @@ try // In the case of the underline and strikethrough offsets, the stroke width // is already accounted for, so they don't require further adjustments. - if (lines & (GridLines::Underline | GridLines::DoubleUnderline | GridLines::HyperlinkUnderline)) + if (WI_IsAnyFlagSet(lines, GridLines::Underline | GridLines::DoubleUnderline | GridLines::HyperlinkUnderline)) { const auto halfUnderlineWidth = _lineMetrics.underlineWidth / 2.0f; const auto startX = target.x + halfUnderlineWidth; const auto endX = target.x + fullRunWidth - halfUnderlineWidth; const auto y = target.y + _lineMetrics.underlineOffset; - if (lines & GridLines::Underline) + if (WI_IsFlagSet(lines, GridLines::Underline)) { DrawLine(startX, y, endX, y, _lineMetrics.underlineWidth); } - if (lines & GridLines::HyperlinkUnderline) + if (WI_IsFlagSet(lines, GridLines::HyperlinkUnderline)) { DrawHyperlinkLine(startX, y, endX, y, _lineMetrics.underlineWidth); } - if (lines & GridLines::DoubleUnderline) + if (WI_IsFlagSet(lines, GridLines::DoubleUnderline)) { DrawLine(startX, y, endX, y, _lineMetrics.underlineWidth); const auto y2 = target.y + _lineMetrics.underlineOffset2; @@ -1588,7 +1588,7 @@ try } } - if (lines & GridLines::Strikethrough) + if (WI_IsFlagSet(lines, GridLines::Strikethrough)) { const auto halfStrikethroughWidth = _lineMetrics.strikethroughWidth / 2.0f; const auto startX = target.x + halfStrikethroughWidth; diff --git a/src/types/KeyEvent.cpp b/src/types/KeyEvent.cpp index ab891b814..802f27009 100644 --- a/src/types/KeyEvent.cpp +++ b/src/types/KeyEvent.cpp @@ -72,7 +72,7 @@ void KeyEvent::ActivateModifierKey(const ModifierKeyState modifierKey) noexcept SetActiveModifierKeys(keys); } -bool KeyEvent::DoActiveModifierKeysMatch(const std::unordered_set& consoleModifiers) const +bool KeyEvent::DoActiveModifierKeysMatch(const std::unordered_set& consoleModifiers) const noexcept { DWORD consoleBits = 0; for (const ModifierKeyState& mod : consoleModifiers) diff --git a/src/types/inc/IInputEvent.hpp b/src/types/inc/IInputEvent.hpp index bf662f0df..6ebda3d76 100644 --- a/src/types/inc/IInputEvent.hpp +++ b/src/types/inc/IInputEvent.hpp @@ -297,7 +297,7 @@ public: void SetActiveModifierKeys(const DWORD activeModifierKeys) noexcept; void DeactivateModifierKey(const ModifierKeyState modifierKey) noexcept; void ActivateModifierKey(const ModifierKeyState modifierKey) noexcept; - bool DoActiveModifierKeysMatch(const std::unordered_set& consoleModifiers) const; + bool DoActiveModifierKeysMatch(const std::unordered_set& consoleModifiers) const noexcept; bool IsCommandLineEditingKey() const noexcept; bool IsPopupKey() const noexcept;