简体   繁体   English

pylint \\ flake8 插件不会从 pyBuilder 运行

[英]pylint \ flake8 plugins won't run from pyBuilder

No linter plugins seem to run from my pyBuild run.我的 pyBuild 运行似乎没有运行任何 linter 插件。 I can use either我可以使用

use_plugin("python.distutils")

or或者

use_plugin("python.flake8")

but when the pyBuilder run is finished, it says: Tasks: prepare [2073 ms] compile_sources [0 ms] run_unit_tests [504 ms] package [460 ms] run_integration_tests [0 ms] verify [0 ms ] publish [2164 ms]但是当 pyBuilder 运行完成时,它说:任务:准备 [2073 毫秒] compile_sources [0 毫秒] run_unit_tests [504 毫秒] 包 [460 毫秒] run_integration_tests [0 毫秒]验证 [0 毫秒]发布 [2164 毫秒]

Full build.py file:完整的 build.py 文件:

from pybuilder.core import use_plugin, init

use_plugin("python.core")
use_plugin("python.pylint")
use_plugin("python.install_dependencies")
use_plugin("pypi:pybuilder_pytest")
use_plugin("pypi:pybuilder_pylint_extended")
#use_plugin("pypi:pybuilder_pytest_coverage")
use_plugin("python.distutils")

default_task = "publish"

@init
def initialize(project):
    project.author = "DellEMC"
    project.name = "RPCenter"
    project.set_property('dir_source_main_python', '..\..\services')
    project.get_property("pytest_extra_args").append("-x")
    project.set_property('dir_source_pytest_python', '..\..\services')
    #project.set_property('pytest_coverage_break_build_threshold', 75)
    project.set_property('pylint_options', '["--rcfile=pylintrc.txt", "--reports=n", "../../services"]')

Any ideas?有任何想法吗?

Thanks.谢谢。

I encountered exactly same problem and reached pybuilder issue tracker for help in issue #652 .我遇到了完全相同的问题,并在问题 #652 中找到pybuilder问题跟踪器寻求帮助。

As it has been answered I quote正如它已经回答我引用

Flake8 works quite well. Flake8 运行良好。 It is however is registered as an analyze task which is not executed by default然而,它被注册为一个默认情况下不执行的分析任务

So just run your build with a command that enables analyze tasks and yout flake8 linting will be executed, as follows:因此,只需使用启用analyze任务的命令运行您的构建,就会执行flake8 ,如下所示:

$ pyb analyze -vvv
PyBuilder version 0.11.17
Build started at 2019-11-23 13:22:04
------------------------------------------------------------
[INFO]  Building pybflake8 version 1.0.dev0
[INFO]  Executing build in /Users/marekyggdrasil/projects/pybflake8
[INFO]  Going to execute task analyze
[INFO]  Executing flake8 on project sources.
[WARN]  flake8: src/main/python/run.py:2:121: E501 line too long (345 > 120 characters)
------------------------------------------------------------
BUILD FAILED - flake8 found 1 warning(s)
------------------------------------------------------------
Build finished at 2019-11-23 13:22:06
Build took 1 seconds (1627 ms)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM