Skip to content

Commit

Permalink
add uncrustify fixer for several languages
Browse files Browse the repository at this point in the history
  • Loading branch information
dsifford committed Sep 5, 2018
1 parent d476578 commit 0ed4a5b
Show file tree
Hide file tree
Showing 14 changed files with 165 additions and 13 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ formatting.
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
| Bash | [language-server](https://github.com/mads-hartmann/bash-language-server), shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [clazy](https://github.com/KDE/clazy) !!, [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/), [uncrustify](https://github.com/uncrustify/uncrustify) |
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [clazy](https://github.com/KDE/clazy) !!, [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/), [uncrustify](https://github.com/uncrustify/uncrustify) |
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration, [uncrustify](https://github.com/uncrustify/uncrustify) |
| Chef | [foodcritic](http://www.foodcritic.io/) |
| Clojure | [joker](https://github.com/candid82/joker) |
| CloudFormation | [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) |
Expand All @@ -110,7 +110,7 @@ formatting.
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
| Cucumber | [cucumber](https://cucumber.io/) |
| Cython (pyrex filetype) | [cython](http://cython.org/) |
| D | [dmd](https://dlang.org/dmd-linux.html) |
| D | [dmd](https://dlang.org/dmd-linux.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server), [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) |
| Dockerfile | [hadolint](https://github.com/hadolint/hadolint) |
Expand All @@ -132,7 +132,7 @@ formatting.
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [cabal-ghc](https://www.haskell.org/cabal/), [stylish-haskell](https://github.com/jaspervdj/stylish-haskell), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt), [hie](https://github.com/haskell/haskell-ide-engine) |
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
| Idris | [idris](http://www.idris-lang.org/) |
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/), [javalsp](https://github.com/georgewfraser/vscode-javac) |
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/), [javalsp](https://github.com/georgewfraser/vscode-javac), [uncrustify](https://github.com/uncrustify/uncrustify) |
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
| JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) |
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !!, [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions |
Expand All @@ -149,8 +149,8 @@ formatting.
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
| Objective-C | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html) |
| Objective-C++ | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html) |
| Objective-C | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
| Objective-C++ | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) |
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic), [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) |
| PHP | [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer), [php-cs-fixer](http://cs.sensiolabs.org/) |
Expand Down
5 changes: 5 additions & 0 deletions autoload/ale/fix/registry.vim
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['xml'],
\ 'description': 'Fix XML files with xmllint.',
\ },
\ 'uncrustify': {
\ 'function': 'ale#fixers#uncrustify#Fix',
\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'objc', 'objcpp', 'd', 'java', 'p', 'vala' ],
\ 'description': 'Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.',
\ },
\}

" Reset the function registry to the default entries.
Expand Down
16 changes: 16 additions & 0 deletions autoload/ale/fixers/uncrustify.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
" Author: Derek P Sifford <[email protected]>
" Description: Fixer for C, C++, C#, ObjectiveC, D, Java, Pawn, and VALA.

call ale#Set('c_uncrustify_executable', 'uncrustify')
call ale#Set('c_uncrustify_options', '')

function! ale#fixers#uncrustify#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'c_uncrustify_executable')
let l:options = ale#Var(a:buffer, 'c_uncrustify_options')

return {
\ 'command': ale#Escape(l:executable)
\ . ' --no-backup'
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction
19 changes: 19 additions & 0 deletions doc/ale-c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,5 +262,24 @@ g:ale_c_gcc_options *g:ale_c_gcc_options*
This variable can be change to modify flags given to gcc.


===============================================================================
uncrustify *ale-c-uncrustify*

g:ale_c_uncrustify_executable *g:ale_c_uncrustify_executable*
*b:ale_c_uncrustify_executable*
Type: |String|
Default: `'uncrustify'`

This variable can be changed to use a different executable for uncrustify.


g:ale_c_uncrustify_options *g:ale_c_uncrustify_options*
*b:ale_c_uncrustify_options*
Type: |String|
Default: `''`

This variable can be change to modify flags given to uncrustify.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
6 changes: 6 additions & 0 deletions doc/ale-cpp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,11 @@ g:ale_cpp_gcc_options *g:ale_cpp_gcc_options*
This variable can be changed to modify flags given to gcc.


===============================================================================
uncrustify *ale-cpp-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
6 changes: 6 additions & 0 deletions doc/ale-cs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,11 @@ g:ale_cs_mcsc_assemblies *g:ale_cs_mcsc_assemblies*
\]
<

===============================================================================
uncrustify *ale-cs-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
12 changes: 12 additions & 0 deletions doc/ale-d.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
===============================================================================
ALE D Integration *ale-d-options*


===============================================================================
uncrustify *ale-d-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
6 changes: 6 additions & 0 deletions doc/ale-java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,11 @@ g:ale_java_javalsp_jar *g:ale_java_javalsp_jar*
and -d. They are added automatically.


===============================================================================
uncrustify *ale-java-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
6 changes: 6 additions & 0 deletions doc/ale-objc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ g:ale_objc_clangd_options *g:ale_objc_clangd_options*
This variable can be changed to modify flags given to clangd.


===============================================================================
uncrustify *ale-objc-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
6 changes: 6 additions & 0 deletions doc/ale-objcpp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ g:ale_objcpp_clangd_options *g:ale_objcpp_clangd_options*
This variable can be changed to modify flags given to clangd.


===============================================================================
uncrustify *ale-objc-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
12 changes: 12 additions & 0 deletions doc/ale-pawn.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
===============================================================================
ALE Pawn Integration *ale-pawn-options*


===============================================================================
uncrustify *ale-pawn-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
12 changes: 12 additions & 0 deletions doc/ale-vala.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
===============================================================================
ALE VALA Integration *ale-vala-options*


===============================================================================
uncrustify *ale-vala-uncrustify*

See |ale-c-uncrustify| for information about the available options.


===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
Loading

0 comments on commit 0ed4a5b

Please sign in to comment.