Git Product home page Git Product logo

Comments (14)

tomasbjerre avatar tomasbjerre commented on September 23, 2024

The createCommentWithAllSingleFileComments (when set to true) should create one comment per violation.

There is currently no option to not delete old comments.

from violation-comments-to-stash-plugin.

leinardi avatar leinardi commented on September 23, 2024

Hey, thanks for the answer.
I already tried to set createCommentWithAllSingleFileComments to true but I got a single comment with all the violations on it. What value should I set to createSingleFileComments? I had both set to true iirc.

Any plan to add the option to keep the previous comments?

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on September 23, 2024

Here is where it happens:
https://github.com/tomasbjerre/violation-comments-lib/blob/master/src/main/java/se/bjurr/violations/comments/lib/CommentsCreator.java#L59

Sorry, it is the other one. Set createSingleFileComments to true to create individual comments.

from violation-comments-to-stash-plugin.

leinardi avatar leinardi commented on September 23, 2024

I already have it set to true and most of the time it works fine but for some violation it still create a file comment instead of a line comment:

image

The second comment should have been created on line 26 but instead was created as file comment.

step([
                    $class: 'ViolationsToBitbucketServerRecorder',
                    config: [
                            bitbucketServerUrl                    : 'https://xxxxx.com',
                            createCommentWithAllSingleFileComments: false,
                            createSingleFileComments              : true,
                            commentOnlyChangedContent             : false,
                            projectKey                            : "${PULL_REQUEST_TO_REPO_PROJECT_KEY}",
                            repoSlug                              : "${PULL_REQUEST_TO_REPO_SLUG}",
                            pullRequestId                         : "${PULL_REQUEST_ID}",
                            useUsernamePassword                   : false,
                            username                              : '',
                            password                              : '',
                            useUsernamePasswordCredentials        : true,
                            usernamePasswordCredentialsId         : 'mobile_ci',
                            minSeverity                           : 'INFO',
                            violationConfigs                      : [
                                    [pattern: ".*/reports/lint-results-.*\\.xml\$", parser: 'ANDROIDLINT', reporter: "Lint ${flavor}"],
                                    [pattern: ".*/checkstyle/.*\\.xml\$", parser: 'CHECKSTYLE', reporter: "Checkstyle ${flavor}"],
//                                    [pattern: '.*/findbugsXml\\.xml$', parser: 'FINDBUGS', reporter: 'Findbugs'],
//                                    [pattern: '.*/pmd\\.xml$', parser: 'PMD', reporter: 'PMD'],
                            ]
                    ]
            ])

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on September 23, 2024

What you refer to as "a file comment" is the same thing as the first comment.

It is just that the first comment were on a part of the file that was changed in the PR and the second was not.

You can set commentOnlyChangedContent to true in order to only comment changed content. And also the commentOnlyChangedContentContext to, perhaps, 2 in order to comment on violations that are reported in the near context of changed lines.

from violation-comments-to-stash-plugin.

leinardi avatar leinardi commented on September 23, 2024

Oh ok, this sound interesting. Can I ask you what is the value of the commentOnlyChangedContentContext? Are those the number of lines above and below the violation (eg: line 29 +- 2 lines)? Is there a maximum value?

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on September 23, 2024

yes. No maximum value.

from violation-comments-to-stash-plugin.

leinardi avatar leinardi commented on September 23, 2024

It doesn't seem to work, as you can see I changed something just 3 lines before the "legacy" violation but still it didn't create an in line comment, like it did for the new code:
image

This is the config I used:

                                createCommentWithAllSingleFileComments: false,
                                createSingleFileComments              : true,
                                commentOnlyChangedContent             : true,
                                commentOnlyChangedContentContext      : 100,

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on September 23, 2024

Looks good to me.

You introduced a violation on line 33. You have a context of 100 and line 29 is indeed withing that context.

You might be confused about how Bitbucket displays the violation on line 29, but that has nothing to do with the plugin. It is simply up to Bitbucket to display it like that.

from violation-comments-to-stash-plugin.

leinardi avatar leinardi commented on September 23, 2024

Ok I see, thanks for the answers :)

from violation-comments-to-stash-plugin.

Onlinedispatcher avatar Onlinedispatcher commented on September 23, 2024

Thank you :)
Can I vote for an option to not delete old comments :)?
The reason for this is, that developers always gets mails for the same issues :) (for every new commit in a PR)

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on September 23, 2024

Sounds like you are asking for 2 new features

  • Not deleting old comments
  • Not commenting on the same violation again if old comment exists

from violation-comments-to-stash-plugin.

Onlinedispatcher avatar Onlinedispatcher commented on September 23, 2024

Hey :),

jupp you are completely right.

  • Not deleting old comments (because of multiple flavors build in parallel)
  • Not commenting on the same violation again if old comment exists

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on September 23, 2024

Releasing it now. There is a new config parameter keepOldComments that you will want to set to true.

...
keepOldComments: true,
...

Open issue again if not working.

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.