Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Zlika on September 23, 2005, 11:33:21 pm
-
Hi everybody!
During a long time, I was looking for an IDE which can count the code/comments lines of a project. I haven't found one (maybe in a commercial IDE...). So I have found small command-line programs able to do that, but it was not very convenient.
That's why I'm proud to announce you the release of a first version of a small "Code Statistics" plugin.
It can count the code/comments/empty lines of the files of the current project. Languages supported for the moment are C/C++, java and Python. In a future release, users will be able to add their own language settings.
You can find the plugin here: http://membres.lycos.fr/exoguard/
Zlika
-
Good! I see you're into developing plugins for C::B, thats really neat :D
-
Nice plugin!
Additional idea for line statistics: avg lines per file.
If you plan further development of this plugin, you might consider measuring also size of the source files: (it might be a new tab already)
- size (in bytes) of the source files ("w00t, this code is getting ~200K")
- amount of source files
- amount of headers
- size of implementation (*.cpp)
- size of headers (*.h)
- avg size of *.cpp file (also the biggest and the smallest file)
- avg size of *.h file
Thanks for the plugin
-
Thanks for your comments.
It's interesting ideas for the next releases!
Zlika
-
This plugin has been added in CVS, in the contrib plugins section.
Zlika is now a registered Code::Blocks Plugin Developer.
Very well done, Zlika :)
-
It is probably very nice, but... could you make it Unicode compatible?
-
*EDITED*
You are right, sorry about that. Fixed it in CVS.
-
There are plenty of empty lines in the sources when I view them with CB.
When I look the text files with an hex editor, I can see each end of line is: CR-CR-LF !
Is it a bug of CB when you edit a file under Unix and then Windows?
Zlika
-
Yes, sometimes it can happen (depends on the editor used, etc - some files I quickly edit with other editors, not CB).
If you see this, and it's more than a couple of lines (where you could just fix it yourself by deleting them), run dos2unix on the files before editing them and all will be fine again.
-
Zlika,
Thanks for the nice plugin. Good example code for us novices.
I noticed (on my win xp sp2 system) that Codestat::Configure()
isn't being called. I modified it as follows:
int CodeStat::Configure()
{
// if not attached, exit
asm("int3"); //?? is this function being called??
if (!m_IsAttached)
return -1;
LanguageDef languages[NB_FILETYPES];
LoadSettings(languages);
CodeStatConfigDlg dlg(Manager::Get()->GetAppWindow(), languages);
wxString msg = _("Configure called!");
wxMessageBox(msg, _("Error"), wxICON_ERROR | wxOK);
if (dlg.ShowModal() == wxID_OK)
{
}
return 0;
}
It neither crashed at the "asm("int3")" nor did it ever produce a
message box.
What am I missing here??
Thanks
-
Zlika,
Please ignore my last message. I don't know what I'm doing.
My bad. ::Configure() works fine.
Sorry for the false alarm,
Pecan
-
Great plugin, thanks. Hope it will be supported in the future.
The most important addition I'd like to see is displaying statistics for all projects in the workspace, not just the active one.
Regards,
Ivan
-
I have a little "refactoring" suggestion.
Move the comment tokens and file types pair, from this plugin, to the SDK; to increase reuse in other plugins: CodeCompletion, ToDo plugin, wxSmith, and any other wanting to use this information.
In the SDK, a good place to put physically the tokens are inside the xml lexers :)