8000 fix: fmt by myfreess · Pull Request #2297 · moonbitlang/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: fmt #2297

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 1 commit into from
Jun 19, 2025
Merged

fix: fmt #2297

merged 1 commit into from
Jun 19, 2025

Conversation

myfreess
Copy link
Contributor

No description provided.

Copy link
peter-jerry-ye-code-review bot commented Jun 19, 2025
Inconsistent use of single-line vs multi-line closures across codebase

Category
Maintainability
Code Snippet
data.iter().each(k => s += " {k}")
Recommendation
Establish consistent guidelines for when to use single-line vs multi-line closures. For example:

  • Use single-line when the operation is simple and fits in <80 chars
  • Use multi-line when there are multiple statements or line length exceeds limit
    Reasoning
    While the changes make the code more concise, having inconsistent styles across the codebase can make it harder to maintain. Clear guidelines help developers make consistent choices.
Chain of method calls without line breaks may reduce readability

Category
Maintainability
Code Snippet
data.iter().each(k => s += " {k}")
Recommendation
Consider breaking long chains into multiple lines for better readability:

data
  .iter()
  .each(k => s += " \{k}")

Reasoning
While shorter code is often better, method chaining on a single line can become hard to read if there are many operations. Breaking into multiple lines improves scanability while maintaining the concise logic.

String concatenation in loops could be inefficient for large datasets

Category
Maintainability
Code Snippet
s += " {k},{v}"
Recommendation
Consider using a string builder or collecting into an array and joining at the end if this needs to handle large datasets
Reasoning
String concatenation in loops can lead to many intermediate string allocations. While fine for small test cases, this pattern could cause performance issues at scale.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 7374

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 93.678%

Totals Coverage Status
Change from base Build 7365: -0.001%
Covered Lines: 8624
Relevant Lines: 9206

💛 - Coveralls

@myfreess myfreess merged commit 5538908 into main Jun 19, 2025
12 of 16 checks passed
@myfreess myfreess deleted the myfreess/fmt branch June 19, 2025 05:31
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.

2 participants
0