Jenkins and pep257 warnings

Want to get your Python pep257 docstring errors in a Jenkins job?  Then you can use the Jenkins Warnings plugin with a custom parser.  These can be added under “Manage Jenkins” > “Configure System” and in the “Compiler Warnings” section.

Add a new parser (I set “Name”, “Link name” and “Trend report name” to “pep257”) with the following settings:

Regular Expression


Mapping Script

import hudson.plugins.warnings.parser.Warning

String fileName =;
String lineNumber =;
String category =;
String message = + ":" +;

return new Warning(fileName, Integer.parseInt(lineNumber), "Dynamic Parser", category, message);

Example Log Message in private nested class `meta`:
        D101: Docstring missing in public method `method`:
        D102: Docstring missing

Jenkins job

Also worth remembering that pep257 returns an exit code of 1 if it finds any problems. This will cause the Jenkins job to be marked as failure. To avoid this change the exit code:

find . -name '*.py' | xargs pep257 || true

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.