ducminh-phan / reformat-gherkin

Formatter for Gherkin language
MIT License
24 stars 13 forks source link

Replace deprecated attrs "cmp" argument #20

Closed rayjolt closed 4 years ago

rayjolt commented 4 years ago

The "cmp" argument was deprecated in attrs 19.2.0 in favour of "eq" (see the changelog at [1]), so switch to using "eq" and update the minimum required attrs version.

At the moment, several deprecation warnings are displayed when running the tests. This pull request fixes all of those warnings.

[1] https://www.attrs.org/en/stable/changelog.html

rayjolt commented 4 years ago

It seems that the attrs MyPy stubs are picky about what overloads are allowed for attrib(). I'll see if I can find something that works.

rayjolt commented 4 years ago

I've worked out the immediate reason for the failure - the "eq" parameter isn't included in the overrides listed in the error message. However, in the stub file for the version of attrs listed in poetry.lock - 19.3.0 - both the "eq" and "order" parameters are included. I guess pre-commit must somehow be using an older version of attrs, but I'm not sure exactly how that works.

rayjolt commented 4 years ago

I just tried using the latest version of MyPy (0.750) locally, and that works fine. Just updating MyPy to 0.750 in .pre-commit-config.yaml doesn't work though. It must be the attrs stub file that is out of date, but I haven't worked out where MyPy is getting it from yet.

rayjolt commented 4 years ago

Solved it by manually specifying the attrs version in the pre-commit config.