Skip to content

Fix the failure of ruff check in loongsuite instrumentations. #63

@Cirilla-zmh

Description

@Cirilla-zmh

Describe your environment

You could easily reproduce this issue by tox.

What happened?

Some code that does not conform to Python coding best practices has been detected. I have fixed the obvious parts, but there are still some issues whose impact cannot be fully assessed. Please, authors of the instrumentation code, provide some suggestions. It would be even better if these issues could be resolved.

To locate these issues, you can search for the keyword # FIXME ruff failed within the instrumentation-loongsuite directory — these are the places that need to be addressed.

Currently, I have bypassed the linting checks by adding # noqa, but this does not mean the code is correct — further evaluation is required.

  • If you have a valid reason to keep the code as is, you may retain the # noqa comment, remove the # FIXME comment, and add necessary comments explaining why the exception is justified.
  • If the issue is indeed caused by an improper design, please remove the # noqa comment after redesigning the relevant part. It is recommended to run tox -e precommit before submitting to check your code.

The instrumentation modules currently affected include:

  • loongsuite-instrumentation-agentscope
  • loongsuite-instrumentation-agno
  • loongsuite-instrumentation-dify
  • loongsuite-instrumentation-langchain
  • loongsuite-instrumentation-mcp

P.S. The # noqa is followed by ruff rules, which you could search on https://docs.astral.sh/ruff/rules/.
Here're the meaning of these rules:

  • A001 - Variable {name} is shadowing a Python builtin
  • A002 - Function argument {name} is shadowing a Python builtin
  • E402 - Module level import not at top of cell
  • E501 - Line too long ({width} > {limit})
  • F401 - {name} imported but unused; consider using importlib.util.find_spec to test for availability
  • F841 - Local variable {name} is assigned to but never used

cc @sipercai @undertaker86001 @hieheihei

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions