py3gpp icon indicating copy to clipboard operation
py3gpp copied to clipboard

pre-commit flow for CI and standalone run

Open vborchsh opened this issue 1 year ago • 7 comments

More contributors are here and I bring pre-commit formatter to CI to keep code in the same style. I think this might be useful for such a project. But we need to format WHOLE THE CODE.

So, I decided to leave this responsibility to @catkira as an owner and main contributor :) From my point it's better to include formatting as early as possible, otherwise it will be more and more painful.

I see several steps:

  1. Format the whole code with pre-commit run -a 1.1 There are several exclude folders, and they won't affected
  2. Push this massive change to repos
  3. Check if pre-commit CI hooks works fine

I checked all of them, but we need to check hat everything is smooth in the main repo (here).

PS. The exact rules is point for discussion or modification. I've bring more or less default styles partially from cocotb CI flow.

vborchsh avatar Oct 08 '23 16:10 vborchsh

yes, that's a good idea.

catkira avatar Oct 08 '23 16:10 catkira

@vborchsh where is the screen width and indent configured?

catkira avatar Oct 08 '23 19:10 catkira

@vborchsh where is the screen width and indent configured?

I've added line length=120 for example.

About indents - I'm not sure, flack8/black formatters are uncompromising here... But for me it's completely fine. Less settings - less pain.

vborchsh avatar Oct 09 '23 03:10 vborchsh

The problem with this PR is that the contributions will not be shown correctly anymore on Github. One would have to make a separate script that calculates contributions by not taking into account this commit. I would wait with this commit until this script is added, because I don't want to take away the visibility of contributions from other people.

But we can already add a commit hook that is active for new changes only - if that is possible.

catkira avatar Nov 03 '23 08:11 catkira

The problem with this PR is that the contributions will not be shown correctly anymore on Github. ...

The commits statistic will be fine. The only issue is addition/deletions statistic right? And the later you do the worse it will :) Btw github has no option to exclude commits from contributors statistic, so I see no outs. Anyway, its up to you. Let's wait for possible workaround or fixes of this issue.

vborchsh avatar Nov 03 '23 08:11 vborchsh

The problem with this PR is that the contributions will not be shown correctly anymore on Github. ...

The commits statistic will be fine. The only issue is addition/deletions statistic right? And the later you do the worse it will :) Btw github has no option to exclude commits from contributors statistic, so I see no outs. Anyway, its up to you. Let's wait for possible workaround or fixes of this issue.

Yes Github cannot do it, other projects therefore of a separate file that how much each user contributed, for example this https://github.com/analogdevicesinc/libiio/blob/main/Contributors.md

catkira avatar Nov 03 '23 08:11 catkira

Also, you can expand this file: https://github.com/vborchsh/py3gpp/blob/master/pyproject.toml (authors) in automatic way

vborchsh avatar Nov 03 '23 08:11 vborchsh