ansible-collections / news-for-maintainers

Announcements of changes impacting collection contributors and maintainers
27 stars 4 forks source link

ansible-test `unused-import` pylint rule to be enabled #34

Closed mattclay closed 5 months ago

mattclay commented 1 year ago

The pylint rule unused-import will be enabled for collections running devel sanity tests on Monday, February 13th.

This change is expected to report many errors (hundreds) on large collections. Most collections should expect at least a few errors. Due to the expected impact, advance notice is being given of this change.

Most reported errors will be easily resolved by removing the reported import(s). As a temporary measure, they can be added to the collection's tests/ignore-2.15.txt file:

plugins/modules/something.py pylint:unused-import 

However, there may be cases where the import must be kept. This is most likely in code providing compatibility between Python versions. In such cases, using an inline ignore is recommended instead:

import something  # pylint: disable=unused-import

The PR for this change can be found here: https://github.com/ansible/ansible/pull/79912

felixfontein commented 1 year ago

https://github.com/ansible/ansible/pull/79912 has been merged, i.e. the pylint rule is now active when using ansible-test from ansible-core's devel branch.