docformatter icon indicating copy to clipboard operation
docformatter copied to clipboard

Inconsistent behavior with :arg syntax

Open avylove opened this issue 2 years ago • 1 comments

Seeing some inconsistent behavior in docformatter 1.7.5.

Docformatter 1.7.5 (Last successful CI used 1.7.3) CPython 3.11 Example file: https://github.com/jquast/blessed/blob/a34c6b1869b4dd467c6d1ab6895872bb72db7e0f/blessed/terminal.py

Docformatter flags the following

    def rgb_downconvert(self, red, green, blue):
        """
        Translate an RGB color to a color code of the terminal's color depth.

        :arg int red: RGB value of Red (0-255).
        :arg int green: RGB value of Green (0-255).
        :arg int blue: RGB value of Blue (0-255).
        :rtype: int
        :returns: Color code of downconverted RGB color
        """

Allowing Docformatter to fix it results in all the arguments running together

    def rgb_downconvert(self, red, green, blue):
        """
        Translate an RGB color to a color code of the terminal's color depth.

        :arg int red: RGB value of Red (0-255). :arg int green: RGB value of Green (0-255). :arg int
        blue: RGB value of Blue (0-255).
        :rtype: int
        :returns: Color code of downconverted RGB color
        """

Changing arg to param prevents it from being flagged

   def rgb_downconvert(self, red, green, blue):
        """
        Translate an RGB color to a color code of the terminal's color depth.

        :param int red: RGB value of Red (0-255).
        :param int green: RGB value of Green (0-255).
        :param int blue: RGB value of Blue (0-255).
        :rtype: int
        :returns: Color code of downconverted RGB color
        """

However, arg is not flagged elsewhere in the file and is processed fine with autodoc

    def move_yx(self, y, x):
        """
        A callable string that moves the cursor to the given ``(y, x)`` screen coordinates.

        :arg int y: vertical position, from top, *0*, to bottom of screen, *self.height - 1*.
        :arg int x: horizontal position, from left, *0*, to right edge of screen, *self.width - 1*.
        :rtype: ParameterizingString
        :returns: Callable string that moves the cursor to the given coordinates
        """

avylove avatar Aug 25 '23 23:08 avylove