mirror of https://github.com/dense-analysis/ale
Add cljfmt fixer for clojure files (#4860)
This commit is contained in:
parent
5cc6b933b1
commit
defb0ea336
|
@ -672,6 +672,11 @@ let s:default_registry = {
|
||||||
\ 'suggested_filetypes': ['ruby'],
|
\ 'suggested_filetypes': ['ruby'],
|
||||||
\ 'description': 'A formatter for Ruby source code',
|
\ 'description': 'A formatter for Ruby source code',
|
||||||
\ },
|
\ },
|
||||||
|
\ 'cljfmt': {
|
||||||
|
\ 'function': 'ale#fixers#cljfmt#Fix',
|
||||||
|
\ 'suggested_filetypes': ['clojure'],
|
||||||
|
\ 'description': 'formatter and linter for clojure files',
|
||||||
|
\ },
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Reset the function registry to the default entries.
|
" Reset the function registry to the default entries.
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
" Author: rudolf ordoyne <rudolfordoyne@protonmail.com>
|
||||||
|
" Description: Support for cljfmt https://github.com/weavejester/cljfmt
|
||||||
|
|
||||||
|
call ale#Set('clojure_cljfmt_executable', 'cljfmt')
|
||||||
|
|
||||||
|
function! ale#fixers#cljfmt#Fix(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'clojure_cljfmt_executable')
|
||||||
|
|
||||||
|
return {
|
||||||
|
\ 'command': ale#Escape(l:executable) . ' fix %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\}
|
||||||
|
endfunction
|
||||||
|
|
|
@ -16,6 +16,18 @@ g:ale_clojure_clj_kondo_options *g:ale_clojure_clj_kondo_options*
|
||||||
|
|
||||||
This variable can be changed to modify options passed to clj-kondo.
|
This variable can be changed to modify options passed to clj-kondo.
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
cljfmt *ale-clojure-cljfmt*
|
||||||
|
|
||||||
|
cljfmt is a linter and fixer for Clojure code, with defaults adhering to the
|
||||||
|
Clojure Style Guide (see https://guide.clojure.style/ )
|
||||||
|
|
||||||
|
https://github.com/weavejester/cljfmt
|
||||||
|
|
||||||
|
Linting options are not configurable by ale, but instead are controlled by
|
||||||
|
Leiningen, or a cljfmt file in the current or parent directories.
|
||||||
|
|
||||||
|
see https://github.com/weavejester/cljfmt#Configuration for more information.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
joker *ale-clojure-joker*
|
joker *ale-clojure-joker*
|
||||||
|
|
|
@ -112,6 +112,7 @@ Notes:
|
||||||
* `foodcritic`!!
|
* `foodcritic`!!
|
||||||
* Clojure
|
* Clojure
|
||||||
* `clj-kondo`
|
* `clj-kondo`
|
||||||
|
* `cljfmt`
|
||||||
* `joker`
|
* `joker`
|
||||||
* CloudFormation
|
* CloudFormation
|
||||||
* `cfn-python-lint`
|
* `cfn-python-lint`
|
||||||
|
|
|
@ -2946,6 +2946,7 @@ documented in additional help files.
|
||||||
foodcritic............................|ale-chef-foodcritic|
|
foodcritic............................|ale-chef-foodcritic|
|
||||||
clojure.................................|ale-clojure-options|
|
clojure.................................|ale-clojure-options|
|
||||||
clj-kondo.............................|ale-clojure-clj-kondo|
|
clj-kondo.............................|ale-clojure-clj-kondo|
|
||||||
|
cljfmt................................|ale-clojure-cljfmt|
|
||||||
joker.................................|ale-clojure-joker|
|
joker.................................|ale-clojure-joker|
|
||||||
cloudformation..........................|ale-cloudformation-options|
|
cloudformation..........................|ale-cloudformation-options|
|
||||||
cfn-python-lint.......................|ale-cloudformation-cfn-python-lint|
|
cfn-python-lint.......................|ale-cloudformation-cfn-python-lint|
|
||||||
|
|
|
@ -121,6 +121,7 @@ formatting.
|
||||||
* [foodcritic](http://www.foodcritic.io/) :floppy_disk:
|
* [foodcritic](http://www.foodcritic.io/) :floppy_disk:
|
||||||
* Clojure
|
* Clojure
|
||||||
* [clj-kondo](https://github.com/borkdude/clj-kondo)
|
* [clj-kondo](https://github.com/borkdude/clj-kondo)
|
||||||
|
* [cljfmt](https://github.com/weavejester/cljfmt)
|
||||||
* [joker](https://github.com/candid82/joker)
|
* [joker](https://github.com/candid82/joker)
|
||||||
* CloudFormation
|
* CloudFormation
|
||||||
* [cfn-python-lint](https://github.com/awslabs/cfn-python-lint)
|
* [cfn-python-lint](https://github.com/awslabs/cfn-python-lint)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpFixerTest('clojure', 'cljfmt')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
|
Execute(The cljfmt callback should return the correct default values):
|
||||||
|
AssertFixer {
|
||||||
|
\ 'command': ale#Escape('cljfmt') . ' fix %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\}
|
||||||
|
|
Loading…
Reference in New Issue