Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: pybowler conforance refactoring

by
dar
- 30/07/2019 11:09:26

On Tue, Jul 30, 2019 at 10:55 AM David Arnold <dar@xoe.solutions> wrote:
Moises, can we teach pylint-odoo to avoid (statically) inferring such nonsense:

def something(self):
    for location in self.location_ids:
        ... = location.type   #  E1101: Instance of 'tuple' has no 'type' member (no-member)

def name(self):
    self.location_ids = [(6, 0, [x.id for x in sorted_locations])]



On Sat, Jul 27, 2019 at 5:35 PM David Arnold <dar@xoe.solutions> wrote:
Yep, perfect, I'm analyzing very intensely your code...
Meanwhile I did another for lazy loggin fixes (just for fun)

There are some cool helper functions which spell out the grammar structure of code matches with an initial general match.
With a large ode base and those helpers from idea to production of one script it's maybe 30 min...

Really Cool :D Definitly a lot quicker than regexing and sed - ing.

On Sat, Jul 27, 2019 at 12:42 AM Moises Lopez <moylop260@vauxoo.com> wrote:
> With pybowler, you just run the script and it walkes you through the diffs to keep or discard.

Yes, that is the reason I commented about the same thing using a custom autopep8 script.

> A code migration from one API version to another can be entirely scripted

Yes, we have used autopep8 for that too.

And I commented you these kind of tools are not used after a while.

Since that you know the guidelines after first iteration
Plus if you have your IDE configured to show you checks fails when you are programming, in live.

Even If it is a MS Open Source Project or if it is a David’s One File Shared, is the same trends ;)

Maybe I’m wrong but that is MHO
If you see autopep8 history git log you will see that the last commit was at 2015

And there are not too much people using this tool. This one is doing the same that your are proposing.

But I’m not blocking your idea, I’m sharing you the possible future about

You can create a better product and proposal to OCA and it will be welcome.



On Fri, Jul 26, 2019 at 11:32 AM David Arnold <dar@xoe.solutions> wrote:
Hi Moises,

The real use case is to get a huge codebase conformant to OCA styling.

With pybowler, you just run the script and it walkes you through the diffs to keep or discard.

It is not suitable for checking or code linting, it's a safe (!) refactoring tool at it's core.

A code migration from one API version to another can be entirely scripted. And as you see, the basic semantics of such fixers are not even complicated.

+- 2 days of research on python grammars gets you going.

I plan to incorporate such refactoring snippets in DockeryOdoo, once I get a better grip on it.

pylint-odoo is already running on a language server protocol (LSP) server. Yes it's Microsoft open source ;-)

Best Regards,

David A.


El vie., 26 jul. 2019, 6:17 p.m., Moises Lopez <moylop260@vauxoo.com> escribió:
Hi David,

If I understood correctly your script is creating the same pylint-odoo check:

It is allowing auto modify code fixing the convention check

For me, It looks great!

I have created a time ago a similar tool using autoflake8:
But after a while I didn't use it since that I know the conventions and my editor is making a mark where I have a convention detail.

Then, I don't know if really is a good idea duplicate pylint and pylint-odoo checks to auto-fixing.

Using VIM I have created the following configuration:
let g:syntastic_python_checkers = ['pylint', 'flake8']
let g:syntastic_python_pylint_args = '--rcfile=mqt/travis/cfg/travis_run_pylint_vim.cfg'
(see attached image)

You can configured it for pycharm and other IDEs

What do you think?


El vie., 26 jul. 2019 a las 10:17, David Arnold (<dar@xoe.solutions>) escribió:
Hi All,

Out of bare exitement, I wanted to share with you my first pybowler conformance refactoring

Let's build a library for pylint-odoo so people can get an actual chance to apply it on a legacy codebase.

Best Regards,
David A.

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe



--
Moisés López Calderón
Mobile: (+521) 477-752-22-30
Twitter: @moylop260
hangout: moylop260@vauxoo.com
http://www.vauxoo.com - Odoo Gold Partner
Twitter: @vauxoo

_______________________________________________

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

--
Moisés López Calderón
Mobile: (+521) 477-752-22-30
Twitter: @moylop260
hangout: moylop260@vauxoo.com
http://www.vauxoo.com - Odoo Gold Partner
Twitter: @vauxoo

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

Reference