vscode-exporter icon indicating copy to clipboard operation
vscode-exporter copied to clipboard

Adding "good practices" metrics

Open DavidAuger opened this issue 1 year ago • 3 comments

Hello @guicaulada,

Hope you are doing great.

Describe the solution you'd like

Add some new metrics we could use to show some new dashboards, related to some development "good practices". For instance, some:

  • git => Goal here is to explain the necessity to have some versionning hygiena.
    • number of lines and files modified before commit
    • time spent to develop before commit
    • number of lines and files modified added by commit
    • number of commits before push
    • time spent before push
  • complexity
    • Don't investigate yet but thinking the same way, would be great to use some plugin's API (like SonarLint ?) to evaluate complexity of code produced, number of native functions, etc

Describe alternatives you've considered

Discussed with some colleagues and they told me about Wakatime. Do not really like their solution but did find some stuff about commits for instance: https://wakatime.com/developers#commit

Additional context

I red your article on Grafana community blog some days ago and enjoyed it. I think it's a good idea to use grafana to such purpose. However, really love to "see some more".

DavidAuger avatar Jun 23 '23 08:06 DavidAuger

Hi David,

Thank you for this feedback! This is a great idea! I was planning on taking a look over the weekend, but unfortunately it was a little bit imprevisible.

I will try to take a look at this as soon as possible!

guicaulada avatar Jun 26 '23 13:06 guicaulada

Hello Guilherme,

No problem and no rush, perfectly know how it goes when it comes to free time :) It would be a pleasure for me to help you and not letting you to do all the work.

What was your idea to start ? I was planning on look some NPM library about GIT, but maybe have you some other more precise ideas in mind ?

Best regards, David

DavidAuger avatar Jul 03 '23 08:07 DavidAuger

Hello Guilherme, Hope you are doing great !

I have look some stuff that could help adding features according to Git activity:

  • Using Git extension of VsCode https://github.com/microsoft/vscode/tree/main/extensions/git

AS they explain, it seems possible to access extension using its id and them using its API. I red a bit API code source and it seems that there is some events:

get onDidChangeState(): Event<APIState> {
  return this._model.onDidChangeState;
}

get onDidPublish(): Event<PublishEvent> {
  return this._model.onDidPublish;
}

get onDidOpenRepository(): Event<Repository> {
  return mapEvent(this._model.onDidOpenRepository, r => new ApiRepository(r));
}

get onDidCloseRepository(): Event<Repository> {
  return mapEvent(this._model.onDidCloseRepository, r => new ApiRepository(r));
}

Not sure yet how they behave.

  • Find an other node library called "nodegit" https://github.com/nodegit/nodegit

Seems to also have some events. For example, event on commit: https://www.nodegit.org/api/commit/

var eventEmitter = commit.history();

eventEmitter.on('commit', function(commit) {
   // Use commit
});

My issue here with this library is that it seems that library is not well maintained as there is like 330+ issues opened and no release since july 2023. Maybe not the best issue.

DavidAuger avatar Jul 05 '23 16:07 DavidAuger