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

Support for Multi-line Code Snippets with #@ Marker #2566

Open
PeterHamfelt opened this issue Sep 19, 2024 · 0 comments
Open

Support for Multi-line Code Snippets with #@ Marker #2566

PeterHamfelt opened this issue Sep 19, 2024 · 0 comments

Comments

@PeterHamfelt
Copy link
Member

PeterHamfelt commented Sep 19, 2024

Steps to reproduce

  1. Write a multi-line code snippet (e.g., a Keras Sequential model definition) and place the #@ marker at the end of the line.
  2. Try splitting the code across multiple lines while keeping the #@ marker.
  3. Run the checker that leverages the #@ marker to see how nodes are created.

Current behavior

The code checker creates new nodes for each line when the #@ marker is used in multi-line code snippets, resulting in separate nodes rather than treating the code block as one unit. This reduces the clarity of scenarios and makes it challenging to handle more complex, multi-line code.

model = tf.keras.Sequential(layers=[
    tf.keras.layers.Dense(units=64, activation='relu'),
    tf.keras.layers.Dense(units=10)
])  #@

Additionally, having everything on a single line makes the code harder to read and maintain. For example, writing it all in one line like below is less readable and too long:

model = tf.keras.Sequential(layers=[tf.keras.layers.Dense(units=64, activation='relu'), tf.keras.layers.Dense(units=10)]) #@

Expected behavior

The code checker should treat multi-line code snippets marked with #@ as a single unit, allowing for improved readability and easier handling of more complex scenarios.

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

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

No branches or pull requests

1 participant