Author Topic: New plugin! (Code Statistics)  (Read 8589 times)

Offline Zlika

  • Plugin developer
  • Multiple posting newcomer
  • ****
  • Posts: 59
New plugin! (Code Statistics)
« 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

Offline darklordsatan

  • Almost regular
  • **
  • Posts: 132
    • http://eviltrend.sf.net
Re: New plugin! (Code Statistics)
« Reply #1 on: September 24, 2005, 12:10:11 am »
Good! I see you're into developing plugins for C::B, thats really neat  :D

Offline squizzz

  • Almost regular
  • **
  • Posts: 132
Re: New plugin! (Code Statistics)
« Reply #2 on: September 24, 2005, 11:36:36 am »
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
this space is for rent

Offline Zlika

  • Plugin developer
  • Multiple posting newcomer
  • ****
  • Posts: 59
Re: New plugin! (Code Statistics)
« Reply #3 on: September 24, 2005, 01:03:53 pm »
Thanks for your comments.
It's interesting ideas for the next releases!

Zlika

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: New plugin! (Code Statistics)
« Reply #4 on: September 25, 2005, 02:30:20 pm »
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 :)
Be patient!
This bug will be fixed soon...

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: New plugin! (Code Statistics)
« Reply #5 on: September 25, 2005, 02:53:07 pm »
It is probably very nice, but... could you make it Unicode compatible?
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: New plugin! (Code Statistics)
« Reply #6 on: September 25, 2005, 04:33:28 pm »
*EDITED*

You are right, sorry about that. Fixed it in CVS.
« Last Edit: September 25, 2005, 04:51:21 pm by mandrav »
Be patient!
This bug will be fixed soon...

Offline Zlika

  • Plugin developer
  • Multiple posting newcomer
  • ****
  • Posts: 59
Re: New plugin! (Code Statistics)
« Reply #7 on: September 25, 2005, 05:20:04 pm »
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

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: New plugin! (Code Statistics)
« Reply #8 on: September 25, 2005, 05:30:52 pm »
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.
Be patient!
This bug will be fixed soon...

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2143
Re: New plugin! (Code Statistics)
« Reply #9 on: October 23, 2005, 08:41:20 pm »
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

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2143
Re: New plugin! (Code Statistics)
« Reply #10 on: October 24, 2005, 12:18:51 am »
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

Offline Ivan Kolev

  • Multiple posting newcomer
  • *
  • Posts: 20
    • Home page
Re: New plugin! (Code Statistics)
« Reply #11 on: May 19, 2006, 01:18:33 pm »
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

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: New plugin! (Code Statistics)
« Reply #12 on: May 19, 2006, 01:28:16 pm »
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 :)