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

Merge use implicit booleaness like checks #8630

Conversation

Pierre-Sassoulas
Copy link
Member

Type of Changes

Type
🔨 Refactoring

Description

First step before #6870 and following #8592, just merging without modifying the messages or optimizing anything for now to make it more reviewable and validating the premises.

Refs #6871 #6870

@Pierre-Sassoulas Pierre-Sassoulas added the Maintenance Discussion or action around maintaining pylint or the dev workflow label Apr 26, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.0.0b1 milestone Apr 26, 2023
@Pierre-Sassoulas Pierre-Sassoulas changed the title Merge use implicite booleaness like checks Merge use implicit booleaness like checks Apr 26, 2023
@github-actions

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the merge-use-implicite-booleaness-like-checks branch from 838d8ff to 6f0ddf6 Compare April 27, 2023 11:31
Comment on lines 5 to 9
- ``compare-to-zero`` was renamed ``use-implicit-booleaness-not-comparison-to-zero``
and ``compare-to-empty-string`` was renamed ``use-implicit-booleaness-not-comparison-to-string``
and they now need to be enabled explicitly.
- The `pylint.extensions.emptystring`` and ``pylint.extensions.compare-to-zero`` extensions no longer exists and
needs to be removed from the ``load-plugins`` option.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really considering to make an update tool for configuration files, it's not a lot of work and will permit to make breaking changes with more serenity.

@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

Merging #8630 (2526ec9) into main (87fe5e5) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8630      +/-   ##
==========================================
- Coverage   95.81%   95.81%   -0.01%     
==========================================
  Files         174      172       -2     
  Lines       18337    18309      -28     
==========================================
- Hits        17570    17542      -28     
  Misses        767      767              
Impacted Files Coverage Δ
...heckers/refactoring/implicit_booleaness_checker.py 100.00% <100.00%> (ø)

@github-actions
Copy link
Contributor

🤖 Effect of this PR on checked open source code: 🤖

Effect on astroid:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-zero:
    "argindex == 0" can be simplified to "not argindex" as 0 is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/arguments.py#L196
  2. use-implicit-booleaness-not-comparison-to-string:
    "parts[0] == ''" can be simplified to "not parts[0]" as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/modutils.py#L430
  3. use-implicit-booleaness-not-comparison-to-string:
    "parts[starti] == ''" can be simplified to "not parts[starti]" as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/modutils.py#L436
  4. use-implicit-booleaness-not-comparison-to-zero:
    "last_index[names[0]] != 0" can be simplified to "last_index[names[0]]" as 0 is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/nodes/scoped_nodes/scoped_nodes.py#L142

The following messages are no longer emitted:

  1. compare-to-zero:
    "argindex == 0" can be simplified to "not argindex" as 0 is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/arguments.py#L196
  2. compare-to-empty-string:
    "parts[0] == ''" can be simplified to "not parts[0]" as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/modutils.py#L430
  3. compare-to-empty-string:
    "parts[starti] == ''" can be simplified to "not parts[starti]" as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/modutils.py#L436
  4. compare-to-zero:
    "last_index[names[0]] != 0" can be simplified to "last_index[names[0]]" as 0 is falsey
    https://github.com/pylint-dev/astroid/blob/da246398cb42c1c0509ce572cfb93b6bc1776c1a/astroid/nodes/scoped_nodes/scoped_nodes.py#L142

Effect on black:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "LL[string_idx - 1].value == ''" can be simplified to "not LL[string_idx - 1].value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/trans.py#L1101
  2. use-implicit-booleaness-not-comparison-to-string:
    "N.value == ''" can be simplified to "not N.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/trans.py#L1133
  3. use-implicit-booleaness-not-comparison-to-zero:
    "self._unmatched_lpars == 0" can be simplified to "not self._unmatched_lpars" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/trans.py#L2299
  4. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/linegen.py#L221
  5. use-implicit-booleaness-not-comparison-to-zero:
    "tail_len == 0" can be simplified to "not tail_len" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/linegen.py#L856
  6. use-implicit-booleaness-not-comparison-to-zero:
    "index == 0" can be simplified to "not index" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/linegen.py#L1146
  7. use-implicit-booleaness-not-comparison-to-zero:
    "len(back_slashes) % 2 == 0" can be simplified to "not len(back_slashes) % 2" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/strings.py#L264
  8. use-implicit-booleaness-not-comparison-to-zero:
    "self.bracket_tracker.depth == 0" can be simplified to "not self.bracket_tracker.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L101
  9. use-implicit-booleaness-not-comparison-to-zero:
    "len(self.leaves) == 0" can be simplified to "not len(self.leaves)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L195
  10. use-implicit-booleaness-not-comparison-to-zero:
    "leaf.lineno != 0" can be simplified to "leaf.lineno" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L280
  11. use-implicit-booleaness-not-comparison-to-zero:
    "leaf.lineno != 0" can be simplified to "leaf.lineno" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L282
  12. use-implicit-booleaness-not-comparison-to-zero:
    "current_line.depth == 0" can be simplified to "not current_line.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L570
  13. use-implicit-booleaness-not-comparison-to-zero:
    "before == 0" can be simplified to "not before" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L668
  14. use-implicit-booleaness-not-comparison-to-zero:
    "len(multiline_string_contexts) == 0" can be simplified to "not len(multiline_string_contexts)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L837
  15. use-implicit-booleaness-not-comparison-to-zero:
    "val == 0" can be simplified to "not val" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L840
  16. use-implicit-booleaness-not-comparison-to-string:
    "first.value == ''" can be simplified to "not first.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L759
  17. use-implicit-booleaness-not-comparison-to-string:
    "last.value == ''" can be simplified to "not last.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L762
  18. use-implicit-booleaness-not-comparison-to-string:
    "leaf.value == ''" can be simplified to "not leaf.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L771
  19. use-implicit-booleaness-not-comparison-to-string:
    "leaf.value == ''" can be simplified to "not leaf.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L775
  20. use-implicit-booleaness-not-comparison-to-zero:
    "self.depth == 0" can be simplified to "not self.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/brackets.py#L98
  21. use-implicit-booleaness-not-comparison-to-zero:
    "self.depth == 0" can be simplified to "not self.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/brackets.py#L119
  22. use-implicit-booleaness-not-comparison-to-zero:
    "len(nodes) == 0" can be simplified to "not len(nodes)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pytree.py#L948
  23. use-implicit-booleaness-not-comparison-to-zero:
    "len(nodes) == 0" can be simplified to "not len(nodes)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pytree.py#L953
  24. use-implicit-booleaness-not-comparison-to-zero:
    "len(alive_ilabels) == 0" can be simplified to "not len(alive_ilabels)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pgen2/parse.py#L119
  25. use-implicit-booleaness-not-comparison-to-zero:
    "x == 0" can be simplified to "not x" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pgen2/conv.py#L179
  26. use-implicit-booleaness-not-comparison-to-zero:
    "parenlev == 0" can be simplified to "not parenlev" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pgen2/tokenize.py#L485

The following messages are no longer emitted:

  1. compare-to-empty-string:
    "LL[string_idx - 1].value == ''" can be simplified to "not LL[string_idx - 1].value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/trans.py#L1101
  2. compare-to-empty-string:
    "N.value == ''" can be simplified to "not N.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/trans.py#L1133
  3. compare-to-zero:
    "self._unmatched_lpars == 0" can be simplified to "not self._unmatched_lpars" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/trans.py#L2299
  4. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/linegen.py#L221
  5. compare-to-zero:
    "tail_len == 0" can be simplified to "not tail_len" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/linegen.py#L856
  6. compare-to-zero:
    "index == 0" can be simplified to "not index" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/linegen.py#L1146
  7. compare-to-zero:
    "len(back_slashes) % 2 == 0" can be simplified to "not len(back_slashes) % 2" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/strings.py#L264
  8. compare-to-zero:
    "self.bracket_tracker.depth == 0" can be simplified to "not self.bracket_tracker.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L101
  9. compare-to-zero:
    "len(self.leaves) == 0" can be simplified to "not len(self.leaves)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L195
  10. compare-to-zero:
    "leaf.lineno != 0" can be simplified to "leaf.lineno" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L280
  11. compare-to-zero:
    "leaf.lineno != 0" can be simplified to "leaf.lineno" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L282
  12. compare-to-zero:
    "current_line.depth == 0" can be simplified to "not current_line.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L570
  13. compare-to-zero:
    "before == 0" can be simplified to "not before" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L668
  14. compare-to-zero:
    "len(multiline_string_contexts) == 0" can be simplified to "not len(multiline_string_contexts)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L837
  15. compare-to-zero:
    "val == 0" can be simplified to "not val" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/lines.py#L840
  16. compare-to-empty-string:
    "first.value == ''" can be simplified to "not first.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L759
  17. compare-to-empty-string:
    "last.value == ''" can be simplified to "not last.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L762
  18. compare-to-empty-string:
    "leaf.value == ''" can be simplified to "not leaf.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L771
  19. compare-to-empty-string:
    "leaf.value == ''" can be simplified to "not leaf.value" as an empty string is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/nodes.py#L775
  20. compare-to-zero:
    "self.depth == 0" can be simplified to "not self.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/brackets.py#L98
  21. compare-to-zero:
    "self.depth == 0" can be simplified to "not self.depth" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/black/brackets.py#L119
  22. compare-to-zero:
    "len(nodes) == 0" can be simplified to "not len(nodes)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pytree.py#L948
  23. compare-to-zero:
    "len(nodes) == 0" can be simplified to "not len(nodes)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pytree.py#L953
  24. compare-to-zero:
    "len(alive_ilabels) == 0" can be simplified to "not len(alive_ilabels)" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pgen2/parse.py#L119
  25. compare-to-zero:
    "x == 0" can be simplified to "not x" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pgen2/conv.py#L179
  26. compare-to-zero:
    "parenlev == 0" can be simplified to "not parenlev" as 0 is falsey
    https://github.com/psf/black/blob/de65741b8d49d78fa2675ef79b799cd35e92e7c1/src/blib2to3/pgen2/tokenize.py#L485

Effect on django:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "key == ''" can be simplified to "not key" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/views/i18n.py#L185
  2. use-implicit-booleaness-not-comparison-to-zero:
    "unmatched_open_brackets == 0" can be simplified to "not unmatched_open_brackets" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/admindocs/utils.py#L184
  3. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/admin/helpers.py#L150
  4. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/admin/helpers.py#L153
  5. use-implicit-booleaness-not-comparison-to-string:
    "salt != ''" can be simplified to "salt" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/hashers.py#L744
  6. use-implicit-booleaness-not-comparison-to-string:
    "salt != ''" can be simplified to "salt" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/hashers.py#L799
  7. use-implicit-booleaness-not-comparison-to-string:
    "username == ''" can be simplified to "not username" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/management/commands/createsuperuser.py#L117
  8. use-implicit-booleaness-not-comparison-to-string:
    "password.strip() == ''" can be simplified to "not password.strip()" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/management/commands/createsuperuser.py#L178
  9. use-implicit-booleaness-not-comparison-to-string:
    "raw_value == ''" can be simplified to "not raw_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/management/commands/createsuperuser.py#L256
  10. use-implicit-booleaness-not-comparison-to-zero:
    "delta.days == 0" can be simplified to "not delta.days" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L187
  11. use-implicit-booleaness-not-comparison-to-zero:
    "delta.days != 0" can be simplified to "delta.days" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L289
  12. use-implicit-booleaness-not-comparison-to-zero:
    "delta.seconds == 0" can be simplified to "not delta.seconds" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L295
  13. use-implicit-booleaness-not-comparison-to-zero:
    "delta.days != 0" can be simplified to "delta.days" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L307
  14. use-implicit-booleaness-not-comparison-to-zero:
    "delta.seconds == 0" can be simplified to "not delta.seconds" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L313
  15. use-implicit-booleaness-not-comparison-to-string:
    "r.new_path == ''" can be simplified to "not r.new_path" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/redirects/middleware.py#L45
  16. use-implicit-booleaness-not-comparison-to-zero:
    "expiry == 0" can be simplified to "not expiry" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/sessions/backends/base.py#L287
  17. use-implicit-booleaness-not-comparison-to-zero:
    "num_feat % progress_interval == 0" can be simplified to "not num_feat % progress_interval" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/utils/layermapping.py#L682
  18. use-implicit-booleaness-not-comparison-to-zero:
    "index == 0" can be simplified to "not index" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/point.py#L109
  19. use-implicit-booleaness-not-comparison-to-zero:
    "s == 0" can be simplified to "not s" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/geometry.py#L362
  20. use-implicit-booleaness-not-comparison-to-zero:
    "index == 0" can be simplified to "not index" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/polygon.py#L139
  21. use-implicit-booleaness-not-comparison-to-zero:
    "result == 0" can be simplified to "not result" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/prototypes/coordseq.py#L10
  22. use-implicit-booleaness-not-comparison-to-zero:
    "result == 0" can be simplified to "not result" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/prototypes/errcheck.py#L53
  23. use-implicit-booleaness-not-comparison-to-string:
    "geo_value == ''" can be simplified to "not geo_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/db/models/proxy.py#L40
  24. use-implicit-booleaness-not-comparison-to-zero:
    "z != 0.0" can be simplified to "z" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/db/models/functions.py#L518
  25. use-implicit-booleaness-not-comparison-to-string:
    "path == ''" can be simplified to "not path" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/staticfiles/views.py#L35
  26. use-implicit-booleaness-not-comparison-to-zero:
    "len(bits) % 2 == 0" can be simplified to "not len(bits) % 2" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/flatpages/templatetags/flatpages.py#L81
  27. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L253
  28. use-implicit-booleaness-not-comparison-to-string:
    "v == ''" can be simplified to "not v" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L546
  29. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L561
  30. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L739
  31. use-implicit-booleaness-not-comparison-to-string:
    "y == m == d == ''" can be simplified to "not d" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L1156
  32. use-implicit-booleaness-not-comparison-to-zero:
    "value != 0" can be simplified to "value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/timesince.py#L119
  33. use-implicit-booleaness-not-comparison-to-zero:
    "value == 0" can be simplified to "not value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/timesince.py#L128
  34. use-implicit-booleaness-not-comparison-to-string:
    "number == ''" can be simplified to "not number" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/numberformat.py#L28
  35. use-implicit-booleaness-not-comparison-to-zero:
    "grouping != 0" can be simplified to "grouping" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/numberformat.py#L34
  36. use-implicit-booleaness-not-comparison-to-zero:
    "space == 0" can be simplified to "not space" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/text.py#L52
  37. use-implicit-booleaness-not-comparison-to-zero:
    "space == 0" can be simplified to "not space" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/text.py#L54
  38. use-implicit-booleaness-not-comparison-to-zero:
    "truncate_len == 0" can be simplified to "not truncate_len" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/text.py#L107
  39. use-implicit-booleaness-not-comparison-to-zero:
    "count == 0" can be simplified to "not count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/inspect.py#L69
  40. use-implicit-booleaness-not-comparison-to-string:
    "text == ''" can be simplified to "not text" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/termcolors.py#L49
  41. use-implicit-booleaness-not-comparison-to-zero:
    "i != 0" can be simplified to "i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/http.py#L172
  42. use-implicit-booleaness-not-comparison-to-zero:
    "version[4] == 0" can be simplified to "not version[4]" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/version.py#L34
  43. use-implicit-booleaness-not-comparison-to-zero:
    "version[2] == 0" can be simplified to "not version[2]" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/version.py#L49
  44. use-implicit-booleaness-not-comparison-to-zero:
    "self.data.minute == 0" can be simplified to "not self.data.minute" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/dateformat.py#L151
  45. use-implicit-booleaness-not-comparison-to-zero:
    "self.data.hour == 0" can be simplified to "not self.data.hour" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/dateformat.py#L151
  46. use-implicit-booleaness-not-comparison-to-zero:
    "self.data.minute == 0" can be simplified to "not self.data.minute" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/dateformat.py#L153
  47. use-implicit-booleaness-not-comparison-to-zero:
    "count == 0" can be simplified to "not count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/regex_helper.py#L166
  48. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/lorem_ipsum.py#L262
  49. use-implicit-booleaness-not-comparison-to-string:
    "subpath == ''" can be simplified to "not subpath" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/apps/registry.py#L265
  50. use-implicit-booleaness-not-comparison-to-zero:
    "token_type == 0" can be simplified to "not token_type" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/template/base.py#L470
  51. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/template/defaulttags.py#L213
  52. use-implicit-booleaness-not-comparison-to-zero:
    "int(value) % int(arg) == 0" can be simplified to "not int(value) % int(arg)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/template/defaultfilters.py#L843
  53. use-implicit-booleaness-not-comparison-to-zero:
    "round(abs(self.val - other), self.places) == 0" can be simplified to "not round(abs(self.val - other), self.places)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/utils.py#L67
  54. use-implicit-booleaness-not-comparison-to-zero:
    "real_count != 0" can be simplified to "real_count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/testcases.py#L537
  55. use-implicit-booleaness-not-comparison-to-zero:
    "real_count != 0" can be simplified to "real_count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/testcases.py#L903
  56. use-implicit-booleaness-not-comparison-to-zero:
    "self.port == 0" can be simplified to "not self.port" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/testcases.py#L1609
  57. use-implicit-booleaness-not-comparison-to-zero:
    "self._content_length == 0" can be simplified to "not self._content_length" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/http/multipartparser.py#L145
  58. use-implicit-booleaness-not-comparison-to-zero:
    "remaining != 0" can be simplified to "remaining" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/http/multipartparser.py#L308
  59. use-implicit-booleaness-not-comparison-to-zero:
    "remaining != 0" can be simplified to "remaining" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/http/multipartparser.py#L452
  60. use-implicit-booleaness-not-comparison-to-zero:
    "s == 0" can be simplified to "not s" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/signing.py#L67
  61. use-implicit-booleaness-not-comparison-to-zero:
    "self.count == 0" can be simplified to "not self.count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/paginator.py#L116
  62. use-implicit-booleaness-not-comparison-to-zero:
    "self.paginator.count == 0" can be simplified to "not self.paginator.count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/paginator.py#L226
  63. use-implicit-booleaness-not-comparison-to-zero:
    "len(path_segments) == 0" can be simplified to "not len(path_segments)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/files/storage/memory.py#L122
  64. use-implicit-booleaness-not-comparison-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/base.py#L92
  65. use-implicit-booleaness-not-comparison-to-zero:
    "self._cull_frequency == 0" can be simplified to "not self._cull_frequency" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/db.py#L257
  66. use-implicit-booleaness-not-comparison-to-zero:
    "int(timeout) == 0" can be simplified to "not int(timeout)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/memcached.py#L53
  67. use-implicit-booleaness-not-comparison-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/memcached.py#L163
  68. use-implicit-booleaness-not-comparison-to-zero:
    "self._cull_frequency == 0" can be simplified to "not self._cull_frequency" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/locmem.py#L92
  69. use-implicit-booleaness-not-comparison-to-zero:
    "self._cull_frequency == 0" can be simplified to "not self._cull_frequency" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/filebased.py#L109
  70. use-implicit-booleaness-not-comparison-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/redis.py#L90
  71. use-implicit-booleaness-not-comparison-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/redis.py#L105
  72. use-implicit-booleaness-not-comparison-to-zero:
    "visible_issue_count == 0" can be simplified to "not visible_issue_count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/base.py#L547
  73. use-implicit-booleaness-not-comparison-to-zero:
    "s_opt.nargs != 0" can be simplified to "s_opt.nargs" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/__init__.py#L333
  74. use-implicit-booleaness-not-comparison-to-zero:
    "objects_in_fixture == 0" can be simplified to "not objects_in_fixture" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/commands/loaddata.py#L274
  75. use-implicit-booleaness-not-comparison-to-zero:
    "len(leaf_migration_nodes) == 0" can be simplified to "not len(leaf_migration_nodes)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/commands/makemigrations.py#L268
  76. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/commands/compilemessages.py#L174
  77. use-implicit-booleaness-not-comparison-to-string:
    "lookup_value == ''" can be simplified to "not lookup_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/base.py#L1314
  78. use-implicit-booleaness-not-comparison-to-zero:
    "self.start.value == 0" can be simplified to "not self.start.value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/expressions.py#L1820
  79. use-implicit-booleaness-not-comparison-to-zero:
    "self.end.value == 0" can be simplified to "not self.end.value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/expressions.py#L1827
  80. use-implicit-booleaness-not-comparison-to-string:
    "lookup_value == ''" can be simplified to "not lookup_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/constraints.py#L385
  81. use-implicit-booleaness-not-comparison-to-string:
    "val == ''" can be simplified to "not val" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related_descriptors.py#L680
  82. use-implicit-booleaness-not-comparison-to-string:
    "self.path != ''" can be simplified to "self.path" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/__init__.py#L1913
  83. use-implicit-booleaness-not-comparison-to-string:
    "default == ''" can be simplified to "not default" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/__init__.py#L2635
  84. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related.py#L1141
  85. use-implicit-booleaness-not-comparison-to-zero:
    "seen_from == 0" can be simplified to "not seen_from" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related.py#L1583
  86. use-implicit-booleaness-not-comparison-to-zero:
    "seen_to == 0" can be simplified to "not seen_to" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related.py#L1583
  87. use-implicit-booleaness-not-comparison-to-string:
    "lookup.rhs == ''" can be simplified to "not lookup.rhs" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L1311
  88. use-implicit-booleaness-not-comparison-to-zero:
    "pos == 0" can be simplified to "not pos" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L1639
  89. use-implicit-booleaness-not-comparison-to-zero:
    "self.low_mark != 0" can be simplified to "self.low_mark" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L2050
  90. use-implicit-booleaness-not-comparison-to-zero:
    "pos == 0" can be simplified to "not pos" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L2263
  91. use-implicit-booleaness-not-comparison-to-zero:
    "empty_needed == 0" can be simplified to "not empty_needed" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/where.py#L161
  92. use-implicit-booleaness-not-comparison-to-zero:
    "full_needed == 0" can be simplified to "not full_needed" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/where.py#L166
  93. use-implicit-booleaness-not-comparison-to-zero:
    "self.query.alias_refcount[a] == 0" can be simplified to "not self.query.alias_refcount[a]" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/compiler.py#L71
  94. use-implicit-booleaness-not-comparison-to-zero:
    "index % 2 == 0" can be simplified to "not index % 2" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/functions/comparison.py#L165
  95. use-implicit-booleaness-not-comparison-to-zero:
    "braces_deep == 0" can be simplified to "not braces_deep" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/sqlite3/introspection.py#L183
  96. use-implicit-booleaness-not-comparison-to-zero:
    "scale == 0" can be simplified to "not scale" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/oracle/base.py#L446
  97. use-implicit-booleaness-not-comparison-to-zero:
    "precision == 0" can be simplified to "not precision" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/oracle/base.py#L460
  98. use-implicit-booleaness-not-comparison-to-zero:
    "scale == 0" can be simplified to "not scale" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/oracle/introspection.py#L57
  99. use-implicit-booleaness-not-comparison-to-string:
    "settings_dict['NAME'] == ''" can be simplified to "not settings_dict['NAME']" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/postgresql/base.py#L193
  100. use-implicit-booleaness-not-comparison-to-zero:
    "value == 0" can be simplified to "not value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/mysql/operations.py#L249
  101. use-implicit-booleaness-not-comparison-to-zero:
    "count == 0" can be simplified to "not count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/base/features.py#L388
  102. use-implicit-booleaness-not-comparison-to-zero:
    "start == 0" can be simplified to "not start" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/base/operations.py#L712
  103. use-implicit-booleaness-not-comparison-to-zero:
    "end == 0" can be simplified to "not end" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/base/operations.py#L723
  104. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/migrations/autodetector.py#L1714
  105. use-implicit-booleaness-not-comparison-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/migrations/autodetector.py#L1719
  106. use-implicit-booleaness-not-comparison-to-string:
    "request_csrf_token == ''" can be simplified to "not request_csrf_token" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/middleware/csrf.py#L375
  107. use-implicit-booleaness-not-comparison-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/middleware/cache.py#L113

The following messages are no longer emitted:

  1. compare-to-empty-string:
    "key == ''" can be simplified to "not key" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/views/i18n.py#L185
  2. compare-to-zero:
    "unmatched_open_brackets == 0" can be simplified to "not unmatched_open_brackets" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/admindocs/utils.py#L184
  3. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/admin/helpers.py#L150
  4. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/admin/helpers.py#L153
  5. compare-to-empty-string:
    "salt != ''" can be simplified to "salt" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/hashers.py#L744
  6. compare-to-empty-string:
    "salt != ''" can be simplified to "salt" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/hashers.py#L799
  7. compare-to-empty-string:
    "username == ''" can be simplified to "not username" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/management/commands/createsuperuser.py#L117
  8. compare-to-empty-string:
    "password.strip() == ''" can be simplified to "not password.strip()" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/management/commands/createsuperuser.py#L178
  9. compare-to-empty-string:
    "raw_value == ''" can be simplified to "not raw_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/auth/management/commands/createsuperuser.py#L256
  10. compare-to-zero:
    "delta.days == 0" can be simplified to "not delta.days" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L187
  11. compare-to-zero:
    "delta.days != 0" can be simplified to "delta.days" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L289
  12. compare-to-zero:
    "delta.seconds == 0" can be simplified to "not delta.seconds" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L295
  13. compare-to-zero:
    "delta.days != 0" can be simplified to "delta.days" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L307
  14. compare-to-zero:
    "delta.seconds == 0" can be simplified to "not delta.seconds" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/humanize/templatetags/humanize.py#L313
  15. compare-to-empty-string:
    "r.new_path == ''" can be simplified to "not r.new_path" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/redirects/middleware.py#L45
  16. compare-to-zero:
    "expiry == 0" can be simplified to "not expiry" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/sessions/backends/base.py#L287
  17. compare-to-zero:
    "num_feat % progress_interval == 0" can be simplified to "not num_feat % progress_interval" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/utils/layermapping.py#L682
  18. compare-to-zero:
    "index == 0" can be simplified to "not index" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/point.py#L109
  19. compare-to-zero:
    "s == 0" can be simplified to "not s" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/geometry.py#L362
  20. compare-to-zero:
    "index == 0" can be simplified to "not index" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/polygon.py#L139
  21. compare-to-zero:
    "result == 0" can be simplified to "not result" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/prototypes/coordseq.py#L10
  22. compare-to-zero:
    "result == 0" can be simplified to "not result" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/geos/prototypes/errcheck.py#L53
  23. compare-to-empty-string:
    "geo_value == ''" can be simplified to "not geo_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/db/models/proxy.py#L40
  24. compare-to-zero:
    "z != 0.0" can be simplified to "z" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/gis/db/models/functions.py#L518
  25. compare-to-empty-string:
    "path == ''" can be simplified to "not path" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/staticfiles/views.py#L35
  26. compare-to-zero:
    "len(bits) % 2 == 0" can be simplified to "not len(bits) % 2" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/contrib/flatpages/templatetags/flatpages.py#L81
  27. compare-to-empty-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L253
  28. compare-to-empty-string:
    "v == ''" can be simplified to "not v" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L546
  29. compare-to-empty-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L561
  30. compare-to-empty-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L739
  31. compare-to-empty-string:
    "y == m == d == ''" can be simplified to "not d" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/forms/widgets.py#L1156
  32. compare-to-zero:
    "value != 0" can be simplified to "value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/timesince.py#L119
  33. compare-to-zero:
    "value == 0" can be simplified to "not value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/timesince.py#L128
  34. compare-to-empty-string:
    "number == ''" can be simplified to "not number" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/numberformat.py#L28
  35. compare-to-zero:
    "grouping != 0" can be simplified to "grouping" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/numberformat.py#L34
  36. compare-to-zero:
    "space == 0" can be simplified to "not space" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/text.py#L52
  37. compare-to-zero:
    "space == 0" can be simplified to "not space" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/text.py#L54
  38. compare-to-zero:
    "truncate_len == 0" can be simplified to "not truncate_len" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/text.py#L107
  39. compare-to-zero:
    "count == 0" can be simplified to "not count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/inspect.py#L69
  40. compare-to-empty-string:
    "text == ''" can be simplified to "not text" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/termcolors.py#L49
  41. compare-to-zero:
    "i != 0" can be simplified to "i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/http.py#L172
  42. compare-to-zero:
    "version[4] == 0" can be simplified to "not version[4]" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/version.py#L34
  43. compare-to-zero:
    "version[2] == 0" can be simplified to "not version[2]" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/version.py#L49
  44. compare-to-zero:
    "self.data.minute == 0" can be simplified to "not self.data.minute" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/dateformat.py#L151
  45. compare-to-zero:
    "self.data.hour == 0" can be simplified to "not self.data.hour" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/dateformat.py#L151
  46. compare-to-zero:
    "self.data.minute == 0" can be simplified to "not self.data.minute" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/dateformat.py#L153
  47. compare-to-zero:
    "count == 0" can be simplified to "not count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/regex_helper.py#L166
  48. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/utils/lorem_ipsum.py#L262
  49. compare-to-empty-string:
    "subpath == ''" can be simplified to "not subpath" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/apps/registry.py#L265
  50. compare-to-zero:
    "token_type == 0" can be simplified to "not token_type" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/template/base.py#L470
  51. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/template/defaulttags.py#L213
  52. compare-to-zero:
    "int(value) % int(arg) == 0" can be simplified to "not int(value) % int(arg)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/template/defaultfilters.py#L843
  53. compare-to-zero:
    "round(abs(self.val - other), self.places) == 0" can be simplified to "not round(abs(self.val - other), self.places)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/utils.py#L67
  54. compare-to-zero:
    "real_count != 0" can be simplified to "real_count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/testcases.py#L537
  55. compare-to-zero:
    "real_count != 0" can be simplified to "real_count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/testcases.py#L903
  56. compare-to-zero:
    "self.port == 0" can be simplified to "not self.port" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/test/testcases.py#L1609
  57. compare-to-zero:
    "self._content_length == 0" can be simplified to "not self._content_length" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/http/multipartparser.py#L145
  58. compare-to-zero:
    "remaining != 0" can be simplified to "remaining" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/http/multipartparser.py#L308
  59. compare-to-zero:
    "remaining != 0" can be simplified to "remaining" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/http/multipartparser.py#L452
  60. compare-to-zero:
    "s == 0" can be simplified to "not s" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/signing.py#L67
  61. compare-to-zero:
    "self.count == 0" can be simplified to "not self.count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/paginator.py#L116
  62. compare-to-zero:
    "self.paginator.count == 0" can be simplified to "not self.paginator.count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/paginator.py#L226
  63. compare-to-zero:
    "len(path_segments) == 0" can be simplified to "not len(path_segments)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/files/storage/memory.py#L122
  64. compare-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/base.py#L92
  65. compare-to-zero:
    "self._cull_frequency == 0" can be simplified to "not self._cull_frequency" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/db.py#L257
  66. compare-to-zero:
    "int(timeout) == 0" can be simplified to "not int(timeout)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/memcached.py#L53
  67. compare-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/memcached.py#L163
  68. compare-to-zero:
    "self._cull_frequency == 0" can be simplified to "not self._cull_frequency" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/locmem.py#L92
  69. compare-to-zero:
    "self._cull_frequency == 0" can be simplified to "not self._cull_frequency" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/filebased.py#L109
  70. compare-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/redis.py#L90
  71. compare-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/cache/backends/redis.py#L105
  72. compare-to-zero:
    "visible_issue_count == 0" can be simplified to "not visible_issue_count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/base.py#L547
  73. compare-to-zero:
    "s_opt.nargs != 0" can be simplified to "s_opt.nargs" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/__init__.py#L333
  74. compare-to-zero:
    "objects_in_fixture == 0" can be simplified to "not objects_in_fixture" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/commands/loaddata.py#L274
  75. compare-to-zero:
    "len(leaf_migration_nodes) == 0" can be simplified to "not len(leaf_migration_nodes)" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/commands/makemigrations.py#L268
  76. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/core/management/commands/compilemessages.py#L174
  77. compare-to-empty-string:
    "lookup_value == ''" can be simplified to "not lookup_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/base.py#L1314
  78. compare-to-zero:
    "self.start.value == 0" can be simplified to "not self.start.value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/expressions.py#L1820
  79. compare-to-zero:
    "self.end.value == 0" can be simplified to "not self.end.value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/expressions.py#L1827
  80. compare-to-empty-string:
    "lookup_value == ''" can be simplified to "not lookup_value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/constraints.py#L385
  81. compare-to-empty-string:
    "val == ''" can be simplified to "not val" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related_descriptors.py#L680
  82. compare-to-empty-string:
    "self.path != ''" can be simplified to "self.path" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/__init__.py#L1913
  83. compare-to-empty-string:
    "default == ''" can be simplified to "not default" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/__init__.py#L2635
  84. compare-to-empty-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related.py#L1141
  85. compare-to-zero:
    "seen_from == 0" can be simplified to "not seen_from" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related.py#L1583
  86. compare-to-zero:
    "seen_to == 0" can be simplified to "not seen_to" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/fields/related.py#L1583
  87. compare-to-empty-string:
    "lookup.rhs == ''" can be simplified to "not lookup.rhs" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L1311
  88. compare-to-zero:
    "pos == 0" can be simplified to "not pos" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L1639
  89. compare-to-zero:
    "self.low_mark != 0" can be simplified to "self.low_mark" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L2050
  90. compare-to-zero:
    "pos == 0" can be simplified to "not pos" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/query.py#L2263
  91. compare-to-zero:
    "empty_needed == 0" can be simplified to "not empty_needed" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/where.py#L161
  92. compare-to-zero:
    "full_needed == 0" can be simplified to "not full_needed" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/where.py#L166
  93. compare-to-zero:
    "self.query.alias_refcount[a] == 0" can be simplified to "not self.query.alias_refcount[a]" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/sql/compiler.py#L71
  94. compare-to-zero:
    "index % 2 == 0" can be simplified to "not index % 2" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/models/functions/comparison.py#L165
  95. compare-to-zero:
    "braces_deep == 0" can be simplified to "not braces_deep" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/sqlite3/introspection.py#L183
  96. compare-to-zero:
    "scale == 0" can be simplified to "not scale" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/oracle/base.py#L446
  97. compare-to-zero:
    "precision == 0" can be simplified to "not precision" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/oracle/base.py#L460
  98. compare-to-zero:
    "scale == 0" can be simplified to "not scale" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/oracle/introspection.py#L57
  99. compare-to-empty-string:
    "settings_dict['NAME'] == ''" can be simplified to "not settings_dict['NAME']" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/postgresql/base.py#L193
  100. compare-to-zero:
    "value == 0" can be simplified to "not value" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/mysql/operations.py#L249
  101. compare-to-zero:
    "count == 0" can be simplified to "not count" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/base/features.py#L388
  102. compare-to-zero:
    "start == 0" can be simplified to "not start" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/base/operations.py#L712
  103. compare-to-zero:
    "end == 0" can be simplified to "not end" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/backends/base/operations.py#L723
  104. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/migrations/autodetector.py#L1714
  105. compare-to-zero:
    "i == 0" can be simplified to "not i" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/db/migrations/autodetector.py#L1719
  106. compare-to-empty-string:
    "request_csrf_token == ''" can be simplified to "not request_csrf_token" as an empty string is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/middleware/csrf.py#L375
  107. compare-to-zero:
    "timeout == 0" can be simplified to "not timeout" as 0 is falsey
    https://github.com/django/django/blob/7d0e56620882c207998a41ac07ec5da572045b31/django/middleware/cache.py#L113

Effect on flask:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-zero:
    "total_found == 0" can be simplified to "not total_found" as 0 is falsey
    https://github.com/pallets/flask/blob/5f4072423ec6ee0c71d5995bec41e59d044e7737/src/flask/debughelpers.py#L145
  2. use-implicit-booleaness-not-comparison-to-zero:
    "port == 0" can be simplified to "not port" as 0 is falsey
    https://github.com/pallets/flask/blob/5f4072423ec6ee0c71d5995bec41e59d044e7737/src/flask/app.py#L873

The following messages are no longer emitted:

  1. compare-to-zero:
    "total_found == 0" can be simplified to "not total_found" as 0 is falsey
    https://github.com/pallets/flask/blob/5f4072423ec6ee0c71d5995bec41e59d044e7737/src/flask/debughelpers.py#L145
  2. compare-to-zero:
    "port == 0" can be simplified to "not port" as 0 is falsey
    https://github.com/pallets/flask/blob/5f4072423ec6ee0c71d5995bec41e59d044e7737/src/flask/app.py#L873

Effect on music21:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "value != ''" can be simplified to "value" as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/1573e3708232d4d45e50e14fa98931d85919838d/music21/environment.py#L229
  2. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value" as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/1573e3708232d4d45e50e14fa98931d85919838d/music21/environment.py#L254
  3. use-implicit-booleaness-not-comparison-to-zero:
    "len(os.listdir(newTempDir)) == 0" can be simplified to "not len(os.listdir(newTempDir))" as 0 is falsey
    https://github.com/cuthbertLab/music21/blob/1573e3708232d4d45e50e14fa98931d85919838d/music21/environment.py#L1642
  4. use-implicit-booleaness-not-comparison-to-zero:
    *"RepeatFinder(s).getQuarterLengthOfPickupMeasure() != 0" can be simplified to "RepeatFinder(s).getQuarterLengthO...

This comment was truncated because GitHub allows only 65536 characters in a comment.

This comment was generated for commit d3447c5

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the merge-use-implicite-booleaness-like-checks branch from d3447c5 to c484c72 Compare May 1, 2023 05:49
@@ -70,6 +80,21 @@ class ImplicitBooleanessChecker(checkers.BaseChecker):
"used to check for emptiness; Use implicit booleaness instead "
"of a collection classes; empty collections are considered as false",
),
"C1804": (
'"%s" can be simplified to "%s" as an empty string is falsey',
"use-implicit-booleaness-not-comparison-to-string",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"use-implicit-booleaness-not-comparison-to-string",
"consider-implicit-booleaness-str",

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the merge-use-implicite-booleaness-like-checks branch 2 times, most recently from 5f65700 to 7fa78c3 Compare May 2, 2023 11:41
@Pierre-Sassoulas Pierre-Sassoulas force-pushed the merge-use-implicite-booleaness-like-checks branch from 7fa78c3 to 2526ec9 Compare May 2, 2023 17:33
@Pierre-Sassoulas Pierre-Sassoulas merged commit 74ff4c5 into pylint-dev:main May 2, 2023
@Pierre-Sassoulas Pierre-Sassoulas deleted the merge-use-implicite-booleaness-like-checks branch May 2, 2023 18:01
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.0b1, 3.0.0a7 May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants