Skip to content

chore: Add contributing guidelines #874

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

Merged
merged 2 commits into from
Apr 5, 2022
Merged

chore: Add contributing guidelines #874

merged 2 commits into from
Apr 5, 2022

Conversation

kylecarbs
Copy link
Member

It's helpful for us Coders to align on a common set of style
guidelines. While I'd prefer to automate this, documentation
should get us a lot of the way there!

Please review these thoroughly, as PRs will be checked against it
after merge.

It's helpful for us Coders to align on a common set of style
guidelines. While I'd prefer to automate this, documentation
should get us a lot of the way there!

Please review these thoroughly, as PRs will be checked against it
after merge.
@kylecarbs kylecarbs self-assigned this Apr 4, 2022
@kylecarbs kylecarbs force-pushed the contributing branch 2 times, most recently from c929bab to 201f4c2 Compare April 4, 2022 23:46
@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

Merging #874 (3066383) into main (f02b8fd) will decrease coverage by 0.49%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #874      +/-   ##
==========================================
- Coverage   65.93%   65.43%   -0.50%     
==========================================
  Files         204      212       +8     
  Lines       13252    13382     +130     
  Branches       86      103      +17     
==========================================
+ Hits         8738     8757      +19     
- Misses       3622     3725     +103     
- Partials      892      900       +8     
Flag Coverage Δ
unittest-go- 65.15% <ø> (-0.22%) ⬇️
unittest-go-macos-latest 52.56% <ø> (+0.03%) ⬆️
unittest-go-ubuntu-latest 55.24% <ø> (+0.04%) ⬆️
unittest-go-windows-2022 51.91% <ø> (+0.08%) ⬆️
unittest-js 58.83% <ø> (-3.88%) ⬇️
Impacted Files Coverage Δ
provisionersdk/transport.go 78.72% <0.00%> (-6.39%) ⬇️
coderd/workspaceresources.go 54.87% <0.00%> (-6.10%) ⬇️
cli/cliui/agent.go 77.19% <0.00%> (-5.27%) ⬇️
coderd/provisionerdaemons.go 59.02% <0.00%> (-2.53%) ⬇️
peerbroker/proxy.go 57.55% <0.00%> (-0.59%) ⬇️
cli/root.go 76.41% <0.00%> (-0.43%) ⬇️
site/src/app.tsx 0.00% <0.00%> (ø)
site/src/Main.tsx 0.00% <0.00%> (ø)
site/src/pages/404.tsx 0.00% <0.00%> (ø)
site/src/pages/index.tsx 0.00% <0.00%> (ø)
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f02b8fd...3066383. Read the comment docs.

Copy link
Contributor

@greyscaled greyscaled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion(optional): We sometimes use conventional comments. It's not required, but can help. Could be a good link out (in the review section) in case people come across it and are curious

https://conventionalcomments.org/

Not sure if you feel it fits in (borders too much info). Thought I'd leave this as an optional suggestion.

@kylecarbs
Copy link
Member Author

We can add standardized commits as a listing rule in the future - I'm extremely game for that! I'm hesitant to add in this PR to avoid scope bloat.

@kylecarbs kylecarbs requested review from a team April 5, 2022 00:50
Copy link
Contributor

@greyscaled greyscaled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Can we limit the line-length to 80? We used to have our prettier and eslint stuff at the root of the repo for purposes such as this. I don't feel compelled to move it now and/or inflate this effort, so another way to go about this is for me to ask: are you ok if we prettier-ify these docs once we configure it for use across the repo?

@kylecarbs
Copy link
Member Author

I'm certainly game for that... long markdown lines are terrible to edit! We'll have to move the .prettierrc to the root to make this consistent, so I just manually ran prettier for now.

