Git Product home page Git Product logo

Comments (7)

tomasbjerre avatar tomasbjerre commented on August 29, 2024 1

Redirect to file first. This plugin only works with files.

from violation-comments-to-stash-plugin.

whitty avatar whitty commented on August 29, 2024

Forgot to add - all the examples specifically use filenames in pattern, but nothing in the documentation makes it clear that these are required, or that the default (empty) is not valid.

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

Yes files are needed.

Will consider this a feature request to add error message if no file pattern supplied.

This should work if you want the console log as a file:
https://stackoverflow.com/questions/37386581/jenkins-console-output-log-location-in-filesystem

But it is possible that things that are not really violations, lines that accidentally have the same format, will be matched by the parsers if you parse the entire log.

from violation-comments-to-stash-plugin.

whitty avatar whitty commented on August 29, 2024

Thanks - at least one of my tools already produced a log-file so at least I have the basics running now.

Do you mind if I also add a separate enhancement request to (either) parse console log, or hook into "Analysis Model API" which is the basis of the "Warnings Next Generation Plugin" implementation that does file and/or console parsing as in recordIssues.

Are either ever likely to be supported?

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

I think parsing the entire log will generate a lot of support issues with strange findings. Things that accidently match. So no I dont want that feature.

Hooking into Warnings is not going to happen. It would change the design too much. That plugin and this one are already sharing Violations Lib. I like my plugins to be as slim as possible and only contain Jenkins stuff. So that I can easily migrate workflows to another automation server if needed. Like creating maven/gradle plugins to do the same thing with Travis...

from violation-comments-to-stash-plugin.

miikeat avatar miikeat commented on August 29, 2024

@tomasbjerre
I'm Confused!

For ktlint and detekt your plugin really works like a charm and it's really cool work with it!

But i couldn't figure out yet how to get Kotlin Compiler Warnings working! :(

So you say the Violations Plugin requires files to parse for errors/warnings, but in the list of supported parsers for KotlinGradle it is noted "Output from Kotlin Gradle Plugin."
So do i need now to redirect the Gradle Output to a file first to use KotlinGradle plugin or can it read the Output on it's own???

Without a pattern it at least doesn't seem to work :-/

violationConfigs : [
    [parser: 'CHECKSTYLE', pattern: '.*/ktlint/.*\\.xml\$', reporter: 'ktlint'],
    [parser: 'CHECKSTYLE', pattern: '.*/detekt/.*\\.xml\$', reporter: 'detekt'],
    [parser: 'KOTLINGRADLE', reporter: 'KotlinGradle'] // not working
]

from violation-comments-to-stash-plugin.

miikeat avatar miikeat commented on August 29, 2024

@tomasbjerre Thanks for the quick reply.

With this configuration it works now:
Regarding your concern that the whole log is parsed, this way it only writes the log of compileKotlin task to a seperate file!

build.gradle.kts

tasks {
    compileKotlin {
        kotlinOptions {
            jvmTarget = "1.8"
        }
        // redirect output of task to file, required for violations plugin
        val taskOutput = StringBuilder()
        logging.addStandardOutputListener { taskOutput.append(it) }
        doLast {
            project.file("build/kotlin/compileKotlin.log").writeText(taskOutput.toString())
        }
    }
}

Jenkinsfile:

violationConfigs                      : [
    // Many more formats available, check https://github.com/tomasbjerre/violations-lib
    [parser: 'CHECKSTYLE', pattern: '.*/ktlint/.*\\.xml\$', reporter: 'ktlint'],
    [parser: 'CHECKSTYLE', pattern: '.*/detekt/.*\\.xml\$', reporter: 'detekt'],
    [parser: 'KOTLINGRADLE', pattern: '.*/kotlin/compileKotlin\\.log\$', reporter: 'KotlinGradle']
]

from violation-comments-to-stash-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.