Unignore flake8 E123, E126, E305, E741, W504 - #3673
Conversation
|
Sorry for the spamming |
sampsyo
left a comment
There was a problem hiding this comment.
Looks wonderful; thank you for getting this heroic effort going! The whole "binary operators go on the second line, not on the first line" thing is going to take some getting used to, but I think I can adapt. 😅
I did a complete review of all the changes. A couple of things seem like they're worth addressing before we merge:
- Some of the automatically "fixed" variable names could use an audit.
- Some new indentation choices are somewhat strange (presumably these were also automated?).
| model_cls._table, | ||
| where or '1', | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Weird—I think this conformant indentation is now less clear, somehow? Maybe it would look less strange if we just put the closing parentheses right after the '1' instead of on their own lines.
| '/usr/sbin/sysctl', | ||
| '-n', | ||
| 'hw.ncpu', | ||
| ]).stdout | ||
| ) |
There was a problem hiding this comment.
Another instance where I think the new conformant indentation is unambiguously worse… maybe the checker would be happy if we just un-indented the last line to match the first line?
|
|
||
| def test_str_format_logging(self): | ||
| l = blog.getLogger("baz123") | ||
| lteststrlogging = blog.getLogger("baz123") |
There was a problem hiding this comment.
Maybe log would be a clearer name for this variable?
| for l in logs: | ||
| self.assertIn(u"import", l) | ||
| self.assertIn(u"album", l) | ||
| for ltestrootlogging in logs: |
|
|
||
|
|
||
| def _consume(l): | ||
| def _consume(lconsume): |
There was a problem hiding this comment.
I'm not really sure fixing this single-letter variable name (in this test file) is really worth it. But if we do, let's pick something else simple instead of new names based on the surrounding context.
| def test_base(self): | ||
| l = self.run_with_output(u'ls') | ||
| self.assertEqual(l, u'the artist - the album - the title\n') | ||
| ltestbase = self.run_with_output(u'ls') |
There was a problem hiding this comment.
Perhaps a better name for this variable would be out or something to indicate that it's the output log from the command.
| self.io.restore() | ||
|
|
||
| def remove_keys(self, l, text): | ||
| def remove_keys(self, lrm, text): |
There was a problem hiding this comment.
Perhaps a better name for this argument would be lst (the l is short for "list").
|
Regarding the indentation changes, I tend to agree that they seem a little strange. For comparison, I ran the relevant code blocks through the black python code formatter, and it chose some different indentations. """.format(
- model_cls._flex_table,
- model_cls._table,
- where or '1',
- )
+ model_cls._flex_table, model_cls._table, where or "1",
)and - num = int(command_output([
- '/usr/sbin/sysctl',
- '-n',
- 'hw.ncpu',
- ]).stdout)
+ num = int(command_output(["/usr/sbin/sysctl", "-n", "hw.ncpu",]).stdout)Perhaps, it could be useful to switch to using black as a code formatter entirely? Then we wouldn't have to worry about these linting errors or correcting user's, as all the code would be unified. Edit: I just realized this was also with black's default max line-length of 88
Using it with max line-length of 80 results in a different diff for the second one: - num = int(command_output([
- '/usr/sbin/sysctl',
- '-n',
- 'hw.ncpu',
- ]).stdout)
+ num = int(
+ command_output(["/usr/sbin/sysctl", "-n", "hw.ncpu",]).stdout
+ ) |
|
Have some time to come back to this. I can run the entire code base through black if we wish to compare and have a conversation about a formatter and the default settings. I'll tackle the variable names in the tests later today. I was reluctant to change those as they were tests. This depends how conformant we wish to be. I've run the attached diff across beets/master using |
|
Thanks for keeping up with this. I think whether or not we decide to switch to using a universal code formatter like black probably deserves it's own discourse discussion. If we do adopt something like that, I imagine these flake8 errors would disappear as a side effect. |
I had done all of the indenting manually. The black format would fix it once if we accept the changes. I still have to redo the variables Now I need to work out how to fix the extra commit I did with the fetch of master 😰 |
|
Yeah the variables are formatting independent, so that's good. Perhaps that could go in its own pull request while we decide what to do about the more sweeping formatting changes? |
|
Also, here's a great article on adjusting some commits. I can't believe I used git for years before I found out about |
|
Sorry for spamming this PR, but I started a discussion on discourse about black. |
|
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Un-ignore flake8 errors that require more than zero or minimal change to the codebase.
See the the discourse discussion
Uploading changes based on PR #3666 and #3669 for discussion
To Do
docs/changelog.rstnear the top of the document.)