|
|
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » [PROPOSAL] CppCheck support
[PROPOSAL] CppCheck support [message #59544] |
Sun, 22 January 2023 18:00 |
Oblivion
Messages: 1135 Registered: August 2007
|
Senior Contributor |
|
|
Hi,
I've been using CppCheck for a long time, and found it very useful. It is a very popular free static analyzer tool with lots of features and it is easy to integrate.
While its own parser is very good, it also provides an experimental clang AST backend, so it is very flexible.
I am currently integrating it with theIDE, and the integration is very smooth. So I am proposing to add cppcheck support to TheIDE.
My Plan is to make it available to public before U++ 2023 1, in a usable/stable state.
What it requires.
0. CppCheck binary.
1. A single file in TheIDE's codebase (CppCheck.cpp)
2. Detection of CppCheck binary (HasCppCheck() function)
3. A settings pane, in theIDE's settings dialog (will be available only if the binary is detected).
4. Color entries in (Settings/Syntax Highligting pane) for CppCheck error severity types (style, warning, performance, portability, etc.)
5. It will have the ability to check
a) A single file
b) A package
c) Workspace (all packages)
This will require adding menu and toolbar entries when cppcheck binary is detected.
(Similar to existing "Compile $FILENAME" or "Build $PACKAGE" entries -> "Analyze $PACKAGE)
See the below screenshot for a working version (initial)
I will create a branch (theide_cppcheck) in my fork of upp and make the source code available so others can participate.
What do you think?
Best regards
Oblivion,
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
|
Re: [PROPOSAL] CppCheck support [message #59557 is a reply to message #59544] |
Sat, 04 February 2023 11:54 |
Oblivion
Messages: 1135 Registered: August 2007
|
Senior Contributor |
|
|
Hello,
The initial linter (cppcheck) support has landed in my fork of U++, under ide_linter branch.
The basic functionality is there. It is tested on Linux. Windows exe detection will be availble tomorrow, so as of today it only supports Linux.
DONE
+ Check file, package, project (all) commands.
+ TheIDe linter keyboard shortcuts for check file, package, and project commands.
+ TheIDE linter setup pane in Setup dialog.
+ Ability to select severity message types.
+ Core configuration settings (language, standard, platform, etc.)
TODO:
- Add Windows cppcheck executable detection.
- Add configurable cppcheck build dir path (to speed-up analysis)
- Add library file support.
- Add Package/File list menu entries.
- Add CLANG backend switch.
- Add the ability to pass additional command line options.
- Filter out non C/C++ files (*.tpp, *.log, etc).
To make it less intrusive, I have put it into its own package under ide (ide/Linter).
I'll add a more detailed overview tomorrow.
Reviews, patches, suggestions and testing is welcome.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
|
|
Re: [PROPOSAL] CppCheck support [message #59560 is a reply to message #59559] |
Sat, 04 February 2023 22:05 |
Oblivion
Messages: 1135 Registered: August 2007
|
Senior Contributor |
|
|
Hello Klugier,
Quote:Hello Oblivion,
I like the idea to addlinter support for TheIDE, however I am not sure we should go for cppcheck. When I used it in the past, the tool had some problems like false positives. Also, the decision to relay on this particular one in the main code base is very difficult. We have very good alternatives such as clang-tidy and the true thing is that we are now basing on clang ecosystem like never before. With the usage of libclang and recent clang-format integration.
What about creating plugin system for TheIDE to allowing creation of extensions? Thanks to that there will be possible to support multiple linters. I understand that it will require a lot of work, but in the long term it is the way to go.
Klugier
Thank you very much for your comments.
CppCheck has matured nicely. Yes, it occasionaly gives false positives, but so does clang-tidy. Not to mention cppcheck is famous for catching *interesting* issues where other solutions fail.
The main reason why I opt for cppcheck is:
It is extremely simple to integrate and remove.
a) The ide/Linter package is almost self-contained package in the sense that there are only several Lines of code (7 lines of code in cpp files, and one line of code in ide.h: only menu entries, and config stuff) in TheIde's codebase.
IMO that's not much of a maintenanca burden. Removing it completely from the codebase if required won't take more than 15 seconds.
b) It uses it's own config file (JSON), meaning it does not mess with TheIDE's config file.
c) Implementation does not have to rely on low level, raw stuff, so future changes won't really break it unless U++ somehow gets broken.
d) It is activated only if the cppcheck executable is found.
If you look closely to the linter package, you'll notice that the main class (Linter) is actually an abstraction.
This is a stripped down version of my own linters system (I use a commercial solution besides cppcheck).
Hence the name is Linter, not CppCheck. We can definitely (re)add clang-tidy later.
As for the plugin system:
Writing a plugin system has always been a good idea, given that I intend to participate more in TheIDE's development this year, I'll likely look into it.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Sat, 04 February 2023 22:22] Report message to a moderator
|
|
|
|
|
Re: [PROPOSAL] CppCheck support [message #59597 is a reply to message #59544] |
Sat, 11 February 2023 23:55 |
Oblivion
Messages: 1135 Registered: August 2007
|
Senior Contributor |
|
|
Hi,
TheIde/Linter (Cppcheck) has made some more progress.
+ CppCheck library files support is enabled.
+ CppCheck plugins support is enabled.
+ Additional command line options can now be passed manually, via setup dialog. (If needed)
+ U++ X11 (NOGTK) backend crash fixed on linux.
Note that, cppcheck library files (configurable checkers) are a powerful and nice way to allow cppcheck to recognize external libraries' (U++, GTK, QT, etc.) stuff (functions, etc.) Now it is enabled. ide/Linter will now check for .cfg files under a user-configurable path.
Similarly, 3rd party plugins for cppcheck can now be enabled.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
|
Re: [PROPOSAL] CppCheck support [message #59809 is a reply to message #59544] |
Thu, 20 April 2023 21:40 |
Oblivion
Messages: 1135 Registered: August 2007
|
Senior Contributor |
|
|
Hi,
Experimenal linter package for TheIDE is updated.
This is a big update since the package is now reimplemented as a generic framework for interfacing with command-line-driven static analysis tools.
Accordingly, CppCheck interface is reimplemented as a linter module.I've added the essential API docs.
It is now possible to add multiple linters easily. (Meaning that clang-tidy module is on its way.)
Also, cppcheck module can now display verbose messages and inconclusive results.
DONE & TODO List:
+ Linter package: Redesigned as a framework to utilize multiple command-line-driven static analysis tools.
+ Linter package: Added initial API docs for implmenting linter modules.
+ CppCheck module: Re-implemented as a linter module.
+ CppCheck module: Can now show verbose messages.
+ CppCheck module: Can now show inconclusive results.
+ CppCheck module: Filtering out non C/C++ files and directories (*.tpp, *.log, etc).
TODO:
- CppCheck module: Add configurable build dir path (to speed-up analysis).
- CppCheck module: Add CLANG backend switch to CppCheck module.
- CppCheck module: Allow per-project configuration file.
- Linter package: Add a mechanism to switch between linter modules on-the-fly.
- Linter package: Add a clang-tidy module.
You can download the code from this address.
Any questions, suggestions, bug reports, etc. are welcome.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Thu, 20 April 2023 21:42] Report message to a moderator
|
|
|
|
Re: [PROPOSAL] CppCheck support [message #59831 is a reply to message #59544] |
Sat, 29 April 2023 13:36 |
Oblivion
Messages: 1135 Registered: August 2007
|
Senior Contributor |
|
|
Hi,
A round of weekly updates to the experimental TheIDe/Linter framework:
+ Linter package: Linter package is now a compile-time option, using the LINTER flag.
+ Linter package: Footprint in TheIDE's source code is further narrowed down.
+ Linter package: A module registration mechanism is implemented.
+ Linter package: Added a mechanism to switch between available linter modules on-the-fly.
Now the registered modules that have a valid/installed backend will appear in the menu and can be selected by the user.
Since now the module registration and selection is implemented, it is time to send a pull request for review and start implementing clang-tidy module.
Any questions, reviews, testing, help is welcome.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Sat, 29 April 2023 13:38] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Nov 03 00:21:54 CET 2024
Total time taken to generate the page: 0.01129 seconds
|
|
|