使用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代码静态检查的更多相关文章

  1. Android(Java)利用findbugs进行代码静态检查

    主要介绍利用java静态代码检查工具findbugs进行代码检查,包括其作用.安装.使用.高级功能(远程review和bug同步). 虽然Android提供了Test Project工程以及instr ...

  2. 四种java代码静态检查工具

    [转载]常用 Java 静态代码分析工具的分析与比较 转载自 开源中国社区 http://www.oschina.net/question/129540_23043       1月16日厦门 OSC ...

  3. instrument之Xcode Analyze 代码静态检查及问题解决

    Static Code Analysis(静态代码分析)用来发现源代码潜在的错误与缺陷,源代码编译后只有在运行时有可能会产生细微的错误,他们可能难以识别和修复,所以这些潜在的威胁在开发过程中一定要尽可 ...

  4. 代码静态检查Eclipse插件:SonarLint插件离线安装

    Eclipse Version: Oxygen.3a Release (4.7.3a)Myeclipse版本: 10.7 SonarLint 插件离线安装包:org.sonarlint.eclipse ...

  5. C/C++代码静态检查工具Cppcheck在VS2008开发环境中的安装配置和使用

    Cppcheck is an analysis tool for C/C++code. Unlike C/C++ compilers and many other analysis tools, it ...

  6. JAVA代码静态检测之PMD

    今天再次想启动Java代码静态检测工具的利用问题,主要再次尝试用了PMD,发现不少代码编码规范问题和好的代码建议,并学到不少自己之前没有注意到的Java方便的基础知识,感觉很不错,把相关明白的好的规则 ...

  7. React Native工程中TSLint静态检查工具的探索之路

    建立的代码规范没人遵守,项目中遍地风格迥异的代码,你会不会抓狂? 通过测试用例的程序还会出现Bug,而原因仅仅是自己犯下的低级错误,你会不会抓狂? 某种代码写法存在问题导致崩溃时,只能全工程检查代码, ...

  8. maven配置checkstyle插件对代码规范进行静态检查

    checkstyle配置的官方网站:http://checkstyle.sourceforge.net/config.html (1)新建maven项目,配置checkstyle插件 pom.xml ...

  9. QtCreator 可以通过 Clang-Tidy 和 CLazy 对你的代码进行静态检查

    QtCreator 可以通过 Clang-Tidy 和 CLazy 对你的代码进行静态检查 打开你的工程,点击Analyze -> Clang-Tidy and CLazy 选择你想分析的 cp ...

随机推荐

  1. IO流基本概念

    IO流主要分为两类 节点流:直接能够进行数据写入或读取的I0流.可以单独执行读写操作,但是功能比较单一,只能进行一些基本 的操作.例如:FileInputStream FileInputStream ...

  2. windows下如何查看所有端口及占用

    1.在windows下查看所有端口: 先点击电脑左下角的开始,然后选择运行选项,接着我们在弹出的窗口中,输入[cmd]命令,进行命令提示符. 然后我们在窗口中输入[netstat -ano]按下回车, ...

  3. mimikatz使用笔记

    一.获取密码# privilege::debug sekurlsa::logonpasswords mimikatz.exe "sekurlsa::debug" "sek ...

  4. 痞子衡嵌入式:我的三个小项目陆续上线恩智浦官方Github

    恍如眨眼间,痞子衡在飞思卡尔/恩智浦已经工作 8 年多了,前 5 年主要是在软件团队,最近 3 年在系统团队.所处团队不同,工作思维也不同,自从转到系统团队,开始跟客户打起交道,对待问题和解决问题的立 ...

  5. VirtualBox上安装Debian10个人备忘笔记

    准备 VirtualBox 下载链接:Downloads – Oracle VM VirtualBox,下载完成后安装即可. Debian 下载链接:通过 HTTP/FTP 下载 Debian CD/ ...

  6. 从零入门 Serverless | 一文讲透 Serverless Kubernetes 容器服务

    作者 | 张维(贤维) 阿里云函数计算开发工程师 导读:Serverless Kubernetes 是以容器和 kubernetes 为基础的 Serverless 服务,它提供了一种简单易用.极致弹 ...

  7. Python Pandas的使用 !!!!!详解

     Pandas是一个基于python中Numpy模块的一个模块 Python在数据处理和准备⽅⾯⼀直做得很好,但在数据分析和建模⽅⾯就差⼀些.pandas帮助填补了这⼀空⽩,使您能够在Python中执 ...

  8. ubuntu16.04安装klee

    ubuntu16.04安装klee(基于llvm 3.8)教程 前言 查阅了很多资料,踩了不少的坑,总的来说,这个应该是比较完善的基于llvm3.8和ubuntu16.04的安装教程,至少我自己按照这 ...

  9. 【UE4】类的继承层级关系

  10. JuiceFS 如何帮助趣头条超大规模 HDFS 降负载

    作者简介 王振华,趣头条大数据总监,趣头条大数据负责人. 王海胜,趣头条大数据工程师,10 年互联网工作经验,曾在 eBay.唯品会等公司从事大数据开发相关工作,有丰富的大数据落地经验. 高昌健,Ju ...