GithubHelp home page GithubHelp logo

dupl things two switch/case clauses are the same when they differ in variable type creation. Mention the actual behaviour in README. about dupl HOT 8 CLOSED

mibk avatar mibk commented on June 15, 2024
dupl things two switch/case clauses are the same when they differ in variable type creation. Mention the actual behaviour in README.

from dupl.

Comments (8)

mibk avatar mibk commented on June 15, 2024

This is just an issue related to the method dupl uses for clone detection. It's a "false positive" match. The algorithm works only with token types, not their values. From certain angle I would say it is a duplicate because if both cases are that similar, their behaviour could be probably abstracted to an interface.

Ad 2. issue: I think it works as expected. You can check #2 where we have discussed the desired output format.

Did I miss something?

from dupl.

oryband avatar oryband commented on June 15, 2024

actually, this switch case is for initializing different structs which implement the same interface, so there isn't any further abstraction i can do in this case. if you say this is a FP than ok, but I think the chance for FPs should be mentioned in the README or something.

from dupl.

oryband avatar oryband commented on June 15, 2024

it also means i should unfortunately take this tool with a grain of salt, since not all outputs are TP :\

from dupl.

mibk avatar mibk commented on June 15, 2024

That's just the way it is. You are right it should be more emphasized in README. It only contains one sentence about it (It ignores values of AST nodes, it cares just about the types.) so far. The reason is English is my second language. So I find it quite uncomfortable to write long passages of text.

dupl is a tool, it is not a source of truth. It should provide a user information about possible clones that would have been otherwise missed by the user.

from dupl.

dmitshur avatar dmitshur commented on June 15, 2024

Yeah, dupl is not a tool whose output can be run in CI and non-zero output can be considered a failure, the way, for example, vet is. It's more like golint, its output are hints, some of which may be helpful, some others may be noise.

On another note, in your original code, couldn't you factor out:

dec := json.NewDecoder(bytes.NewReader(b))
dec.UseNumber()

It seems that part is duplicated without necessity. It case it happens to lead to more readable, better code to factor it out, then dupl has been helpful even in this relatively false positive-y case.

from dupl.

oryband avatar oryband commented on June 15, 2024

I agree, and maybe you should quote from here in the README.

from dupl.

oryband avatar oryband commented on June 15, 2024

thanks for the quick response :)
hurray for awesome maintainers 👍

from dupl.

mibk avatar mibk commented on June 15, 2024

You're welcome :-)

from dupl.

Related Issues (11)

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.