pylint代码静态检查
使用git-pylint-commit-hook工具
pre-commit脚本
配置文件放在仓库根目录/hooks下面
git-pylint-commit-hook --limit=9.0 --pylintrc=hooks/.pylintrc
配置
[BASIC]
# Regular expression which should only match correct module names
module-rgx=([a-z][a-z0-9_]*)$ attr-rgx=[a-z_][a-z0-9_]{,30} # Regular expression which should only match correct class names
class-rgx=[A-Z_]+[a-zA-Z0-9]+$ # Regular expression which should only match correct function names
function-rgx=[a-z_]+[a-z0-9_][a-z0-9]*$ # Regular expression which should only match correct method names
# Allow upper cases in testFeatureSelection where FeatureSelection
# is a class name
method-rgx=(([a-z_]|__)[a-z0-9_]*(__)?|test[a-zA-Z0-9_]*)$ # Regular expression which should only match correct argument names
argument-rgx=[a-z][a-z0-9]*_*[a-z0-9]*_*[a-z0-9]*_?$ # Regular expression which should only match correct variable names
variable-rgx=([a-z_]+[a-z0-9]*_*[a-z0-9]*_*[a-z0-9]*_?||(__[a-zA-Z0-9_]*__))$||[A-Z]+ # Regular expression which should only match correct module level names
# Default: (([A-Z_][A-Z1-9_]*)|(__.*__))$
const-rgx=([a-z_]+[a-z0-9]*_*[a-z0-9]*_*[a-z0-9]*_?|__[a-zA-Z0-9_]*__)$||[A-Z]+ [FORMAT]
indent-string=' ' [DESIGN] # We are capable to follow that many, yes!
max-branchs = 20 # some base class constructors have quite a few arguments
max-args = 14 # and due to ClassWithCollections and conditional attributes classes by default have lots
# of attributes
max-attributes = 14 # some sci computation can't be handled efficiently without having
#lots of locals
max-locals = 35 [MESSAGES CONTROL]
# Disable the following PyLint messages:
# R0903 - Not enough public methods
# W0105 - String statement has no effect # often used for after-line doc
# W0142 - Used * or ** magic
# W0232 - Class has no __init__ method
# W0212 - Access to a protected member ... of a client class
# W0613 - Unused argument
# E1101 - Has no member (countless false-positives)
# R0904 - Too many public methods
disable-msg=R0903,W0142,W0105,W0212,W0613,E1101,R0904
disable=import-error,unused-import [REPORTS] # set the output format. Available formats are text, parseable, colorized and
# html
output-format=parseable # Include message's id in output
include-ids=yes # Tells wether to display a full report or only the messages
# reports=no [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma.
# FIXME -- something which needs fixing
# TODO -- future plan
# XXX -- some concern
# YYY -- comment/answer to above mentioned concern
notes=FIXME,TODO,XXX,YYY [MASTER]
ignore=tests
disable-msg=R0904,R0903,E1101,R21
pylint代码静态检查的更多相关文章
- Android(Java)利用findbugs进行代码静态检查
主要介绍利用java静态代码检查工具findbugs进行代码检查,包括其作用.安装.使用.高级功能(远程review和bug同步). 虽然Android提供了Test Project工程以及instr ...
- 四种java代码静态检查工具
[转载]常用 Java 静态代码分析工具的分析与比较 转载自 开源中国社区 http://www.oschina.net/question/129540_23043 1月16日厦门 OSC ...
- instrument之Xcode Analyze 代码静态检查及问题解决
Static Code Analysis(静态代码分析)用来发现源代码潜在的错误与缺陷,源代码编译后只有在运行时有可能会产生细微的错误,他们可能难以识别和修复,所以这些潜在的威胁在开发过程中一定要尽可 ...
- 代码静态检查Eclipse插件:SonarLint插件离线安装
Eclipse Version: Oxygen.3a Release (4.7.3a)Myeclipse版本: 10.7 SonarLint 插件离线安装包:org.sonarlint.eclipse ...
- C/C++代码静态检查工具Cppcheck在VS2008开发环境中的安装配置和使用
Cppcheck is an analysis tool for C/C++code. Unlike C/C++ compilers and many other analysis tools, it ...
- JAVA代码静态检测之PMD
今天再次想启动Java代码静态检测工具的利用问题,主要再次尝试用了PMD,发现不少代码编码规范问题和好的代码建议,并学到不少自己之前没有注意到的Java方便的基础知识,感觉很不错,把相关明白的好的规则 ...
- React Native工程中TSLint静态检查工具的探索之路
建立的代码规范没人遵守,项目中遍地风格迥异的代码,你会不会抓狂? 通过测试用例的程序还会出现Bug,而原因仅仅是自己犯下的低级错误,你会不会抓狂? 某种代码写法存在问题导致崩溃时,只能全工程检查代码, ...
- maven配置checkstyle插件对代码规范进行静态检查
checkstyle配置的官方网站:http://checkstyle.sourceforge.net/config.html (1)新建maven项目,配置checkstyle插件 pom.xml ...
- QtCreator 可以通过 Clang-Tidy 和 CLazy 对你的代码进行静态检查
QtCreator 可以通过 Clang-Tidy 和 CLazy 对你的代码进行静态检查 打开你的工程,点击Analyze -> Clang-Tidy and CLazy 选择你想分析的 cp ...
随机推荐
- Python实现Telnet连接
import loggingimport telnetlibimport timeclass TelnetClient(): def __init__(self,): self.tn = telnet ...
- 『Python』整洁之道
1. 使用 assert 加一层保险 断言是为了告诉开发人员程序中发生了不可恢复的错误,对于可以预料的错误(如文件不存在),用户可以予以纠正或重试,断言并不是为此而生的. 断言用于程序内部自检,如声明 ...
- P1712-[NOI2016]区间【线段树,尺取法】
正题 题目链接:https://www.luogu.com.cn/problem/P1712 题目大意 \(n\)个区间,求出其中\(m\)个区间使得它们有覆盖同一个点且最长区间长度减去最短长度最小. ...
- Hive语法及其进阶(一)
1.Hive完整建表 1 CREATE [EXTERNAL] TABLE [IF NOT EXISTS] table_name( 2 [(col_name data_type [COMMENT col ...
- self是什么?什么时候加?什么时候不加?
Python里边self倒底是什么?什么时候加self?什么时候不加? self是什么? 如果你问别人大多人回答是: 指对象本身,然后噼里啪啦说一堆,然后听完的你,仍然完全搞不清楚,什么时候变量前需要 ...
- Spring,IOC源码分析
有错勿喷 1.首先是Spring,IOC的基本概念 IOC是一个容器 容器启动的时候创建所有单实例对象 我们可以直接从容器中获取到这个对象 2.调试流程 ioc容器的启动过程?启动期间都做了什么(什么 ...
- mybatis多种查询方法
1. 查询单行,对象,并封装成一个对象 Employee getEmpById(Integer id); <select id="getEmpById" resultType ...
- HTML选择器的权重(优先级)
选择器的优先级主要用于样式发生冲突的情况下 选择器范围越小,优先级越高 行内样式>id选择器>类选择器>标签选择器>通用选择器 这里涉及一个权重值的问题,权重值越高,优先级越大 ...
- 极简SpringBoot指南-Chapter01-如何用Spring框架声明Bean
仓库地址 w4ngzhen/springboot-simple-guide: This is a project that guides SpringBoot users to get started ...
- python的函数参数传递方式
python的一切数据类型都是对象.但是python的对象分为不可变对象和可变对象.python的变量是引用,对python变量的赋值是引用去绑定该对象. 可变对象的数据发生改变,例如列表和字典,引用 ...