Comments (8)
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.
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.
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.
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.
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.
That would be cool. Anything to lower the barrier to tool-writing seems like a good thing in my book.
from clojure.
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.
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)
- User is not told what the error is when a runtime error occurs HOT 1
- Rotational Cipher Tests differ from description HOT 2
- Broken URL in strings concept
- Elyses Destructured Enchantments: Tests mix up Expected and Actual results HOT 1
- Complex Numbers: Tests mix up Expected and Actual results, and unclear about requiring floats rather than rationals HOT 1
- Implement new learning exercise: Protocols
- Bank Account problem under wrong concept? HOT 2
- Implement new learning exercise: Atoms HOT 1
- Tracks on Tracks on Tracks: Incorrect implementation of task 4 passes test for task 4, but fails test for task 6 HOT 3
- Difficult to reproduce tests locally HOT 2
- test HOT 1
- New concept: deriving new functions from existing functions (partial, comp, memoize) HOT 8
- Building a training set of tags for clojure HOT 21
- The specification of 'memoize-transform' in the coordinate-transformation exercise can be made more precise HOT 1
- Leap 48in24 approaches HOT 1
- Reverse-string 48in24 approaches HOT 3
- Exercises to port HOT 4
- Approaches for raindrops HOT 1
- Error in test for Card Games exercise, 6. More averaging techniques HOT 1
- No function found on command line or in :exec-fn during test execution HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clojure.