Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pylint 2.12 issues #244

Closed
stanislavlevin opened this issue Feb 15, 2022 · 0 comments · Fixed by #245
Closed

pylint 2.12 issues #244

stanislavlevin opened this issue Feb 15, 2022 · 0 comments · Fixed by #245

Comments

@stanislavlevin
Copy link
Contributor

Pylint 2.12.2 reports several issues:

  • consider-using-f-string
  • redundant-u-string-prefix
  • use-dict-literal
  • unspecified-encoding
  • use-list-literal

pylint.log

stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
- f-strings are not mandatory
- format can be more readable
- there are 140 spotted issues

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
Pylint 2.10 introduced new checker `redundant-u-string-prefix`:
> Added redundant-u-string-prefix checker: Emitted when the u prefix is
  added to a string

https://pylint.pycqa.org/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-10-0
pylint-dev/pylint#4102

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
Pylint 2.10 introduced new checker use-dict-literal:
> Added use-dict-literal: Emitted when dict() is called with no
  arguments instead of using {}

https://pylint.pycqa.org/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-10-0
pylint-dev/pylint#4365

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
Pylint 2.10 introduced new checker unspecified-encoding:
> Added unspecified-encoding: Emitted when open() is called without
  specifying an encoding

https://pylint.pycqa.org/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-10-0
pylint-dev/pylint#3826
https://www.python.org/dev/peps/pep-0597/

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
Pylint 2.10 introduced new checker use-list-literal:
> Added use-list-literal: Emitted when list() is called with no
  arguments instead of using []

https://pylint.pycqa.org/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-10-0
pylint-dev/pylint#4365

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
https://pylint.pycqa.org/en/latest/user_guide/message-control.html#detecting-useless-disables:

> As pylint gets better and false positives are removed, disables that
  became useless can accumulate and clutter the code. In order to clean
  them you can enable the useless-suppression warning.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
https://pylint.pycqa.org/en/latest/user_guide/message-control.html#detecting-useless-disables:

> As pylint gets better and false positives are removed, disables that
  became useless can accumulate and clutter the code. In order to clean
  them you can enable the useless-suppression warning.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 15, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
- f-strings are not mandatory
- format can be more readable
- there are 140 spotted issues

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
Pylint 2.10 introduced new checkers:
> Emitted when using dict() to create an empty dictionary instead of the
  literal {}. The literal is faster as it avoids an additional function
  call.

> Emitted when using list() to create an empty list instead of the
  literal []. The literal is faster as it avoids an additional function
  call.

Too many unessential changes.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
Pylint 2.10 introduced new checker:
> It is better to specify an encoding when opening documents. Using the
  system default implicitly can create problems on other operating
  systems. See https://www.python.org/dev/peps/pep-0597/

According to that PEP:
> open(filename) isn't explicit about which encoding is expected:
  - If ASCII is assumed, this isn't a bug, but may result in decreased
    performance on Windows, particularly with non-Latin-1 locale
    encodings
  - If UTF-8 is assumed, this may be a bug or a platform-specific script
  - If the locale encoding is assumed, the behavior is as expected (but
    could change if future versions of Python modify the default)

IPA requires UTF-8 environments.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
https://pylint.pycqa.org/en/latest/user_guide/message-control.html#detecting-useless-disables:

> As pylint gets better and false positives are removed, disables that
  became useless can accumulate and clutter the code. In order to clean
  them you can enable the useless-suppression warning.

This doesn't enforce useless-suppression warnings as errors. The idea is
cleanup of these warings on every Pylint's bump.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
Pylint 2.10 introduced new checker `redundant-u-string-prefix`:
> Used when we detect a string with a u prefix. These prefixes were
  necessary in Python 2 to indicate a string was Unicode, but since Python
  3.0 strings are Unicode by default.

There are ~40 emitted warnings right now. They can be fixed on
refactorings without any rush.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
- f-strings are not mandatory
- format can be more readable
- there are 140 spotted issues

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
Pylint 2.10 introduced new checkers:
> Emitted when using dict() to create an empty dictionary instead of the
  literal {}. The literal is faster as it avoids an additional function
  call.

> Emitted when using list() to create an empty list instead of the
  literal []. The literal is faster as it avoids an additional function
  call.

Too many unessential changes.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
Pylint 2.10 introduced new checker:
> It is better to specify an encoding when opening documents. Using the
  system default implicitly can create problems on other operating
  systems. See https://www.python.org/dev/peps/pep-0597/

According to that PEP:
> open(filename) isn't explicit about which encoding is expected:
  - If ASCII is assumed, this isn't a bug, but may result in decreased
    performance on Windows, particularly with non-Latin-1 locale
    encodings
  - If UTF-8 is assumed, this may be a bug or a platform-specific script
  - If the locale encoding is assumed, the behavior is as expected (but
    could change if future versions of Python modify the default)

