redplanetlabs / rama-clj-kondo

clj-kondo hooks for Rama code
Apache License 2.0
11 stars 0 forks source link

Custom linters for invalid code within dataflow or foreign queries #7

Closed vemv closed 2 months ago

vemv commented 4 months ago

Hi!

As a suggestion, it would seem feasible to create custom linters for the following patterns that are invalid code:

WDYT?

Thanks - V

basilesportif commented 4 months ago

Would you create these linters at the editor level?

nixin72 commented 4 months ago

Hi @vemv thanks for the suggestions! I'll create tickets for those. Building off the first point there, I think we should also have linting that Clojure primitives don't appear in Rama code (fn, let, if and friends).

@basilesportif - This would be implemented as hooks to clj-kondo, so any editor using clj-kondo or Clojure LSP would benefit from these changes. VSCode, Emacs, Vim, etc. IntelliJ's Cursive doesn't use clj-kondo though, so that wouldn't get support from this.

vemv commented 4 months ago

Awesome, thanks!

I think we should also have linting that Clojure primitives don't appear in Rama code

Yes, I was tempted to request that although I noticed that one gets a pretty clear compile-time error. So I requested the simplest thing first 😁

But yes, some folks tend to want feedback asap (i.e. before it hits the Clojure compiler).

IntelliJ's Cursive doesn't use clj-kondo though, so that wouldn't get support from this.

There's https://github.com/clojure-lsp/clojure-lsp-intellij as of lately as well!

vemv commented 3 months ago

Another thing that I spotted is that Java constructors are forbidden and possibly all interop IIRC?

vemv commented 3 months ago

I think we should also have linting that Clojure primitives don't appear in Rama code (fn, let, if and friends).

Yes, and bit me today, it's somewhat easy to forget

nixin72 commented 2 months ago

Ahh, forgot to close this issue after I merged in the fixes.

vemv commented 2 months ago

Thanks! Will make sure to try these out.