Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/e2e/target.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
action-ref=79dfaaef8e18815e923592c1d5098c7e0d25ecf6
clang-version=21
9 changes: 8 additions & 1 deletion src/demo.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/** This is a very ugly test code (doomed to fail linting) */
#include "demo.hpp"
#include <cstdio>
Expand All @@ -6,12 +6,19 @@
// using size_t from cstddef
size_t dummyFunc(size_t i) { return i; }

int scale(int value)

Check warning on line 9 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:9:5 [modernize-use-trailing-return-type]

use a trailing return type for this function

Check warning on line 9 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:9:5 [misc-use-internal-linkage]

function 'scale' can be made static or moved into an anonymous namespace to enforce internal linkage

Check warning on line 9 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:9:5 [modernize-use-trailing-return-type]

use a trailing return type for this function

Check warning on line 9 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:9:5 [misc-use-internal-linkage]

function 'scale' can be made static or moved into an anonymous namespace to enforce internal linkage

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
int scale(int value)
static auto scale(int value) -> int

{
if (value > 0)

Check warning on line 11 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:11:19 [readability-braces-around-statements]

statement should be inside braces

Check warning on line 11 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:11:19 [readability-braces-around-statements]

statement should be inside braces
return value*3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
return value*3;
return value * 3;

Comment on lines +11 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
if (value > 0)
return value*3;
if (value > 0) {
return value * 3;
}

return 0;
}

int main()
{
for (;;)
break;

printf("Hello world!\n");
printf("Hello world! %d\n", scale( 14 ));

Check warning on line 21 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:21:40 [cppcoreguidelines-avoid-magic-numbers]

14 is a magic number; consider replacing it with a named constant

Check warning on line 21 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:21:5 [cppcoreguidelines-pro-type-vararg]

do not call c-style vararg functions

Check warning on line 21 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:21:40 [cppcoreguidelines-avoid-magic-numbers]

14 is a magic number; consider replacing it with a named constant

Check warning on line 21 in src/demo.cpp

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

src/demo.cpp:21:5 [cppcoreguidelines-pro-type-vararg]

do not call c-style vararg functions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
printf("Hello world! %d\n", scale( 14 ));
printf("Hello world! %d\n", scale(14));

clang-tidy diagnostic

src/demo.cpp:21:5: warning: [cppcoreguidelines-pro-type-vararg]

do not call c-style vararg functions

   21 |     printf("Hello world! %d\n", scale( 14 ));
      |     ^

clang-tidy diagnostic

src/demo.cpp:21:40: warning: [cppcoreguidelines-avoid-magic-numbers]

14 is a magic number; consider replacing it with a named constant

   21 |     printf("Hello world! %d\n", scale( 14 ));
      |                                        ^


return 0;
}
Loading