with - pylint jenkins integration

Generating PEP8 xml report for Jenkins/Violations use (2)

I've setup Cobertura successfully to run through Jenkins and generate coverage reports, now I'm stuck on configuring Violations to report results for pep8 tests.

Right now I have it so that I run PEP8 with a batch command and it generate a .txt file that stores all the violations which ends up in the workspace.

Do I have to define batch commands to create an xml file for these violations to send to the Report Violations Post-build action? If so, how would I define that command?

As Vajk points out, you do not need an XML file. You can simply pipe the output of the pep8 utility to a file and use that as the violations file in Jenkins.

For example in your Jenkins build configuration under:

Build -> Execute Shell -> Command

you can write:

pep8 path/to/code > pep8_report.txt

And then under:

Post-build Actions -> Report Violations -> pep8 / XML filename pattern



Note that even though the UI asks for an XML file and the file is not an XML file, this worked fine for me on Jenkins version 1.499.

I see this a very old question but I had a lot of trouble myself to find an answer to this, so hopefully this will help others.

After a lot of research I found that Jenkins Violations plugin does not like the ./ bit before each line, so just parsing the output of pep8 (it is also valid for flake8) will do the trick:

pep8 . | 's|^./||' | tee pep.txt

The important bit in there is sed which changes the occurrences of ./ at the beginning of the string(^) to '', effectively removing them

The tee bit is some workaround to avoid Jenkins halting if the output of the pep8 command is non-zero.