Skip to content
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

add class-level comments #144

Merged
merged 1 commit into from
Oct 18, 2021
Merged

add class-level comments #144

merged 1 commit into from
Oct 18, 2021

Conversation

exterm
Copy link
Contributor

@exterm exterm commented Oct 12, 2021

What are you trying to accomplish?

Make packwerk code easier to understand to enable easier maintenance.

What approach did you choose and why?

Add class / module level comments in a general way that shouldn't become outdated anytime soon.

At this point we have a lot of classes and modules directly in the Packwerk namespace, and it's absolutely not obvious what each of them does without reading the implementation of multiple of them.

Even for me who has been at least superficially involved with most of the development of the library, this lack of documentation creates a lot of friction.

What should reviewers focus on?

  • Are the comments correct, do they correspond to the implementation?
  • Are any comments likely to become outdated over time (most likely because they reference implementation details)?
  • Are the comments helpful to you?

Type of Change

  • Bugfix
  • New feature
  • Non-breaking change (a change that doesn't alter functionality - i.e., code refactor, configs, etc.)

Additional Release Notes

  • Breaking change (fix or feature that would cause existing functionality to change)

Include any notes here to include in the release description. For example, if you selected "breaking change" above, leave notes on how users can transition to this version.

If no additional notes are necessary, delete this section or leave it unchanged.

Checklist

  • It is safe to rollback this change.

@exterm exterm requested a review from a team as a code owner October 12, 2021 17:01
@exterm exterm changed the title add comments add class-level comments Oct 12, 2021
@@ -2,6 +2,7 @@
# frozen_string_literal: true

module Packwerk
# A command-line interface to Packwerk.
Copy link
Contributor

Choose a reason for hiding this comment

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

This one feels a little too much like describe the class name and I don't think it adds any value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I was on the fence about this one, but then thought - does everyone know CLI means command-line interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you have the same doubts as me I should probably remove this one.

class Graph
# @param [Array<Array>] edges The edges of the graph; An edge being represented as an Array of two nodes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be we using sorbet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we could use sorbet, that's true - I wanted to keep this PR to comments only so we could more easily merge it. 🤔

Sorbet would make it way more explicit and also be guaranteed to match the code, so definitely better. Will think about doing it later, want to play around with restructuring the code first in a separate PR

Copy link
Member

Choose a reason for hiding this comment

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

Even if we were using sorbet we should be documenting our methods and parameters.

@exterm
Copy link
Contributor Author

exterm commented Oct 13, 2021

There are a few other classes that should probably get a comment, like ParseRun

class Graph
# @param [Array<Array>] edges The edges of the graph; An edge being represented as an Array of two nodes.
Copy link
Member

Choose a reason for hiding this comment

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

Even if we were using sorbet we should be documenting our methods and parameters.

lib/packwerk/reference.rb Outdated Show resolved Hide resolved
@exterm exterm merged commit 6d26e8e into main Oct 18, 2021
@exterm exterm deleted the add-comments branch October 18, 2021 18:30
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.

4 participants