Code Monkey home page Code Monkey logo

Comments (5)

jd1378 avatar jd1378 commented on May 22, 2024 1

I made a pull request, see if it looks good

from protolint.

yoheimuta avatar yoheimuta commented on May 22, 2024 1

isn't it better to exit with 0 when there's nothing to lint ?

I understand your point. Can you show me some linters that behave so?
For example, eslint that has immense popularity exits with code 0 when it found no files.

Sorry, I misunderstood the current spec opposite 😓
(But #134 looked good to me regardless of the interpretation, as the first step.)

from protolint.

yoheimuta avatar yoheimuta commented on May 22, 2024

@jd1378 Thank you for your interesting suggestion.

I understand your point. Can you show me some linters that behave so?
I think it's better to follow the nearly de facto rule if it exists (because many tools depend on this). Then, if it doesn't seem to be the de facto rule, we should support it with a new option.

For example, eslint that has immense popularity exits with code 0 when it found no files.

❯❯❯ ls empty
hoge.txt
❯❯❯ eslint "empty/*"; echo $?
0

[memo] OTOH, it exits with 2 when the glob doesn't match any files. --no-error-on-unmatched-pattern option can change this behavior.

❯❯❯ rm empty/hoge.txt
remove empty/hoge.txt? y
❯❯❯ eslint "empty/*"; echo $?

Oops! Something went wrong! :(

ESLint: 7.5.0

No files matching the pattern "empty/*" were found.
Please check for typing mistakes in the pattern.

2
❯❯❯ eslint --no-error-on-unmatched-pattern true "empty/*"; echo $?
0

from protolint.

jd1378 avatar jd1378 commented on May 22, 2024

You are right, I wasn't thinking about that
I checked out golangci-lint with golangci-lint run ./...; echo $? and it also exits with code 5 when it founds no file
I'll try to find more, but it looks like that going with a new option be the best way to do it and it won't be a breaking change if anyone by any chance depending on this

from protolint.

yoheimuta avatar yoheimuta commented on May 22, 2024

@jd1378 Thank you for your confirmation.
I agree with you.

BTW, I added a commit f45a1c7 to clarify the current spec. In this case, it should return an error message with an exit code 2.

Can you make a PR if you don't mind? Otherwise, it falls under I will get to it someday.

  • func (c *CmdLint) run() ([]report.Failure, error) {
    var allFailures []report.Failure
    for _, f := range c.protoFiles {
    failures, err := c.runOneFile(f)
    if err != nil {
    return nil, err
    }
    allFailures = append(allFailures, failures...)
    }
    return allFailures, nil
    }
    is a related part, in particular c.protoFiles.

from protolint.

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.