diff --git a/doc/BUILTINS.md b/doc/BUILTINS.md index f5c0aecfd..4d6c03a2d 100644 --- a/doc/BUILTINS.md +++ b/doc/BUILTINS.md @@ -175,6 +175,24 @@ local sources = { null_ls.builtins.formatting.asmfmt } - `command = "asmfmt"` - `args = {}` +#### [autopep8](https://github.com/hhatto/autopep8) + +##### About + +Formatter for `python` files. + +##### Usage + +```lua +local sources = { null_ls.builtins.formatting.autopep8 } +``` + +##### Defaults + +- `filetypes = { "python" }` +- `command = "autopep8"` +- `args = { "-" }` + #### [bean-format](https://beancount.github.io/docs/running_beancount_and_generating_reports.html#bean-format) ##### About @@ -269,27 +287,6 @@ local sources = { null_ls.builtins.formatting.codespell } - `command = "codespell"` - `args = { "--write-changes", "$FILENAME" }` -#### [credo](https://hexdocs.pm/credo) - -##### About - -Static analysis for `elixir` files for enforcing code consistency. - -- Searches upwards from the buffer to the project root and tries to find the first `.credo.exs` file in case nested credo configs are used. -- When not using a global credo install, the diagnostic can be disable with a conditional checking for the config file with `utils.root_has_file('.credo.exs')` - -##### Usage - -```lua -local sources = { null_ls.builtins.diagnostics.credo } -``` - -##### Defaults - -- `filetypes = { "elixir" }` -- `command = "mix"` -- `args = { "credo", "suggest", "--format", "json", "--read-from-stdin", "$FILENAME" }` - #### [crystal-format](https://crystal-lang.org/2015/10/16/crystal-0.9.0-released.html) ##### About @@ -308,66 +305,66 @@ local sources = { null_ls.builtins.formatting.crystal_format } - `command = "crystal"` - `args = { "tool", "format" }` -#### [dfmt](https://github.com/dlang-community/dfmt) +#### [dart-format](https://dart.dev/tools/dart-format) ##### About -Formatter for `D` source code +Replace the whitespace in your program with formatting that follows Dart guidelines. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.dfmt } +local sources = { null_ls.builtins.formatting.dart_format } ``` ##### Defaults -- `filetypes = { "d" }` -- `command = "dfmt"` -- `args = {}` +- `filetypes = { "dart" }` +- `command = "dart"` +- `args = { "format" }` -#### [dart-format](https://dart.dev/tools/dart-format) +#### [Deno Formatter](https://deno.land/manual/tools/formatter) ##### About -Replace the whitespace in your program with formatting that follows Dart guidelines. +Use [Deno](https://deno.land) to format TypeScript and JavaScript code. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.dart_format } +local sources = { null_ls.builtins.formatting.deno_fmt } ``` ##### Defaults -- `filetypes = { "dart" }` -- `command = "dart"` -- `args = { "format" }` +- `filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" }` +- `command = "deno"` +- `args = { "fmt", "-"}` -#### [deno formatter](https://deno.land/manual/tools/formatter) +#### [dfmt](https://github.com/dlang-community/dfmt) ##### About -Use [deno](https://deno.land) to format TypeScript and JavaScript code +Formatter for `D` source code. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.deno_fmt } +local sources = { null_ls.builtins.formatting.dfmt } ``` ##### Defaults -- `filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" }` -- `command = "deno"` -- `args = { "fmt", "-"}` +- `filetypes = { "d" }` +- `command = "dfmt"` +- `args = {}` #### [elm-format](https://github.com/avh4/elm-format) ##### About `elm-format` formats Elm source code according to a standard set of rules based -on the [official Elm Style Guide](https://elm-lang.org/docs/style-guide) +on the [official Elm Style Guide](https://elm-lang.org/docs/style-guide). ##### Usage @@ -381,6 +378,24 @@ local sources = { null_ls.builtins.formatting.elm_format } - `command = "elm-format"` - `args = { "--stdin", "--elm-version=0.19" }` +#### [erlfmt](https://github.com/WhatsApp/erlfmt) + +##### About + +Opinionated `erlang` code formatter. + +##### Usage + +```lua +local sources = { null_ls.builtins.formatting.erlfmt } +``` + +##### Defaults + +- `filetypes = { "erlang" }` +- `command = "erlfmt"` +- `args = { "-" }` + #### [ESLint](https://github.com/eslint/eslint) ##### About @@ -420,24 +435,6 @@ local sources = { null_ls.builtins.formatting.eslint_d } - `command = "eslint_d"` - `args = { "--fix-to-stdout", "--stdin", "--stdin-filepath", "$FILENAME" }` -#### [erlfmt](https://github.com/WhatsApp/erlfmt) - -##### About - -Opinionated `erlang` code formatter. - -##### Usage - -```lua -local sources = { null_ls.builtins.formatting.erlfmt } -``` - -##### Defaults - -- `filetypes = { "erlang" }` -- `command = "erlfmt"` -- `args = { "-" }` - #### [fish_indent](https://linux.die.net/man/1/fish_indent) ##### About @@ -486,11 +483,30 @@ local sources = {null_ls.builtins.formatting.fnlfmt} - `command: "fnlfmt"` - `args: { "--fix" }` +#### [formatR](https://github.com/yihui/formatR) + +##### About + +- Format R code automatically. +- Supports both `textDocument/formatting` and `textDocument/rangeFormatting`. + +##### Usage + +```lua +local sources = { null_ls.builtins.formatting.format_r } +``` + +##### Defaults + +- `filetypes = { "r", "rmd" }` +- `command = "R"` +- `args = { "--slave", "--no-restore", "--no-save", "-e", 'formatR::tidy_source(source="stdin")' }` + #### [fprettify](https://github.com/pseewald/fprettify) ##### About -`fprettify` is an auto-formatter for modern Fortran code that imposes strict whitespace formattin. +`fprettify` is an auto-formatter for modern Fortran code that imposes strict whitespace formatting. ##### Usage @@ -504,88 +520,88 @@ local sources = { null_ls.builtins.formatting.fprettify } - `command = "fprettify"` - `args = { "--silent" }` -#### [golines](https://pkg.go.dev/github.com/segmentio/golines) +#### [gofmt](https://pkg.go.dev/cmd/gofmt) ##### About -Applies a base formatter (eg. `goimports` or `gofmt`), then shorten long lines of code +Formats `go` programs. + +- It uses tabs for indentation and blanks for alignment. +- Alignment assumes that an editor is using a fixed-width font. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.golines } +local sources = { null_ls.builtins.formatting.gofmt } ``` ##### Defaults - `filetypes = { "go" }` -- `command = "golines"` +- `command = "gofmt"` - `args = {}` -#### [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports) +#### [gofumpt](https://github.com/mvdan/gofumpt) ##### About -Updates your Go import lines, adding missing ones and removing unreferenced ones. +Enforce a stricter format than `gofmt`, while being backwards compatible. +That is, `gofumpt` is happy with a subset of the formats that `gofmt` is happy with. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.goimports } +local sources = { null_ls.builtins.formatting.gofumpt } ``` ##### Defaults - `filetypes = { "go" }` -- `command = "goimports"` +- `command = "gofumpt"` - `args = {}` -#### [gofmt](https://pkg.go.dev/cmd/gofmt) +#### [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports) ##### About -Formats `go` programs. - -- It uses tabs for indentation and blanks for alignment. -- Alignment assumes that an editor is using a fixed-width font. +Updates your Go import lines, adding missing ones and removing unreferenced ones. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.gofmt } +local sources = { null_ls.builtins.formatting.goimports } ``` ##### Defaults - `filetypes = { "go" }` -- `command = "gofmt"` +- `command = "goimports"` - `args = {}` -#### [gofumpt](https://github.com/mvdan/gofumpt) +#### [golines](https://pkg.go.dev/github.com/segmentio/golines) ##### About -Enforce a stricter format than `gofmt`, while being backwards compatible. -That is, `gofumpt` is happy with a subset of the formats that `gofmt` is happy with. +Applies a base formatter (eg. `goimports` or `gofmt`), then shorten long lines of code. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.gofumpt } +local sources = { null_ls.builtins.formatting.golines } ``` ##### Defaults - `filetypes = { "go" }` -- `command = "gofumpt"` +- `command = "golines"` - `args = {}` #### [isort](https://github.com/PyCQA/isort) ##### About -`python` utility / library to sort imports alphabetically, and automatically -separated into sections and by type. +`python` utility / library to sort imports alphabetically and automatically +separate them into sections and by type. ##### Usage @@ -674,24 +690,6 @@ local sources = { null_ls.builtins.formatting.mix } - `command = "mix"` - `args = { "format", "-" }` -#### [Surface](https://hexdocs.pm/surface_formatter/readme.html) - -##### About - -A code formatter for Surface, the server-side rendering component library for Phoenix. - -##### Usage - -```lua -local sources = { null_ls.builtins.formatting.surface } -``` - -##### Defaults - -- `filetypes = { "elixir", "surface" }` -- `command = "mix"` -- `args = { "surface.format", "-" }` - #### [nginxbeautifier](https://github.com/vasilevich/nginxbeautifier) ##### About @@ -765,12 +763,29 @@ local sources = { null_ls.builtins.formatting.phpcbf } - `command = "phpcbf"` - `args = { "--standard=PSR12", "-" }` +#### [php-cs-fixer](https://github.com/FriendsOfPhp/PHP-CS-Fixer) + +##### About + +Formatter for `php` files. + +##### Usage + +```lua +local sources = { null_ls.builtins.formatting.phpcsfixer } +``` + +##### Defaults + +- `filetypes = { "php" }` +- `command = "php-cs-fixer"` +- `args = { '--no-interaction', '--quiet', 'fix', "$FILENAME" }` + #### [prettier](https://github.com/prettier/prettier) ##### About -- Supports both `textDocument/formatting` and `textDocument/rangeFormatting` -- May not work on some filetypes. +- Supports both `textDocument/formatting` and `textDocument/rangeFormatting`. ##### Usage @@ -812,7 +827,6 @@ local sources = { null_ls.builtins.formatting.prettier_d_slim } - Another "`prettier`, but faster" formatter, with better support for non-JavaScript filetypes. - - Does not support `textDocument/rangeFormatting`. ##### Usage @@ -845,78 +859,78 @@ local sources = { null_ls.builtins.formatting.prismaFmt } - `command = "prisma-fmt"` - `args = { "format", "-i", "$FILENAME" }` -#### [formatR](https://github.com/yihui/formatR) +#### [qmlformat](https://doc-snapshots.qt.io/qt6-dev/qtquick-tools-and-utilities.html#qmlformat) ##### About -- Format R code automatically. -- Supports both `textDocument/formatting` and `textDocument/rangeFormatting`. +`qmlformat` is a tool that automatically formats QML files in accordance with +the QML Coding Conventions. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.format_r } +local sources = { null_ls.builtins.formatting.qmlformat } ``` ##### Defaults -- `filetypes = { "r", "rmd" }` -- `command = "R"` -- `args = { "--slave", "--no-restore", "--no-save", "-e", 'formatR::tidy_source(source="stdin")' }` +- `filetypes = { "qml" }` +- `command = "qmlformat"` +- `args = { "-i", "$FILENAME" }` -#### [rubocop](https://github.com/rubocop/rubocop) +#### [reorder_python_imports](https://pypi.org/project/reorder-python-imports/) ##### About -Ruby static code analyzer and formatter, based on the community Ruby style guide. +Tool for automatically reordering python imports. Similar to `isort` but uses static analysis more. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.rubocop } +local sources = { null_ls.builtins.formatting.reorder_python_imports } ``` ##### Defaults -- `filetypes = { "ruby" }` -- `command = "rubocop"` -- `args = { "--auto-correct", "-f", "quiet", "--stderr", "--stdin", "$FILENAME" }` +- `filetypes = { "python" }` +- `command = "reorder-python-imports"` +- `args = { "-", "--exit-zero-even-if-changed" }` -#### [rufo](https://github.com/ruby-formatter/rufo) +#### [rubocop](https://github.com/rubocop/rubocop) ##### About -Opinionated `ruby` formatter. +Ruby static code analyzer and formatter, based on the community Ruby style guide. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.rufo } +local sources = { null_ls.builtins.formatting.rubocop } ``` ##### Defaults - `filetypes = { "ruby" }` -- `command = "rufo"` -- `args = { "-x" }` +- `command = "rubocop"` +- `args = { "--auto-correct", "-f", "quiet", "--stderr", "--stdin", "$FILENAME" }` -#### [zigfmt](https://github.com/ziglang/zig) +#### [rufo](https://github.com/ruby-formatter/rufo) ##### About -Reformat Zig source into canonical form +Opinionated `ruby` formatter. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.zigfmt } +local sources = { null_ls.builtins.formatting.rufo } ``` ##### Defaults -- `filetypes = { "zig" }` -- `command = "zig"` -- `args = { "fmt", "--stdin" }` +- `filetypes = { "ruby" }` +- `command = "rufo"` +- `args = { "-x" }` #### [rustfmt](https://github.com/rust-lang/rustfmt) @@ -954,66 +968,47 @@ local sources = { null_ls.builtins.formatting.rustywind } - `command = "rustywind"` - `args = { "--stdin" }` -#### [shellcheck](https://www.shellcheck.net) +#### [scalafmt](https://github.com/scalameta/scalafmt) ##### About -A shell script static analysis tool. +Code formatter for Scala ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.shellcheck } +local sources = { null_ls.builtins.formatting.scalafmt } ``` ##### Defaults -- `filetypes = { "sh" }` -- `command = "shellcheck"` -- args = { "--format", "json1", "-" }, +- `filetypes = { "scala" }` +- `command = "scalafmt"` +- `args = { "--stdin" }` -#### [sqlformat](https://manpages.ubuntu.com/manpages/xenial/man1/sqlformat.1.html) +#### [shellharden](https://github.com/anordal/shellharden) ##### About -The `sqlformat` command-line tool can be used to reformat SQL file -according to specified options. +Hardens shell scripts by quoting variables, replacing `` `function_call` `` with `$(function_call)`, and more. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.sqlformat } +local sources = { null_ls.builtins.formatting.shellharden } ``` ##### Defaults -- `filetypes = { "sql" }` -- `command = "sqlformat"` -- `args = { "--reindent", "-" }` - -#### [scalafmt](https://github.com/scalameta/scalafmt) - -##### About - -Code formatter for Scala - -##### Usage - -```lua -local sources = { null_ls.builtins.formatting.scalafmt } -``` - -##### Defaults - -- `filetypes = { "scala" }` -- `command = "scalafmt"` -- `args = { "--stdin" }` +- `filetypes = { "sh" }` +- `command = "shellharden"` +- `args = { "--transform", "$FILENAME" }` #### [shfmt](https://github.com/mvdan/sh) ##### About -A `shell` parser, formatter, and interpreter with `bash` support +A `shell` parser, formatter, and interpreter with `bash` support. ##### Usage @@ -1027,23 +1022,24 @@ local sources = { null_ls.builtins.formatting.shfmt } - `command = "shfmt"` - `args = {}` -#### [shellharden](https://github.com/anordal/shellharden) +#### [sqlformat](https://manpages.ubuntu.com/manpages/xenial/man1/sqlformat.1.html) ##### About -Hardens shell scripts by quoting variables, replacing `` `function_call` `` with `$(function_call)`, and more +The `sqlformat` command-line tool can be used to reformat SQL file +according to specified options. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.shellharden } +local sources = { null_ls.builtins.formatting.sqlformat } ``` ##### Defaults -- `filetypes = { "sh" }` -- `command = "shellharden"` -- `args = { "--transform", "$FILENAME" }` +- `filetypes = { "sql" }` +- `command = "sqlformat"` +- `args = { "--reindent", "-" }` #### [standardrb](https://github.com/testdouble/standard) @@ -1063,6 +1059,24 @@ local sources = { null_ls.builtins.formatting.standardrb } - `command = "standardrb"` - `args = { "--fix", "--format", "quiet", "--stderr", "--stdin", "$FILENAME" }` +#### [Stylelint](https://github.com/stylelint/stylelint) + +##### About + +A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. + +##### Usage + +```lua +local sources = { null_ls.builtins.formatting.stylelint } +``` + +##### Defaults + +- `filetypes = { "scss", "less", "css", "sass" }` +- `command = "stylelint"` +- `args = { "--fix", "--stdin", "-" }` + #### [styler](https://github.com/r-lib/styler) ##### About @@ -1104,6 +1118,24 @@ local sources = { null_ls.builtins.formatting.stylua } - `command = "stylua"` - `args = { "-s", "-" }` +#### [Surface](https://hexdocs.pm/surface_formatter/readme.html) + +##### About + +A code formatter for Surface, the server-side rendering component library for Phoenix. + +##### Usage + +```lua +local sources = { null_ls.builtins.formatting.surface } +``` + +##### Defaults + +- `filetypes = { "elixir", "surface" }` +- `command = "mix"` +- `args = { "surface.format", "-" }` + #### [swiftformat](https://github.com/nicklockwood/SwiftFormat) ##### About @@ -1123,6 +1155,24 @@ local sources = { null_ls.builtins.formatting.swiftformat } - `command = "swiftformat"` - `args = {}` +#### [Taplo](https://taplo.tamasfe.dev) + +#### About + +A versatile, feature-rich TOML toolkit. + +##### Usage + +```lua +local sources = { null_ls.builtins.formatting.taplo } +``` + +##### Defaults + +- `filetypes = { "toml" }` +- `command = "taplo"` +- `args = { "format", "-" }` + #### [terraform_fmt](https://www.terraform.io/docs/cli/commands/fmt.html) ##### About @@ -1160,14 +1210,6 @@ local sources = { null_ls.builtins.formatting.trim_newlines } - `command = "awk"` - `args = { 'NF{print s $0; s=""; next} {s=s ORS}' }` -if you want to use this with specific filetypes you can set using `with` - -```lua -local sources = { null_ls.builtins.formatting.trim_newlines.with({ - filetypes = { "lua", "c", "cpp } -}) } -``` - #### trim_whitespace ##### About @@ -1186,14 +1228,6 @@ local sources = { null_ls.builtins.formatting.trim_whitespace } - `command = "awk"` - `args = { '{ sub(/[ \t]+$/, ""); print }' }` -if you want to use this with specific filetypes you can set using `with` - -```lua -local sources = { null_ls.builtins.formatting.trim_whitespace.with({ - filetypes = { "lua", "c", "cpp } -}) } -``` - #### [uncrustify](https://github.com/uncrustify/uncrustify) ##### About @@ -1231,97 +1265,100 @@ local sources = { null_ls.builtins.formatting.yapf } - `command = "yapf"` - `args = { "--quiet" }` -#### [autopep8](https://github.com/hhatto/autopep8) +#### [zigfmt](https://github.com/ziglang/zig) ##### About -Formatter for `python` files +Reformat Zig source into canonical form. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.autopep8 } +local sources = { null_ls.builtins.formatting.zigfmt } ``` ##### Defaults -- `filetypes = { "python" }` -- `command = "autopep8"` -- `args = { "-" }` +- `filetypes = { "zig" }` +- `command = "zig"` +- `args = { "fmt", "--stdin" }` -#### [php-cs-fixer](https://github.com/FriendsOfPhp/PHP-CS-Fixer) +### Diagnostics + +#### [chktex](https://www.nongnu.org/chktex/) ##### About -Formatter for `php` files +`latex` semantic linter. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.phpcsfixer } +local sources = { null_ls.builtins.diagnostics.chktex } ``` ##### Defaults -- `filetypes = { "php" }` -- `command = "php-cs-fixer"` -- `args = { '--no-interaction', '--quiet', 'fix', "$FILENAME" }` +- `filetypes = { "tex" }` +- `command = "chktex"` +- `args = { "-q", "-I0", "-f%l:%c:%d:%k:%m\n" }` -#### [Stylelint](https://github.com/stylelint/stylelint) +#### [codespell](https://github.com/codespell-project/codespell) ##### About -A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. +`codespell` finds common misspellings in text files. ##### Usage ```lua -local sources = { null_ls.builtins.formatting.stylelint } +local sources = { null_ls.builtins.diagnostics.codespell } ``` ##### Defaults -- `filetypes = { "scss", "less", "css", "sass" }` -- `command = "stylelint"` -- `args = { "--fix", "--stdin", "-" }` - -### Diagnostics +- `filetypes = {}` +- `command = "codespell"` +- `args = { "-" }` -#### [chktex](https://www.nongnu.org/chktex/) +#### [cppcheck](https://github.com/danmar/cppcheck) ##### About -`latex` semantic linter. +A tool for fast static analysis of `C/C++` code. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.chktex } +local sources = { null_ls.builtins.diagnostics.cppcheck } ``` ##### Defaults -- `filetypes = { "tex" }` -- `command = "chktex"` -- `args = { "-q", "-I0", "-f%l:%c:%d:%k:%m\n" }` +- `filetypes = { "cpp" , "c" }` +- `command = "cppcheck"` +- `args = { "--enable=warning,style,performance,portability", "--template=gcc", "$FILENAME" }` -#### [codespell](https://github.com/codespell-project/codespell) +#### [credo](https://hexdocs.pm/credo) ##### About -`codespell` fix common misspellings in text files. +Static analysis for `elixir` files for enforcing code consistency. + +- Searches upwards from the buffer to the project root and tries to find the first `.credo.exs` file in case nested credo configs are used. +- When not using a global credo install, the diagnostic can be disable with a conditional checking for the config file with `utils.root_has_file('.credo.exs')` ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.codespell } +local sources = { null_ls.builtins.diagnostics.credo } ``` ##### Defaults -- `filetypes = {}` -- `command = "codespell"` -- `args = { "-" }` +- `filetypes = { "elixir" }` +- `command = "mix"` +- `args = { "credo", "suggest", "--format", "json", "--read-from-stdin", "$FILENAME" }` #### [ESLint](https://github.com/eslint/eslint) @@ -1422,41 +1459,79 @@ local sources = { null_ls.builtins.diagnostics.luacheck } - `command = "luacheck"` - `args = { "--formatter", "plain", "--codes", "--ranges", "--filename", "$FILENAME", "-" }` -#### [cppcheck](https://github.com/danmar/cppcheck) +#### [markdownlint](https://github.com/DavidAnson/markdownlint) via [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) + +##### About + +`markdown` style and syntax checker. + +##### Usage + +```lua +local sources = { null_ls.builtins.diagnostics.markdownlint } +``` + +##### Defaults + +- `filetypes = { "markdown" }` +- `command = "markdownlint"` +- `args = { "--stdin" }` + +#### [misspell](https://github.com/client9/misspell) ##### About -A tool for fast static analysis of `C/C++` code +Checks commonly misspelled English words in source files. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.cppcheck } +local sources = { null_ls.builtins.diagnostics.misspell } ``` ##### Defaults -- `filetypes = { "cpp" , "c" }` -- `command = "cppcheck"` -- `args = { "--enable=warning,style,performance,portability", "--template=gcc", "$FILENAME" }` +- `filetypes = {}` +- `command = "misspell"` +- `args = { "$FILENAME" }` -#### [write-good](https://github.com/btford/write-good) +#### [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) ##### About -English prose linter. +PHP_CodeSniffer is a script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard. ##### Usage ```lua -local sources = {null_ls.builtins.diagnostics.write_good} +local sources = { null_ls.builtins.diagnostics.phpcs } ``` ##### Defaults -- `filetypes = { "markdown" }` -- `command = "write"-good` -- `args = { "--text=$TEXT", "--parse" }` +- `filetypes = { "php" }` +- `command = "phpcs"` +- `args = { "--report=json", "-s", "-" }` + +#### [phpstan](https://github.com/phpstan/phpstan) + +##### About + +PHP static analysis tool. + +- Requires a valid `phpstan.neon` at root. + +##### Usage + +```lua +local sources = { null_ls.builtins.diagnostics.phpstan } +``` + +##### Defaults + +- `filetypes = { "php" }` +- `command = "phpstan"` +- `args = { "analyze", "--error-format", "json", "--no-progress", "$FILENAME" }` #### [proselint](https://github.com/amperser/proselint) @@ -1471,41 +1546,35 @@ An English prose linter. ##### Usage -Add diagnostics using: - ```lua local sources = { null_ls.builtins.diagnostics.proselint } ``` -Add code actions using: - -```lua -local source = { null_ls.builtins.code_actions.proselint } -``` - ##### Defaults - `filetypes = { "markdown", "tex" }` - `command = "proselint"` - `args = { "--json" }` -#### [markdownlint](https://github.com/DavidAnson/markdownlint) via [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) +#### [psalm](https://psalm.dev) ##### About -`markdown` style and syntax checker. +A static analysis tool for finding errors in PHP applications + +- Requires a valid `psalm.xml` at root. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.markdownlint } +local sources = { null_ls.builtins.diagnostics.psalm } ``` ##### Defaults -- `filetypes = { "markdown" }` -- `command = "markdownlint"` -- `args = { "--stdin" }` +- `filetypes = { "php" }` +- `command = "psalm"` +- `args = { "--output-format=json", "--no-progress", "$FILENAME" }` #### [pylint](https://github.com/PyCGA/pylint) @@ -1525,220 +1594,213 @@ local sources = { null_ls.builtins.diagnostics.pylint } - `command = "pylint"` - `args = {"--from-stdin", "$FILENAME", "-f", "json"}` -#### [vale](https://docs.errata.ai/vale/about) +#### [qmllint](https://doc-snapshots.qt.io/qt6-dev/qtquick-tools-and-utilities.html#qmllint) ##### About -Syntax-aware linter for prose built with speed and extensibility in mind. +`qmllint` is a tool shipped with Qt that verifies the syntatic validity of QML +files. It also warns about some QML anti-patterns. ##### Usage -- `vale` does not include a syntax by itself, so you probably need to grab a - `vale.ini` (at `"~/.vale.ini"`) and a `StylesPath` (somewhere, pointed from - `vale.ini`) from [here](https://docs.errata.ai/vale/about#open-source-configurations). - ```lua -local sources = {null_ls.builtins.diagnostics.vale} +local sources = { null_ls.builtins.diagnostics.qmllint } ``` ##### Defaults -- `filetypes = { "markdown", "tex" }` -- `command = "vale"` -- `args = { "--no-exit", "--output=JSON", "$FILENAME" }` +- `filetypes = { "qml" }` +- `command = "qmllint"` +- `args = { "--no-unqualified-id", "$FILENAME" }` -#### [teal](https://github.com/teal-language/tl) +#### [Rubocop](https://rubocop.org/) ##### About -Turns `tl check` command into a linter. Works on change. - -##### LSP Support - -- [neovim](https://github.com/teal-language/teal-language-server) -- [vim](https://github.com/teal-language/vim-teal) +The Ruby Linter/Formatter that Serves and Protects. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.teal } +local sources = { null_ls.builtins.diagnostics.rubocop } ``` ##### Defaults -- `filetypes = { "teal" }` -- `command = "tl"` -- `args = { "check", "$FILENAME" }` +- `filetypes = { "ruby" }` +- `command = "rubocop"` +- `args = { "-f", "json", "--stdin", "$FILENAME" }` -#### [misspell](https://github.com/client9/misspell) +#### [selene](https://kampfkarren.github.io/selene/) ##### About -Correct commonly misspelled English words in source files +Command line tool designed to help write correct and idiomatic `lua` code. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.misspell } +local sources = { null_ls.builtins.diagnostics.selene } ``` ##### Defaults -- `filetypes = {}` -- `command = "misspell"` -- `args = { "$FILENAME" }` +- `filetypes = { "lua" }` +- `command = "selene"` +- `args = { "--display-style", "quiet", "-" }` -#### [vim-vint](https://github.com/Vimjas/vint) +#### [shellcheck](https://www.shellcheck.net) ##### About -Linter for `vimscript`. +A shell script static analysis tool. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.vint } +local sources = { null_ls.builtins.diagnostics.shellcheck } ``` ##### Defaults -- `filetypes = { "vim" }` -- `command = "vint"` -- `args = { "-s", "-j", "$FILENAME" }` +- `filetypes = { "sh" }` +- `command = "shellcheck"` +- `args = { "--format", "json1", "-" }` -#### [selene](https://kampfkarren.github.io/selene/) +#### [standardrb](https://github.com/testdouble/standard) ##### About -Command line tool designed to help write correct and idiomatic `lua` code. +The Ruby Linter/Formatter that Serves and Protects. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.selene } +local sources = { null_ls.builtins.diagnostics.standardrb } ``` ##### Defaults -- `filetypes = { "lua" }` -- `command = "selene"` -- `args = { "--display-style", "quiet", "-" }` +- `filetypes = { "ruby" }` +- `command = "standardrb"` +- `args = { "--no-fix", "-f", "json", "--stdin", "$FILENAME" }` -#### [standardrb](https://github.com/testdouble/standard) +#### [statix](https://github.com/nerdypepper/statix) ##### About -The Ruby Linter/Formatter that Serves and Protects. +Lints and suggestions for the nix programming language. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.standardrb } +local sources = { null_ls.builtins.diagnostics.statix } ``` ##### Defaults -- `filetypes = { "ruby" }` -- `command = "standardrb"` -- `args = { "--no-fix", "-f", "json", "--stdin", "$FILENAME" }` +- `filetypes = { "nix" }` +- `command = "statix"` +- `args = { "check", "--format=errfmt", "--", "$FILENAME" }` -#### [phpstan](https://github.com/phpstan/phpstan) +#### [Stylelint](https://github.com/stylelint/stylelint) ##### About -PHP Static Analysis Tool +A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.phpstan } +local sources = { null_ls.builtins.diagnostics.stylelint } ``` ##### Defaults -- `filetypes = { "php" }` -- `command = "phpstan"` -- `args = { "analyze", "--error-format", "json", "--no-progress", "$FILENAME" }` +- `filetypes = { "scss", "less", "css", "sass" }` +- `command = "stylelint"` +- `args = { "--formatter", "json", "--stdin-filename", "$FILENAME" }` -##### Requirements +#### [teal](https://github.com/teal-language/tl) -A valid `phpstan.neon` at root. +##### About -#### [psalm](https://psalm.dev) +Turns `tl check` command into a linter. Works on change. -##### About +##### LSP Support -A static analysis tool for finding errors in PHP applications +- [neovim](https://github.com/teal-language/teal-language-server) +- [vim](https://github.com/teal-language/vim-teal) ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.psalm } +local sources = { null_ls.builtins.diagnostics.teal } ``` ##### Defaults -- `filetypes = { "php" }` -- `command = "psalm"` -- `args = { "--output-format=json", "--no-progress", "$FILENAME" }` - -##### Requirements - -A valid `psalm.xml` at root. +- `filetypes = { "teal" }` +- `command = "tl"` +- `args = { "check", "$FILENAME" }` -#### [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) +#### [vale](https://docs.errata.ai/vale/about) ##### About -PHP_CodeSniffer is a script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard. +Syntax-aware linter for prose built with speed and extensibility in mind. + +- `vale` does not include a syntax by itself, so you probably need to grab a + `vale.ini` (at `"~/.vale.ini"`) and a `StylesPath` (somewhere, pointed from + `vale.ini`) from [here](https://docs.errata.ai/vale/about#open-source-configurations). ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.phpcs } +local sources = {null_ls.builtins.diagnostics.vale} ``` ##### Defaults -- `filetypes = { "php" }` -- `command = "phpcs"` -- `args = { "--report=json", "-s", "-" }` +- `filetypes = { "markdown", "tex" }` +- `command = "vale"` +- `args = { "--no-exit", "--output=JSON", "$FILENAME" }` -#### [Rubocop](https://rubocop.org/) +#### [vim-vint](https://github.com/Vimjas/vint) ##### About -The Ruby Linter/Formatter that Serves and Protects. +Linter for `vimscript`. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.rubocop } +local sources = { null_ls.builtins.diagnostics.vint } ``` ##### Defaults -- `filetypes = { "ruby" }` -- `command = "rubocop"` -- `args = { "-f", "json", "--stdin", "$FILENAME" }` +- `filetypes = { "vim" }` +- `command = "vint"` +- `args = { "-s", "-j", "$FILENAME" }` -#### [Stylelint](https://github.com/stylelint/stylelint) +#### [write-good](https://github.com/btford/write-good) ##### About -A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. +English prose linter. ##### Usage ```lua -local sources = { null_ls.builtins.diagnostics.stylelint } +local sources = {null_ls.builtins.diagnostics.write_good} ``` ##### Defaults -- `filetypes = { "scss", "less", "css", "sass" }` -- `command = "stylelint"` -- `args = { "--formatter", "json", "--stdin-filename", "$FILENAME" }` +- `filetypes = { "markdown" }` +- `command = "write"-good` +- `args = { "--text=$TEXT", "--parse" }` #### [yamllint](https://github.com/adrienverge/yamllint) @@ -1780,6 +1842,62 @@ local sources = { null_ls.builtins.code_actions.gitsigns } - `filetypes = {}` +#### [proselint](https://github.com/amperser/proselint) + +##### About + +An English prose linter. Can fix some issues via code actions. + +##### Usage + +```lua +local source = { null_ls.builtins.code_actions.proselint } +``` + +##### Defaults + +- `filetypes = { "markdown", "tex" }` +- `command = "proselint"` +- `args = { "--json" }` + +#### [refactoring.nvim](https://github.com/ThePrimeagen/refactoring.nvim) + +##### About + +The Refactoring library based off the Refactoring book by Martin Fowler. + +##### Usage + +- Requires visually selecting the code you want to refactor and calling + `:'<,'>lua vim.lsp.buf.range_code_action()` (for the default handler) or + `:'<,'>Telescope lsp_range_code_actions` (for Telescope). + +```lua +local sources = { null_ls.builtins.code_actions.refactoring } +``` + +##### Defaults + +- `filetypes = { "go", "javascript", "lua", "python", "typescript" }` + +#### [statix](https://github.com/nerdypepper/statix) + +##### About + +Lints and suggestions for the nix programming language. + +##### Usage + +```lua +local sources = { null_ls.builtins.code_actions.statix } +``` + +##### Defaults + +- `filetypes = { "nix" }` +- `command = "statix"` +- `args = { "check", "--format=json", "--", "$FILENAME" }` + ### Hover #### Dictionary definitions via [dictionaryapi.dev](https://dictionaryapi.dev) diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index 00ffdc15b..53f5c0caf 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -31,7 +31,8 @@ to reduce the number of lines of code in your PR. - Make sure to add your built-in source to [BUILTINS](BUILTINS.md). Check other - examples and follow the existing style. + examples and follow the existing style. Make sure to insert your source's + documentation in the correct place to maintain alphabetical order! - A built-in source's arguments are the minimal arguments required for the source to work. Leave out non-essential arguments.