platisd / duplicate-code-detection-tool

A simple Python3 tool to detect similarities between files within a repository
MIT License
162 stars 30 forks source link

Reuse of the previous comment #27

Closed idzm closed 11 months ago

idzm commented 11 months ago

It better to reuse (overwrite) existing comment (which starts with Duplicate code detection tool report) to avoid being overloaded by bot comments.

platisd commented 11 months ago

:thinking: Don't know... Assuming there's a large pull request, which includes discussions etc, it will not be obvious which version of the code the report is about. Additionally, any "progress" will not be visible either.

On what events are you having the Action triggered? My recommendation would be to trigger it only based on a keyword/comment to decrease the spam.

idzm commented 11 months ago

Action is triggered by pull_request event. Many services (codecov, sonarcloud) reuse previous comment. To save history we can just rewrite previous comment.

platisd commented 11 months ago

Sonarcloud seems to leave new comments, at least in the configuration I have: image

Codecov seems to be reusing the same comment: image

My suggestion is to make this an opt-in feature via a property in the yml file.

E.g., one_comment: true which defaults to false:

name: Duplicate code

on: pull_request

jobs:
  duplicate-code-check:
    name: Check for duplicate code
    runs-on: ubuntu-20.04
    steps:
      - name: Check for duplicate code
        uses: platisd/duplicate-code-detection-tool@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          one_comment: true
          directories: "src/, test/ut"

Feel free to submit a pull request that provides this feature. :100: