Code Monkey home page Code Monkey logo

Comments (5)

dsymonds avatar dsymonds commented on September 13, 2024

It is indeed a better fit for lint than vet.

I'm not sure about your first four (comparing against true/false). It's true that they are equivalent, but code can carry semantic emphasis by doing that, so I'm wary of flagging them as wrong.

The remainder, now that I think about it, might match vet better. Though they are not incorrect code, they may be accidentally hiding code, and flagging them there probably makes sense in the same way that flagging unreachable code makes sense. I wonder what Rob thinks about that idea.

from lint.

josharian avatar josharian commented on September 13, 2024

I'm not sure about your first four (comparing against true/false). It's true that they are equivalent, but code can carry semantic emphasis by doing that, so I'm wary of flagging them as wrong.

Do you have an example handy?

Flipping through instances from the corpus, comparing against true/false appears to be a habit of the developer, rather than being reserved for emphasis.

The remainder, now that I think about it, might match vet better. Though they are not incorrect code, they may be accidentally hiding code, and flagging them there probably makes sense in the same way that flagging unreachable code makes sense.

That was the theory I held when I wrote it as a vet check, but it didn't survive first contact. I did some sampling, and I did not find any flagged code that was clearly buggy. I found lots of code that I didn't understand -- and which thus might have been buggy -- but nothing obviously incorrect.

I'd prefer to be wrong about this though, so feel free to push on it. :)

from lint.

dsymonds avatar dsymonds commented on September 13, 2024

On 28 June 2014 01:53, Josh Bleecher Snyder [email protected] wrote:

Do you have an example handy?

I don't have an example handy, but it reminds me of test code for
functions that return a bool, and sometimes I find it clearer to write
if foo(tt.in) == false. I don't think that's necessarily that much
worse than if !foo(tt.in) to warrant warning people about it.

That was the theory I held when I wrote it as a vet check, but it didn't survive first contact. I did some sampling, and I did not find any flagged code that was clearly buggy. I found lots of code that I didn't understand -- and which thus might have been buggy -- but nothing obviously incorrect.

I'd prefer to be wrong about this though, so feel free to push on it. :)

If it empirically doesn't find any bad code, or very little bad code,
we should probably just drop it.

from lint.

josharian avatar josharian commented on September 13, 2024

Sounds right. Dropped! Thanks for the helpful discussion.

from lint.

two avatar two commented on September 13, 2024

m

from lint.

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.