IPA requires UTF-8 environments.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
https://pylint.pycqa.org/en/latest/user_guide/message-control.html#detecting-useless-disables:

> As pylint gets better and false positives are removed, disables that
  became useless can accumulate and clutter the code. In order to clean
  them you can enable the useless-suppression warning.

This doesn't enforce useless-suppression warnings as errors. The idea is
cleanup of these warings on every Pylint's bump.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Feb 25, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
Pylint 2.10 introduced new checker `redundant-u-string-prefix`:
> Used when we detect a string with a u prefix. These prefixes were
  necessary in Python 2 to indicate a string was Unicode, but since Python
  3.0 strings are Unicode by default.

There are ~40 emitted warnings right now. They can be fixed on
refactorings without any rush.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
- f-strings are not mandatory
- format can be more readable
- there are 140 spotted issues

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
Pylint 2.10 introduced new checkers:
> Emitted when using dict() to create an empty dictionary instead of the
  literal {}. The literal is faster as it avoids an additional function
  call.

> Emitted when using list() to create an empty list instead of the
  literal []. The literal is faster as it avoids an additional function
  call.

Too many unessential changes.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
Pylint 2.10 introduced new checker:
> It is better to specify an encoding when opening documents. Using the
  system default implicitly can create problems on other operating
  systems. See https://www.python.org/dev/peps/pep-0597/

According to that PEP:
> open(filename) isn't explicit about which encoding is expected:
  - If ASCII is assumed, this isn't a bug, but may result in decreased
    performance on Windows, particularly with non-Latin-1 locale
    encodings
  - If UTF-8 is assumed, this may be a bug or a platform-specific script
  - If the locale encoding is assumed, the behavior is as expected (but
    could change if future versions of Python modify the default)

IPA requires UTF-8 environments.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
https://pylint.pycqa.org/en/latest/user_guide/message-control.html#detecting-useless-disables:

> As pylint gets better and false positives are removed, disables that
  became useless can accumulate and clutter the code. In order to clean
  them you can enable the useless-suppression warning.

This doesn't enforce useless-suppression warnings as errors. The idea is
cleanup of these warings on every Pylint's bump.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
Pylint 2.12.0 introduced new checker:
> Used when Pylint detects that collection literal comparison is being
  used to check for emptiness; Use implicit booleaness insteadof a
  collection classes; empty collections are considered as false

Comparison of variable to equality to collection:
> Lexicographical comparison between built-in collections works as follows:
  For two collections to compare equal, they must be of the same type,
  have the same length, and each pair of corresponding elements must
  compare equal (for example, [1,2] == (1,2) is false because the type is
  not the same).
  Collections that support order comparison are ordered the same as their
  first unequal elements (for example, [1,2,x] <= [1,2,y] has the same
  value as x <= y). If a corresponding element does not exist, the shorter
  collection is ordered first (for example, [1,2] < [1,2,3] is true).

So, `assert value == {}` is not the same as `assert not value`.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
Pylint 2.9 introduced new check:
> New checker consider-using-dict-items. Emitted when iterating over
dictionary keys and then indexing the same dictionary with the key
within loop body.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
stanislavlevin added a commit to stanislavlevin/freeipa-healthcheck that referenced this issue Mar 17, 2022
This is backport of
freeipa/freeipa@a1f0f27.

Fixes: freeipa#244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
Pylint 2.10 introduced new checker `redundant-u-string-prefix`:
> Used when we detect a string with a u prefix. These prefixes were
  necessary in Python 2 to indicate a string was Unicode, but since Python
  3.0 strings are Unicode by default.

There are ~40 emitted warnings right now. They can be fixed on
refactorings without any rush.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
- f-strings are not mandatory
- format can be more readable
- there are 140 spotted issues

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
Pylint 2.10 introduced new checkers:
> Emitted when using dict() to create an empty dictionary instead of the
  literal {}. The literal is faster as it avoids an additional function
  call.

> Emitted when using list() to create an empty list instead of the
  literal []. The literal is faster as it avoids an additional function
  call.

Too many unessential changes.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
Pylint 2.10 introduced new checker:
> It is better to specify an encoding when opening documents. Using the
  system default implicitly can create problems on other operating
  systems. See https://www.python.org/dev/peps/pep-0597/

According to that PEP:
> open(filename) isn't explicit about which encoding is expected:
  - If ASCII is assumed, this isn't a bug, but may result in decreased
    performance on Windows, particularly with non-Latin-1 locale
    encodings
  - If UTF-8 is assumed, this may be a bug or a platform-specific script
  - If the locale encoding is assumed, the behavior is as expected (but
    could change if future versions of Python modify the default)

IPA requires UTF-8 environments.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
https://pylint.pycqa.org/en/latest/user_guide/message-control.html#detecting-useless-disables:

