pshergie / prator

Add review comments to your pull requests based on changes
22 stars 1 forks source link

Add check that file was not added #11

Open ai opened 4 months ago

ai commented 4 months ago

Use case:

I want to add “Add tests” message if user change core/*.ts but don’t change anything in core/test/*.test.ts

So I suggest something like:

    - paths: 'core/*.ts'
      missed: 'core/test/*.test.ts'
      message: |
        - [ ] Don’t rush. Check all changes in PR again.
        - [ ] Run `pnpm test`.
pshergie commented 4 months ago

Good idea, the only thing I'd change is to rename missed to exclude

ai commented 4 months ago

exclude for me looks like list to exclude from paths, like !pattern in glob

pshergie commented 4 months ago

so, wouldn't the - paths: 'core/*.ts', !core/test/*.test.ts pattern work in your case? Would you prefer an explicit config setting to it?

ai commented 4 months ago

No, ! only affect to the glob matching pattern, no to the list:

glob({
  pattern: ['a*.txt', '!ab.txt'],
  files: ['a.txt', 'ab.txt']
}) //=> true, since `a.txt` still pass ['a*.txt', '!ab.txt'] pattern
pshergie commented 4 months ago

I see. Still, I think "skip" or "ignore" would suit better than "missed"