Skip to content

Instantly share code, notes, and snippets.

@bstaletic
Last active October 8, 2023 10:52
Show Gist options
  • Select an option

  • Save bstaletic/ef913d6df9b9eafc76a7d55ea4079a0c to your computer and use it in GitHub Desktop.

Select an option

Save bstaletic/ef913d6df9b9eafc76a7d55ea4079a0c to your computer and use it in GitHub Desktop.
lama.md

Completers

  • String statement has no effect - but was a "docstring" for a global variable
  • Consider f-string instead of manual format...
  • Consider x not in {a, b} instead of x != a and x != b
  • Consider raise NewException( ... ) from OldException
  • NamedTemporaryFile/urlopen/subprocess.Popen() - consider context manager - NamedTemporaryFile should have been!
  • Catching too wide exception type - Exception - bleh...
  • Override changes number of args.
  • Tuple unpacking - unused variables should be _
  • Redefining builtin range in function parameter.
  • Do not use len( list ) to check emptiness
  • Assing a return value of a function with no return - true, but intentional. It's just that such server has never come about.
  • Unnecessary lambda - just pass the function!
  • Eager formatting in logging - true.
  • Bad for loop - for idx in range( len( thing ) )
  • Deprecated logger.warn()
  • Too many args for logger.error()?
  • if a >= 0 and 0 <= b - simplify chained comparison between operands - HOW?
  • Using a possibly undefined variable!
  • Dead code detected!
  • Mutable default argument is dangerous.
  • class Foo(object) -> class Foo
  • Consider iterating with items() - actually a correct suggestion!

Tests

  • Mutable default argument is dangerous.
  • shared_app is global bun not initialized. True, but...
  • Consider raise NewException( ... ) from OldException
  • Using open for writing without specifying encoding.
  • Change not x != y to x == y
  • @patch breaks pylint parsing.
  • Tuple unpacking - unused variables should be _
  • For loop - unused variables should be _
  • Implicit string concatenation found
  • Member function foo(*args) should have self as the first argument.
  • Redefinition of a function - looks like a copy/paste error. Twice! Well, a bunch of times!
  • f-string insead of manual format
  • Missing abstract member function override? Must be wrong!
  • Unnecessary lambda - just pass the function!
  • Redefining builtin tuple/range in function parameter.
  • app.post_json( ... ).json assigned to nothing.
  • Calling requests.request without specifying a timeout.
  • Some W0640/E0601 that seem like false positives.

Other

  • Catching too why exception type - Exception - bleh...
  • Simplify x == a or x == b to x in {a, b}
  • f-string insead of manual format
  • Mutable default argument is dangerous.
  • import ycm_core as ycm_core - no rename
  • Use isinstance() rather than type() for a typecheck... No!
  • Redefining builtin range in function parameter.
  • Confusion about bottle - same thing as with @patch. Too much magic.

Scripts in root

  • Too many branches in FindLatestsMSVC
  • Optimize str.split('.')[0] to str.split('.', maxsplit=1)[0]!
  • Consider raise NewException( ... ) from OldException
  • Unable to import winreg - because I'm on linux.
  • Tuple unpacking - unused variables should be _
  • Trailing comma
  • open - consider context manager - NamedTemporaryFile should have been!
  • Using open for writing without specifying encoding.
  • Duplicate import
  • Unused import
  • Did you really want to compare with a callable? Yes... yes, I did.
  • f-string insead of manual format
  • Consider iterating with items() - actually a correct suggestion!
  • Redefining builtin dir in function parameter.
  • Too many return statements in UnicodeToUtf8.
  • Shadowing argument with local.
  • Using open for writing without specifying encoding.
@puremourning

Copy link
Copy Markdown

Thanks for reviewing these. I'll try to take a look soon. Still busy with kitchen stuff.

@puremourning

Copy link
Copy Markdown

But as I said before - happy to fix anything which is an actual problem, and use checker that reports only errors. Not super interested in more dogma/"consider this other thing which is essentially the same, but My Style Guru says it's Bettah". Seems like there's a mix here. Perhaps we can tune it, but it does look like a useful linter.

@bstaletic

Copy link
Copy Markdown
Author

Definitely a mixed bag. I do agree that we don't need a style guru. The pull request that I have opened should be just the interesting stuff, but very open to criticism.

@puremourning

Copy link
Copy Markdown

Oh cool. Didn’t see the PR yet! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment