[Cubicweb] a script to save you time during development/project cleaning: autocommit the fixes of autopep8 so you don't have to do it by hand

Arthur Lutz arthur.lutz at logilab.fr
Fri May 3 09:26:21 CEST 2019


Am in favor of choosing having a massive apply of this
autocommitautopep8 strategy. Maybe we need to select the cubes which
have a sufficient test coverage (or some other criteria) in case things
get broken.

Have you come across problems introduced by this approach or is it just
when you're stuck in the middle of an series ?

For the 2300 patches, it could indicate that we have to "deprecate" or
retire some projects that aren't used anywhere any more.

Arthur

On 02/05/2019 12:04, Laurent Peuch wrote:
> Hello everyone,
>
> Nico asked me to also to send those emails on this mailing list to
> describe the tools I've been creating to help the work on CW
> (especially migration). Here is the first one :)
>
> During development of cubicweb and logilab related project we often
> face ourselves with the need to conform with pep8 guidelines, either
> because we prefer it, want it or to please the flake8/pep8 god (and
> remove the red warning everywhere in your editor.) This task is often
> done by hand (or with autopep8 on the file your are on right now)and
> can take quite some time, a not very interesting time that would be
> better put on funnier things.
>
> To win this time and do much more interesting things I've recreate a
> long lost script by Denis that wraps autopep8 and do the job for you:
> you launch it into a project, is fix everything and do a commit per
> error categories fixes by pep8 (or only on commit if you prefer.) The
> usage is very simple:
>
>     pip install --user autocommitautopep8
>
>     # anywhere in a hg/git repository
>     autocommitautopep8
>
> (be aware that this can take quite some time if you have a lot of
> files.)
>
> If you want only one commit do:
>
>     autocommitautopep8 -s
>     # or
>     autocommitautopep8 --single-commit
>
> And you can also specify a path to a git/hg repository using
> -p/--path:
>
>     autocommitautopep8 --path path/to/my/project
>
> The code is here: https://github.com/Psycojoker/autocommitautopep8
> Feel free to send patch/contributions/open... tickets here of there :)
>
> As an anecdote I've launched it on all the projects I could find on
> https://www.cubicweb.org/project/ and ended up with ... 2300 patches ^^'
> I haven't send them here since it would have been madness and totally
> pointless to have you review 2300 patches. I think that we should
> simply apply this script to the whole code base one day (once we are
> happy with it) and don't think about it anymore and use mercurial
> format-source extension if we need it https://octobus.net/blog/2018-12-03-mercurial-format-source-0.2.0.html
> But we have first to agree on that which might happen one day :)
>
> Cheers <3
>



More information about the Cubicweb mailing list