Coder Social home page Coder Social logo

lein-clj-kondo's Introduction

Clojars Project

lein-clj-kondo

A Leiningen plugin to run clj-kondo.

Rationale

Running clj-kondo through Leiningen has some advantages, since it can compute for you things that would have to be specified by hand otherwise (and those things can be forgotten, outdated, etc).

It also provides the ability to express clj-kondo options as Lein project map options, which can work nicely with Lein profiles, plugins, etc.

With using Leiningen, there's the tradeoff of startup speed, which might not be as critical in a CI environment as it is in your CLI.

Installation

Add the plugin to your project.clj:

:plugins [[com.github.clj-kondo/lein-clj-kondo "0.2.5"]]

Usage

This plugin accepts one of the following patterns:

  • lein clj-kondo
    • This lints your :source-paths and :test-paths, as computed by Leiningen.
    • It is necessary that you have analysed the project beforehand (see below)
  • lein clj-kondo <options>
    • This is a good place to analyse your project, or to lint directories other than the :source-paths and :test-paths.
    • For more information on all available options, check the documentation.

Lein CLI

$ # 1.- Analyse your project:
$ lein with-profile +test clj-kondo --copy-configs --dependencies --parallel --lint '$classpath'
$ # 2.- Lint your source and test paths:
$ lein with-profile +test clj-kondo

Activating the +test profile is recommended, so that any :test dependencies are analysed, increasing linting accuracy.

(Note that the :dev profile is already active by default)

Aliases

You can configure your project.clj to add custom aliases to run specific clj-kondo tasks, below you can find a simple example which first lints the project dependencies and then lints the project code:

,,,
:aliases {"clj-kondo-deps" ["with-profile" "+test" "clj-kondo" "--copy-configs" "--dependencies" "--parallel" "--lint" "$classpath"]
          "clj-kondo-lint" ["do" ["clj-kondo-deps"] ["with-profile" "+test" "clj-kondo"]]}
,,,

Config

lein-clj-kondo understands clj-kondo config expressed as :config in a Leiningen project map. Example:

;; Enable a specific linter
:clj-kondo {:config {:linters {:docstring-leading-trailing-whitespace {:level :warning}}}}

The traditional ways of specifying options of course keep working:

  • You can place a .clj-kondo/config.edn file in your project.
  • You can use the --config ... CLI option.

Deploy

bb tag x.y.z to tag the new release, github actions will do the deploy to clojars automatically.

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.