algorandfoundation / algokit-python-template

Official AlgoKit template for smart contract development project using Algorand Python
5 stars 3 forks source link

Allow `extend-allowed-calls` for `algopy.GlobalState` #26

Open cusma opened 2 months ago

cusma commented 2 months ago

Problem

Declaring a bool as GlobalState (e.g. ):

self.foo = GlobalState(True, description="A boolean")

Raises the following error on linting: FBT003 Boolean positional value in function call

Solution

Add the following Ruff config to pyproject.toml (@daniel-makerx):

[tool.ruff.lint.flake8-boolean-trap]
extend-allowed-calls = ["algopy.GlobalState"]

Dependencies

Needs ruff >= 0.3.5 (to be bumped in AlgoKit init requirements, as is currently set as ruff = "^0.1.6").

aorumbayev commented 2 months ago

@daniel-makerx i suppose unless there is a way to ignore a specific rule in specific file (containing puya imports) the only workaround is to tweak the stub itself ?