zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    ABP PUT、DELETE请求错误405.0
    Visual Studio Code 通过 Chrome插件Type Script断点调试Angular 2
    Angular 报错 Can't bind to 'formGroup' since it isn't a known property of 'form'
    ABP 用swagger UI测试API报401无权限访问问题
    ABP .Net Core API和Angular前端APP集成部署
    ABP .Net Core API和Angular前端APP独立部署跨域问题(No Access-Control-Allow-Origin)
    Hosts文件实际应用 配置内部服务器提高访问效率和速度
    mysql-proxy实现读写分离
    mysql主从复制-linux版本
    nginx作反向代理,实现负载均衡
  • 原文地址:https://www.cnblogs.com/buxizhizhoum/p/14639304.html
Copyright © 2011-2022 走看看