Coder Social home page Coder Social logo

Comments (14)

rrrene avatar rrrene commented on August 29, 2024

Here is a sample project which loads a demo plugin which brings its own check.

I think this demonstrates what you are trying to do, right?

If you are still having problems, can you create a minimal reproducible example?

from credo.

epinault avatar epinault commented on August 29, 2024

yea this assumes that it s all in the same repo that example. I ll see if i can build a minimal repro next week

from credo.

rrrene avatar rrrene commented on August 29, 2024

yea this assumes that it s all in the same repo that example.

So, you have (a) a plugin in one repo, (b) a check in another repo and (c) a project where this should come together?

from credo.

epinault avatar epinault commented on August 29, 2024

I have a lib that define the plugin and includes custom checks
then I have an app that use that lib to configure credo and run the check defined by that lib

from credo.

rrrene avatar rrrene commented on August 29, 2024

And how is this different from the example linked above?

from credo.

epinault avatar epinault commented on August 29, 2024

so I guess the setup is similar but I don t want the sample project to load the custom check. I put the require and the custom check in the demo plugin. So I was hoping not to have to have every application to have to enable the custom check in their credo file.

so I would say try to move the require and the custom check enabling in the plugin instead and that should about what I have

from credo.

rrrene avatar rrrene commented on August 29, 2024

So I was hoping not to have to have every application to have to enable the custom check in their credo file.

And you don't have to (again: see the linked example above).

I would very much like to help you (again: can you put something online that reproduces this error, so I can look at it?).

from credo.

epinault avatar epinault commented on August 29, 2024

there you go!

clone both https://github.com/epinault/credo_sample_project and https://github.com/epinault/credo_demo_plugin
both in the same dir

if you run mix credo,, you ll noticed I added a debug that show it s never running the Better check

from credo.

rrrene avatar rrrene commented on August 29, 2024

If I run mix credo suggest I get this:

image

Do you get another result?

from credo.

epinault avatar epinault commented on August 29, 2024
❯ elixir -v
Erlang/OTP 25 [erts-13.2.2.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.14.5 (compiled with Erlang/OTP 24)

❯ mix credo --help
Credo Version 1.7.0-ref.master.7179615+uncommittedchanges
Usage: $ mix credo <command> [options]

credo_sample_project on  master is 📦 v0.1.0 via 💧 on ☁️  (us-west-2) took 2s
❯ mix credo
By the power of !
```


only difference I see is you use suggest?  I have it all over my CI or running locally as this
```
mix credo --strict
```

and now i see this error

❯ mix credo --strict
** (credo) Unknown switch for `demo` command: --strict


yet the lock file says


```
  "credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "6839fcf63d1f0d1c0f450abc8564a57c43d644077ab96f2934563e68b8a769d7"},
  ```

from credo.

rrrene avatar rrrene commented on August 29, 2024

The demo plugin teaches you to

  1. add a config (for a check provided by the plugin)
  2. register a new command
  3. register a CLI switch to configure that command and
  4. set that command as the "default command"

You seem to have used that demo plugin, wanting to use the first point and have not stripped out the code responsible for the last three points.

Therefore, when you type mix credo, it does not do what you think.

Did you never think "Why is it printing 'By the power of !'??" ...

from credo.

epinault avatar epinault commented on August 29, 2024

I did not realize this plugin was also doing another command. I ll modify once more the code to reflect more my project . let me fully get a commit for those repo that reflect and remove that CLI command

from credo.

epinault avatar epinault commented on August 29, 2024

meanwhile would you mind looking at #1069 since really that would solving my problem if that was part of credo already anyway

from credo.

epinault avatar epinault commented on August 29, 2024

ok so I can see it working . I am not sure why it was not working on mh other project but once I clobber my plugin package then it started to behave again correctly. Though both were using the exact same plugin and using path: to point to it.. I wonder if there is an issue around hex and some caching using path at time.

I literally had the same config between those project another one. and only thing that made it work was doing a

mix deps.clean my_plugin

from credo.

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.