Commit Graph

222 Commits

Author SHA1 Message Date
Kyle Chisholm 4e25da7b9d Misra.py fix multiple file processing (#1332)
* MISRA addon: Support multiple files with argparse

* MISRA addon fix exit code 

Fix to run all dump files then exit with error code if any error in any file found.
2018-08-09 08:51:00 +02:00
Oliver Stöneberg bb27bc280a more small *.py cleanups (#1329)
* added CLion project folder to .gitignore

* adjusted project name in CMakeLists.txt

* avoid warning when compiling "Debug" with Visual Studio via CMake

There was a GCC-style compiler flag in the common flags in compileroptions.cmake which caused the following warning:
cl : Command line warning D9002 : ignoring unknown option '-O0'

* compileroptions.cmake: restored original formatting

* daca2.py: added missing import

* misra.py: removed unnecessary escaping from regular expression
2018-08-06 22:07:58 +02:00
Oliver Stöneberg 13cf982b77 some small *.py script cleanup (#1328)
* added CLion project folder to .gitignore

* adjusted project name in CMakeLists.txt

* avoid warning when compiling "Debug" with Visual Studio via CMake

There was a GCC-style compiler flag in the common flags in compileroptions.cmake which caused the following warning:
cl : Command line warning D9002 : ignoring unknown option '-O0'

* compileroptions.cmake: restored original formatting

* some small *.py script cleanups
2018-08-05 20:36:21 +02:00
Kyle Chisholm aa831ce972 MISRA addon: Support multiple files with argparse (#1327) 2018-08-04 21:37:08 +02:00
Konrad Grochowski 3702c477c0 misra.py - rule 8.12 fixed for enums depending on other enums values (#1287) 2018-06-13 06:54:30 +02:00
Konrad Grochowski 8925a0fd81 misra.py - Rule 11.8 fixed in function arguments checks (#1288) 2018-06-13 06:51:24 +02:00
Konrad Grochowski 8290d84472 MISRA 10.4 - fixed ?: operator (#1281)
x ? a : b - only a and b has to be checked
2018-06-09 08:23:41 +02:00
Konrad Grochowski 06f19fb3a7 misra.py: template used for error reporting will now be configurable (#1279)
WARNING: breaking change - now default misra.py report style will be the
same as cppcheck itself, but previosly misra.py default template was a
little different
2018-06-06 14:53:09 +02:00
orbitcowboy 79f70cbb32 misra.py: restored previous output style. The output style was broken by 0c6d60d202. 2018-06-05 14:16:25 +02:00
Konrad Grochowski 0c6d60d202 MISRA - support for per file/line error suppression (#1275)
* cppcheckdata.py: fixed Suppression.isMatch method

* cppcheckdata.py: fixed parsing <suppressions> tag

* misra.py: now uses cppcheckdata.reportError and supports suppressions
2018-06-04 21:50:21 +02:00
Swasti Shrivastava bdb372f929 Modified rule 14.1 (#1267)
* Modified rule 14.1

* Made suggested changes

* Added findCounterTokens

* Removed hasFloatComparison

* Improved isFloatCounterInWhileLoop

* Made all required minor changes
2018-06-04 10:12:51 +02:00
Konrad Grochowski e1014253ef MISRA Rule 11.6 will no longer report violation on '(void)p;' (#1272) 2018-05-30 12:44:20 +02:00
Konrad Grochowski d46baad462 misra.py: support for and C99 keywords in isBoolExpression (#1268) 2018-05-29 06:50:32 +02:00
Swasti Shrivastava a3b9745557 Modified Rule 10.8 (#1265)
* Modified Rule 10.8

* Made suggested changes to handle unary operators
2018-05-28 12:58:19 +02:00
Swasti Shrivastava 742d6513a1 Modified rule 10.6 (#1263)
* Modified rule 10.6

* Improved rule 10.6
2018-05-24 22:28:36 +02:00
Kyle Chisholm 6ce3571bdd Add --suppress-rules argument for misra.py (#1259)
* Added ignore list

- Added ignore list
- Use argparse to parse arguments
- Source formatting

* misra.py changed argument name

- Changed ` --ignore-rules` to ` --suppress-rules`

* Resolved VERIFY option in misra.py

Resolved broken broken logic in commit to add argparse.

* edit suppression list

Modified names
Hide some arguments

* command line help formatting

* Revert removal of --no-summary argument

* missing text rules no longer reported

* VERIFY scope modified to global
2018-05-24 06:31:20 +02:00
Daniel Marjamäki 9f47d04af6 misra.py: add rule 10.1, partial checking 2018-05-23 16:26:00 +02:00
Swasti Shrivastava ea5417b8af Modified rule 11.9 (#1262) 2018-05-23 15:48:07 +02:00
Swasti Shrivastava 8daa8520ba Modified rule 11.6 (#1261) 2018-05-23 12:50:35 +02:00
Swasti Shrivastava 684c18f657 Modified rule 11.3 and 11.7 (#1260)
* Modified rule 11.3 and 11.7

* Changed if to elif
2018-05-23 10:14:17 +02:00
Swasti Shrivastava c73dc63537 Modified rule 11.5 (#1256) 2018-05-22 14:32:00 +02:00
Daniel Marjamäki 5505cbac26 misra.py: fixed fix for fp so that struct initializers are handled also 2018-05-22 13:27:27 +02:00
Daniel Marjamäki dbe2a42e89 misra.py: Fixed 13.1 fp for struct initialization 2018-05-22 13:11:39 +02:00
Swasti Shrivastava c511b3de20 Modified rule 11.4 (#1252)
* Modified rule 11.4

* Made changes in isEnum()

* Made suggested changes in isEnum()
2018-05-22 09:07:48 +02:00
Richard A. Smith 01cbadc6ed Add --quiet flag to misra.py for cleaner output (#1254)
Output will still be given for style violations.

This allows the build process output to be smaller and cleaner,
making it easier to spot and address problems.
2018-05-21 21:46:58 +02:00
Swasti Shrivastava f78314b613 Updated rule 10 4 (#1251)
* Updated rule 10.4

* Updated rule 10.4

* updated rule 10.4 along with test suite
2018-05-21 12:04:20 +02:00
Richard A. Smith e4f10bce6d Show summary of violations (#1244)
- Show a summary of the of the number of violations.  This can be
  disabled with the --no-summary option.

- Return an error code if -verify flag not used and violation exists.
2018-05-20 14:48:01 +02:00
Swasti Shrivastava 00970274b2 Added rule 21.6 and 21.10 (#1243) 2018-05-20 14:44:12 +02:00
Richard A. Smith 672d0433a4 Allow per project misra.py addon (#1241)
Use python's __file__ variable to figure out where the checker script is
located.

This allows a customized per project scripts to be used instead of the
one provided in the cppcheck release.
2018-05-20 14:42:25 +02:00
Richard A. Smith a26d73f78f Fix false positive in misra.py rule 20.14 (#1240)
MISRA rule 20.14 is not limited to #if pragmas and also extends to
positives whenever #ifdef/#ifndef is used.
2018-05-20 08:31:59 +02:00
Swasti Shrivastava 248e2ef2f8 Modified rule 7.3 (#1232) 2018-05-16 12:04:02 +02:00
Swasti Shrivastava 92fd7d9343 Modified rule 5.1 along with test suite (#1231)
* Modified rule 5.1 along with test suite

* Modified variable name in misra-test.c

* Modified rule 5.1 along with test suite

* Changed variable name
2018-05-16 11:07:44 +02:00
Swasti Shrivastava bb7ffd123d Modified rule 8.12 (#1233) 2018-05-15 13:18:55 +02:00
Swasti Shrivastava 4b873ed573 Rule 5.3 modified along with test suite (#1227)
* Added rule 5.2

* updated 5.2

request-checks: true

* Added rule 5.3

* Changed rule 5.4, 5.5

* Updated test suite for Rule 5.2

* Changes in Rule 5.4 and 5.5

* Change in function name in test suite and removed type from class token in cppcheck

* Changed the name of function in misra-test.c

* Modified rule 5.3

* Modified misra-test.c for rule 5.3
2018-05-14 13:09:38 +02:00
swasti16 4956b89506 Changes in misra c rule 5.4 and 5.5 (#1219)
* Added rule 5.2

* updated 5.2

request-checks: true

* Added rule 5.3

* Changed rule 5.4, 5.5

* Updated test suite for Rule 5.2

* Changes in Rule 5.4 and 5.5

* Change in function name in test suite and removed type from class token in cppcheck

* Changed the name of function in misra-test.c
2018-05-11 14:57:08 +02:00
orbitcowboy c39e3467a4 misra.py: Rule 21.8, added missing exit() function. 2018-05-09 16:48:49 +02:00
orbitcowboy bcae3ce9d4 misra.py: State that Cppcheck already covers rule 22.4 with error-id: 'writeReadOnlyFile'. 2018-05-09 13:51:14 +02:00
swasti16 d934065d21 Added rule 5.2 (#1212)
* Added rule 5.2

* updated 5.2

request-checks: true

* Updated test suite for Rule 5.2
2018-05-08 20:41:45 +02:00
Markus Elfring 58ebc64b2f Using compiled regular expressions for MISRA check functions (#1208)
​The method “match” was used as a module-level function in ​for loops
of implementations for MISRA check functions so far.
Use ​compiled regular expression objects instead.
Link: https://trac.cppcheck.net/ticket/8547
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2018-05-07 22:19:39 +02:00
Daniel Marjamäki 904e9149bf misra: fix 16.3 false negative for conditional break 2018-05-04 22:27:45 +02:00
Daniel Marjamäki 53e3217254 misra: updated 20.14 2018-05-04 06:37:02 +02:00
Daniel Marjamäki 8b42706158 misra: Added check for rule 20.13 2018-05-03 22:53:06 +02:00
Daniel Marjamäki 274d56d0aa misra: Added 20.14 rule 2018-05-03 22:41:12 +02:00
Daniel Marjamäki 493e243c0b misra: fix fp in 16.6 2018-05-03 10:59:09 +02:00
Daniel Marjamäki 2a9ee563c2 misra: avoid fp for essentially boolean conditions when bitfield member is used 2018-05-02 20:56:03 +02:00
Daniel Marjamäki 5e31911fcd misra.py: fix false positives in 16.3 for unconditional blocks of code 2018-04-24 09:28:24 +02:00
Daniel Marjamäki fb89c987b0 misra.py: Improved 'isBoolExpression' 2018-04-18 16:20:54 +02:00
Daniel Marjamäki f94a2b0019 misra.py: cppcheck handle rule 20.6 2018-04-17 08:15:36 +02:00
Sebastian d46e4c1df6
misra.py: Typo in number of rules (comment) (#1150)
I have no copy of the misra pdf but according to
https://sourceforge.net/p/cppcheck/discussion/general/thread/ccbe9e89/#a6ab
and the number of lines/rules printed by misra.py -generate-table i
guess 143 is really the correct number of rules.
2018-04-10 08:55:25 +02:00
Daniel Marjamäki d31ba0ca02 misra.py: updated 11.8 2018-04-03 15:11:25 +02:00
Daniel Marjamäki 4a36520af2 misra.py: reformatting -generate-table output 2018-04-02 13:04:44 +02:00
Daniel Marjamäki 15218b388f misra.py: Add -generate-table option that shows what rules are implemented 2018-03-31 12:52:00 +02:00
Daniel Marjamäki ed8fda571b misra.py: Add rule 4.1 2018-03-31 12:17:55 +02:00
Daniel Marjamäki 588ec80122 misra: the user must provide the rule texts in text file. 2018-03-24 13:28:40 +01:00
amai ed25e21929 Set executable bit for addons/ python scripts 2018-03-20 20:54:59 +01:00
Daniel Marjamäki 480d84d69c Fixed #8441 (MISRA Addon: FP 12.3 issued for initializer lists) 2018-03-18 22:05:31 +01:00
amai2012 449dcc15e8 Add links to external references 2018-03-16 08:12:39 +01:00
Daniel Marjamäki 1110cd0c57 misra.py: updated parsing of misra-rules.txt 2018-03-14 23:00:17 +01:00
Daniel Marjamäki c74b0934e9 misra.py: assume that '0' and '1' have essentially boolean types 2018-03-14 14:54:05 +01:00
Daniel Marjamäki 08ee5709ed misra.py: updated 17.1 to catch non-compliant code in example suite 2018-03-14 09:41:23 +01:00
Daniel Marjamäki 348232a599 misra.py: catch all 15.6 bugs in misra exemplar suite 2018-03-13 14:22:25 +01:00
Daniel Marjamäki 49c8e42b30 misra.py: Clarify code for switch case fallthrough 2018-03-13 13:14:26 +01:00
Daniel Marjamäki caf0789ab3 misra.py: updated -verify behaviour, print all errors seen and not just the first 2018-03-12 15:51:41 +01:00
Daniel Marjamäki a705391054 misra.py: minor update 2018-03-12 15:47:06 +01:00
Daniel Marjamäki 77318d0e14 misra.py: updated 16.3 code 2018-03-12 15:16:57 +01:00
Daniel Marjamäki f10d170ad3 misra addon: handle [[fallthrough]] attribute 2018-03-12 13:43:23 +01:00
Jonathan Clohessy 589cc6049d Modified misra.py to fix issue introduced during last change (#1101)
Added additional elif confition to cause error checks to ignore .dump files
Previous change meant that .dump always falls into else statement and script exits
2018-02-26 22:08:22 +01:00
Daniel Marjamäki 7f616a1805 misra.py: Add error handling when there are missing files, wrong arguments, etc 2018-02-17 07:39:37 +01:00
Daniel Marjamäki 55b3004000 misra.py: minor tweaks 2018-01-21 10:39:18 +01:00
Daniel Marjamäki 6f2d4361df Misra: Integration of MISRA in the GUI. The misra addon can now extract the rule texts from the PDF. 2018-01-20 14:13:09 +01:00
KMilhan 76c3cef4d6 MISRA 15.7 only checks if...else if constructs (#983) 2017-10-26 08:47:53 +02:00
Daniel Marjamäki 243960eb8a Revert "Remove MISRA addon before the release of 1.81"
This reverts commit 9baefd8687.
2017-10-09 15:25:55 +02:00
Daniel Marjamäki 9baefd8687 Remove MISRA addon before the release of 1.81 2017-10-07 13:38:21 +02:00
KMilhan 8b509a158f Make MISRA C 2012 12.2 work on C++ (#946) 2017-08-31 16:06:46 +02:00
Daniel Marjamäki 051fb55e2c misra.py: Reformatting output 2017-08-15 20:34:44 +02:00
Daniel Marjamäki bb5b18cf7e Revert "Remove MISRA addon before the release of 1.80"
This reverts commit 2ecf47c328.
2017-07-29 16:28:57 +02:00
Daniel Marjamäki 2ecf47c328 Remove MISRA addon before the release of 1.80 2017-07-29 10:04:54 +02:00
Ayaz Salikhov 2e6a22e882 Improve Python code 2017-07-22 11:05:50 +02:00
Ayaz Salikhov 3dc4188292 Improve Python code 2017-06-05 13:23:00 +02:00
Ayaz Salikhov 2dd6168258 Improve Python code 2017-06-04 22:51:48 +02:00
Daniel Marjamäki 39d55a6f6e Revert "Temporarily remove MISRA addon"
This reverts commit b85150d45a.
2017-05-13 15:03:29 +02:00
Daniel Marjamäki b85150d45a Temporarily remove MISRA addon 2017-05-13 10:55:10 +02:00
Daniel Marjamäki 82a68858ef Misra: Add rule 3.1 2017-04-18 20:47:11 +02:00
Daniel Marjamäki ea67086da4 Misra: Fix crash in rule 10.6 for bad AST 2017-04-18 19:57:49 +02:00
Daniel Marjamäki f707eceb20 Misra: Fix endless loop in rule 5.3 2017-04-18 19:54:43 +02:00
Daniel Marjamäki ce9f121ce6 Misra: Fix rule 5.3 2017-04-17 13:32:48 +02:00
Daniel Marjamäki 9305394abd Misra: Add rule 5.3 2017-04-17 13:17:37 +02:00
Daniel Marjamäki dd2eb9ad1a Misra: tweak rule 5.4 2017-04-17 12:57:21 +02:00
Daniel Marjamäki 11621b2b36 Misra: Add rule 5.4 2017-04-17 12:55:19 +02:00
Daniel Marjamäki c56926f4bd Misra: Add rule 5.5 2017-04-17 12:48:28 +02:00
Daniel Marjamäki 892f11b7f1 Misra: Fix FP, rule 15.6 2017-04-17 10:39:05 +02:00
Daniel Marjamäki a47a5e55e4 Misra: Fix FP, rule 15.6 2017-04-17 09:38:46 +02:00
Daniel Marjamäki 0adc4f0789 Misra: Fix FP, rule 16.6 2017-04-17 09:07:45 +02:00
Daniel Marjamäki 196b530ede Misra: Fix FP, rule 10.8 2017-04-17 08:44:30 +02:00
Daniel Marjamäki d6570b01e1 misra.py: Fix loading of rule texts 2017-04-17 08:35:17 +02:00
Daniel Marjamäki 4f64e67298 Misra: Add rule 8.11 2017-04-17 07:45:27 +02:00
Daniel Marjamäki 6c8712c57b Misra: Added --rule-texts=<file> flag 2017-04-16 21:38:26 +02:00
Daniel Marjamäki ad8fef8a2f Misra: Add rule 8.12 2017-04-16 19:01:33 +02:00
Daniel Marjamäki b2a846dff0 Misra: Add rule 9.5 2017-04-16 17:19:30 +02:00
Daniel Marjamäki b5bd9468de Misra: Add rule 8.14 2017-04-16 17:04:40 +02:00