Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 Python 项目,并且在某些文件中使用以下行:
# coding: utf-8
当我使用 pylint 时,它会抱怨 R0801 警告说有许多文件具有相同的代码。让 pylint 忽略这些的最佳方法是什么?
如评论中所述,Jenkins Violations 扫描器出现此问题的根本原因是它在这种情况下无法正确解析 Pylint 输出,并且所有代码重复都分配给一个文件的第一行。
如果您使用此语法进行编码声明,您是否还有问题:
# -*- coding: utf-8 -*-
由于 utf-8 是 Python 3.0+ 中的默认编码,您可以删除这些行。
PEP 3120 -- 使用 UTF-8 作为默认源编码