flake8插件查找注释代码

flake8-eradicate的Python项目详细描述


鳞片8根除

wemake.servicesBuild StatusCoveragePython VersionPyPI versionwemake-python-styleguide

flake8用于查找已注释(或所谓的“死亡”)代码的插件。

从长远来看,这对项目来说是相当重要的。 基于^{}项目。

安装

pip install flake8-eradicate

它也是^{}的一个有价值的部分。

用法

运行flake8检查程序as usual。 注释的代码应引发错误。

示例:

flake8 your_module.py

选项

  • --eradicate-aggressiveeradicate启用攻击模式可能导致误报

错误代码

Error codeDescription
E800Found commented out code

输出示例

无攻击模式

» flake8 tests/fixtures/incorrect.py
tests/fixtures/incorrect.py:1:1: E800: Found commented out code:
--- before/tests/fixtures/incorrect.py+++ after/tests/fixtures/incorrect.py@@ -1,23 +1,16 @@

 class Some(object):
-    # property_name = 1-    # typed_property: int = 10
     other_property = 2


 # def function_name():
-#     return None


 # class CommentedClass(object):
 #     def __init__(self, prop: int) -> None:
-#         self.property = prop

 #     def __str__(self) -> str:
-#         return self.__class__.__name__

 #    def set_prop(self, prop: int):
-#        self.prop = prop

 #    def get_prop(self):
-#        return self.prop

攻击模式

» flake8 --eradicate-aggressive tests/fixtures/incorrect.py
tests/fixtures/incorrect.py:1:1: E800: Found commented out code:
--- before/tests/fixtures/incorrect.py+++ after/tests/fixtures/incorrect.py@@ -1,23 +1,10 @@

 class Some(object):
-    # property_name = 1-    # typed_property: int = 10
     other_property = 2


-# def function_name():-#     return None-# class CommentedClass(object):-#     def __init__(self, prop: int) -> None:-#         self.property = prop-#     def __str__(self) -> str:-#         return self.__class__.__name__-#    def set_prop(self, prop: int):-#        self.prop = prop-#    def get_prop(self):-#        return self.prop

许可证

麻省理工学院。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在SWT中关闭CTabItem时如何获取警告消息?   java如何从中获取文本字符串   java带有(int[][])的方法意味着什么?   java我在创建这个安卓浮动泡泡动画时做错了什么?   将边距属性作为列表项的java表抛出异常ClassCastException   java如何在Storm拓扑中测量延迟和吞吐量   java如何在javafx中序列化事件?   java访问main()之外的线程   java如何强制某些方法仅对kotlin可见   java如何使用quartzscheduler启动具有多个crontrigger的作业?   java无法使用VM选项获取转储文件:引发OOM异常时出现HEAPDUMPONAUTOFMEMORYERROR   java无法在安卓中的FTP服务器上上载文件   java RecordView未显示   java有没有办法在Eclipse中隐藏/折叠虚张声势的注释?   java如何从xml中提取xml。广州?