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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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 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.

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)

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.


## 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.


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.


### 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.


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.

## 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


Coders value thorough reviews. Think of each review comment like a ticket: you are expected to
somehow "close" it by acting on it, either by implementing the suggestion or convincing the reviewer
otherwise.

After you update the change, go through the review comments and make sure to reply to every one. You
can click the "Done" button to reply indicating that you've implemented the reviewer's suggestion;
otherwise, click on "Reply" and explain why you have not, or what you have done instead.

It is perfectly normal for changes to go through several round of reviews, with one or more
reviewers making new comments every time and then waiting for an updated change before reviewing
again. All contributors, including experienced maintainers, are subject to the same review cycle;
this process is not meant to be applied selectively or discourage anyone from contribution.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $ coder projects update gcp-linux

## Development

The code structure is inspired by [Basics of Unix Philosophy](https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch01s06.html) and [Effective Go](https://go.dev/doc/effective_go).
Read the [contributing docs](./CONTRIBUTING.md) for style and review guidelines.

Coder requires Go 1.18+, Node 14+, and GNU Make.

Expand Down