Code Monkey home page Code Monkey logo

Comments (4)

nono avatar nono commented on June 18, 2024

Hi, sorry for the delay.

I agree that we should close our Response.Body in production code. I have done it on the critical parts, like the connections to CouchDB, for the reasons you explain. But I have been more sloppy on other places.

I think one way we can advance on the subject could be:

  1. fix the production code
  2. enable the linter via another configuration file to disable running it on test files (temporary)
  3. work on the tests to use httpexpect (I agree it improves tests)
  4. when/if we can migrate all the tests, we can fusion the two configuration file for linters in one.

Are you OK with that?

from cozy-stack.

Peltoche avatar Peltoche commented on June 18, 2024

Hi 👋

My first message make the issue as terrible because the linter return a lot of errors but after a deeper look it seems that the linter have a lot of limitations. Id doesn't handle the body closed inside an another function.

So I totally agree with you plan, I had the same in mind but if we want to enable the linter in prod it would require to move the body closing next to the requests. This will make a lot of duplicate juste for making the linter happy.

Personnaly I think it's not terrible but it's still a good idea because this linter have a lot of value but this is your choice to make 😄

I will start to migrate the tests to httpexpect ASAP but it will take some time.

from cozy-stack.

Peltoche avatar Peltoche commented on June 18, 2024

It's done!

After a loooooong and tedious refactoring all the tests have moved on gavv/httpexpect and we can better see the actual bodyclose errors and hope to be able to activated soon.

Have a propose a bunch of PR which, once merged, should allow to enable the bodyclose linter and ensure that no body have been leaved unclosed.

from cozy-stack.

Peltoche avatar Peltoche commented on June 18, 2024

Final note: It seems that there is far fewer body not close than what I have expected. 95% of them was inside the tests.

from cozy-stack.

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.