JelleZijlstra / autotyping

Automatically add simple type annotations to your code
222 stars 19 forks source link

Add `--int-param`, `--float-param`, `--str-param`, `--bytes-param` #9

Closed JelleZijlstra closed 3 years ago

JelleZijlstra commented 3 years ago

Similar to --bool-param. --int-param will autoannotate any param with an integer default as int.

Do we need separate options for each of these? I like it when I'm applying a change so I can keep my diff focused, but users may also want to just do everything. Maybe we should add an --all option that enables all boolean options.

orsinium commented 3 years ago

I think more scalable is to give every fixer a name (like "error code" in linters) and allow to enable/disable them in unified way.

The first approach is how it is done in golangci-lint, flake8, and other linters:

Another interesting approach is how I did in flakehell: Use + for "enable", - for "disable", and allow globs for plugins, and give priority to the last matching rule. For example, enable all plugins, except "return" ones but allow "return-none": --plugins='+*,-return-*,+return-none'.