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

Refactor: KCL Lint(Rust ver.) #160

Merged
merged 2 commits into from
Aug 23, 2022
Merged

Refactor: KCL Lint(Rust ver.) #160

merged 2 commits into from
Aug 23, 2022

Conversation

He1pa
Copy link
Contributor

@He1pa He1pa commented Aug 17, 2022

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

sema/lint
sema/resolver
ast/walker

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

Add Lint check in resolver. Main changes are:

  1. mode.rs: Definition of Linter, the entry for lint check
  2. combinedlintpass.rs: CombinedLintPass collects all the lints defined in the lints_def.rs
  3. lints_def.rs: Defined the various lints and the corresponding lintpasses implementation
  4. lintpass.rs: Definition of Lintpass
  5. lint.rs: Definition of Lint
  6. resolver/mode.rs: Call lint_check_module when recursively check the ast, and call lint_check_scope after check

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

6. Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Add Lint check in resolver. Main changes are:
1. mode.rs: Definition of `Linter`, the entry for lint check
2. combinedlintpass.rs: `CombinedLintPass` collects all the lints defined in the lints_def.rs
3. lints_def.rs: Defined the various lints and the corresponding lintpasses implementation
4. lintpass.rs: Definition of `Lintpass`
5. lint.rs: Definition of `Lint`
6. resolver/mode.rs: Call `lint_check_module` when recursively check the ast, and call `lint_check_scope` after check

re KusionStack#109
@coveralls
Copy link
Collaborator

coveralls commented Aug 17, 2022

Pull Request Test Coverage Report for Build 2879830177

  • 480 of 689 (69.67%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 59.223%

Changes Missing Coverage Covered Lines Changed/Added Lines %
kclvm/sema/src/lint/lintpass.rs 1 3 33.33%
kclvm/sema/src/lint/combinedlintpass.rs 8 13 61.54%
kclvm/sema/src/lint/mod.rs 267 272 98.16%
kclvm/ast/src/walker.rs 46 243 18.93%
Totals Coverage Status
Change from base Build 2873317284: 0.2%
Covered Lines: 21855
Relevant Lines: 36903

💛 - Coveralls

kclvm/sema/src/lint/mod.rs Show resolved Hide resolved
kclvm/sema/src/lint/mod.rs Show resolved Hide resolved
kclvm/sema/src/resolver/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

LGTM.

@zong-zhe zong-zhe self-requested a review August 23, 2022 03:05
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

@He1pa He1pa merged commit 9b8bbea into kcl-lang:main Aug 23, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 23, 2022
@Peefy Peefy linked an issue Aug 25, 2022 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Reimport and Unusedimport check in Resolver::import
4 participants