Giter Site home page Giter Site logo

Comments (4)

tsdh avatar tsdh commented on September 2, 2024

Here's a very related occurence.

[91] Consider:
  (.add (.getContentPane) (JScrollPane. label))
instead of:
  (-> (.getContentPane) (.add (JScrollPane. label)))

While this looks correct when viewed isolated, it's wrong if you check the complete context:

(doto frame
   (-> (.getContentPane)
        (.add (JScrollPane. label)))
   (.setDefaultCloseOperation WindowConstants/DISPOSE_ON_CLOSE)
   (.addKeyListener ...))

As you can see, frame will be injected as first form into the threading form by the doto. With the suggestion, frame would be injected into the (.add #_frame-would-end-up-here (.getContentPane) (JScrollPane. label)) form and render it invalid.

from kibit.

jonase avatar jonase commented on September 2, 2024

In general, I think this is a fundamental limitation of kibit. Since kibit reads the source without macroexpanding it first it's easy for a macro to invalidate a rule.

from kibit.

tsdh avatar tsdh commented on September 2, 2024

Yes, after thinking about it, I came to the same conclusion. Anything that's nested inside some macro can be transformed to possibly anything.

Would it be possible to restrict kibit to forms that aren't inside a macro or only inside some whitelisted macro we know it won't restructure the code in inexpected ways (like defn, fn, do, when, ...)?

from kibit.

danielcompton avatar danielcompton commented on September 2, 2024

@tsdh because we don't evaluate any of the code in Kibit, I don't think we can know which forms are inside a macro or just another users function. I'm closing this for now as I don't think there's any way to get around this, but I'd be happy to hear if there is.

from kibit.

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.