python-trio / flake8-async

Highly opinionated linter for Trio code
https://flake8-async.readthedocs.io
MIT License
17 stars 2 forks source link

add ASYNC300 create-task-no-reference #256

Closed jakkdl closed 4 months ago

jakkdl commented 4 months ago

Fixes #207, originally requested by @alicederyn in https://github.com/Zac-HD/flake8-async-archive/issues/5

The doc and error message can probably be improved.

I went for quite comprehensive checks for possible ways of not using the value. I don't think ~anybody that installs this plugin would hit any of them, but if/when this gets packaged into ruff I could imagine one of the weirder corner cases getting hit.

jakkdl commented 4 months ago

whoa, slow tests found a crash! Somehow the value attribute of a cst.Attribute is neither cst.Attribute nor cst.Name. The docs do say that it can be any BaseExpression, but I'm failing to make sense of that. Time to dig into the mccabe==0.7.0 source code.

EDIT: ah, self.nodes[n1].append(n2)

jakkdl commented 4 months ago

and your changes look good too, thanks!