631 Commits

Author SHA1 Message Date
Daniel Marjamäki
029056b0b4 misra.py: Add safety check 2023-04-17 17:21:02 +02:00
Swasti Shrivastava
e575a84c8a
Update misra.py to not run a few rules for cppcheck premium (#4970) 2023-04-15 18:35:34 +02:00
apuly
30ff1aad9a
misra: fix misra-3_1 false positive for URIs in block comments (#4939)
* misra: fix misra-3_1 false positive for URIs in block comments

* added unit test, improved new misra 3.1 based on false positives

---------

Co-authored-by: Paul B <unconfigured@null.spigotmc.org>
2023-04-11 16:13:10 +02:00
tx_haggis
c0d9a76dd9
MISRA: Speed up analysis of .ctu_info files (#4666)
* Speed up analyses of .ctu_info files
Use temporary dictionaries to eliminate duplicate typedefs,
tags and macros

* Consistency: use a cache key variable
Ensures that the get and add use the same key.

* CTU perf: use dict for macros, tags & types.
2023-04-11 14:20:58 +02:00
Daniel Marjamäki
7cded1967d misra.py: Fix mistake I saw when looking at the code 2023-04-09 18:55:47 +02:00
Daniel Marjamäki
5830047fcb misra: fix misra-10.7 false positive for constant expression 2023-01-02 18:52:33 +01:00
Oliver Stöneberg
0c95971c54
added .gitattributes and normalized files (#4668) 2022-12-30 21:33:45 +01:00
dzid26
3887d6dde1
Missing rule-text-file to not stop the analysis (#4458) 2022-09-12 12:55:07 +02:00
Daniel Marjamäki
514278e02b Fixed #11181 (cppcheckdata.py: handle exception when ctu-info file is missing) 2022-08-25 11:10:39 +02:00
Daniel Marjamäki
0d9bf03b5c misra.py: do not execute premiumaddon to perform misra checks 2022-08-25 08:07:22 +02:00
g-chauvel
be658e2392
misra_14_2 various fixes (#4324) 2022-08-21 20:11:10 +02:00
Paul Fultz II
72c764b034
Expose exprId to addon (#4354) 2022-08-16 22:00:31 +02:00
Paul Fultz II
a8c1cdca57
Add ** to match until in addons (#4353) 2022-08-16 19:05:37 +02:00
Paul Fultz II
754250cd57
Add methods to token class in addons (#4320) 2022-07-30 11:09:22 +02:00
Daniel Marjamäki
13c80d6cce Fixed #11180 (False positive: misra-c2012-8.1 for code 'unsigned x;') 2022-07-28 20:34:56 +02:00
Oliver Stöneberg
bc58f55c6e
donate-cpu: greatly improved LibraryIncludes.get_libraries() performance / some optimizations and cleanups (#4273)
* donate_cpu_lib.py: use `os.path.join()`

* donate-cpu: removed remaining usage of `os.chdir()`

* donate_cpu_lib.py: moved library includes code into class

* donate_cpu_lib.py: pre-compile library include regular expressions

* donate_cpu_lib.py: pre-compile some more regular expressions

* donate_cpu_lib.py: small unpack_package() cleanup and optimization

* donate_cpu_lib.py: added some information about the extracted files to unpack_package()

* donate_cpu_lib.py: bumped version

* added test_donate_cpu_lib.py

* donate_cpu_lib.py: greatly improved `LibraryIncludes.get_libraries()` performance

only scan each file once for previously undetected libraries only

* test_donate_cpu_lib.py: fix for Python 3.5

* scriptcheck.yml: added `-v` to pytest calls so we get the complete diff on assertions

* fixed `test_arguments_regression()` Python tests with additional pytest arguments

* donate_cpu_lib.py: use `subprocess.check_call()`

* test_donate_cpu_lib.py: sort results to address differences in order with Python 3.5
2022-07-13 21:09:29 +02:00
Paul Fultz II
7b549b622f
Add match function to addons (#4268) 2022-07-12 22:00:15 +02:00
Daniel Marjamäki
e0bc871bae misra.py: strip error message so it does not end with \r 2022-07-08 16:11:15 +02:00
Daniel Marjamäki
e64e5811ab misra.py: better handling of --get-rule-text 2022-07-08 14:06:27 +02:00
Daniel Marjamäki
ef33ff628f cppcheckdata.py: fix cmd_output() function, handle errors better 2022-06-16 14:07:14 +02:00
Daniel Marjamäki
9e31d6d05d Revert "cppcheckdata.py: better handling when subprocess call fails"
This reverts commit 1cc3b46d32292c7dcd6b4b8aeb66b7a766af6d36.
2022-06-15 19:38:40 +02:00
Daniel Marjamäki
1cc3b46d32 cppcheckdata.py: better handling when subprocess call fails 2022-06-15 17:13:14 +02:00
Daniel Marjamäki
359f6b3680 misra: enable more checks for misra c++ 2008 checking 2022-06-07 20:55:55 +02:00
Daniel Marjamäki
ec13f5fe5c misra: When checking C++ code only activate certain misra c++ compliant rules. It will be supported to run the addon on C++ code. 2022-06-06 22:22:52 +02:00
Alon Alexander
ea3bb8b297
Ignore copy/move constructors for function naming checks (#4134)
* Ignore copy/move constructors for function naming checks

* Also change in namingng

* Add test in naming_test.cpp
2022-06-01 06:54:31 +02:00
Daniel Marjamäki
8dbc1b802a misra: fix crash 2022-05-17 22:15:49 +02:00
Daniel Marjamäki
9b807ba047 misra: fix problems when executing premium addon 2022-05-05 14:15:09 +02:00
Daniel Marjamäki
b444c002e2 Fixed #11000 (misra: crash) 2022-05-03 22:03:35 +02:00
Daniel Marjamäki
d50823fd22 Fix misra crash when premium addon fails 2022-05-03 18:37:59 +02:00
Daniel Marjamäki
a5e0a9fe08 cppcheckdata: if 'import pathlib' fails then print a proper error message that explains how user can solve the problem. 2022-04-22 21:39:14 +02:00
Daniel Marjamäki
ea63b8e2bb misra: fix void parameter check 2022-04-01 21:34:47 +02:00
Paul Fultz II
5bea50cd36
Fix 10908: FP: uninitvar after for-loop (#3942) 2022-03-31 21:24:20 +02:00
Paul Fultz II
32ded1602b
Fix warnings in switch statements on clang (#3943) 2022-03-30 19:30:02 +02:00
Daniel Marjamäki
92316b07c8 Remove CERT addon from open source Cppcheck. The plan is to provide complete CERT C checking in Cppcheck Premium during this year. 2022-03-23 20:30:43 +01:00
Daniel Marjamäki
f907bba4e5 cppcheckdata.py: code cleanup 2022-03-19 12:27:24 +01:00
Daniel Marjamäki
7728c53cb9 Addons: Variable.constness will never be None 2022-03-19 10:36:46 +01:00
Daniel Marjamäki
fb89a2c742 misra: improved execution of premium addon 2022-03-16 18:59:02 +01:00
Daniel Marjamäki
a6c1653ed2 Fixed #10853 (False positive: misra-c2012-16.3: macro parameter "default") 2022-03-13 19:58:27 +01:00
Daniel Marjamäki
ee0d93e5da Fixed #10861 (False positive: CERT-API01: only warn about char/wchar arrays.) 2022-03-13 16:42:07 +01:00
Daniel Marjamäki
df2c8f3a65 Fixed #10862 (Misplaced warning: misra-2.2: macros) 2022-03-13 13:15:38 +01:00
Daniel Marjamäki
7290ec0db6 cppcheckdata: remove debug output 2022-03-09 21:38:44 +01:00
José Martins
b1e92fc399
Misra false positive fixes for rules 8.7 and 5.9 (#3844)
* Fix misra 8.7 false positives on single function usage

When there is a single usage of a function, we should first check if the
file it is used in, is the same one it was defined in. When this is not the
case, there is no violatior to be reported.

* Fix misra rule 5.9 false positives for exception

The exception for rule 5.9 described in the guidelines allows for
multiple definitions of internal linkage obejcts when these regard a
static inlined function defined in the same header file.

* Fix neglecting of inline keyword flag upon simplifications

When the inline keyword is being "simplified" and the inline flag is
degated to the next token. However, this information might be lost if the next
token itself is simplified/deleted in a futher pass. Therefore, we must
propagated the flag to all the next named tokens, so we can make sure the
function name token itself is tagged with this property.

* add tests for misra addon rules 8.7 and 5.9
2022-02-27 19:17:48 +01:00
Daniel Marjamäki
03deb4d31e addons: interface with premiumaddon if it exists 2022-02-24 16:08:59 +01:00
Daniel Marjamäki
3dd200930a Revert "misra,cert: use premiumaddon if it exists"
This reverts commit ef28c579bfef5c9591bd1b89ef9c4189176dbc76.
2022-02-23 22:38:41 +01:00
Daniel Marjamäki
f68b219300 Revert "cppcheckdata: a bit better handling for windows"
This reverts commit ef6bbcb6ad09e9e9eeaefce5b9aaf9662361fb46.
2022-02-23 22:38:26 +01:00
Daniel Marjamäki
ef6bbcb6ad cppcheckdata: a bit better handling for windows 2022-02-23 20:40:00 +01:00
Daniel Marjamäki
ef28c579bf misra,cert: use premiumaddon if it exists 2022-02-23 20:26:31 +01:00
Daniel Marjamäki
bb8b9a8001 misra: optional interactions with premium addon 2022-02-17 11:18:54 +01:00
Daniel Marjamäki
68b00b3cfc misra: fix 7.2 checking 2022-02-12 12:44:44 +01:00
Daniel Marjamäki
515649217f fix 2022-02-12 07:47:26 +01:00