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

[Enhancement]: Reimport and Unusedimport check in Resolver::import #102

Closed
He1pa opened this issue Jul 7, 2022 · 1 comment · Fixed by #160
Closed

[Enhancement]: Reimport and Unusedimport check in Resolver::import #102

He1pa opened this issue Jul 7, 2022 · 1 comment · Fixed by #160
Assignees
Labels
enhancement New feature or request error-handling Issues or PRs related to kcl error handling feat resolver tool Issues or PRs related to kcl tools inlucding format, lint, validation, document tools, etc.

Comments

@He1pa
Copy link
Contributor

He1pa commented Jul 7, 2022

Enhancement

KCLVM Resolver checking for import statements should be enhance. Need to check for user-defined but unused , and duplicate defined import statements. Prompting users to remove useless importstmt to improve compilation speed.

  • kcl code
import a
import a

schema Data:
    id: int = 1
  • The warning message like
KCL Warning [ReimportWarning]
---> File /path_to_file/main.k:2:1
1 |import a
a is reimported multiple times.

KCL Warning [UnusedImportWarning]
---> File /path_to_file/main.k:2:1
1 |import a
a imported but unused.
@He1pa He1pa added enhancement New feature or request tool Issues or PRs related to kcl tools inlucding format, lint, validation, document tools, etc. error-handling Issues or PRs related to kcl error handling feat resolver labels Jul 7, 2022
@He1pa He1pa added this to the v0.4.3 Release milestone Jul 7, 2022
@He1pa He1pa self-assigned this Jul 7, 2022
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 7, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning' and 'ReimportWarning',
2. Add 'check_unused_import()' method to Resolver and is called in the 'check()' method.
fix kcl-lang#102
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 7, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning' and 'ReimportWarning',
2. Add 'check_unused_import()' method to Resolver and is called in the 'check()' method.
fix kcl-lang#102
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 12, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning' and 'ReimportWarning',
2. Add 'check_unused_import()' method to Resolver and is called in the 'check_import()' method.
3. Add trait 'MutSelfWalker', which does not return value and does not modify AST when traversing AST, used for lint check.
fix kcl-lang#102
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 13, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning' and 'ReimportWarning',
2. Add 'check_unused_import()' method to Resolver and is called in the 'check_import()' method.
3. Add trait 'MutSelfWalker', which does not return value and does not modify AST when traversing AST, used for lint check.
fix kcl-lang#102
@He1pa He1pa changed the title Enhancement: Reimport and Unusedimport check in Resolver::import [Enhancement]: Reimport and Unusedimport check in Resolver::import Jul 13, 2022
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 15, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 15, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 18, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 21, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 21, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 25, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Jul 25, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 2, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 2, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 4, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 8, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 15, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 16, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 16, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 16, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
He1pa added a commit to He1pa/KCLVM that referenced this issue Aug 16, 2022
1. Add warning level diagnotics, including 'UnusedImportWarning', 'ReimportWarning' and 'ImportPostionWarning'

2. Add 'lint_check_module' method to Resolver and is called in the 'check()' method.

3. Add KCL Lint stuct, For details see issue kcl-lang#109

fix kcl-lang#102, kcl-lang#109
@Peefy Peefy linked a pull request Aug 25, 2022 that will close this issue
16 tasks
@Peefy
Copy link
Contributor

Peefy commented Aug 25, 2022

#160

@Peefy Peefy closed this as completed Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request error-handling Issues or PRs related to kcl error handling feat resolver tool Issues or PRs related to kcl tools inlucding format, lint, validation, document tools, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants