Comments (8)
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.
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.
it also means i should unfortunately take this tool with a grain of salt, since not all outputs are TP :\
from dupl.
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.
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.
I agree, and maybe you should quote from here in the README.
from dupl.
thanks for the quick response :)
hurray for awesome maintainers
from dupl.
You're welcome :-)
from dupl.
Related Issues (11)
- Allow disabling of check with in code comments HOT 14
- Remove -connect and -serve
- Why is the output non-deterministic? HOT 1
- Serious memory leak HOT 4
- Bump golang.org/x/tools to v0.7.0 (as minimum) and make new tag HOT 1
- Output in a format more easily digested by editors HOT 17
- why dupl report with different function name? HOT 3
- Add flag to ignore certain directories (e.g. generated code) HOT 3
- dupl not the same as dupl *.go HOT 4
- Please mention that this tool required go 1.4 or greater HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dupl.