Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Test the possibility of using problem matchers for errors/warnings #195

Closed
wants to merge 6 commits into from

Conversation

lefticus
Copy link
Member

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2022

Codecov Report

Merging #195 (cb1b553) into main (a85fe3d) will decrease coverage by 12.35%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #195       +/-   ##
===========================================
- Coverage   80.00%   67.64%   -12.36%     
===========================================
  Files           3        3               
  Lines          35       34        -1     
  Branches       18        0       -18     
===========================================
- Hits           28       23        -5     
- Misses          6       11        +5     
+ Partials        1        0        -1     
Flag Coverage Δ
Linux ?
Windows 67.64% <0.00%> (-12.36%) ⬇️
macOS ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main.cpp 21.42% <0.00%> (-24.73%) ⬇️
test/tests.cpp 100.00% <0.00%> (ø)
test/constexpr_tests.cpp 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a85fe3d...cb1b553. Read the comment docs.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
Co-authored-by: Amin Yahyaabadi <[email protected]>
@aminya
Copy link
Contributor

aminya commented Feb 12, 2022

Does clang uses the same report style as gcc?
Related to aminya/setup-cpp#34

@lefticus
Copy link
Member Author

Does clang uses the same report style as gcc? Related to aminya/setup-cpp#34

It is very similar, but isn't matching.

I'm pretty confused, TBH

clang, which doesn't match:

https://github.com/cpp-best-practices/cpp_starter_project/runs/5164418830?check_suite_focus=true#step:6:20

/home/runner/work/cpp_starter_project/cpp_starter_project/src/main.cpp:47:13: warning: variable 'j' is uninitialized when used here [-Wuninitialized]
    int l = j + k;

clang-tidy, which does match:

https://github.com/cpp-best-practices/cpp_starter_project/runs/5164419289?check_suite_focus=true#step:6:23

/home/runner/work/cpp_starter_project/cpp_starter_project/src/main.cpp:43:10: error: 42 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-warnings-as-errors]

gcc, which does match:

https://github.com/cpp-best-practices/cpp_starter_project/runs/5164419322?check_suite_focus=true#step:6:16

/Users/runner/work/cpp_starter_project/cpp_starter_project/src/main.cpp:47:15: warning: 'j' may be used uninitialized [-Wmaybe-uninitialized]
   47 |     int l = j + k;
      |             ~~^~~

@lefticus
Copy link
Member Author

lefticus commented Feb 12, 2022

I just ran them through a regex tester and don't see what it's not matching

https://github.com/aminya/setup-cpp/pull/35/files#diff-1eb832d204888d4e54321209ab1d61281ea359429af65207b2420b4bdd9f8358R7

@aminya
Copy link
Contributor

aminya commented Feb 12, 2022

The gcc matcher is only enabled if the compiler is gcc. If the regex is the same as clang, I can add the same thing to clang and clang-tidy.

@aminya
Copy link
Contributor

aminya commented Feb 12, 2022

Here it is for llvm:
aminya/setup-cpp#36

@lefticus
Copy link
Member Author

The gcc matcher is only enabled if the compiler is gcc. If the regex is the same as clang, I can add the same thing to clang and clang-tidy.

clang-tidy is automatically getting picked up, since it's not being run as its own compiler here.

it's on my to-do list to have cppcheck output in the appropriate gcc/msvc so it shows up in IDEs as expected, which should also make it get picked up here.

@lefticus
Copy link
Member Author

aminya/project_options#66 to make sure cppcheck is picked up as expected.

@lefticus
Copy link
Member Author

Confirmed @aminya if we merge aminya/project_options#66 then we get all of the warnings now picked up and this PR becomes an interesting artifact

https://github.com/cpp-best-practices/cpp_starter_project/pull/195/files

@aminya
Copy link
Contributor

aminya commented Feb 12, 2022

Awesome! 🎉.

I wish I could add similar support for other CI services like GitLab. I don't know if other services have such similar capabilities.

@lefticus lefticus closed this Feb 15, 2022
@lefticus lefticus deleted the enable_problem_matchers branch February 19, 2022 13:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants