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

ERA001: detect single-line code for try:, except:, etc. #10056

Closed
ottaviohartman opened this issue Feb 20, 2024 · 0 comments · Fixed by #10057
Closed

ERA001: detect single-line code for try:, except:, etc. #10056

ottaviohartman opened this issue Feb 20, 2024 · 0 comments · Fixed by #10057
Labels
rule Implementing or modifying a lint rule

Comments

@ottaviohartman
Copy link
Contributor

ottaviohartman commented Feb 20, 2024

❯ ruff --version
ruff 0.2.2

As discussed in #10055 , detect single-line code for the eradicate rule:

Example playground

# try:
# ^ works

# try:  # doesn't work

# try: print()
# ^ doesn't work

# same with except, which also doesn't correctly detect plain `expect:`

# except:
# ^ doesn't work

# except Foo:
# ^ works

# except Exception as e:
# ^ works

# except Exception as e: print()
# ^ doesn't work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants