Search code examples
pluginspylintflake8pybuilder

pylint \ flake8 plugins won't run from pyBuilder


No linter plugins seem to run from my pyBuild run. 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]

Full build.py file:

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.


Solution

  • I encountered exactly same problem and reached pybuilder issue tracker for help in issue #652.

    As it has been answered I quote

    Flake8 works quite well. 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:

    $ 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)