Giter Club home page Giter Club logo

qtc-cppcheck's Introduction

Qt Creator Cppcheck Integration

Introduction

Plugin integrates some Cppcheck functionality into Qt Creator IDE.

Features

  • Automatically check active project after build
  • Automatically check active project's files on save
  • Manually check any project's file
  • Display found error in task pan (with marks in editor)
  • Most settings are configurable
  • Translation support

Tips

  • Checking for unused functions prevents use of several threads and can decrease performance
  • Custom launch parameters are passing before plugin's so can take no effect

Downloads

Built plugin can be downloaded from github releases.

Installation

IMPORTANT: plugin's version must match Qt Creator's version (difference in last digit is acceptable)

From source

  1. Change paths.pri:

    • set QTCREATOR_SOURCES = path to Qt Creator source dir (with qtcreator.pro)
    • set IDE_BUILD_TREE = path to compiled Qt Creator dir (with bin,lib,libexec,...)
  2. Compile plugin.

From binaries

  1. Extract/copy files from archive into Qt Creator's dir (archive already contains proper paths).
  • find QtCreator install directory
  • copy lib/qtcreator/plugins/libQtcCppcheck.so to QC_DIR's lib/qtcreator/plugins
  • copy share/qtcreator/translations/QtcCppcheck_ru.qm to QC_DIR's share/qtcreator/translations/
  1. Enable plugin in Help->Modules menu.

More info

Additional information can be obtained here (in russian)

qtc-cppcheck's People

Contributors

0x6368656174 avatar francoisferrand avatar onemoregres avatar orgads avatar phenomretroshare avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtc-cppcheck's Issues

symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5

Hi. i download release 4.4 and follow your instructions. every thins is ok until open qt creator, it says:
"qtcreator: relocation error: /usr/lib/qtcreator/plugins/libQtcCppcheck.so: symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
OS: Arch linux, 64bit,
Qt Creator: 4.4.1,
Qt: 5.9.2

Qt5 + QtCreator 3.1.2 porting issue

Не успешная попытка адаптировать плагин под QtCreator 3.x.x и Qt5.

Что я менял:

paths.pri - согласно моим путям (и убрал обработку виндовых компиляторов, что бы не отвлекала внимание):

QTCREATOR_VERSION = 3.1.2

## set the QTC_SOURCE environment variable to override the setting here
QTCREATOR_SOURCES = $$(QTC_SOURCE)
isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=/home/anton/workspace/qt-creator-5/qt-creator/

## set the QTC_BUILD environment variable to override the setting here
IDE_BUILD_TREE = $$(QTC_BUILD)
isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=/home/anton/Qt/Tools/QtCreator

Также заменил инклуды согласно The Transition from Qt 4.x to Qt 5 в файлах:

OptionsWidget.h

- #include <QWidget>
+ #include <QtWidgets/QWidget>

OptionsWidget.cpp

- #include <QFileDialog>
+ #include <QtWidgets/QFileDialog>
- #include <QTextEdit>
+ #include <QtWidgets/QTextEdit>

Других изменений в исходники я не вносил.

В результате при компиляции выдает:

src/QtcCppcheckPlugin.cpp: In member function 'void QtcCppcheck::Internal::QtcCppcheckPlugin::initConnections()':
src/QtcCppcheckPlugin.cpp:145:12: error: 'documentModel' is not a member of 'Core::EditorManager'
src/QtcCppcheckPlugin.cpp:148:12: error: 'documentModel' is not a member of 'Core::EditorManager'
src/QtcCppcheckPlugin.cpp: In member function 'void QtcCppcheck::Internal::QtcCppcheckPlugin::checkActiveProjectDocuments(int, int, bool)':
src/QtcCppcheckPlugin.cpp:360:26: error: 'documentModel' is not a member of 'Core::EditorManager'
src/QtcCppcheckPlugin.cpp:365:42: error: 'class Core::DocumentModel' has no member named 'documentAtRow'

Подозреваю что QtCreator 3.x.x внутри чем-то отличается от более старых версий.

Document how to use plugin

This plugin looks great. However, when adding it to the appropriate path on Qt Creator, it seems to load properly (I see it in the list of available plugins) but I'm unsure what to do next. Could the readme be updated to indicate what next steps are?

Cannot integrate qtc-cppcheck

I have downloaded qtc last version and copy binary to QtCreator as manual guide, but when I open QtCreator it was not show qtcCppcheck in Analyzer as image.
untitled2
I am using Qt 5.4 and QtCreator 3.3.1
Please help me! Thanks

Custom parameters not added to cppcheck command line

When using qtccppcheck with default values (just setting the executable path), i've got many errors like this :

C:\blahblahpath\mysuperfile.h:11: erreur : Cppcheck(syntaxError): Code 'classMySuperFile:' is invalid C code. Use --std or --language to configure the language.
C:\blahblahpath\myothersuperfile.h:15: erreur : Cppcheck(syntaxError): Code 'template<...' is invalid C code. Use --std or --language to configure the language.

So, i've added custom parameters to the cppcheck plugin interface :
--std=c++11 --language=c++

But they are not taken in account when executing the cppcheck executable. Since i've checked the Show binary output i can now view the command line executed that is :

Starting CppChecker with:C:/Program Files/Cppcheck/cppcheck.exe, --enable=warning,style,performance,portability,information,missingInclude,unusedFunction --inconclusive --template={file},{line},{severity},{id},{message} --file-list=C:/Users/JohnDoe/AppData/Local/Temp/qtcreator.T10400 --includes-file=C:/Users/JohnDoe/AppData/Local/Temp/qtcreator.x10400

Currenly using Windows 7 x64 - QtCreator 4.3.0 - Qtccppcheck 4.3.0

QtCreator crashes when I change branch or stash changes from command line

This happens since I installed your plugin.

  1. git stash or git pull <branch>
  2. <file> has changed outside Qt Creator. Do you want to reload it?
  3. Select Yes to all

Possible two different errors:

 /usr/bin/qtcreator: line 2: 16501 Segmentation fault      (core dumped) QT_LOGGING_TO_CONSOLE=1 qtcreator-bin $@

or

0  libLLVM-3.5.so     0x00007f8b46bcbb82 llvm::sys::PrintStackTrace(_IO_FILE*) + 50
1  libLLVM-3.5.so     0x00007f8b46bcb5dc
2  libpthread.so.0    0x00007f8b5f3e7210
3  libTextEditor.so   0x00007f8b51f9f693 TextEditor::TextDocumentLayout::documentReloaded(QList<TextEditor::TextMark*>, TextEditor::TextDocument*) + 275
4  libTextEditor.so   0x00007f8b51f2cae7 TextEditor::TextDocument::reload(QString*) + 311
5  libCore.so         0x00007f8b5288885e Core::DocumentManager::checkForReload() + 4190
6  libQt5Core.so.5    0x00007f8b5f8b14ba QObject::event(QEvent*) + 250
7  libQt5Widgets.so.5 0x00007f8b5fc1bd8c QApplicationPrivate::notify_helper(QObject*, QEvent*) + 140
8  libQt5Widgets.so.5 0x00007f8b5fc21370 QApplication::notify(QObject*, QEvent*) + 1392
9  libQt5Core.so.5    0x00007f8b5f880a9b QCoreApplication::notifyInternal(QObject*, QEvent*) + 219
10 libQt5Core.so.5    0x00007f8b5f882adb QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 491
11 libQt5Core.so.5    0x00007f8b5f8d7c83
12 libglib-2.0.so.0   0x00007f8b5dd4ca0d g_main_context_dispatch + 589
13 libglib-2.0.so.0   0x00007f8b5dd4ccf8
14 libglib-2.0.so.0   0x00007f8b5dd4cdac g_main_context_iteration + 44
15 libQt5Core.so.5    0x00007f8b5f8d8077 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 87
16 libQt5Core.so.5    0x00007f8b5f87e532 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 274
17 libQt5Core.so.5    0x00007f8b5f885f0c QCoreApplication::exec() + 156
18 qtcreator-bin      0x000000000040a208
19 libc.so.6          0x00007f8b5eb2f040 __libc_start_main + 240
20 qtcreator-bin      0x000000000040a3eb
/usr/bin/qtcreator: line 2: 17133 Segmentation fault      (core dumped) QT_LOGGING_TO_CONSOLE=1 qtcreator-bin $@

Unable to reproduce without plugin, happens only when QtcCppCheck is enabled.

Qt Creator 3.3.0
Based on Qt 5.4.0 (GCC 4.9.2, 64 bit)
Built on Dec 10 2014 at 12:50:07

Ability to exclude files from check

I can't figure out how to exclude files or directories from the check (I have some source files I must not change, but create many cppcheck warnings).

cppcheck has a switch --config-exclude, but if I add --config-exclude=/absoulet/path/to/exclude_dir to "custom parameters" in the Settings it doesn't have an effect: warnings from source files in exclude_dir still show in QtCreator.

PS: Big thanks for this plugin :) It allows me to catch problems early.

Cannot install to QT 4.5.2..

I have Qtcreator 4.5.2.
I have copied the .so file in: /usr/lib/x86_64-linux-gnu/qtcreator/plugins

But when I launch the Qtcreator I get this error:

Screenshot from 2019-03-25 10-58-22

Could you please help me to fix this?

Analysis of project with v4.5.0 (Windows) is significantly slower than CppCheck GUI

I took the 4.5.0 release for Windows and integrated it with Qt Creator 4.5.0 (x86) and CppCheck v1.81 on Windows 10 (x64). The analysis is notably slower than with 4.3.0 and the same version of CppCheck, and with the CppCheck GUI. Both of those take around 10 minutes with my solution, but with v4.5.0 I gave up after 20 minutes at 10% done.

Support for Qt Creator 4.0.0>=beta1

Trying to use version 3.6.0 of the plugin with the newly released Qt Creator 4.0.0beta1, it appears in an error state and the "Error Details" button of the "Installed Plugins" shows:

Could not resolve dependency 'Core(3.6.0)'
Could not resolve dependency 'ProjectExplorer(3.6.0)'

Failed to build on Linux.

Hi,

I am trying build plugin for Qt Creator 3.0.1 on Linux, but can't.
qmake return WARNING: Failure to find: QtcCppcheck.pluginspec

How i understand you have template QtcCppcheck.json.in, but how get QtcCppcheck.pluginspec from this file?

Thanks.

Excluding files does not work

As the custom parameters now works properly, see issue #30 , I've tried now to exclude lib files from my project, all the external library files are located in the libs directory.

So i've tried the
--config-exclude=libs/
this does not work properly. After viewing the issue #17 i've tested the --suppress option without success.

If i use the --suppress on some files here is the command line executed :
Starting CppChecker with:C:/Program Files/Cppcheck/cppcheck.exe, --std=c++11 --language=c++ -j9 --suppress=*:quazip.cpp --suppress=*:quazip.h --suppress=*:qioapi.cpp --suppress=*:quazip_unzip.cpp --config-exclude=libs/ --enable=warning,style,performance,portability,information,missingInclude,unusedFunction --template={file},{line},{severity},{id},{message} --file-list=C:/Users/Myself/AppData/Local/Temp/qtcreator.V15064 --includes-file=C:/Users/Myself/AppData/Local/Temp/qtcreator.n15064

In the previous command line, my custom parameters are the following :
--std=c++11 --language=c++ -j9 --suppress=*:quazip.cpp --suppress=*:quazip.h --suppress=*:qioapi.cpp --suppress=*:quazip_unzip.cpp --config-exclude=libs/

