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

Implement tryceratops #2056

Closed
12 tasks done
sbrugman opened this issue Jan 21, 2023 · 14 comments
Closed
12 tasks done

Implement tryceratops #2056

sbrugman opened this issue Jan 21, 2023 · 14 comments
Labels
plugin Implementing a known but unsupported plugin

Comments

@sbrugman
Copy link
Contributor

sbrugman commented Jan 21, 2023

  • TC002: Create your own exception
  • TC003: Avoid specifying long messages outside the exception class
  • TC004: Prefer TypeError exception for invalid type
  • TC100: Check to continue
  • TC101: Too many try blocks
  • TC200: Use raise Exception from
  • TC201: Simply use raise
  • TC202: Don't ignore a broad exception without even logging
  • TC300: Consider adding an else block
  • TC301: Avoid direct raises in try body
  • TC400: Use logging .exception instead of .error
  • TC401: Do not log the exception object
@alonme
Copy link
Contributor

alonme commented Jan 21, 2023

Taking TC201

@sbrugman
Copy link
Contributor Author

For tracking: I'm working on TC004

@karpa4o4
Copy link
Contributor

@charliermarsh, i would like to do TC200.

@charliermarsh
Copy link
Member

Awesome -- thanks all! Will review as they come in :)

@charliermarsh charliermarsh added the plugin Implementing a known but unsupported plugin label Jan 22, 2023
charliermarsh pushed a commit that referenced this issue Jan 23, 2023
@karpa4o4
Copy link
Contributor

I'll take TC301 next.

@Flowake
Copy link
Contributor

Flowake commented Jan 23, 2023

I'd like to implement TC400, which would be my first rule so it might take a few days. Would that be fast enough ?

@charliermarsh
Copy link
Member

@Flowake - Sure! Take your time. Feel free to open a draft PR and ask questions there if you run into any.

@karpa4o4
Copy link
Contributor

I'll take TC002 next.

@bigluck
Copy link

bigluck commented Jan 26, 2023

Ciao, I'm testing the new implementation, but I'm getting this error: TRY300 Consider else block

Screenshot 2023-01-26 at 22 16 04

Isn't it a false positive?
Thanks so much

@charliermarsh
Copy link
Member

Hmm, comparing to the original plugin, I think what's incorrect is the highlighted region. It seems to want you to do this (omitting some intermediary lines since I had to copy from the screenshot :)):

try:
    assert isinstance(value, list) is False
except Exception as exc:
    msg = ""
    raise EnsureStrException(msg)
else:
    return str(value)

@charliermarsh
Copy link
Member

(Fixed in #2228.)

@bigluck
Copy link

bigluck commented Jan 26, 2023

Superb, thanks!

@jacopotagliabue
Copy link

@charliermarsh me and luca should buy you lunch in BKL - ping me on linkedin or whatever and I'm happy to buy you lunch. Thanks for all the great work!

@colin99d
Copy link
Contributor

colin99d commented Feb 19, 2023

Taking TC401 and TC202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin Implementing a known but unsupported plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants