0

我将 flake8 与 emacs 一起使用。如果我开始一个文件

# comment comment comment comment comment comment comment comment comment comment
class Foo(object):
    pass

它说没有语法错误。但是,如果我将其包装为:

# comment comment comment comment comment comment comment comment
# comment comment
class Foo(object):
    pass

对于“class”行,我得到“E302 预期 2 个空白行,找到 0”。

这是一个错误吗?可以通过配置设置修复吗?

4

1 回答 1

0

这个问题在这里,因为它在emacs网站上被标记为oftop,但实际答案在那里:https ://emacs.stackexchange.com/a/13762

无论如何,这段代码很好:

class A:
    pass


# two empty lines above and comment comment comment comment
class B:
    """
    About class B
    """

这也很好:

class A:
    pass


# two empty lines above and a comment
# comment
class B:
    """
    About class B
    """

这将失败E302 expected 2 blank lines found 1

class A:
    pass

# comment
# comment
class B:
    """
    About class B
    """

该错误是由类之间的一行引起的。可能,这就是你的问题

于 2017-05-17T16:43:19.397 回答