quick-lint-js
quick-lint-js copied to clipboard
#475 Added export flag for CMake and cleaned up its output
Note: The exported CMake file seems to ignore clang CWE-119 for some reason
This should print out the output of the clang-tidy's clang-analysis-* from both: stdout and the file it exports
CLA Assistant Lite bot Thank you for your contribution! Like many free software projects, you must sign our Contributor License Agreement before we can accept your contribution.
EDIT: All contributors have signed quick-lint-js' Contributor License Agreement (CLA-v1.md).
I have read and hereby agree to quick-lint-js' Contributor License Agreement (CLA-v1.md).
Here is my attempt to make the workflow more relevant 218d590
Here is my attempt to make the workflow more relevant 218d590
Thanks for showing the example!
Here's an excerpt:
- DiagnosticName: clang-analyzer-deadcode.DeadStores
DiagnosticMessage:
Message: 'Value stored to ''input'' is never read'
FilePath: '/__w/quick-lint-js/quick-lint-js/src/lex.cpp'
FileOffset: 6102
Replacements: []
This is missing a line number. How am I (as a contributor) supposed to use this information? There are many variables called input
in that file.
Here is my attempt to make the workflow more relevant 218d590 sample action after making the changes
Thanks for showing the example!
Here's an excerpt:
- DiagnosticName: clang-analyzer-deadcode.DeadStores DiagnosticMessage: Message: 'Value stored to ''input'' is never read' FilePath: '/__w/quick-lint-js/quick-lint-js/src/lex.cpp' FileOffset: 6102 Replacements: []
This is missing a line number. How am I (as a contributor) supposed to use this information? There are many variables called
input
in that file.
Unfortunately, there are no options for showing line numbers instead of byte offset in theclang-tidy
output file.
For Vim users, :goto xxxx
can help in navigating to the byte offset.
Another option is using the output of "build with clang-tidy static analysis" step, shown in the example, which shows the line numbers by using 1>/dev/null
to remove the stdout and keep stderr. That way, clang-tidy output is displayed with the line number as opposed to the byte offset.
I can try exploring other options such as using cppcheck as opposed to clang-tidy if preferred.
Another option is using the output of "build with clang-tidy static analysis" step, shown in the example, which shows the line numbers by using
1>/dev/null
to remove the stdout and keep stderr. That way, clang-tidy output is displayed with the line number as opposed to the byte offset.
Would this show errors similar to Clang's normal compile errors? e.g. https://github.com/quick-lint/quick-lint-js/runs/4260383272?check_suite_focus=true
[snip]
[ 20%] Building CXX object src/CMakeFiles/quick-lint-js-lib.dir/buffering-error-reporter.cpp.o
[ 21%] Building CXX object src/CMakeFiles/quick-lint-js-lib.dir/byte-buffer.cpp.o
[ 21%] Building CXX object src/CMakeFiles/quick-lint-js-lib.dir/c-api-error-reporter.cpp.o
[ 22%] Building CXX object src/CMakeFiles/quick-lint-js-lib.dir/c-api.cpp.o
In file included from /__w/quick-lint-js/quick-lint-js/src/c-api.cpp:17:
In file included from /__w/quick-lint-js/quick-lint-js/src/./quick-lint-js/parse.h:10:
/__w/quick-lint-js/quick-lint-js/src/./quick-lint-js/buffering-visitor.h:171:51: error: unused parameter 'assignment_operator' [-Werror,-Wunused-parameter]
source_code_span assignment_operator) {
^
1 error generated.
make[2]: *** [src/CMakeFiles/quick-lint-js-lib.dir/c-api.cpp.o] Error 1
src/CMakeFiles/quick-lint-js-lib.dir/build.make:204: recipe for target 'src/CMakeFiles/quick-lint-js-lib.dir/c-api.cpp.o' failed
make[1]: *** [src/CMakeFiles/quick-lint-js-lib.dir/all] Error 2
make: *** [all] Error 2
CMakeFiles/Makefile2:1923: recipe for target 'src/CMakeFiles/quick-lint-js-lib.dir/all' failed
Makefile:145: recipe for target 'all' failed
Error: Process completed with exit code 2.
I can try exploring other options such as using cppcheck as opposed to clang-tidy if preferred.
We can use clang-tidy, as long as we have a way to present issues clearly.
If simple solutions don't work, could we use something like this? https://github.com/ZedThree/clang-tidy-review
@maljaroudi It looks like there are some issues with your latest commit. A snippet from https://github.com/quick-lint/quick-lint-js/runs/4330962788?check_suite_focus=true:
/github/workspace/benchmark/benchmark-lsp/main.cpp:4:10: error: 'boost/json/serialize.hpp' file not found [clang-diagnostic-error]
#include <boost/json/serialize.hpp>
^
/github/workspace/benchmark/benchmark-lsp/quick-lint-js/benchmark-config.h:7:10: error: 'cstdint' file not found [clang-diagnostic-error]
#include <cstdint>
^
/github/workspace/benchmark/benchmark-lsp/quick-lint-js/lsp-benchmarks.h:7:10: error: 'memory' file not found [clang-diagnostic-error]
#include <memory>
^
/github/workspace/benchmark/benchmark-lsp/quick-lint-js/lsp-logging.h:7:1: error: unknown type name 'namespace' [clang-diagnostic-error]
namespace quick_lint_js {
^