Giter VIP home page Giter VIP logo

Comments (6)

AndreaCrotti avatar AndreaCrotti commented on September 28, 2024

Would it not be enough to print out the list of available plugins in these cases?
That should hopefully clarify what they are doing wrong automatically.

from kaocha.

plexus avatar plexus commented on September 28, 2024

Any namespace on the classpath could potentially be a plugin, so that's not really feasible.

from kaocha.

noorfathima11 avatar noorfathima11 commented on September 28, 2024

Can this be assigned to me?

from kaocha.

plexus avatar plexus commented on September 28, 2024

That would be great @noorfathima11 , thanks for looking into this. You'll find the code in kaocha.plugin. What happens there is two things

First we try to load the plugin namespace based on the plugin name. How it does this depends on what kind of name the plugin has.

If it's a namespaced (qualified) keyword like :foo.bar/baz then we try to first load foo.bar.baz, and if that doesn't succeed then we try to load foo.bar.

If it's a simple keyword that contains a period then we load the corresponding namespace, so :foo.bar.baz -> (require 'foo.bar.baz). If there is no period in the name, e.g. :notifier, then we consider the plugin to be under kaocha.plugin, so we (require 'kaocha.plugin.notifier) (that last bit is new, I've been wanting to do that forever, code coming to master today).

This namespace loading completely ignores all errors, it really doesn't care if it finds a namespace or not, it proceeds regardless.

The namespace that we try to load is expected to contain a (defmethod kaocha.plugin/-register :the-plugin-name ...). (or a (defplugin ...), which really does the same thing). After trying to load the namespace, we call -register, and this is the point where you get the error message you see above. It's printed in the :default implementation of -register, so it's what you get if no specific -register has been defined for the plugin.

So to give better diagnostics this code is going to have to become smarter. try-load-third-party-namespaces should return information about which namespaces we tried to load, and which one of them actually loaded. The default version of -register should not throw immediately, but it should return a special value so that the caller knows that the default was called.

In register (without the -) we now get all the information we need to generate a proper error message. We can check if the default version of -register got called, and if so print out a message saying which files we attempted to load, and which ones did or did not load.

For example:

ERROR: Failed loading plugin :foo.bar.baz, no such namespace foo.bar.baz.
ERROR: Failed loading plugin :foo.bar/baz, no such namespace foo.bar or foo.bar/baz.
ERROR: Failed loading plugin :foo.bar/baz, loaded namespace foo.bar, but no definition of kaocha.plugin/-register found for :foo.bar/baz.

I hope that makes sense... let me know if you have any questions!

from kaocha.

plexus avatar plexus commented on September 28, 2024

Hi @noorfathima11 , I've unassigned you so others can take this up if they want you. Do let me know if you still want to try your hand at this or other issues.

from kaocha.

alysbrooks avatar alysbrooks commented on September 28, 2024

Fixed by #181

from kaocha.

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.