-
Notifications
You must be signed in to change notification settings - Fork 0
Revamp README and workflows for my own fork, start adding fbinfer and… #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
⚡ Static analysis result ⚡ 🔴 PyLint found 60 issues! Click here to see details.StaticAnalysis-MoreCPP/test/test_sa_utils.py Lines 20 to 25 in 2a990e6
!Line: 20 - C0202: Class method mock_env should have 'cls' as first argument (bad-classmethod-argument)StaticAnalysis-MoreCPP/test/test_sa_utils.py Lines 32 to 37 in 2a990e6
!Line: 32 - C0415: Import outside toplevel (src.sa_utils) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 21 to 26 in 2a990e6
!Line: 21 - C0202: Class method mock_env should have 'cls' as first argument (bad-classmethod-argument)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 33 to 38 in 2a990e6
!Line: 33 - C0415: Import outside toplevel (src.static_analysis_cpp) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 77 to 82 in 2a990e6
!Line: 77 - C0415: Import outside toplevel (src.static_analysis_cpp) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 78 to 83 in 2a990e6
!Line: 78 - C0415: Import outside toplevel (utils.helper_functions) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 92 to 97 in 2a990e6
!Line: 92 - C0415: Import outside toplevel (src.static_analysis_cpp) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 93 to 98 in 2a990e6
!Line: 93 - C0415: Import outside toplevel (utils.helper_functions) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 115 to 120 in 2a990e6
!Line: 115 - C0415: Import outside toplevel (src.static_analysis_cpp) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 116 to 121 in 2a990e6
!Line: 116 - C0415: Import outside toplevel (utils.helper_functions) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 138 to 143 in 2a990e6
!Line: 138 - C0415: Import outside toplevel (src.static_analysis_cpp) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 139 to 144 in 2a990e6
!Line: 139 - C0415: Import outside toplevel (utils.helper_functions) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 160 to 165 in 2a990e6
!Line: 160 - C0415: Import outside toplevel (src.static_analysis_cpp) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_static_analysis_cpp.py Lines 161 to 166 in 2a990e6
!Line: 161 - C0415: Import outside toplevel (utils.helper_functions) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_get_files_to_check.py Lines 69 to 74 in 2a990e6
!Line: 69 - C0301: Line too long (137/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_get_files_to_check.py Lines 78 to 83 in 2a990e6
!Line: 78 - C0301: Line too long (137/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_get_files_to_check.py Lines 79 to 84 in 2a990e6
!Line: 79 - C0301: Line too long (162/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_get_files_to_check.py Lines 14 to 19 in 2a990e6
!Line: 14 - C0411: third party import "utils.helper_functions" should be placed before first party import "src.get_files_to_check" (wrong-import-order)StaticAnalysis-MoreCPP/test/test_static_analysis_python.py Lines 181 to 186 in 2a990e6
!Line: 181 - C0301: Line too long (121/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_static_analysis_python.py Lines 189 to 194 in 2a990e6
!Line: 189 - C0301: Line too long (121/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_static_analysis_python.py Lines 193 to 198 in 2a990e6
!Line: 193 - C0301: Line too long (121/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_static_analysis_python.py Lines 201 to 206 in 2a990e6
!Line: 201 - C0301: Line too long (121/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_static_analysis_python.py Lines 22 to 27 in 2a990e6
!Line: 22 - C0202: Class method mock_env should have 'cls' as first argument (bad-classmethod-argument)StaticAnalysis-MoreCPP/test/test_static_analysis_python.py Lines 34 to 39 in 2a990e6
!Line: 34 - C0415: Import outside toplevel (src.static_analysis_python) (import-outside-toplevel)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 38 to 43 in 2a990e6
!Line: 38 - C0301: Line too long (121/120) (line-too-long)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 27 to 32 in 2a990e6
!Line: 27 - W0622: Redefining built-in 'dir' (redefined-builtin)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 49 to 53 in 2a990e6
!Line: 49 - R1732: Consider using 'with' for resource-allocating operations (consider-using-with)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 49 to 53 in 2a990e6
!Line: 49 - W1514: Using open without explicitly specifying an encoding (unspecified-encoding)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 5 to 10 in 2a990e6
!Line: 5 - C0411: standard import "os" should be placed before third party import "jsonpickle" (wrong-import-order)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 6 to 11 in 2a990e6
!Line: 6 - C0411: standard import "sys" should be placed before third party import "jsonpickle" (wrong-import-order)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 7 to 12 in 2a990e6
!Line: 7 - C0411: standard import "tempfile" should be placed before third party import "jsonpickle" (wrong-import-order)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 8 to 13 in 2a990e6
!Line: 8 - C0411: standard import "unittest" should be placed before third party import "jsonpickle" (wrong-import-order)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 18 to 23 in 2a990e6
!Line: 18 - C0411: standard import "pathlib.Path" should be placed before third party import "jsonpickle" (wrong-import-order)StaticAnalysis-MoreCPP/test/test_join_sarif.py Lines 20 to 25 in 2a990e6
!Line: 20 - C0411: third party import "utils.helper_functions" should be placed before first party import "src.join_sarif" (wrong-import-order)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 279 to 284 in 2a990e6
!Line: 279 - C0301: Line too long (131/120) (line-too-long)
!Line: 412 - C0301: Line too long (122/120) (line-too-long)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 128 to 133 in 2a990e6
!Line: 128 - W0105: String statement has no effect (pointless-string-statement)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 142 to 147 in 2a990e6
!Line: 142 - E1120: No value for argument 'per_issue_string' in function call (no-value-for-parameter)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 142 to 147 in 2a990e6
!Line: 142 - E1120: No value for argument 'new_line' in function call (no-value-for-parameter)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 142 to 147 in 2a990e6
!Line: 142 - E1120: No value for argument 'list_of_issues' in function call (no-value-for-parameter)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 175 to 180 in 2a990e6
!Line: 175 - R0914: Too many local variables (27/25) (too-many-locals)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 175 to 180 in 2a990e6
!Line: 175 - R0915: Too many statements (57/50) (too-many-statements)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 252 to 257 in 2a990e6
!Line: 252 - W0612: Unused variable 'issue_key' (unused-variable)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 308 to 313 in 2a990e6
!Line: 308 - R0913: Too many arguments (8/5) (too-many-arguments)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 308 to 313 in 2a990e6
!Line: 308 - R0917: Too many positional arguments (8/5) (too-many-positional-arguments)StaticAnalysis-MoreCPP/src/static_analysis_cpp.py Lines 325 to 330 in 2a990e6
!Line: 325 - C0103: Variable name "SEPARATOR" doesn't conform to snake_case naming style (invalid-name)StaticAnalysis-MoreCPP/src/get_files_to_check.py Lines 24 to 29 in 2a990e6
!Line: 24 - C2801: Unnecessarily calls dunder method __eq__. Use == operator. (unnecessary-dunder-call)StaticAnalysis-MoreCPP/src/get_files_to_check.py Lines 30 to 35 in 2a990e6
!Line: 30 - C0117: Consider changing "not dirin.find(f'{os.sep}{os.sep}') == -1" to "dirin.find(f'{os.sep}{os.sep}') != -1" (unnecessary-negation)StaticAnalysis-MoreCPP/src/get_files_to_check.py Lines 8 to 13 in 2a990e6
!Line: 8 - R0912: Too many branches (16/12) (too-many-branches)StaticAnalysis-MoreCPP/src/get_files_to_check.py Lines 77 to 82 in 2a990e6
!Line: 77 - C0103: Constant name "directory" doesn't conform to UPPER_CASE naming style (invalid-name)StaticAnalysis-MoreCPP/src/get_files_to_check.py Lines 78 to 83 in 2a990e6
!Line: 78 - C0117: Consider changing "not directory.find('//') == -1" to "directory.find('//') != -1" (unnecessary-negation)StaticAnalysis-MoreCPP/src/get_files_to_check.py Lines 79 to 84 in 2a990e6
!Line: 79 - C0103: Constant name "directory" doesn't conform to UPPER_CASE naming style (invalid-name)StaticAnalysis-MoreCPP/src/join_sarif.py Lines 10 to 15 in 2a990e6
!Line: 10 - W1514: Using open without explicitly specifying an encoding (unspecified-encoding)StaticAnalysis-MoreCPP/src/join_sarif.py Lines 16 to 21 in 2a990e6
!Line: 16 - C0121: Comparison 'joined == None' should be 'joined is None' (singleton-comparison)StaticAnalysis-MoreCPP/src/join_sarif.py Lines 26 to 31 in 2a990e6
!Line: 26 - W0621: Redefining name 'joined_sarif' from outer scope (line 46) (redefined-outer-name)StaticAnalysis-MoreCPP/src/join_sarif.py Lines 26 to 31 in 2a990e6
!Line: 26 - W0621: Redefining name 'output_file' from outer scope (line 48) (redefined-outer-name)StaticAnalysis-MoreCPP/src/join_sarif.py Lines 27 to 32 in 2a990e6
!Line: 27 - W1514: Using open without explicitly specifying an encoding (unspecified-encoding)StaticAnalysis-MoreCPP/test/utils/helper_functions.py Lines 63 to 65 in 2a990e6
!Line: 63 - C0301: Line too long (129/120) (line-too-long)StaticAnalysis-MoreCPP/test/utils/helper_functions.py Lines 14 to 19 in 2a990e6
!Line: 14 - C0103: Variable name "SEPARATOR" doesn't conform to snake_case naming style (invalid-name)StaticAnalysis-MoreCPP/test/utils/helper_functions.py Lines 55 to 60 in 2a990e6
!Line: 55 - W1514: Using open without explicitly specifying an encoding (unspecified-encoding) |
|
This is to fulfill TestCPP#85 and TestCPP#86. |
In the C++ workflow eg in the README.md, examples for fbinfer_args, flawfinder_args, and flawfinder_targets are now present that I added. Fixed defaults for cmake_args, flawfinder_targets, and fbinfer_args in the action.yml and README. Preprocess fbinfer_args, flawfinder_args, and flawfinder_targets in line with the way cppcheck and clang_tidy arg preprocessing is handled. Add -fi and -ff options to python3 -m src.static_analysis_cpp commands, note that I have not yet added these to the python code yet. -fi receives the file name for the infer report, and -ff receives the file name for the flawfinder report. Output the values of INFER_ARGS, FLAWFINDER_ARGS, and FLAWFINDER_TGTS for debugging where necessary. Added calls to infer for CMake and non-CMake sections. Add call to flawfinder, that does not depend at all on whether CMake is being used. Ordered the variables and operations so everything is consistent.
Also remove associated variable since it's no longer used to fix SC2034 Double quote arguments to prevent unwanted globbing/splitting to fix SC2086.
Start to move away from line output parsing so there's a common format
being used as much as possible for gathering static analysis issues
data/results.
I chose SARIF since CPPCheck, FlawFinder, and Infer all support this
format, and it is a format supported by a number of other static
analysis tools that could then be integrated without consideration of
any particular custom stdout format.
This opens up the possibility for other languages and tools that also
support this format to be easily integrated into this Action.
The first step was ensuring all tools that can support it are using
versions with SARIF support; this is complete, only cppcheck needed to
be upgraded in the docker image that supports the runner, and is now
set to version 2.17.1.
The second step in this was to install the Python 3 SARIF Object Model
library into the docker image that supports the runner; this is
complete.
The third step was to add the proper command line arguments to the
tools that get called in the entrypoint_cpp.sh; this is also complete.
The fourth step was to add execution of a new python script that joins
multiple SARIF files (one for each source file analyzed with cppcheck
and one for each target directory analyzed with flawfinder) to
entrypoint_cpp.sh; this is now complete also.
The fifth step is to actually write the new join_sarif Python 3 module,
which is almost complete but not yet ready.
The final step is to integrate SARIF into the Action code and tests;
this is not yet complete, but I am working on it and have already made
significant progress, and should be something I can finish in the next
2-3 weeks, time permitting.
Fixed spelling in the Action definition.
I finished integrating FlawFinder and Infer into entrypoint_cpp.sh
script, which included adding -ff and -fi arguments to the call to the
static_analysis_cpp Python 3 module.
Fixed/improved aspects of entrypoint_cpp.sh.
- debug_print for get_files_to_check.py that says it is going to run
the script now prints prior to it running so what is being printed
aligns with what is actually happening during the script run.
- Fixed an issue where all the header files in the project being
analyzed were getting passed to cppcheck, which does not support
direct analysis of header files.
- Fix exclude_arg not working with cppcheck by removing it; it is
unnecessary based on how I want cppcheck to be run.
Removed excess whitespace in test/test_utils.py.
Added trailing newline to test/utils/dummy_project/DummyFile.hpp.
I have updated the workflows and added the necessary repository secrets to hopefully allow them to work, and updated the names to be unique to the project. Added a new workflow for code coverage and test results upload to CodeCov for visualization and analysis. Fixed the TestRepo clone URL. Added a new file for running cppcheck locally. Fix a number of cross-platform issues with directory separators, so it is consistent across all of the codebase. Ensure proper regular expression escaping in paths. get_files_to_check now uses a regular-expression-based method for excluding files that is more consistent and works in more cross- platform situations than previous. Fix double-path-separators often showing up in selected paths. Fix line endings (all are now LF-only) Reduced the number of characters in a comment to account for the additional SA tools Use the GITHUB_WORKSPACE env in more places to fix a large number of pathing issues Begin adding SARIF integration; this is a WIP. Formatting, remove excess whitespace Add SARIF test data Add more tests for existing code, add tests for join_sarif Use monkeypatch to ensure the environment is correct for each test Add genhashes to test helper functions
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
… function as expected.
…ect, scan the test/utils/ dir otherwise.
Fixed all links. Added badges for shellcheck, Code Coverage, and CodeCov.
… flawfinder