Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Fix inconsistency of line length between flake8 and black #448 #662

Closed
jcdrubay opened this issue Apr 20, 2020 · 0 comments
Closed

Fix inconsistency of line length between flake8 and black #448 #662

jcdrubay opened this issue Apr 20, 2020 · 0 comments

Comments

@jcdrubay
Copy link
Contributor

Milestone (Odoo version)

  • 13.0

Module(s)

  • all

Steps to reproduce

For a piece of code which is:

  • split on several lines with each line less than 80 characters before running pre-commit
  • re-formatted by black into a single line of more than 80 characters. It's even more than 88 89 characters !!!
  • then I get a pre-commit exit 1 due to flake8

Example:

Before pre-commit,

                    {
                        "time_log_type_id":
                            training_task.program_id.time_log_type_id.id,
                    }

After pre-commit, the line is 85 characters long:

                    {
                        "time_log_type_id": training_task.program_id.time_log_type_id.id,
                    }

Current behavior

pre-commit exit 1 due to the flake8 config at 80 characters for a code that is automatically reformatted by black from less than 80 characters per line to 88 characters per line.

Expected behavior

flake 8 line length should be consistent with the line length applied by black.

Related Issue:

OCA/web#1583

Actually, there is an issue from black that leads to that 89 characters instead of 88:

psf/black#1161

Workaround

Restructure the code to avoid this unfortunate situation:

                    my_value = training_task.program_id.time_log_type_id.id
                    {
                        "time_log_type_id": my_value,
                    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants