Changelog


← Back to all posts

January 31, 2022

Added

  • Sourcery will now show suggestions which are not strict refactorings, but which will improve the code quality or avoid common coding mistakes. In VS Code refactorings will now show as yellow warnings, while suggestions will be at the blue information level. In PyCharm refactorings will stay as warnings, while suggestions will show as weak warnings. These suggestions can be toggled on or off with a new command in VS Code - Toggle Sourcery Recommendation Level, and through a toggle button in the Sourcery panel in PyCharm. The toggle can also be made directly in the user configuration file.
  • default-mutable-arg suggestion - this is the first suggestion, and triggers when you use a dictionary, set or list as a default argument to a function.
  • simplify-empty-collection-comparison proposal
  • non-equal-comparison proposal
  • use-named-expression proposal
  • path-read proposal

Changed

  • Sourcery now suggests some refactorings that require Python 3.9 by default. In these cases a new code action is shown allowing the user to configure which version of Python Sourcery should assume is being used (this is configured in the user or project level sourcery yaml configuration files).
  • merge-nested-ifs will no longer trigger if either condition contains a named expression.
  • for-index-underscore will now also trigger on comprehensions and generators.
  • Enhanced remove-unused-enumerate to handle comprehensions

Fixed

  • use-any and comprehension proposers will no longer incorrectly suggest incorporating code containing named expressions.
  • Don't refactor constants in square-identity
  • Fix timeout issue in PyCharm plugin.