0

I'm trying to use flake8(pydocstyle) to check the quality of my docstring and I'm getting this error:

D205: 1 blank line required between summary line and description This is how my code looks like Exemple:

    def func(
        self,
        source: str,
    ) -> str:
        """
        Generates an sql query for a temporary table by searching 
        the source code in the rules and restrictions table for these sources.

        Args:
            source: data source code

        Returns:
            sql query for creating a table

        """
        sql = None

A long message that is difficult to separate. And max line length = 100 How to transfer a sentence to another line correctly? Or is it easier to ignore the error on such cases?

I tried to divide, but the meaning is a little lost. So far only so

# noqa D205 1 blank line required between summary line and description
seyev15735
  • 23
  • 5
  • personally I find pydocstyle to be a waste of time -- but what it wants you to have is a short one-line summary which fits in N characters (on the opening `"""`), and then a blank line and then a further description – anthony sottile Sep 09 '22 at 12:55
  • See [How can I resolve pydocstyle error "D205: 1 blank line required between summary line and description"?](https://stackoverflow.com/questions/50924700/how-can-i-resolve-pydocstyle-error-d205-1-blank-line-required-between-summary/50926438#50926438) – AcK Nov 29 '22 at 03:04

1 Answers1

0

Actually, lots of well-known packages don't pass all the rules in flake8, numpy for instance. Don't be so harsh on yourself. If you really want to solve this annoying problem, here's some solutions.

First solution: add a summary comment after """ and add a space line between summary and desc.

def func(
        self,
        source: str,
) -> str:
    """Generate a sql query

    Generates an sql query for a temporary table by searching
    the source code in the rules and restrictions table for these sources.

    summary

    Args:
        source: data source code

    Returns:
        sql query for creating a table

    """
    sql = None

Second solution: force to ignore D205 by editing .flake8

hide1nbush
  • 759
  • 2
  • 14