question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should we have some sort of code style?

See original GitHub issue

I notice there’s not much consistency across the codebase in some cases (e.g., 'strings' and "strings", etc.). Any code style is good enough (I really like black). This could be enforced in a post-commit or post-merge hook.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
shivupacommented, Mar 31, 2022

What Minsik said was indeed true. I have some new thoughts about this.

I agree with making it easier to contribute. Personally I think precommit hooks are a little tedious on developers since it requires them to set it up, but I am open to discussion on that point.

I do think just running black -l 100 on the source and adding a github action to check if future contributions abide by the constraints sounds like a good option.

2reactions
berquistcommented, Mar 31, 2022

I think people were asked to run black -l 100 on any file they changed in the commit. As far as I remember, there was a discussion on whether we want to run black on the entire repo some time ago, but we decided not to because it would make it harder to track changes through git history. Please correct me if I am not recalling the discussion correctly!

This is correct on all points. I’m not sure it would be as bad as some renames or moves: I needed multiple revision checkouts to see the original history of io.

One more concrete (and common) concern is that it will mess with all open PRs, so we should try and push them through before running a formatter. Rebasing them after formatting the codebase will be a pain.

I use black as part of https://pre-commit.com/ (but not in GHA) for all my other projects. I think we should do whatever makes contributing to the code and modifying it easier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Coding Style Matters - Smashing Magazine
Coding style guides are an important part of writing code as a professional. Whether you're writing JavaScript or CSS or any other language, ......
Read more >
How important is a good coding style for the decision to hire a ...
Taking coding style to mean things like naming, general ordering, unit separation, and everything else that deals with readability and ...
Read more >
Code Style and Formatting - The Turing Way
A coding style is a set of conventions on how to format code. For instance, what do you call your variables? Do you...
Read more >
Why Enforcing Code Style is Important - Cory Rylan
Why should we care about code styles? Isn't it enough that our code works? Well there are a couple of reasons to care...
Read more >
Coding conventions (code style)
Everyone has opinions about coding style. This document contains some high-level advice. It doesn't go into minutiae like how many spaces per indentation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found