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: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
Language: Cpp
BasedOnStyle: WebKit
BasedOnStyle: WebKit
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,4 @@ CheckOptions:
value: '1'
- key: readability-uppercase-literal-suffix.NewSuffixes
value: ''
...
11 changes: 7 additions & 4 deletions .github/workflows/cpp-lint-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: cpp-linter as action
on:
workflow_dispatch:
workflow_call:
# pull_request:


jobs:
Expand Down Expand Up @@ -32,7 +33,7 @@ jobs:
run: mkdir build && cmake -Bbuild src

- name: Run linter as action
uses: cpp-linter/cpp-linter-action@latest
uses: cpp-linter/cpp-linter-action@v3
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -42,10 +43,12 @@ jobs:
# to ignore all build folder contents
ignore: build
database: build
verbosity: 9
verbosity: debug
version: ${{ matrix.clang-version }}
thread-comments: ${{ matrix.clang-version == '12' }}
file-annotations: ${{ matrix.clang-version == '12' }}
thread-comments: ${{ matrix.clang-version == '17' && 'update' }}
file-annotations: ${{ matrix.clang-version == '17' }}
tidy-review: ${{ matrix.clang-version == '17' }}
format-review: ${{ matrix.clang-version == '17' }}
extra-args: -std=c++14 -Wall

- name: Fail fast?!
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/cpp-lint-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ on:
description: 'which branch to test'
default: 'main'
required: true
pull_request:

jobs:
cpp-linter:
runs-on: windows-latest
permissions:
issues: write
pull-requests: write
contents: write

strategy:
matrix:
Expand All @@ -30,7 +35,11 @@ jobs:
python-version: 3.x

- name: Install workflow deps
run: python -m pip install clang-tools git+https://github.com/${{ matrix.repo }}/@${{ matrix.branch }}
# run: python -m pip install clang-tools git+https://github.com/${{ matrix.repo }}/@${{ matrix.branch }}
run: |
python -m pip install clang-tools
python -m pip install -i https://test.pypi.org/simple/ cpp-linter==2.0.0rc12
# python -m pip install git+https://github.com/cpp-linter/cpp_linter_rs.git@main#subdirectory=py-binding

- name: Install clang-tools
run: clang-tools --install ${{ matrix.clang-version }} --directory ${{ runner.temp }}/llvm
Expand All @@ -55,17 +64,20 @@ jobs:
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CPP_LINTER_COLOR: true
run: >
cpp-linter
-s=file
-v=debug
-i=build
-p=build
-V=${{ runner.temp }}/llvm
-f=false
-l=false
--extra-arg="-std=c++14 -Wall"
--thread-comments=${{ matrix.clang-version == '17' && 'update' }}
-a=${{ matrix.clang-version == '17' }}
--tidy-review=${{ matrix.clang-version == '17' }}
--format-review=${{ matrix.clang-version == '17' }}

- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
Expand Down
21 changes: 11 additions & 10 deletions src/demo.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/** This is a very ugly test code (doomed to fail linting) */
#include "demo.hpp"
#include <cstdio>
#include <cstddef>
#include <stdio.h>
Comment on lines 2 to +3

Choose a reason for hiding this comment

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

clang-tidy diagnostic(s)

Suggested change
#include "demo.hpp"
#include <cstdio>
#include <cstddef>
#include <stdio.h>
#include <cstdio>

Comment on lines 2 to +3

Choose a reason for hiding this comment

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

clang-tidy diagnostic(s)

Suggested change
#include "demo.hpp"
#include <cstdio>
#include <cstddef>
#include <stdio.h>
#include <cstdio>


Choose a reason for hiding this comment

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

clang-tidy suggestion

Suggested change
auto main() -> int
{

Choose a reason for hiding this comment

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

clang-tidy suggestion

Suggested change
auto main() -> int
{

// using size_t from cstddef
size_t dummyFunc(size_t i) { return i; }

Choose a reason for hiding this comment

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

clang-format suggestions

Suggested change
int main()
{

Choose a reason for hiding this comment

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

clang-format suggestions

Suggested change
int main()
{

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


int main(){

for (;;) break;

Comment on lines +6 to +11

Choose a reason for hiding this comment

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

clang-format suggestions

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

clang-tidy diagnostic(s)

Suggested change
int main(){
for (;;) break;
for (;;) {
break;
}

Comment on lines +6 to +11

Choose a reason for hiding this comment

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

clang-format suggestions

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

clang-tidy diagnostic(s)

Suggested change
int main(){
for (;;) break;
for (;;) {
break;
}


printf("Hello world!\n");

Choose a reason for hiding this comment

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

clang-tidy diagnostic

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

do not call c-style vararg functions

   13 |     printf("Hello world!\n");
      |     ^

Choose a reason for hiding this comment

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

clang-tidy diagnostic

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

do not call c-style vararg functions

   13 |     printf("Hello world!\n");
      |     ^


return 0;
}



return 0;}
Comment on lines +15 to +18

Choose a reason for hiding this comment

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

clang-format suggestions

Suggested change
return 0;}
return 0;
}

Comment on lines +15 to +18

Choose a reason for hiding this comment

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

clang-format suggestions

Suggested change
return 0;}
return 0;
}

Choose a reason for hiding this comment

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

clang-tidy suggestion

Suggested change
return 0;}
return 0;
}

Choose a reason for hiding this comment

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

clang-tidy suggestion

Suggested change
return 0;}
return 0;
}

11 changes: 3 additions & 8 deletions src/demo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
class Dummy {
char* useless;
int numb;
Dummy() :numb(0), useless("\0"){}
Comment on lines 6 to +8

Choose a reason for hiding this comment

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

clang-tidy suggestion

Suggested change
char* useless;
int numb;
Dummy() :numb(0), useless("\0"){}
char* useless { "\0" };
int numb { 0 };
Dummy() { }

Comment on lines 6 to +8

Choose a reason for hiding this comment

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

clang-tidy suggestion

Suggested change
char* useless;
int numb;
Dummy() :numb(0), useless("\0"){}
char* useless { "\0" };
int numb { 0 };
Dummy() { }


public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}
Comment on lines +8 to +11

Choose a reason for hiding this comment

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

clang-format suggestions

Suggested change
Dummy() :numb(0), useless("\0"){}
public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}
Dummy()
: numb(0)
, useless("\0")
{
}
public:
void* not_useful(char* str) { useless = str; }

Comment on lines 10 to +11

Choose a reason for hiding this comment

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

clang-tidy diagnostic(s)

Suggested change
public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}
public:
auto not_useful(char* str) -> void* { useless = str; }

Comment on lines +8 to +11

Choose a reason for hiding this comment

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

clang-format suggestions

Suggested change
Dummy() :numb(0), useless("\0"){}
public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}
Dummy()
: numb(0)
, useless("\0")
{
}
public:
void* not_useful(char* str) { useless = str; }

Comment on lines 10 to +11

Choose a reason for hiding this comment

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

clang-tidy diagnostic(s)

Suggested change
public:
void *not_usefull(char *str){
useless = str;
return 0;
}
void *not_useful(char *str){useless = str;}
public:
auto not_useful(char* str) -> void* { useless = str; }

};


Expand All @@ -28,14 +26,11 @@ class Dummy {









struct LongDiff
{

long diff;

Choose a reason for hiding this comment

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

clang-format suggestions

Please remove the line(s)

  • 35

Choose a reason for hiding this comment

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

clang-format suggestions

Please remove the line(s)

  • 35

};