You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2023/01/10 22:27:54 UTC

[GitHub] [tvm] cconvey opened a new issue, #13753: [Bug] TVMScript can interfere with pylint scoping

cconvey opened a new issue, #13753:
URL: https://github.com/apache/tvm/issues/13753

   As part of TVM's CI testing, some of TVM's Python code is checked using pylint.
   
   Pylint allows checks to be selectively enabled or disabled within specific syntactic scopes, using comments such as `# pylint: disable=...` and `# pylint: enable=...`. (See [here](https://pylint.pycqa.org/en/latest/user_guide/messages/message_control.html).)
   
   In certain circumstances, the use of `@tvm.script.ir_module` results in `# pylint: enable=...` commands to influence surrounding syntactic scopes.
   
   We'll use this code snippet as an example: 
   ``` python
   import tvm
   import tvm.script
   
   # pylint: disable=missing-function-docstring
   
   def foo():
   
       # a comment, but a non-comment statement also works here.
   
       @tvm.script.ir_module
       class Bar:
           # pylint: disable=missing-function-docstring
   
           print("Hello, world.")
           # pylint: enable=missing-function-docstring
   
       pass  # we need an actual statement here; a comment doesn't suffice
   ```
   
   I'm using the following comment to perform the linting.  (The command is like those issued during TVM's CI testing.) :
   ``` bash
   docker/bash.sh \
   --env CI \
   --env TVM_SHARD_INDEX \
   --env TVM_NUM_SHARDS \
   --env RUN_DISPLAY_URL \
   --env PLATFORM \
   --env SKIP_SLOW_TESTS \
   --env TEST_STEP_NAME \
   tlcpack/ci-lint:20220908-060034-62bdc91b1 \
   python3 -m pylint \
   tests/python/contrib/test_hexagon/test_pylint_tvmscript_bug.py \
   --rcfile=./tests/lint/pylintrc
   ```
   
   ### Expected behavior
   The output from pylint would contain no "missing-function-docstring" warnings.
   
   
   ### Actual behavior
   It produced this output instead:
   ```
   ...
   DOCKER CONTAINER NAME: tlcpack/ci-lint:20220908-060034-62bdc91b1
   
   Running 'python3 -m pylint tests/python/contrib/test_hexagon/test_pylint_tvmscript_bug.py --rcfile=./tests/lint/pylintrc' inside tlcpack/ci-lint:20220908-060034-62bdc91b1...
   mesg: ttyname failed: Inappropriate ioctl for device
   ************* Module test_hexagon.test_pylint_tvmscript_bug
   tests/python/contrib/test_hexagon/test_pylint_tvmscript_bug.py:1: [C0114(missing-module-docstring), ] Missing module docstring
   tests/python/contrib/test_hexagon/test_pylint_tvmscript_bug.py:7: [C0116(missing-function-docstring), foo] Missing function or method docstring
   tests/python/contrib/test_hexagon/test_pylint_tvmscript_bug.py:18: [W0107(unnecessary-pass), foo] Unnecessary pass statement
   tests/python/contrib/test_hexagon/test_pylint_tvmscript_bug.py:11: [W0612(unused-variable), foo.Bar] Unused variable 'Bar'
   
   ------------------------------------------------------------------
   Your code has been rated at 3.33/10 (previous run: 3.33/10, +0.00)
   ```
   
   ### Environment
   
   The environment is provided by the specified docker image.
   
   ### Steps to reproduce
   
   1. checkout and build TVM
   2. copy the code snippet shown above into the file `tests/python/contrib/test_hexagon/test_pylint_tvmscript_bug.py`.
   3. Run the `docker/bash.sh ...` command shown above.
   
   ### Triage
   
   * needs-triage
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] Hzfengsy commented on issue #13753: [Bug] TVMScript can interfere with pylint scoping

Posted by GitBox <gi...@apache.org>.
Hzfengsy commented on issue #13753:
URL: https://github.com/apache/tvm/issues/13753#issuecomment-1385414853

   cc @junrushao @cyx-6 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org