It already checks for the unwanted files.

I've also tried to surround the --suppress parameter with quotation marks, and this leads to the following execution warning :
Failed to add suppression. Invalid id ""*"

Currenly using Windows 7 x64 - QtCreator 4.3.1 - Qtccppcheck 4.3.1

qtc-cppcheck doesn't build against QtCreator 3.4.0RC1 (partial patch included)

Several compile errors when building qtc-cppcheck against the source of QtCreator 3.4.0RC1.

I fixed the compile errors with the attached patch, but when running the plugin the following assert in function void CppcheckRunner::checkQueuedFiles() fails:

QString binary = settings_->binaryFile ();
Q_ASSERT (!binary.isEmpty ());

Не получается собрать - нет некоторых файлов.

Собственно.

../qtc-cppcheck-master/src/OptionsWidget.cpp:6:30: fatal error: ui_OptionsWidget.h: No such file or directory

Сразу замечу, что пытаюсь собрать под Qt5 под Linux, необходимые правки я у себя локально внес, но вот отсутствие файла - это проблема.

"Check current project" doesn't work in QtCreator 4.1.0 for Linux (x64)

Using QtCreator 4.10 in Linux (Ubuntu Gnome 16.04.1 and Ubuntu 16.04.1), the option Tools -> CppCheck -> Check current project doesn't work.

No action appears to be taken when the option is selected (or when the shortcut [Alt+C, Ctrl+A] is used).

I tested Windows version and it works fine.

Qtcreator-4.5.0 failing to load QtcCppcheck4.dll

Hi,

I have downloaded QtcCppcheck-4.5.0-win and unzipped the contents as instructed.
[from https://github.com/OneMoreGres/qtc-cppcheck/files/1649910/QtcCppcheck-4.5.0-win1.zip ]

Now, everytime I start Qtcreator-4.5.0 I get a pop-up from Plugin Loader Messages:
"The following plugins have errors and cannot be loaded:
QtcCppcheck

Details:
C:\Qt\qtcreator-4.5.0\lib\qtcreator\plugins\QtcCppcheck4.dll: Cannot load library
C:\Qt\qtcreator-4.5.0\lib\qtcreator\plugins\QtcCppcheck4.dll: Unknown error 0x000000c1."

About Qt creator..
Qt Creator 4.5.0
Based on Qt 5.10.0 (MSVC 2015, 64 bit)

Built on Dec 4 2017 04:12:33

Please let me know on how to fix this?

Thanks
Rakesh

Does not work with Qt Creator 3.2.1

I tried the plugin with the following version of Qt Creator and could not get it to do anything (tried different configuration options etc.) on a CMake based project:
Qt Creator 3.2.1 (opensource)
Based on Qt 5.3.2 (GCC 4.6.1, 64 bit)
Built on Sep 14 2014 at 04:13:53
From revision 602746950b

Qt Creator 4.1.0 Support

4.0 version does not work with Qt Creator 4.1.0. Qt Creator reports that there were errors, and the plugin will be disabled.

Qtcreator 4.3 error in Arch linux

When I update qtcreator in arch linux to v4.3, there is a bug:

qtcreator: relocation error: /usr/lib/qtcreator/plugins/libQtcCppcheck.so: symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference

I see this error in qtcGtest and qtcDbviewer too.

Decide how to continue with with Qt Creator >= 4.8

Qt Creator change https://codereview.qt-project.org/#/c/235703/ recently merged upstream adds cppcheck functionality to upstream Qt Creator via a new (experimental) cppcheck plugin. It might make sense to investigate this further and decide how to continue, e.g. either

  • continue with qtc-cppcheck as an alternative
  • try to get all relevant functionality implemented upstream and drop qtc-cppcheck

(I haven't had a closer look at the new upstream plugin yet, just tested quickly and it seems to basically work, but I feel unable to tell how it compares to qtc-cppcheck.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.