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

feat: impl format tool. #48

Merged
merged 1 commit into from
Jul 11, 2022
Merged

feat: impl format tool. #48

merged 1 commit into from
Jul 11, 2022

Conversation

Peefy
Copy link
Contributor

@Peefy Peefy commented May 26, 2022

Why

Formatting tool rewritten in Rust, Issue Number: #35. The original KCL formatting tool is written in python, which has low performance. It is rewritten using Rust tools according to the content of the route plan #29.

What

KCL Rust version of the Format tool, and provides format APIs to further build tools such as the format CLI

How

The Format tool is built based on AST Printer tool #5. The principle is to parse the code that needs to be formatted into AST through the parser, and then recursively traverse the AST to print it as KCL source code.

PR Merge Deps

#88 Merged

Tests

Unit Tests

src/tools/format/tests.rs - mainly unit tests for input and output comparison of code with different KCL syntax

Benchmark

image

@Peefy Peefy added tool Issues or PRs related to kcl tools inlucding format, lint, validation, document tools, etc. enhancement New feature or request feat labels May 27, 2022
@Peefy Peefy added this to the v0.4.3 Release milestone May 27, 2022
@Peefy Peefy linked an issue May 27, 2022 that may be closed by this pull request
@Peefy Peefy self-assigned this May 30, 2022
chai2010
chai2010 previously approved these changes Jun 8, 2022
Copy link
Contributor

@chai2010 chai2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@Peefy Peefy changed the title feat: impl format tool. WIP: feat: impl format tool. Jun 8, 2022
@Peefy Peefy requested a review from ldxdl June 15, 2022 13:50
@Peefy Peefy force-pushed the dev/peefy/format_tool branch from 96925e2 to 39e21ce Compare June 15, 2022 14:39
@Peefy Peefy force-pushed the dev/peefy/format_tool branch from 39e21ce to b719c3e Compare June 30, 2022 07:15
@Peefy Peefy changed the title WIP: feat: impl format tool. [WIP] feat: impl format tool. Jun 30, 2022
@coveralls
Copy link
Collaborator

coveralls commented Jul 1, 2022

Pull Request Test Coverage Report for Build 2609397302

  • 107 of 112 (95.54%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 41.052%

Changes Missing Coverage Covered Lines Changed/Added Lines %
kclvm/tools/src/format/tests.rs 54 55 98.18%
kclvm/tools/src/format/mod.rs 40 44 90.91%
Totals Coverage Status
Change from base Build 2587201011: 0.3%
Covered Lines: 15172
Relevant Lines: 36958

💛 - Coveralls

@Peefy Peefy changed the title [WIP] feat: impl format tool. feat: impl format tool. Jul 1, 2022
@Peefy Peefy changed the title feat: impl format tool. [WIP] feat: impl format tool. Jul 4, 2022
@Peefy Peefy force-pushed the dev/peefy/format_tool branch from b719c3e to ac55874 Compare July 4, 2022 10:21
@Peefy Peefy changed the title [WIP] feat: impl format tool. feat: impl format tool. Jul 5, 2022
Copy link
Contributor

@ldxdl ldxdl left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@zong-zhe zong-zhe left a comment

Choose a reason for hiding this comment

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

LGTM

@Peefy Peefy merged commit c4f9c9a into main Jul 11, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 11, 2022
@Peefy Peefy deleted the dev/peefy/format_tool branch July 13, 2022 02:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request feat tool Issues or PRs related to kcl tools inlucding format, lint, validation, document tools, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KCL Format tool (Rust ver.)
5 participants