使用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. SSA

    wikipedia上关于SSA的定义如下: In compiler design, static single assignment form (often abbreviated as SSA fo ...

  2. Spring技术内幕笔记2--我懒不写了哈哈哈哈。

    目录 1.1 关于IOC容器设计的线路区别 1.1.1 BeanFactory 1.1.2 ApplicationContext 2.1 FileSystemXmlApplicationContext ...

  3. CentOS 7安装docker环境

    一.环境准备 Docker支持以下的CentOS版本: 1.Docker运行在CentOS 7(64-bit)上要求系统为64位,系统内核版本为3.10以上 2.Docker运行在Centos 6.5 ...

  4. Vim合并行

    日常常用到多行合并的功能,记录如下: 第一种, 多行合并成一行,即: AAAAABBBBBCCCCC 合并为:AAAAA BBBBB CCCCC 方法1: normal状态下 3J 其中的3是范围,可 ...

  5. 【Docker】(11)---Docker的网络概念

    一.实现原理 1.实现原理 Docker使用Linux桥接,在宿主机虚拟一个Docker容器网桥(docker0),Docker启动一个容器时会根据Docker网桥的网段分配给容器一个IP地址,称为C ...

  6. 初学python-day3 元组

    day2 列表已更新!

  7. ShardingSphere学习

    1 基本概念 1.1 ShardingSphere概述 官网:https://shardingsphere.apache.org/index_zh.html 1.2 分库分表概述 分库分表是为了解决由 ...

  8. 【Spring】IoC容器 - 依赖来源

    前言 上一篇文章已经学习了[依赖注入]相关的知识,这里详细的介绍一下[依赖来源]. 依赖来源 我们把依赖来源分为依赖查找的来源和依赖注入的来源分别讨论. 依赖查找的来源 1. Spring BeanD ...

  9. vue3.x组件间通信,实用小技巧都在这里

    本想简单写写,没想到说清楚已经变成了一篇很长的帖子,欢迎当笔记搜藏起来. props / emits 父子组件通信 props一般负责向子组件传递数据 下面是一个简单的例子,父组件向子组件传递了一个t ...

  10. 机器学习:KNN

    KNN:K-nearst neighbors 简介: k-近邻算法采用测量不同特征值之间的距离来进行分类,简而言之为:人以类聚,物以群分 KNN既可以应用于分类中,也可用于回归中:在分类的预测是,一般 ...