CppCheck plugin

Discussion about CodeLite development process and patches
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: CppCheck plugin

Post by jfouche »

Hi Eran

Just come back from sea, and crabs hunting...
I'll have a look in the next hours, and tells you.
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CppCheck plugin

Post by eranif »

Hi Jeremie :)

I think you missed one point:

We BOTH started on working on the same plugin ... I took the idea from this post here:

http://forums.codeblocks.org/index.php/ ... 199.0.html (I have been logged in to C::B forum latelty since I was discussing some common issues with MortenMacFly, mainly about scintilla 2.0)

I havn't done much (from the UI point of view), but from the "engine" side, I got the cppchecker running like a daemon and listening on socket/named pipe and it works very fast.

I am not saying that you should NOT work on your plugin, on the contrary! I am saying that we can (and should) co-operate on it :)

Contact me please

Eran
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: CppCheck plugin

Post by jfouche »

Hi Eran,

I didn't miss the point, and I just wanted to change the plugin to integrate your modification (i.e : communicate with cppchecker, as I understood). As the UI (show error, and manage clicking on error to go to src) of the plugin is finished, I just want to implement what you told me on last post.
Jérémie
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: CppCheck plugin

Post by jfouche »

eranif wrote:to establish connection to the cppchecker:

Code: Select all

// build the channel name
char channel_name[1024];
sprintf(channel_name, PIPE_NAME, argv[1]);

clNamedPipeClient client(channel_name);
What is your argv[1] ? If I understood correctly, this code must be embed in my plugin. Is it a unique string identifying the current analysing ? (the project name for example).
eranif wrote:Construct a request object:

Code: Select all

CPPCheckerRequest req;
req.setFile("C:\\Development\\C++\\codelite\\trunk\\Subversion\\subversion.cpp"); //set the file to be parsed here
Actually, the request can manage only one file, but in case of project, giving all files gives more results. Does setFile append file to the checker, or does it start analyses directly ? May be we have to add an appendFile method.

[edit]OK, tells me if I 'm wrong :
1 - Create a CppCheckShellCommand

Code: Select all

class CppCheckShellCommand : public wxEvtHandler
{
	clProcess* m_proc; // which launch the cppcheker ... [files]
	wxEvtHandler* m_owner; // My tab, which receives output from CPPCheckerReply
	wxTimer *m_timer; // which update UI (is it necessary as CPPCheckerReply send replies from times to times ?)

public
	...
};
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CppCheck plugin

Post by eranif »

I already implemented that part - all is missing now is the GUI.
Comitted to SVN trunk

Eran
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: CppCheck plugin

Post by jfouche »

You're to fast, my old computer doesn't compile fast enough 'til your commits :D
Ok, let's have a look too the available classes, and hopefully (if I'm not too lost), I will give you the gui in a few time.

PS : 1 more reply, and you got 1000 post, rev 3000. Good day, isn't it ?
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CppCheck plugin

Post by eranif »

OK, Here is what I have done so far:

Everything is updated (all the wrapper scripts) however the plugin is currently windows only, until I will compile and test it on Linux.

The plugin has the following functionality:
- When you launch codelite, there is another process now: codelite_cppcheck (if the plugin is available)
- You can right click on any item in the file explorer and select CppCheck -> Run CppCheck on it

List of files (one by one) are sent to the daemon over named pipe the response is printed (currently) to the log.

There are 3 methods which are ineteresting:
CppCheckPlugin::OnCheckCompleted() which is called when the worker thread has completed to process a file - the current handle calls ProcessNextfromList() which will pass to the worker thread the next file to process (if any)
CppCheckPlugin::OnReport() which is called when a complete report has arrived for the currently analyzed file, the report is in accessed from event.GetString() method

and:

CppCheckPlugin::OnStatusMessage() which is called by the worker thread whenever the cppcheck has an informative message for the plugin

If the cppcheck process is terminated, it will be restarted automatically (similar to codelite_indexer)

Other than that, I am going to add support for workspace / project context menus

Eran
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: CppCheck plugin

Post by jfouche »

Eran

I suppose that the CppCheckPlugin::OnReport method will be called each time a file is completed (thinking to the next step: multiple files analysis). Do you think a valid xml stream could be send in the wxCommandEvent (because I use wxXmlDocument parser) ? Or do I have to wait until the end of analysis to parser and show results ?

[edit] : OK, it works. I'm gonna make some tests and send you a patch.
Next steps for gui :
- Add icons for file
- Add icons for different kind of severities
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CppCheck plugin

Post by eranif »

I create a skeleton gui to use instead of the 'cscope' one :)

Attched.

in the upper part, we display list of files. Selecting an item on that list, will show all the error messages from that file at the bottom list.
d-clicking an item on the upper part will open that file.

the bottom list contains the detailed errors, d-clicking an item on that list, will open it in the editor (with marker)

Eran
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: CppCheck plugin

Post by jfouche »

Here a small patch for codelite_cppcheck workspace and src (to compile with gcc 4.4.0).

For your gui, could you send me your fbp to make me use it instead of my csope one ? Or maybe you want to continue, as you are faster than me ... Tell me, because I will not continue to work on it if you prefer.
You do not have the required permissions to view the files attached to this post.
Jérémie
Post Reply