Giter Club home page Giter Club logo

Comments (8)

mathias avatar mathias commented on June 22, 2024

One issue that we'll run into with most Clojure code quality tools (I covered a couple in a blog post) is that they expect a proper Leiningen project setup, since the tools themselves are Leiningen plugins. The one exception that does work is kibit. I run it like this:

exercism/clojure/rna-transcription$ lein kibit rna_transcription.clj

As long as the path to the file to check is indicated (and Kibit has been added to the user's ~/.lein/profiles.clj as the instructions for Kibit suggest) it works great as a code smell detector and for suggesting more-idiomatic code. But it isn't quite a linter, in the sense that something like JSHint is. https://github.com/dakrone/lein-bikeshed might be better for traditional linter tasks (line too long, etc.) but it would require changing all the exercises to be proper Leiningen projects. Eastwood is also likely to have helpful feedback for programmers new to Clojure, but it both requires a Leiningen project and can have unexpected results if it can trigger any side effects by loading the code (which, come to think of it, should not be a problem for any of the exercises I've worked on so far, as long as it only loads source files and not tests)

from clojure.

kytrinyx avatar kytrinyx commented on June 22, 2024

Kibit sounds interesting, even if it's not a completely traditional linter.

We're going to add a "leinify" command to the exercism CLI, so we could point to linters for people who choose to use it.

from clojure.

canweriotnow avatar canweriotnow commented on June 22, 2024

kibit is also easy to integrate into emacs:

;; kibit

;; Teach compile the syntax of the kibit output
(require 'compile)
(add-to-list 'compilation-error-regexp-alist-alist
             '(kibit "At \\([^:]+\\):\\([[:digit:]]+\\):" 1 2 nil 0))
(add-to-list 'compilation-error-regexp-alist 'kibit)

;; A convenient command to run "lein kibit" in the project to which
;; the current emacs buffer belongs to.
(defun kibit ()
  "Run kibit on the current project.
Display the results in a hyperlinked *compilation* buffer."
  (interactive)
  (compile "lein kibit"))

(defun kibit-current-file ()
  "Run kibit on the current file.
Display the results in a hyperlinked *compilation* buffer."
  (interactive)
  (compile (concat "lein kibit " buffer-file-name)))

But as @mathias pointed out, kibit's more about writing 'idiomatic' code than traditional linting... and it is showing its age... was just discussing this on #clojure IRC yesterday.

@kytrinyx is there a thread on the leinify cmd addition? I'm trying to keep pace with the CLI in exercism-emacs package, and I could see some really useful support from CIDER and clojure-mode in doing an 'enhanced' leinification from within emacs.

FWIW, I liked the lack of a project.clj in the exercises, helped to keep it simple, and removed direct support for 3rd party libs I discussed in #39

from clojure.

kytrinyx avatar kytrinyx commented on June 22, 2024

We have a thread open here: exercism/cli#102 -- it stalled a bit because I got ridiculously busy, but now that there are 3 core contributors to the CLI package, things have been moving more quickly again.

from clojure.

canweriotnow avatar canweriotnow commented on June 22, 2024

Ah, gotcha. Just commented there with some suggestions on how to achieve this... it occurs to me after the fact that the lein-template suggestion I made over there would also ease access for exercism-emacs or any other editor packages/tools people wanted to write.

from clojure.

kytrinyx avatar kytrinyx commented on June 22, 2024

That would be cool. Anything to lower the barrier to tool-writing seems like a good thing in my book.

from clojure.

canweriotnow avatar canweriotnow commented on June 22, 2024

How about adding squiggly-clojure to the default project.clj, it uses Eastwood and core.typed w/ Flycheck to lint as you type... I guess that's mainly of help to emacs users, but I think there are some similar things for other editors.

It would be interesting to do a survey of editor usage/preference per-track and across the board...

from clojure.

kytrinyx avatar kytrinyx commented on June 22, 2024

I'm down with that. A survey would be interesting... I wonder what the easiest way to implement that would be (external tool, presumably?)

from clojure.

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.