Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow trigger of comments only on additions/deletions #112

Open
mjgpy3 opened this issue Dec 21, 2021 · 2 comments
Open

Allow trigger of comments only on additions/deletions #112

mjgpy3 opened this issue Dec 21, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mjgpy3
Copy link
Contributor

mjgpy3 commented Dec 21, 2021

In #106 we added the ability to comment conditionally where a diff contains some substring.

It would be nice to extend this to be able to differentiate on additions and deletions. For example, a config like

UnsafeMentionedInCode:
  paths:
    - "backend/**/*.hs"
  where:
    additions:
      contain:
        - unsafe
  body: |
    :wave: Hi, I see an addition of "unsafe" in Haskell code. Please consider
    finding a safer alternative!

would only comment if the additions to a patch matching backend/**/*.hs contained the substring unsafe. The current additions_or_deletions key will comment if the change is found anywhere in the patch.

@mjgpy3 mjgpy3 added enhancement New feature or request good first issue Good for newcomers labels Dec 21, 2021
@pbrisbin
Copy link
Member

pbrisbin commented Jul 28, 2023

I like this and am considering working on it. But I wonder if the configuration DSL could be a little bit better. What about:

where:
  diff:
    contains:  # behavior of current additions_or_deletions.contain
    adds:      # behavior of proposed additions.contain
    removes:   # obvious behavior

Instead of diff, I could also see patch. Not sure which is better.

@mjgpy3
Copy link
Contributor Author

mjgpy3 commented Aug 1, 2023

@pbrisbin I think that reads nicely 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: 👜 To do
Development

No branches or pull requests

2 participants