Skip to content

Instantly share code, notes, and snippets.

@mallamanis
Created April 30, 2020 18:11
Show Gist options
  • Save mallamanis/ad9c0baf38fc822d9fcfbe1de7f4920e to your computer and use it in GitHub Desktop.
Save mallamanis/ad9c0baf38fc822d9fcfbe1de7f4920e to your computer and use it in GitHub Desktop.
Prefer invocation to hash()
/**
* @name Use hash()
* @description use hash() instead of __hash__
* @kind problem
* @tags maintainability
* @problem.severity recommendation
* @sub-severity low
* @precision high
* @tags style
* @sub-severity low
* @id py/use-hash
*/
import python
from Call call
where
call.getFunc().(Attribute).getName() = "__hash__"
select call, "Use built-in hash() instead."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment