-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linter/formatter should enforce coding style rules that will gate merging PRs #504
Comments
@hugomrdias @daviddias @victorb @achingbrain Think this is a good idea? Thanks! |
I’m not sure that the problem is with the linter. That is, it would be hard to automate the generation a warning for reformatting of code that has little to do with the intended change behind a PR, since the linter has no idea what the intention behind an edit is. As a rule a PR should be small and focussed and change as little as possible to make the change required. Doing code reviews is really hard because you only see the code, not the thought behind the code, so anything you can do to lower the cognitive load on the reviewer is incredibly helpful. Smaller change sets are thus easier to review, easier to navigate via git history, etc. Fundamentally it’s down to the author to consider if their changes are relevant to fixing the thing they are trying to fix before submitting them. I know I personally do a final sweep of any PR and remove extraneous edits before pushing them. Ok, sometimes right after pushing them. |
@achingbrain Hmm, perhaps my meaning wasn't clear. It's straightforward enough to modify the linter and/or formatter config to throw errors if there's space before the parens in a function declaration, etc. |
Such a setting would lower the cognitive load on PR creators, which would be great! |
I already usually follow all of those norms you mentioned for the reasons you mentioned, and I apologize for missing that in the PR linked above - I'm saying it would be nice to automate as many of those norms for the dev as possible with linter and/or formatter settings. |
This is exactly what our eslint config does, closing this issue. |
I think we should reopen it. I’m pretty sure I ran the linter and it didn’t catch the issue linked to above. I can try to reproduce it to confirm. |
@hugomrdias Just confirmed that - making a change such as this: if (options.enableShardingExperiment != null) searchParams.set('enable-sharding-experiment', options.enableShardingExperiment) -> if (options.enableShardingExperiment != null) {
searchParams.set('enable-sharding-experiment', options.enableShardingExperiment)
} doesn't create any new warnings or errors. So I think this issue should be reopened. Here are the issues like this I noticed (including the one referenced above): ipfs-inactive/js-ipfs-http-client#1224 (comment) |
that happens when you have extra formatters in your editor or manual change formatting. we use eslint-standard and while it doesn't have every single style rule defined to avoid these issues it is enough for our needs. |
Yep, I know. I thought this might increase the odds of helpful PRs making it in going forward, but that's a very reasonable prioritization choice. Thanks! |
See this issue ipfs-inactive/js-ipfs-http-client#1225
Thanks!
The text was updated successfully, but these errors were encountered: