Standardize code style
See original GitHub issueIn #1442 discussion we thought about the possibility of standardizing code style, I think it would make development easier as it helps with reading code, removes “useless” linter warnings and overall makes things more organized.
One of the main points in my opinion is at least standardizing indentation size, as in lax_numpy.py we have some places using indentation of 2 spaces and a few using 4 spaces.
I propose using yapf with the following .yapf.style file:
[style]
based_on_style = chromium
split_before_logical_operator = true
join_multiple_lines = true
column_limit = 100
split_before_named_assigns = false
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Code Style and Formatting - The Turing Way
A coding style is a set of conventions on how to format code. ... specification standardized by ECMA International for programming in Javascript....
Read more >Why You Should Use EditorConfig to Standardize Code Styles
It's great because it's widely supported, and it's not tied to any particular language, framework, or code editor.
Read more >Coding Standards and Best Practices To Follow | BrowserStack
Think of coding standards as a set of rules, techniques, and best practices to create cleaner, more readable, more efficient code with minimal ......
Read more >Standardization of code: The Need of the Hour!
Every coder will have a unique pattern than he adheres to. Such a style might include the conventions he uses to name variables...
Read more >Coding Standards and Guidelines - GeeksforGeeks
Good software development organizations want their programmers to maintain to some well-defined and standard style of coding called coding ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the major reluctance among devs here to adopt yapf, (or black, etc.) is that nearly every python formatter out there tends to mutilate math-heavy code and causes a net decrease in readability, even though they might decrease linter noise. They’re all rather over-specialized on the conventions for webdev, systems code, etc.
That’s not to say that stylistic consistency isn’t a worthy goal to be pursued (e.g. consistent indentation…), but I’ve personally been sorely underwhelmed by the utility of automated python formatters in scientific code in the past, and typically have spent as much time fighting them as I have deriving any tangible benefits. …perhaps if there was an extremely “light-touch” configuration that only fixed obvious issues, it might be considered? Any full chromium/pep-8 enforcement probably won’t be welcomed at the moment. (though further comments welcomed!)
So, the yapf version looks more compact and we can customize the style. What do you think?