> As pylint gets better and false positives are removed, disables that
  became useless can accumulate and clutter the code. In order to clean
  them you can enable the useless-suppression warning.

This doesn't enforce useless-suppression warnings as errors. The idea is
cleanup of these warings on every Pylint's bump.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
Pylint 2.12.0 introduced new checker:
> Used when Pylint detects that collection literal comparison is being
  used to check for emptiness; Use implicit booleaness insteadof a
  collection classes; empty collections are considered as false

Comparison of variable to equality to collection:
> Lexicographical comparison between built-in collections works as follows:
  For two collections to compare equal, they must be of the same type,
  have the same length, and each pair of corresponding elements must
  compare equal (for example, [1,2] == (1,2) is false because the type is
  not the same).
  Collections that support order comparison are ordered the same as their
  first unequal elements (for example, [1,2,x] <= [1,2,y] has the same
  value as x <= y). If a corresponding element does not exist, the shorter
  collection is ordered first (for example, [1,2] < [1,2,3] is true).

So, `assert value == {}` is not the same as `assert not value`.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
Pylint 2.9 introduced new check:
> New checker consider-using-dict-items. Emitted when iterating over
dictionary keys and then indexing the same dictionary with the key
within loop body.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
rcritten pushed a commit that referenced this issue Mar 24, 2022
This is backport of
freeipa/freeipa@a1f0f27.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
Pylint 2.10 introduced new checker `redundant-u-string-prefix`:
> Used when we detect a string with a u prefix. These prefixes were
  necessary in Python 2 to indicate a string was Unicode, but since Python
  3.0 strings are Unicode by default.

There are ~40 emitted warnings right now. They can be fixed on
refactorings without any rush.

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
- f-strings are not mandatory
- format can be more readable
- there are 140 spotted issues

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
Pylint 2.10 introduced new checkers:
> Emitted when using dict() to create an empty dictionary instead of the
  literal {}. The literal is faster as it avoids an additional function
  call.

> Emitted when using list() to create an empty list instead of the
  literal []. The literal is faster as it avoids an additional function
  call.

Too many unessential changes.

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
Pylint 2.10 introduced new checker:
> It is better to specify an encoding when opening documents. Using the
  system default implicitly can create problems on other operating
  systems. See https://www.python.org/dev/peps/pep-0597/

According to that PEP:
> open(filename) isn't explicit about which encoding is expected:
  - If ASCII is assumed, this isn't a bug, but may result in decreased
    performance on Windows, particularly with non-Latin-1 locale
    encodings
  - If UTF-8 is assumed, this may be a bug or a platform-specific script
  - If the locale encoding is assumed, the behavior is as expected (but
    could change if future versions of Python modify the default)

IPA requires UTF-8 environments.

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
https://pylint.pycqa.org/en/latest/user_guide/message-control.html#detecting-useless-disables:

> As pylint gets better and false positives are removed, disables that
  became useless can accumulate and clutter the code. In order to clean
  them you can enable the useless-suppression warning.

This doesn't enforce useless-suppression warnings as errors. The idea is
cleanup of these warings on every Pylint's bump.

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
Either Fedora's or PyPI's release of Pylint can break
ipa-healthcheck's CI. With this change only maintainers of
ipa-healthcheck can decide which version of Pylint the project
is compatible with.

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
Pylint 2.12.0 introduced new checker:
> Used when Pylint detects that collection literal comparison is being
  used to check for emptiness; Use implicit booleaness insteadof a
  collection classes; empty collections are considered as false

Comparison of variable to equality to collection:
> Lexicographical comparison between built-in collections works as follows:
  For two collections to compare equal, they must be of the same type,
  have the same length, and each pair of corresponding elements must
  compare equal (for example, [1,2] == (1,2) is false because the type is
  not the same).
  Collections that support order comparison are ordered the same as their
  first unequal elements (for example, [1,2,x] <= [1,2,y] has the same
  value as x <= y). If a corresponding element does not exist, the shorter
  collection is ordered first (for example, [1,2] < [1,2,3] is true).

So, `assert value == {}` is not the same as `assert not value`.

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
Pylint 2.9 introduced new check:
> New checker consider-using-dict-items. Emitted when iterating over
dictionary keys and then indexing the same dictionary with the key
within loop body.

Fixes: freeipa/freeipa-healthcheck#244
Signed-off-by: Stanislav Levin <[email protected]>
joeldavidparker added a commit to joeldavidparker/freeipa-healthcheck that referenced this issue Jun 24, 2022
rcritten added a commit to rcritten/freeipa-healthcheck that referenced this issue May 31, 2023
This is backport of
freeipa/freeipa@10e18c3

Fixes: freeipa#244

Signed-off-by: Rob Crittenden <[email protected]>
rcritten added a commit to rcritten/freeipa-healthcheck that referenced this issue May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant