Skip to content

TooManyStatementsPerLine for lambdas #2865

@Nekto89

Description

@Nekto89

Describe the bug
TooManyStatementsPerLine is shown for one-line short lambdas which I find strange.

To Reproduce
Analyze code that contains lambdas.
Examples:
const auto get_value = [](const auto& element) noexcept { return element.second; };
std::for_each(files.begin(), files.end(), [&](const auto& i_file) { new_files.AddFile(i_file); });

Expected behavior
In my opinion there should be no "cxx:TooManyStatementsPerLine" code smells in such cases.

Screenshots
Image

Desktop (please complete the following information):

  • OS: Windows
  • SonarQube version: 9.9.8
  • cxx plugin version: 2.1.3.851
  • sonar-scanner version: 5.0.1.3006

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions