All Projects → immoh → lein-nsorg

immoh / lein-nsorg

Licence: EPL-1.0 license
Leiningen plugin for organizing ns form

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to lein-nsorg

Lein Tools Deps
A leiningen plugin that lets you share tools.deps.alpha dependencies in your leiningen project
Stars: ✭ 149 (+223.91%)
Mutual labels:  leiningen
jscs-fixer
Atom package to run jscs --fix on your project files
Stars: ✭ 16 (-65.22%)
Mutual labels:  code-style
lein-nrepl
A simple Leininingen plugin to start nREPL 0.4+
Stars: ✭ 19 (-58.7%)
Mutual labels:  leiningen
Reagent Figwheel
Leiningen template for Reagent applications in Clojurescript with Figwheel. Optionally includes secretary, cljs.test, garden, less, cider, devcards, cljs-devtools, re-risk
Stars: ✭ 161 (+250%)
Mutual labels:  leiningen
doo-chrome-devprotocol
A runner for doo which runs tests in Chrome, using the Chrome Dev Protocol with no need for karma or npm.
Stars: ✭ 27 (-41.3%)
Mutual labels:  leiningen
cos-guidelines
Caché ObjectScript contibutors guidelines
Stars: ✭ 15 (-67.39%)
Mutual labels:  code-style
Lein Jupyter
A Leiningen plugin to integrate clojure with jupyter notebook
Stars: ✭ 97 (+110.87%)
Mutual labels:  leiningen
DemoApp
An Android template project for fast development and test.
Stars: ✭ 33 (-28.26%)
Mutual labels:  code-style
Google-Authenticator
Clojure program to compute your google authenticator OTP using TOTP
Stars: ✭ 23 (-50%)
Mutual labels:  leiningen
cljsee
Backporting cljc
Stars: ✭ 26 (-43.48%)
Mutual labels:  leiningen
Jitpack.io
Documentation and issues of https://jitpack.io
Stars: ✭ 2,156 (+4586.96%)
Mutual labels:  leiningen
Twig-CS-Fixer
A tool to automatically fix Twig Coding Standards issues
Stars: ✭ 61 (+32.61%)
Mutual labels:  code-style
vim-jack-in
cider-jack-in for vim
Stars: ✭ 42 (-8.7%)
Mutual labels:  leiningen
Antq
Point out your outdated dependencies.
Stars: ✭ 157 (+241.3%)
Mutual labels:  leiningen
ts-standard
Typescript style guide, linter, and formatter using StandardJS
Stars: ✭ 338 (+634.78%)
Mutual labels:  code-style
Vizdeps
Visualize Leiningen dependencies using Graphviz
Stars: ✭ 131 (+184.78%)
Mutual labels:  leiningen
lein-jmh
Leiningen plugin for jmh-clojure
Stars: ✭ 17 (-63.04%)
Mutual labels:  leiningen
ex format
ExFormat formats Elixir source code according to a standard set of rules
Stars: ✭ 39 (-15.22%)
Mutual labels:  code-style
scheduler
Laravel on my way
Stars: ✭ 20 (-56.52%)
Mutual labels:  code-style
lein-jlink
A lein plugin creates and manages custom java environment
Stars: ✭ 59 (+28.26%)
Mutual labels:  leiningen

lein-nsorg

Leiningen plugin for organizing ns form in a way that whitespace and comments are preserved.

Rules to apply are fully customizable; the default implementation

  • sorts :require, :require-macros, :use and :use-macros libspecs alphabetically and removes duplicates
  • sorts :import class names alphabetically and removes duplicates
  • sorts :exclude, :only, :refer, :refer-macros and :rename options alphabetically and removes duplicates

Also available as Clojure library nsorg and command line tool nsorg-cli.

Installation

Dependency information:

[lein-nsorg "0.3.0"]

Usage

lein nsorg

Example output:

...
in ./src/perf/clojure/clojure/java/perf_jdbc.clj:
   These test compare the raw performance (against an in-memory H2 database)
   for hand-crafted Java JDBC calls and various `query` and `reducible-query`
   calls."
-  (:require [criterium.core :as cc]
-            [clojure.java.jdbc :as sql])
-  (:import (java.sql Connection PreparedStatement ResultSet Statement ResultSetMetaData)))
+  (:require [clojure.java.jdbc :as sql]
+            [criterium.core :as cc])
+  (:import (java.sql Connection PreparedStatement ResultSet ResultSetMetaData Statement)))

 (defn calibrate []
   ;; 840ms
...

Checked 5 files, found problems in 3 files

Paths

Paths to check can be given as arguments to the plugin:

lein nsorg src dev/src

If no locations are given default location is:

  • :source-paths and :test-paths if plugin is run inside Leiningen project
  • current directory if plugin is run outside Leiningen project

Ignoring files

You can ignore a specific file or directory by excluding it from command-line:

lein nsorg --exclude src/my-project/broken_file.clj --exclude test

Apply changes automatically

By default lein-nsorg prints diffs for suggested changes. Changes can be applied automatically to source files with the following option:

lein nsorg --replace

Interactive mode

Instead of applying changes automatically interactive mode asks for each file if suggestions should be applied or not:

lein nsorg --replace --interactive

License

Copyright © 2018 Immo Heikkinen

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].