Coder Social home page Coder Social logo

Comments (7)

kyoh86 avatar kyoh86 commented on May 29, 2024

It is not supported with exportloopref.
I want to make exportloopref as accurately as possible.

from exportloopref.

siddharth178 avatar siddharth178 commented on May 29, 2024

I thought scopelint checks will be available in exportloopref and I find check done on above code by scopelint important. It would really help if you could give some more context on why that kind of check is not part of exportloopref. @kyoh86

from exportloopref.

kyoh86 avatar kyoh86 commented on May 29, 2024

I found that diagnostics are just noise while a lot of false-positives are included.

  • Any analyzer CANNOT know if a closure is called soon.
  • So any variables in closures in the loop will be reported.

For example, scopelint reports a diagnostic on testcase.expect:

for _, testcase := range []struct {
	title string
	expect int
} {
	t.Run(testcase.title, func(t *testing.T) {
		actual := FUT()
		if testcase.expect != actual { // !!
			t.Errorf("
		}
	})
}

but it's not a problem (false-positive).

from exportloopref.

kyoh86 avatar kyoh86 commented on May 29, 2024

see also: kyoh86/scopelint#16 (comment)

from exportloopref.

siddharth178 avatar siddharth178 commented on May 29, 2024

Thanks @kyoh86 for the details!

from exportloopref.

ziccardi avatar ziccardi commented on May 29, 2024

@kyoh86 I think your example code should be reported at least as a warning.

While it is true that it is not an issue with your code, if you would just add t.Parallel() at the beginning of the test function it won't work anymore.

from exportloopref.

kyoh86 avatar kyoh86 commented on May 29, 2024

I could not found them without false-positives.
You can propose an implementation by pull-request.

from exportloopref.

Related Issues (14)

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.