[Go's Code Review Comments Wiki](https://github.com/golang/go/wiki/CodeReviewComments)
to find common comments made during reviews of Go code.

### No Unused Packages
Copy link
Member

@johnstcn johnstcn Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this lead to a lot of "big bang" PRs?

Edit: by "big bang" I mean a PR that gets created against a changeset when the author considers the unit of work "100% done". This can lead to large changesets that can take a while to review.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's certainly possible, but if it makes reviews simpler it may be overall less taxing.

An example is when we implement OAuth: we could scaffold in one PR, and implement GitHub in another, but then we don't have the context on how it works in a real world implementation.

If it becomes unreasonable, I'm happy to loosen up this language.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also adjust this to Prefer Unused Packages if you feel strongly this will lead to poor decomposition.

Copy link
Member

@johnstcn johnstcn Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can tests count as "checking against implementation" here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, but I should probably make that perspective more explicit. I don't believe we need fully implemented usage of a package to merge, but I think it's helpful context for producing a more cohesive contribution.

@johnstcn do you agree with the core principle? I agree with your thoughts that this promotes chunky PRs (which is bad), so if you have any thoughts to modify the phrasing I would happily accept!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the core principle, yes.
I have an idea for a second principle that I want to try out personally before forcing onto everyone else.

@johnstcn
Copy link
Member

johnstcn commented Apr 5, 2022

Suggestion: Can we limit the line-length to 80?

I'd prefer to not enforce an 80-character line length limit. 100 would probably be OK though.
Interestingly, the Linux kernel no longer enforces an 80 character limit.

@@ -0,0 +1,37 @@
# Contributing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is a great start to our Contributing guide!

What are your thoughts on adding sections for the following:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add these in another PR. I'm primarily focusing on code style and review in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay in that case I don't think it addresses #646 so we should keep that open and I'll address there

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! It's a lil part of it, but certainly doesn't entirely help someone contribute.

@jsjoeio
Copy link
Contributor

jsjoeio commented Apr 5, 2022

Fixes #646

@kylecarbs
Copy link
Member Author

@johnstcn I'm down to bump to 100. I shall make the change! I didn't realize the kernel doesn't recognize 80 chars anymore, that's cool too.


## Review

> Taken from [Go's review philosophy](https://go.dev/doc/contribute#reviews).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love this

Comment on lines 15 to 18
Coders write packages that are used during implementation. It's difficult to
validate whether an abstraction is valid until it's checked against an
implementation. This results in a larger changeset but provides reviewers with
an educated perspective on the contribution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the title misleads the point here - we prefer simple and repetative over pre-mature abstractions. I think we really just want to say "repetition is fine and abstractions can come after the pattern fully emerges". Unused packages are just one form of this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this is a clear example of pre-mature abstraction. I intentionally avoided abstract language to avoid abstract interpretation. I'm happy to lead with that quote prior to examples of common misuse, and we follow it up with these clear examples.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to expand on this in a way that isn't super abstract. I think as we run into cases where this is problematic we should refine it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to be cautious about adding abstract cases without examples. I picked the unused package since it's a common pattern for decomposition, with a clear message why it's wrong. I'm in favor of rolling with this for now, and if we still see problems of duplicative nature, we create another rule.

@kylecarbs
Copy link
Member Author

@presleyp @vapurrmaid @deansheather any last remarks before the merge?

@kylecarbs kylecarbs merged commit 1e9e5f7 into main Apr 5, 2022
@kylecarbs kylecarbs deleted the contributing branch April 5, 2022 20:02
be preferred over documenting styles (run ours with `make lint`); humans are error prone!

Read [Go's Code Review Comments Wiki](https://github.com/golang/go/wiki/CodeReviewComments) to find
common comments made during reviews of Go code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is sufficiently helpful direction.

## Go Style

Contributions must adhere to [Effective Go](https://go.dev/doc/effective_go). Linting rules should
be preferred over documenting styles (run ours with `make lint`); humans are error prone!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUT if you can't figure out how to make it a linting rule, make it documentation rather than doing nothing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like that's expressed here, but I'm fine to change this wording.

@@ -0,0 +1,32 @@
# Contributing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like a note here that every PR should do exactly one thing. Not three things and not half of a thing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing is subjective. This solves a single goal of making it easier to write code with fewer comments in code review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. One thing is not subjective. Maybe we can define it specifically if it's not clear

  • add a feature
  • refactor
  • fix a bug
  • reformat
  • add documentation (except when attached to a new feature)

@@ -0,0 +1,32 @@
# Contributing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this document fails a test I just invented: if someone follows all the included or referenced guidelines, will their code sail through review? Other than domain-specific stuff, e.g. how to interact with the EC2 API, of course.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, their code will sail through review given functionality makes sense. This document isn't intended to provide exhaustive coverage of contribution but provides general guidelines to make it frictionless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.