AUTOSAR C++14
ans MISRA C++:2008
Guidelines viewer / diff viewer
- 1. Version and Stability
- 2. Motivation
- 3. Requirements
- 4. Installation
- 5. Preparing data
- 6. Usage
- 7. Limitation
Version | Stability | Changes |
---|---|---|
0.7.1 | Stability: 1 - Experimental | Added MISRA C++:2008 to the list of supported documents. |
0.7.0 | Stability: 1 - Experimental |
I needed to get diff between AUTOSAR C++14 Coding Rules 17-10 and 19-03.
And it was difficult to prevent mistakes when checking by eye balls, so I wrote this code.
Using aview, you can see them like this:
$ aview diff A18-1-3 -HTR
## A18-1-3
diff: - A17-10 / + A19-03
-------------------------
Compare : header, text, rationale
Ignore : classifier, note, exception, example, seealso
Section:
6 AUTOSAR C++14 coding rules
6.18 Language support library - partial
6.18.1 Types
Rule:
- The std::auto_ptr shall not be used.
+ The std::auto_ptr type shall not be used.
? +++++
Rationale:
- The std::auto_ptr smart pointer is deprecated since C++11 Language Standard and it is planned to be withdrawn in C++17 Language Standard.
- The std::auto_ptr provides unusual copy semantics and it can not be placed in STL containers. It is recommended to use std::unique_ptr instead.
+ The std::auto_ptr type has been deprecated since the C++11 Language Standard and is removed from the C++17 Language Standard. Due to the lack of move semantics in pre C++11 standards, it provides unusual copy semantics and cannot be placed in STL containers.
+ The correct alternative is std::unique_ptr, which shall be used instead.
-
pdftotext
If you don't have the command:
$ sudo apt-get install poppler-utils $ pdftotext -v pdftotext version 20.09.0 Copyright 2005-2020 The Poppler Developers - http://poppler.freedesktop.org Copyright 1996-2011 Glyph & Cog, LLC
pdftotext is a part of poppler-utils.
-
python3
- download or clone aview anywhere you want.
- add execution path to './bin'.
$ aview -v
-
/path/to/aview$ make pdf-install
Downloads
AUTOSAR_RS_CPP14Guidelines.pdf
from AUTOSAR official web site.- ver. 17-10 from Release package 17-10
- ver. 19-03 from Release package 21-11
-
Be sure to read and agree to the license terms.
- The PDFs are stored in
database/pdf/
.
- The PDFs are stored in
-
/path/to/aview$ make db
Converts pdf to text using
pdftotext
, and converts them to json files as caches.
-
In accordance with the restrictions of the license terms, aview does not store or cache any MISRA C++:2008 data.
MISRA data will be retrieved from the PDF file specified in the command line option each time aview is executed.
$ aview diff A18-1-3
$ aview diff A18-1-3 -HTR
- Using opts, specify which part of the rule data to compare.
more >aview diff -h
$ aview diff 0-1-7@2008 A0-1-2@1903 -m path/to/your/misra.pdf
-
@ opts are:
- 1710 = AUTOSAR C++:17-10
- 1903 = AUTOSAR C++:19-03
- 2008 = MISRA C++:2008
$ aview diff all -A
If all is specified as the ID:
- Compare A17-10 and A19-03.
- Only the differences will be displayed, not the parts with the same content.
It's easy to add your own subcommands. Just add the features you want.
-
Duplicate a subcommand
Duplicate
./aview/app/diff
folder with any name your choice.
and you see:$ aview -h usage: aview [-h] [-v] {diff,conv} ... optional arguments: -h, --help show this help message and exit -v, --version show version commands: {diff,conv} diff Display rules with the difference information. conv Converts AUTOSAR text file to json data file My_Command Display rules with the difference information. <<< new
-
Read
command.py
and rewrite.- The
setup()
function sets up the argparse object for command line options, - And the
run()
function is the body of the subcommand.
- The
Current known limitations are:
-
Aview yet does not correctly fix all the formatting collapses when converting pdf files to text data.
It can cause the same text in two versions to be perceived differently.
-
In 19-03, there are rules whose IDs have been changed from 17-10
When
aview diff all
, aview cannot consider them as same rules.