Giter Site home page Giter Site logo

Comments (6)

haya14busa avatar haya14busa commented on May 21, 2024

Is it possible to simply add a generic warning for a whole file (and warn if the file changes)?

I have a plan to support it, but it's not possible right now.

It might be annoying to post false-positive file comments each time to PR which contains the file changed, so we need to consider when reviewdog should post file comments.

from reviewdog.

JensRantil avatar JensRantil commented on May 21, 2024

One idea is simply that line number 0, or negative line number, applies to the whole file. What do you think of that?

from reviewdog.

JensRantil avatar JensRantil commented on May 21, 2024

@haya14busa Please let me know if you'd be fine with the #92 (comment) approach mentioned above. I could consider submitting a pull request when I find the time if you'd be open to such a solution.

from reviewdog.

JensRantil avatar JensRantil commented on May 21, 2024

It might be annoying to post false-positive file comments each time to PR which contains the file changed, so we need to consider when reviewdog should post file comments.

You have a point. I see this as two different things we need to address:

  1. Support for lint warning across ranges of lines, possibly also special identifier for "EOF" for generating a lint forwarning for last line in the file. A warning for the whole file could then be expressed as 1-EOF.
  2. Defining if a warning should be generated for adding line, removing line, or both (that is modification).

Instead of filenumber <= 0 (as in #94), how about

  1. adding support for line ranges with EOF marker in errorformat? And
  2. introducing yet another error format identifier, call it %x, which would be a for lines added, r for lines deleted and ar for lines modified? Obviously %x means that errorformat would diverge from vim's errorformat, but it might be worth it to support changes.

Example: Given an error format of %f:%l:%x: %m the linter line

myfile.go:1-EOF:a: A line has been added.

would trigger a comment on the first added file anywhere in myfile.go. If multiple lines are added only a single (the first) line is commented on.

What do you think of this?

from reviewdog.

haya14busa avatar haya14busa commented on May 21, 2024

I'm so sorry for the late reply.

I don't think it's good idea to add new errorformat identifier.
If you wanna post a comment for whole file, just skipping line number is enough. myfile.go: this file contains blah blah errors for errorformat side.

And reviewdog can deal with it as line number == 0. No need to support negative line number.

it might be interesting to add range identifier to errorformat, but we don't need this feature to fix the issue.

As for the timing to post file comments, I have 2 option to consider.

  1. Post file comments for every pull request containing file comment. If the comment is false positive, users can filter them by their own before passing lint result to reviewdog.
  2. Post file comments only the file is added in the pull request. Unfortunately, it leads false negative.

I don't like both options, but I slightly prefer option 1.
What do you think?

from reviewdog.

haya14busa avatar haya14busa commented on May 21, 2024

Now you can use -filter-mode=file. https://github.com/reviewdog/reviewdog#filter-mode

from reviewdog.

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.