docstr: ```
  def f():
      ...
      a = 1
      ^^^^^ Find useless assignment like this
      return a
  ```
docstr_tok: ["``","`","def","f","(",")",":","...","a","=","1","^^^^^","Find","useless","assignment","like","this","return","a","``","`"]
code: def useless_assign(self, body: List[astroid.NodeNG]):
      """
      ```
      def f():
          ...
          a = 1
          ^^^^^ Find useless assignment like this
          return a
      ```
      """
      if len(body) < 2:
          return
  
      second_last, last = body[-2:]
      # Is the last statement a return statement?
      if not isinstance(last, astroid.Return):
          return
  
      # Does the return statement have a value (e.g. `return a`)?
      if not last.value:
          return
  
      # Is the value a name (e.g. `return a`)?
      if not isinstance(last.value, astroid.Name):
          return
  
      # Is the second last statement an assignment?
      second_last = body[-2]
      if not isinstance(second_last, astroid.Assign):
          return
  
      # Does the assignment have a single target (e.g. `a = 1`)?
      if len(second_last.targets) != 1:
          return
  
      # Is the target a name (e.g. `a = 1`)?
      target = second_last.targets[0]
      if not isinstance(target, astroid.AssignName):
          return
  
      if target.name in self.non_local:
          return
  
      # Is the name in the assignment the same as the name in the return statement?
      if target.name != last.value.name:
          return
  
      self.add_message(USELESS_ASSIGNMENT.name, node=second_last)
  
file_path: mlflow/pylint_plugins/assign_checker.py
imports: from typing import List
  import astroid
  from pylint.checkers import BaseChecker
  from pylint.interfaces import IAstroidChecker
  from pylint_plugins.errors import USELESS_ASSIGNMENT, to_msgs
label_desc: Use image node_id 11 for calling the AssignChecker obj's underlying member method code with example usage: obj.useless_assign(body) without return types