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

Misc refactors #599

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

Misc refactors #599

wants to merge 38 commits into from

Conversation

Sija
Copy link
Member

@Sija Sija commented Mar 19, 2025

No description provided.

@Sija Sija added the refactor label Mar 19, 2025
@Sija Sija added this to the 1.7.0 milestone Mar 19, 2025
@Sija Sija requested a review from veelenga March 19, 2025 05:01
@Sija Sija self-assigned this Mar 19, 2025
@Sija
Copy link
Member Author

Sija commented Mar 20, 2025

@veelenga Could you please review it?

Copy link
Contributor

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

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

That's a lot of changes, and they have varying decrees of impact.
I'm wondering if it might be a good idea to extract some of the non-trivial changes into separate PRs to have them stand out more?

@Sija
Copy link
Member Author

Sija commented Mar 20, 2025

@straight-shoota This might seem like a lot but there's not that much changes, actually. If you think that some particular ones deserves their own PRs, please just say so.

Copy link
Member

@veelenga veelenga left a comment

Choose a reason for hiding this comment

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

Reviewed partially.

@Sija
Copy link
Member Author

Sija commented Mar 23, 2025

CI nightly jobs started failing with error:

Error: expected argument #2 to 'Ameba::Source#add_issue' to be Crystal::Token or Tuple(Int32, Int32), not (Crystal::ASTNode | Nil)

As far as I can see it's related to:

assign.targets.find(node) do |target|

Fixed in crystal-lang/crystal#15589

@Sija Sija requested a review from veelenga March 23, 2025 13:26
@veelenga
Copy link
Member

I would appreciate if we could extract changes in VerboseBlock into separate PR. That one looks like a tough one.

@Sija
Copy link
Member Author

Sija commented Mar 23, 2025

I would appreciate if we could extract changes in VerboseBlock into separate PR. That one looks like a tough one.

There's no point to do so, I've just shuffled the order of method definitions (so the private methods will come after the public ones), nothing really changed beside that.

@Sija Sija requested a review from veelenga March 23, 2025 19:07
@Sija
Copy link
Member Author

Sija commented Mar 23, 2025

@veelenga I'd advise you to look at the individual commits, as opposed to trying to grok the differences from the overall view - this might answer some of your questions.

@veelenga
Copy link
Member

@veelenga I'd advise you to look at the individual commits, as opposed to trying to grok the differences from the overall view - this might answer some of your questions.

Thanks for the heads up, but there are 37 commits, I don't think it is easier to review the individual commits one by one.

@veelenga
Copy link
Member

I would appreciate if we could extract changes in VerboseBlock into separate PR. That one looks like a tough one.

There's no point to do so, I've just shuffled the order of method definitions (so the private methods will come after the public ones), nothing really changed beside that.

Could you please clarify the reason for this change? It seems subjective and isn't enforced by any established rules, meaning it can't be guaranteed in the future. Additionally, someone else could join the project with a different perspective and revert the changes back or enforce other rules they think look better. Do you agree?

@Sija
Copy link
Member Author

Sija commented Mar 24, 2025

Could you please clarify the reason for this change? It seems subjective and isn't enforced by any established rules, meaning it can't be guaranteed in the future. Additionally, someone else could join the project with a different perspective and revert the changes back or enforce other rules they think look better. Do you agree?

Sure. That's the rule I wrote long time ago and now revisiting it after time, I'm finding it's odd having to dig through all of the private methods in order to get to the public ones. Most of other rules are written in such fashion, and I believe it's for a reason (i.e. readability). I'd happily accept a rule requiring an ordering of public/private/protected methods, yet ATM there's none. Regarding your last question: no, I don't agree since, as I've already mentioned - most of the rules are written in that fashion, and this single one was kinda an outlier.

@veelenga
Copy link
Member

Could you please clarify the reason for this change? It seems subjective and isn't enforced by any established rules, meaning it can't be guaranteed in the future. Additionally, someone else could join the project with a different perspective and revert the changes back or enforce other rules they think look better. Do you agree?

Sure. That's the rule I wrote long time ago and now revisiting it after time, I'm finding it's odd having to dig through all of the private methods in order to get to the public ones. Most of other rules are written in such fashion, and I believe it's for a reason (i.e. readability). I'd happily accept a rule requiring an ordering of public/private/protected methods, yet ATM there's none. Regarding your last question: no, I don't agree since, as I've already mentioned - most of the rules are written in that fashion, and this single one was kinda an outlier.

Got it, thanks for explaining. However, I personally don't find this version more readable than the previous one. The change doesn't seem to offer any significant improvement from my perspective.

Also, I want to re-call what I mentioned few times during previous Misc refactoring:

  1. No major benefit
  2. Hard to review, takes a lot of time
  3. Easy to introduce a regression

This PR contains some valuable changes and improvements but mixing it with code style suggestions, while these styles are not enforced on the project, is counterproductive IMO. Code style changes should be discussed separately, maybe written somewhere, and ideally automated with linting rules before being implemented. Otherwise, we risk spending valuable review time on subjective matters rather than focusing on functional improvements.

@Sija Sija force-pushed the some-moar-refactors branch from 7fbd62a to ce5fced Compare April 5, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants