noisebridge / MediaBridge

2 stars 3 forks source link

Create text file to document contribution guidelines #34

Open skyfenton opened 1 month ago

skyfenton commented 1 month ago

As we keep deciding on how tests should be constructed, naming schemes, formatting tools, docstrings, etc. we should have a markdown text file (a "CONTRIBUTING.md") to define our guidelines for writing code, submitting PRs, etc. that we can refer newcomers to and use to remind ourselves.

This way we also have a list of conventions to double check for in PR reviews to maintain consistency and confidence a PR has checked all the boxes.

jhanley634 commented 1 month ago

I can share things that I have seen are effective at "herding cats" when working with teams having between two and two dozen engineers of diverse skill levels.

We conduct a code review during the PR process to assess two things:

  1. Is it correct?
  2. Is it maintainable?

The easy-to-run $ make lint test gives an objective answer to the first. I offer this example.

The author likely believes that anyone in the team could fix a bug or add a feature to the code they just wrote. But only another teammate could give an answer of, "yes! I think I grok this new code and could maintain it." That's why we do reviews, to helpfully reveal blind spots in the author's thinking. What is obvious to the author won't be universally obvious, so we give other folks an opportunity to chime in, before they're stuck with supporting that code.

We desire that functions should compose, so each author takes care to spell out a new function's contract. Sometimes the pre- and post- conditions are clear from the signature. If not, we need at least a one-sentence docstring. A reviewer should be able to articulate what the contract is. Imagine there is no unit test. By examining the function's signature and contract (but not its source code), a reviewer should be able to write meaningful unit tests. If not, it is appropriate to push back, to suggest improvements to the PR prior to merging down to main.

skyfenton commented 4 weeks ago

Those all sound solid to me, I imagine this document would be 70-80% standard python practices with just a little bit of our own preferences for communication and workflow.

audiodude commented 4 weeks ago

@skyfenton would you like to take a crack at it? There's probably templates you can use to get started.

skyfenton commented 3 weeks ago

Sure, I'll draft something up. I'll def want to review it next week with everyone to make sure there aren't any important gaps.

audiodude commented 3 weeks ago

Awesome, sg