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

Feature request: Run a linter during build command to spot and report possible parsing errors or warnings. #1037

Closed
MateuszMa opened this issue Jan 31, 2024 · 3 comments · May be fixed by #1039
Assignees
Labels
enhancement New feature or request

Comments

@MateuszMa
Copy link
Contributor

Description

This approach should ease the usage of ucc-gen and TA development in general, if there is no static analysis in place.

My suggestion is to use pylinter and connect this functionality with verbose mode - meaning that only when verbose mode is triggered the linter will show all found issues. Otherwise it will show a only a short summary_report in the same manner as files check.

test_addon/package/bin/api_call.py:20:11: W3101: Missing timeout argument for method 'requests.get' can cause your program to hang indefinitely (missing-timeout)
test_addon/package/bin/api_call.py:31:8: W0719: Raising too general exception: Exception (broad-exception-raised)
test_addon/package/bin/api_call.py:35:8: W0719: Raising too general exception: Exception (broad-exception-raised)
test_addon/package/bin/my_first_input.py:40:46: W0613: Unused argument 'api_key' (unused-argument)
test_addon/package/bin/my_first_input.py:54:4: W0246: Useless parent or super() delegation in method 'init' (useless-parent-delegation)
test_addon/package/bin/my_first_input.py:70:29: W0613: Unused argument 'definition' (unused-argument)
test_addon/package/bin/my_first_input.py:137:19: W0718: Catching too general exception Exception (broad-exception-caught)
test_addon/package/bin/my_first_input.py:7:0: W0611: Unused import import_declare_test (unused-import)
test_addon/package/bin/test2/test2_3.py:1:0: W0104: Statement seems to have no effect (pointless-statement)
test_addon/package/bin/test2/test2_3.py:1:0: E0602: Undefined variable 'test' (undefined-variable)
Python binaray static analysis: {'Errors': 1, 'Warnings': 9}

@MateuszMa MateuszMa added the enhancement New feature or request label Jan 31, 2024
@MateuszMa MateuszMa assigned MateuszMa and artemrys and unassigned MateuszMa and artemrys Jan 31, 2024
@MateuszMa
Copy link
Contributor Author

Thing to consider:
Stick only to parsing errors (instead of warnings and errors)
pylint library should be treated as optional and set as ucc depenedency.
The user might install it if interested

@MateuszMa MateuszMa linked a pull request Feb 1, 2024 that will close this issue
@artemrys
Copy link
Member

Thanks again for opening this feature request, I've been thinking about it for a while and I believe that checking for such issues is important but UCC may not be the best place for it.

We can extend our documentation to mention that TA developers should add checks to their development workflows.

@artemrys artemrys closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
@MateuszMa
Copy link
Contributor Author

Agreed, the linter run could be documented in the additional packaging section for UCC docs, with a code sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants