使用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. P4173-残缺的字符串【FFT】

    正题 题目链接:https://www.luogu.com.cn/problem/P4173 题目大意 给出两个字符串\(S,T\),其中包含小写字母和一些\(?\),\(?\)可以匹配任何字符. 求 ...

  2. .Net微服务实战之可观测性

    系列文章 .Net微服务实战之技术选型篇 .Net微服务实战之技术架构分层篇 .Net微服务实战之DevOps篇 .Net微服务实战之负载均衡(上) .Net微服务实战之CI/CD .Net微服务实战 ...

  3. 神器----IntelliJ IDEA基本配置

    介绍 首先是百度百科对于 IDEA 的介绍 IDEA 全称 IntelliJ IDEA,是java编程语言开发的集成环境.IntelliJ在业界被公认为最好的java开发工具,尤其在智能代码助手.代码 ...

  4. Ubuntu18.04安装MySQL教程

    Ubuntu18.04下安装MySQL 提示:以下操作均在root权限下进行. # 查看有没有安装MySQL: dpkg -l | grep mysql # 安装MySQL: apt install ...

  5. Python - poetry(1)包管理利器的入门介绍

    Python 虚拟环境详解 https://www.cnblogs.com/poloyy/p/15266382.html poetry 官方介绍 github:https://github.com/p ...

  6. 用OpenCV显示视频时遇到问题

    刚刚接触OpenCV,运行了书上的例程,程序编译没有问题,在视频显示快要结束时遇到了下面的问题,代码在后面 #include "stdafx.h"#include <open ...

  7. Python小知识之对象的比较

    好久不见 国庆回了趟老家,躺平了10天.作息时间基本和小学生差不多,8.9点就睡了, 那滋味别提多舒服了.时间也和小时候过得一样慢了...长时间不更新,还是不行滴,粉都快掉没了. 今天就结合日常生活的 ...

  8. 使用率激增250%,这份报告再将 Serverless 推向幕前

    ​ 作者 | 望宸 来源 | Serverless 公众号 相比去年,国外 Serverless 的适用群体在迅速扩大,函数执行时长不断增加,使用方式也越加成熟,开发者工具也更加开放.本文是对 Dat ...

  9. Java(32)File类的介绍

    作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15228444.html 博客主页:https://www.cnblogs.com/testero ...

  10. Java并行任务框架Fork/Join

    Fork/Join是什么? Fork意思是分叉,Join为合并.Fork/Join是一个将任务分割并行运行,然后将最终结果合并成为大任务的结果的框架,父任务可以分割成若干个子任务,子任务可以继续分割, ...