From dd26bc4697eddf745c15721a52dd73fc369306fc Mon Sep 17 00:00:00 2001 From: Kurtis Moxley Date: Thu, 19 May 2022 21:16:38 +0800 Subject: [PATCH] Update Ale. --- sources_non_forked/ale/Dockerfile | 27 + sources_non_forked/ale/README.md | 963 ++++++++++++++++++ .../ale/ale_linters/ada/cspell.vim | 5 + .../ale/ale_linters/ansible/ansible_lint.vim | 28 +- .../ale/ale_linters/asciidoc/cspell.vim | 5 + .../ale/ale_linters/avra/avra.vim | 36 + .../ale/ale_linters/awk/gawk.vim | 3 +- .../ale/ale_linters/bitbake/oelint_adv.vim | 47 + .../ale/ale_linters/c/cpplint.vim | 20 + .../ale/ale_linters/c/cspell.vim | 5 + .../ale/ale_linters/cmake/cmake_lint.vim | 43 + .../ale/ale_linters/cpp/cspell.vim | 5 + .../ale/ale_linters/cs/cspell.vim | 5 + .../ale/ale_linters/css/cspell.vim | 5 + .../ale/ale_linters/css/vscodecss.vim | 16 + .../ale/ale_linters/dart/dartanalyzer.vim | 36 - .../ale/ale_linters/elixir/cspell.vim | 5 + .../ale/ale_linters/erlang/elvis.vim | 1 + .../ale/ale_linters/go/cspell.vim | 5 + .../ale/ale_linters/go/golangci_lint.vim | 12 +- .../handlebars/embertemplatelint.vim | 15 +- .../ale/ale_linters/haskell/cspell.vim | 5 + .../ale/ale_linters/haskell/hls.vim | 2 + .../ale/ale_linters/help/cspell.vim | 5 + .../ale/ale_linters/html/angular.vim | 16 +- .../ale/ale_linters/html/cspell.vim | 5 + .../ale/ale_linters/html/vscodehtml.vim | 16 + .../ale/ale_linters/java/cspell.vim | 5 + .../ale/ale_linters/java/eclipselsp.vim | 5 + .../ale/ale_linters/javascript/cspell.vim | 5 + .../ale/ale_linters/json/cspell.vim | 5 + .../ale/ale_linters/json/vscodejson.vim | 16 + .../ale/ale_linters/lua/cspell.vim | 5 + .../ale/ale_linters/lua/selene.vim | 46 + .../ale/ale_linters/make/checkmake.vim | 2 +- .../ale/ale_linters/markdown/cspell.vim | 5 + .../ale/ale_linters/nix/nix.vim | 2 +- .../ale/ale_linters/nix/statix.vim | 18 + .../ale/ale_linters/php/cspell.vim | 5 + .../ale/ale_linters/php/intelephense.vim | 0 .../ale/ale_linters/php/phpactor.vim | 23 + .../ale/ale_linters/php/phpstan.vim | 9 +- .../ale/ale_linters/php/psalm.vim | 6 + .../ale/ale_linters/powershell/cspell.vim | 5 + .../ale/ale_linters/proto/buf_lint.vim | 23 + .../ale/ale_linters/python/cspell.vim | 5 + .../ale/ale_linters/python/pydocstyle.vim | 2 +- .../ale/ale_linters/python/pylama.vim | 85 +- .../ale/ale_linters/python/unimport.vim | 75 ++ .../ale/ale_linters/rego/cspell.vim | 4 + .../ale/ale_linters/rego/opacheck.vim | 56 + .../ale/ale_linters/rst/cspell.vim | 5 + .../ale/ale_linters/ruby/cspell.vim | 5 + .../ale/ale_linters/ruby/reek.vim | 6 +- .../ale/ale_linters/rust/analyzer.vim | 14 +- .../ale/ale_linters/rust/cspell.vim | 5 + .../ale/ale_linters/rust/rustc.vim | 2 +- .../ale/ale_linters/scala/cspell.vim | 5 + .../ale/ale_linters/sh/cspell.vim | 5 + .../ale/ale_linters/swift/cspell.vim | 5 + .../ale/ale_linters/terraform/checkov.vim | 41 + .../ale/ale_linters/terraform/terraform.vim | 8 +- .../ale/ale_linters/tex/cspell.vim | 5 + .../ale/ale_linters/tex/texlab.vim | 2 + .../ale/ale_linters/texinfo/cspell.vim | 5 + .../ale/ale_linters/text/cspell.vim | 5 + .../ale/ale_linters/typescript/cspell.vim | 5 + .../ale/ale_linters/vue/cspell.vim | 5 + .../ale/ale_linters/vue/volar.vim | 80 ++ .../ale/ale_linters/wgsl/naga.vim | 12 + .../ale/ale_linters/xhtml/cspell.vim | 5 + .../ale/ale_linters/yaml/actionlint.vim | 10 + .../ale/ale_linters/yaml/ls.vim | 34 + sources_non_forked/ale/autoload/ale.vim | 2 +- .../ale/autoload/ale/code_action.vim | 80 +- .../ale/autoload/ale/codefix.vim | 6 +- .../ale/autoload/ale/completion.vim | 10 +- .../ale/autoload/ale/cursor.vim | 18 +- .../ale/autoload/ale/debugging.vim | 3 +- .../ale/autoload/ale/definition.vim | 33 +- .../ale/autoload/ale/engine.vim | 6 + .../ale/autoload/ale/events.vim | 6 + .../ale/autoload/ale/filerename.vim | 133 +++ sources_non_forked/ale/autoload/ale/fix.vim | 9 +- .../ale/autoload/ale/fix/registry.vim | 40 + .../ale/autoload/ale/fixers/buf_format.vim | 12 + .../ale/autoload/ale/fixers/crystal.vim | 14 + .../ale/autoload/ale/fixers/dprint.vim | 29 + .../ale/autoload/ale/fixers/gofumpt.vim | 17 + .../ale/autoload/ale/fixers/opafmt.vim | 15 + .../ale/autoload/ale/fixers/packer.vim | 17 + .../ale/autoload/ale/fixers/statix.vim | 17 + .../ale/autoload/ale/fixers/uncrustify.vim | 21 +- .../ale/autoload/ale/fixers/zigfmt.vim | 14 + .../ale/autoload/ale/floating_preview.vim | 3 +- .../ale/autoload/ale/handlers/actionlint.vim | 24 + .../ale/autoload/ale/handlers/alex.vim | 7 +- .../ale/autoload/ale/handlers/cppcheck.vim | 23 +- .../ale/autoload/ale/handlers/cspell.vim | 54 + .../ale/autoload/ale/handlers/haskell.vim | 18 + .../ale/autoload/ale/handlers/naga.vim | 30 + .../ale/autoload/ale/handlers/sml.vim | 23 +- .../ale/autoload/ale/handlers/statix.vim | 24 + .../ale/autoload/ale/highlight.vim | 20 + sources_non_forked/ale/autoload/ale/hover.vim | 8 +- sources_non_forked/ale/autoload/ale/job.vim | 12 +- .../ale/autoload/ale/linter.vim | 6 + sources_non_forked/ale/autoload/ale/list.vim | 41 +- sources_non_forked/ale/autoload/ale/lsp.vim | 22 + .../ale/autoload/ale/lsp/message.vim | 37 +- .../ale/autoload/ale/lsp/response.vim | 2 +- .../ale/autoload/ale/lsp/tsserver_message.vim | 16 + .../ale/autoload/ale/lsp_linter.vim | 33 +- .../ale/autoload/ale/organize_imports.vim | 7 +- sources_non_forked/ale/autoload/ale/path.vim | 4 +- .../ale/autoload/ale/python.vim | 1 + .../ale/autoload/ale/references.vim | 69 +- .../ale/autoload/ale/rename.vim | 6 +- .../ale/autoload/ale/symbol.vim | 2 +- sources_non_forked/ale/autoload/ale/test.vim | 21 +- .../ale/autoload/ale/toggle.vim | 3 +- sources_non_forked/ale/autoload/ale/uri.vim | 16 + .../ale/autoload/ale/uri/jdt.vim | 110 ++ sources_non_forked/ale/autoload/ale/util.vim | 39 +- .../ale/autoload/ale/virtualtext.vim | 20 - sources_non_forked/ale/doc/ale-ada.txt | 5 + sources_non_forked/ale/doc/ale-asciidoc.txt | 6 + sources_non_forked/ale/doc/ale-avra.txt | 26 + sources_non_forked/ale/doc/ale-bitbake.txt | 31 + sources_non_forked/ale/doc/ale-c.txt | 6 + sources_non_forked/ale/doc/ale-cmake.txt | 19 + sources_non_forked/ale/doc/ale-cpp.txt | 21 + sources_non_forked/ale/doc/ale-cs.txt | 6 + sources_non_forked/ale/doc/ale-css.txt | 19 + sources_non_forked/ale/doc/ale-dart.txt | 33 - .../ale/doc/ale-development.txt | 27 +- sources_non_forked/ale/doc/ale-dockerfile.txt | 6 + sources_non_forked/ale/doc/ale-elixir.txt | 24 +- sources_non_forked/ale/doc/ale-go.txt | 30 +- sources_non_forked/ale/doc/ale-haskell.txt | 20 + sources_non_forked/ale/doc/ale-hcl.txt | 5 + sources_non_forked/ale/doc/ale-help.txt | 12 + sources_non_forked/ale/doc/ale-html.txt | 18 + sources_non_forked/ale/doc/ale-java.txt | 16 +- sources_non_forked/ale/doc/ale-javascript.txt | 13 + sources_non_forked/ale/doc/ale-json.txt | 24 + sources_non_forked/ale/doc/ale-latex.txt | 7 +- sources_non_forked/ale/doc/ale-lua.txt | 30 + sources_non_forked/ale/doc/ale-markdown.txt | 14 +- sources_non_forked/ale/doc/ale-nix.txt | 53 +- sources_non_forked/ale/doc/ale-packer.txt | 24 + sources_non_forked/ale/doc/ale-php.txt | 20 + sources_non_forked/ale/doc/ale-powershell.txt | 15 +- sources_non_forked/ale/doc/ale-proto.txt | 42 +- sources_non_forked/ale/doc/ale-python.txt | 72 +- sources_non_forked/ale/doc/ale-rego.txt | 50 + .../ale/doc/ale-restructuredtext.txt | 9 +- sources_non_forked/ale/doc/ale-ruby.txt | 9 +- sources_non_forked/ale/doc/ale-rust.txt | 31 +- sources_non_forked/ale/doc/ale-scala.txt | 6 + sources_non_forked/ale/doc/ale-sh.txt | 6 + sources_non_forked/ale/doc/ale-sql.txt | 7 + .../doc/ale-supported-languages-and-tools.txt | 93 +- sources_non_forked/ale/doc/ale-swift.txt | 13 +- sources_non_forked/ale/doc/ale-terraform.txt | 19 + sources_non_forked/ale/doc/ale-tex.txt | 42 +- sources_non_forked/ale/doc/ale-texinfo.txt | 8 +- sources_non_forked/ale/doc/ale-text.txt | 8 +- sources_non_forked/ale/doc/ale-toml.txt | 12 + sources_non_forked/ale/doc/ale-typescript.txt | 19 +- sources_non_forked/ale/doc/ale-vue.txt | 37 + sources_non_forked/ale/doc/ale-wgsl.txt | 17 + sources_non_forked/ale/doc/ale-xhtml.txt | 8 +- sources_non_forked/ale/doc/ale-yaml.txt | 84 ++ sources_non_forked/ale/doc/ale-zig.txt | 12 + sources_non_forked/ale/doc/ale.txt | 301 +++++- sources_non_forked/ale/plugin/ale.vim | 20 +- sources_non_forked/ale/run-tests | 270 +++++ sources_non_forked/ale/run-tests.bat | 30 + sources_non_forked/ale/supported-tools.md | 115 ++- .../completion/test_ale_import_command.vader | 562 ++++++++++ .../completion/test_complete_events.vader | 35 + .../completion/test_completion_events.vader | 486 +++++++++ .../test_completion_filtering.vader | 142 +++ .../completion/test_completion_prefixes.vader | 65 ++ .../test_lsp_completion_messages.vader | 307 ++++++ .../test_lsp_completion_parsing.vader | 736 +++++++++++++ .../completion/test_omnifunc_completion.vader | 60 ++ .../test_public_completion_api.vader | 47 + .../test_tsserver_completion_parsing.vader | 309 ++++++ .../ale/test/fix/test_ale_fix.vader | 884 ++++++++++++++++ .../ale/test/fix/test_ale_fix_aliases.vader | 5 + .../test/fix/test_ale_fix_completion.vader | 23 + .../fix/test_ale_fix_completion_filter.vader | 14 + .../ale/test/fix/test_ale_fix_ignore.vader | 110 ++ .../ale/test/fix/test_ale_fix_suggest.vader | 102 ++ ...test_appleswiftformat_fixer_callback.vader | 47 + .../fixers/test_astyle_fixer_callback.vader | 96 ++ .../test_autoflake_fixer_callback.vader | 49 + .../test_autoimport_fixer_callback.vader | 47 + .../fixers/test_autopep8_fixer_callback.vader | 37 + .../fixers/test_bibclean_fixer_callback.vader | 30 + .../fixers/test_black_fixer_callback.vader | 67 ++ ...est_break_up_long_lines_python_fixer.vader | 39 + .../fixers/test_brittany_fixer_callback.vader | 24 + .../test_buf_format_fixer_callback.vader | 21 + .../test_buildifier_fixer_callback.vader | 29 + .../test_clangformat_fixer_callback.vader | 64 ++ .../test_clangtidy_fixer_callback.vader | 47 + .../test_cmakeformat_fixer_callback.vader | 36 + .../test_crystal_format_fixer_callback.vader | 33 + .../test_dart_format_fixer_callback.vader | 40 + .../fixers/test_dartfmt_fixer_callback.vader | 40 + .../fixers/test_dfmt_fixer_callback.vader | 40 + .../test_dhall_format_fixer_callback.vader | 22 + .../test_dhall_freeze_fixer_callback.vader | 22 + .../test_dhall_lint_fixer_callback.vader | 20 + .../test_dotnet_format_fixer_callback.vader | 41 + .../fixers/test_dprint_fixer_callback.vader | 44 + .../test_elm_format_fixer_callback.vader | 74 ++ .../fixers/test_erblint_fixer_callback.vader | 55 + .../fixers/test_erlfmt_fixer_callback.vader | 25 + .../fixers/test_eslint_fixer_callback.vader | 339 ++++++ .../fixers/test_fecs_fixer_callback.vader | 24 + .../test_fish_indent_fixer_callback.vader | 40 + .../fixers/test_fixjson_fixer_callback.vader | 50 + .../fixers/test_floskell_fixer_callback.vader | 23 + .../fixers/test_gnatpp_fixer_callback.vader | 28 + .../fixers/test_gofmt_fixer_callback.vader | 50 + .../ale/test/fixers/test_gofumpt_fixer.vader | 27 + .../test_goimports_fixer_callback.vader | 57 ++ .../fixers/test_golines_fixer_callback.vader | 54 + .../fixers/test_gomod_fixer_callback.vader | 41 + ...st_goofle_java_format_fixer_callback.vader | 27 + .../fixers/test_hackfmt_fixer_callback.vader | 37 + .../fixers/test_hfmt_fixer_callback.vader | 24 + .../fixers/test_hindent_fixer_callback.vader | 18 + .../fixers/test_hlint_fixer_callback.vader | 20 + .../test_html_beautify_fixer_callback.vader | 12 + .../fixers/test_importjs_fixer_callback.vader | 35 + .../fixers/test_isort_fixer_callback.vader | 70 ++ .../test/fixers/test_jq_fixer_callback.vader | 26 + .../test_jsonnetfmt_fixer_callback.vader | 38 + .../fixers/test_ktlint_fixer_callback.vader | 42 + .../test_latexindent_fixer_callback.vader | 36 + .../test_lua_format_fixer_callback.vader | 35 + .../fixers/test_luafmt_fixer_callback.vader | 35 + .../test_mix_format_fixer_callback.vader | 36 + .../test_nimpretty_fixer_callback.vader | 23 + .../fixers/test_nixfmt_fixer_callback.vader | 24 + .../test_nixpkgsfmt_fixer_callback.vader | 24 + .../test_ocamlformat_fixer_callback.vader | 36 + .../test_ocp_indent_fixer_callback.vader | 34 + .../fixers/test_opa_fmt_fixer_callback.vader | 33 + .../fixers/test_ormolu_fixer_callback.vader | 24 + .../test_packer_fmt_fixer_callback.vader | 34 + .../fixers/test_pandoc_fixer_callback.vader | 23 + .../fixers/test_perltidy_fixer_callback.vader | 40 + .../test_pgformatter_fixer_callback.vader | 24 + .../ale/test/fixers/test_php_cs_fixer.vader | 62 ++ .../fixers/test_phpcbf_fixer_callback.vader | 117 +++ .../test_prettier_eslint_fixer.callback.vader | 97 ++ .../fixers/test_prettier_fixer_callback.vader | 337 ++++++ .../test_prettier_standard_callback.vader | 15 + .../test_protolint_fixer_callback.vader | 28 + .../fixers/test_ptop_fixer_callback.vader | 38 + .../test_puppetlint_fixer_callback.vader | 24 + .../test_purs_tidy_fixer_callback.vader | 20 + .../fixers/test_purty_fixer_callback.vader | 24 + .../test_python_add_blank_lines_fixer.vader | 167 +++ .../fixers/test_qmlfmt_fixer_callback.vader | 12 + .../fixers/test_refmt_fixer_callback.vader | 41 + .../test_remark_lint_fixer_callback.vader | 24 + ...eorder_python_imports_fixer_callback.vader | 46 + .../fixers/test_rubocop_fixer_callback.vader | 89 ++ .../fixers/test_rufo_fixer_callback.vader | 30 + .../fixers/test_rustfmt_fixer_callback.vader | 16 + .../fixers/test_scalafmt_fixer_callback.vader | 66 ++ .../fixers/test_shfmt_fixer_callback.vader | 59 ++ .../fixers/test_sorbet_fixer_callback.vader | 38 + .../fixers/test_sqlfmt_fixer_callback.vader | 26 + .../test_sqlformat_fixer_callback.vader | 24 + .../fixers/test_standard_fixer_callback.vader | 31 + .../test_standardrb_fixer_callback.vader | 51 + .../ale/test/fixers/test_statix_fixer.vader | 18 + .../test_stylelint_fixer_callback.vader | 34 + .../fixers/test_styler_fixer_callback.vader | 21 + .../test_stylish_haskell_fixer_callback.vader | 24 + .../fixers/test_stylua_fixer_callback.vader | 19 + .../test_swiftformat_fixer_callback.vader | 35 + .../test_terraform_fmt_fixer_callback.vader | 34 + .../fixers/test_textlint_fixer_callback.vader | 42 + .../fixers/test_tidy_fixer_callback.vader | 25 + .../test/fixers/test_trim_whitespace.vader | 28 + .../fixers/test_tslint_fixer_callback.vader | 42 + .../test_uncrustify_fixer_callback.vader | 108 ++ .../fixers/test_vfmt_fixer_callback.vader | 44 + .../test_vim_help_tags_alignment_fixer.vader | 19 + .../fixers/test_xmllint_fixer_callback.vader | 46 + .../test/fixers/test_xo_fixer_callback.vader | 45 + .../fixers/test_xots_fixer_callback.vader | 45 + .../fixers/test_yamlfix_fixer_callback.vader | 33 + .../fixers/test_yapf_fixer_callback.vader | 39 + .../fixers/test_zigfmt_fixer_callback.vader | 20 + .../handler/test_actionlint_handler.vader | 28 + .../test/handler/test_ada_gcc_handler.vader | 36 + .../ale/test/handler/test_alex_handler.vader | 54 + .../ale/test/handler/test_ameba_handler.vader | 44 + .../handler/test_ansible_lint_handler.vader | 95 ++ .../test_appleswiftformat_handler.vader | 28 + .../ale/test/handler/test_asm_handler.vader | 26 + .../test/handler/test_atools_handler.vader | 85 ++ .../ale/test/handler/test_avra_handler.vader | 24 + .../test/handler/test_bandit_handler.vader | 42 + .../test/handler/test_bashate_handler.vader | 36 + .../test/handler/test_bibclean_handler.vader | 88 ++ .../test_bitbake_oelint_adv_handler.vader | 28 + .../test/handler/test_brakeman_handler.vader | 83 ++ .../test_cfn_python_lint_handler.vader | 33 + .../test/handler/test_checkmake_handler.vader | 23 + .../test/handler/test_checkov_handler.vader | 66 ++ .../handler/test_checkstyle_handler.vader | 53 + .../test/handler/test_circleci_handler.vader | 39 + .../ale/test/handler/test_clang_handler.vader | 30 + .../test_clojure_clj_kondo_handler.vader | 89 ++ .../handler/test_clojure_joker_handler.vader | 75 ++ .../handler/test_cmake_lint_handler.vader | 30 + .../handler/test_coffeelint_handler.vader | 20 + .../test/handler/test_common_handlers.vader | 181 ++++ .../test/handler/test_cookstyle_handler.vader | 22 + .../test/handler/test_cppcheck_handler.vader | 93 ++ .../test/handler/test_cpplint_handler.vader | 29 + .../ale/test/handler/test_credo_handler.vader | 53 + .../test/handler/test_crystal_handler.vader | 28 + .../ale/test/handler/test_csc_handler.vader | 98 ++ .../test/handler/test_cspell_handler.vader | 13 + .../test/handler/test_cucumber_handler.vader | 18 + .../test/handler/test_cuda_nvcc_handler.vader | 41 + .../handler/test_cypher_lint_handler.vader | 21 + .../ale/test/handler/test_dafny_handler.vader | 36 + .../handler/test_dart_analyze_handler.vader | 28 + .../test/handler/test_debride_handler.vader | 27 + .../test_desktop_file_validate_handler.vader | 26 + .../ale/test/handler/test_dmd_handler.vader | 41 + .../test_dockerfile_lint_handler.vader | 112 ++ .../ale/test/handler/test_dogma_handler.vader | 30 + .../test/handler/test_drafter_handler.vader | 37 + .../test/handler/test_elmmake_handler.vader | 299 ++++++ .../test_embertemplatelint_handler.vader | 81 ++ .../test/handler/test_erblint_handler.vader | 70 ++ .../test_erlang_dialyzer_handler.vader | 27 + .../handler/test_erlang_elvis_handler.vader | 40 + .../test/handler/test_eslint_handler.vader | 438 ++++++++ .../handler/test_eslint_json_handler.vader | 376 +++++++ .../ale/test/handler/test_fecs_handler.vader | 35 + .../ale/test/handler/test_fish_handler.vader | 61 ++ .../test/handler/test_flake8_handler.vader | 276 +++++ .../test/handler/test_flakehell_handler.vader | 276 +++++ .../handler/test_flawfinder_handler.vader | 57 ++ .../ale/test/handler/test_flow_handler.vader | 507 +++++++++ .../handler/test_foodcritic_handler.vader | 44 + .../test/handler/test_fortran_handler.vader | 95 ++ .../ale/test/handler/test_gawk_handler.vader | 39 + .../ale/test/handler/test_gcc_handler.vader | 316 ++++++ .../ale/test/handler/test_ghc_handler.vader | 177 ++++ .../test/handler/test_ghc_mod_handler.vader | 37 + .../ale/test/handler/test_ghdl_handler.vader | 26 + .../test/handler/test_gitlint_handler.vader | 89 ++ .../test/handler/test_glslang_handler.vader | 24 + .../handler/test_go_generic_handler.vader | 38 + .../test/handler/test_gobuild_handler.vader | 45 + .../handler/test_golangci_lint_handler.vader | 84 ++ .../handler/test_gometalinter_handler.vader | 57 ++ .../ale/test/handler/test_hadolint.vader | 59 ++ .../handler/test_haskell_stack_handler.vader | 7 + .../ale/test/handler/test_hlint_handler.vader | 80 ++ .../test_ibm_openapi_validator_handler.vader | 49 + .../ale/test/handler/test_idris_handler.vader | 66 ++ .../ale/test/handler/test_inko_handler.vader | 54 + .../test/handler/test_ispc_ispc_handler.vader | 90 ++ .../ale/test/handler/test_javac_handler.vader | 97 ++ .../ale/test/handler/test_jscs_handler.vader | 39 + .../test/handler/test_ktlint_handler.vader | 21 + .../test/handler/test_lacheck_handler.vader | 34 + .../handler/test_languagetool_handler.vader | 62 ++ .../ale/test/handler/test_lessc_handler.vader | 69 ++ .../ale/test/handler/test_llc_handler.vader | 58 ++ .../handler/test_lua_selene_handler.vader | 38 + .../ale/test/handler/test_luac_handler.vader | 36 + .../test/handler/test_luacheck_handler.vader | 62 ++ .../handler/test_markdownlint_handler.vader | 91 ++ .../ale/test/handler/test_mcs_handler.vader | 37 + .../ale/test/handler/test_mcsc_handler.vader | 88 ++ .../ale/test/handler/test_mdl_handler.vader | 25 + .../handler/test_mercury_mmc_handler.vader | 58 ++ .../ale/test/handler/test_mix_handler.vader | 21 + .../ale/test/handler/test_msgfmt_hander.vader | 24 + .../ale/test/handler/test_mypy_handler.vader | 141 +++ .../ale/test/handler/test_naga_handler.vader | 23 + .../test/handler/test_nagelfar_handler.vader | 174 ++++ .../ale/test/handler/test_nasm_handler.vader | 30 + .../ale/test/handler/test_nim_handler.vader | 80 ++ .../ale/test/handler/test_nix_handler.vader | 91 ++ .../ale/test/handler/test_perl6_handler.vader | 277 +++++ .../ale/test/handler/test_perl_handler.vader | 109 ++ .../handler/test_perlcritic_handler.vader | 20 + .../ale/test/handler/test_php_handler.vader | 93 ++ .../test/handler/test_php_phan_handler.vader | 26 + .../test/handler/test_php_phpmd_handler.vader | 24 + .../ale/test/handler/test_phpcs_handler.vader | 28 + .../test/handler/test_phpstan_handler.vader | 51 + .../ale/test/handler/test_pmd_handler.vader | 42 + .../ale/test/handler/test_pony_handler.vader | 21 + .../handler/test_powershell_handler.vader | 109 ++ .../handler/test_prospector_handler.vader | 163 +++ .../test_psscriptanalyzer_handler.vader | 42 + .../test/handler/test_puglint_handler.vader | 45 + .../test/handler/test_puppet_handler.vader | 77 ++ .../handler/test_pycodestyle_handler.vader | 154 +++ .../handler/test_pydocstyle_handler.vader | 116 +++ .../test/handler/test_pyflakes_handler.vader | 24 + .../test/handler/test_pylama_handler.vader | 268 +++++ .../test/handler/test_pylint_handler.vader | 135 +++ .../handler/test_pyrex_cython_handler.vader | 26 + .../test/handler/test_qmlfmt_handler.vader | 19 + .../test/handler/test_qmllint_handler.vader | 19 + .../ale/test/handler/test_raco_handler.vader | 27 + .../test_rails_best_practices_handler.vader | 52 + .../test/handler/test_redpen_handler.vader | 98 ++ .../ale/test/handler/test_reek_handler.vader | 81 ++ .../handler/test_remark_lint_handler.vader | 39 + .../test/handler/test_rflint_handler.vader | 33 + .../test/handler/test_rpmlint_handler.vader | 33 + .../handler/test_rstcheck_lint_handler.vader | 42 + .../test/handler/test_rubocop_handler.vader | 76 ++ .../ale/test/handler/test_ruby_handler.vader | 38 + .../ale/test/handler/test_rust_handler.vader | 483 +++++++++ .../test/handler/test_salt_salt_lint.vader | 34 + .../ale/test/handler/test_scala_handler.vader | 32 + .../handler/test_scalastyle_handler.vader | 53 + .../ale/test/handler/test_shell_handler.vader | 177 ++++ .../handler/test_shellcheck_handler.vader | 43 + .../ale/test/handler/test_slim_handler.vader | 34 + .../ale/test/handler/test_sml_handler.vader | 119 +++ .../ale/test/handler/test_solc_handler.vader | 34 + .../test/handler/test_solhint_handler.vader | 84 ++ .../test/handler/test_spectral_handler.vader | 52 + .../test/handler/test_sqlint_handler.vader | 34 + .../test/handler/test_sqllint_handler.vader | 23 + .../test/handler/test_standard_handler.vader | 37 + .../test/handler/test_statix_handler.vader | 16 + .../test/handler/test_stylelint_handler.vader | 43 + .../test/handler/test_swaglint_handler.vader | 68 ++ .../test/handler/test_swiftlint_handler.vader | 30 + .../ale/test/handler/test_swipl_handler.vader | 155 +++ .../test/handler/test_syntaxerl_handler.vader | 24 + .../test_systemd_analyze_handler.vader | 19 + .../test/handler/test_terraform_handler.vader | 138 +++ .../test/handler/test_textlint_handler.vader | 41 + .../test/handler/test_tflint_handler.vader | 99 ++ .../test/handler/test_thrift_handler.vader | 63 ++ .../handler/test_thriftcheck_handler.vader | 28 + .../ale/test/handler/test_tlint_handler.vader | 34 + .../test/handler/test_tslint_handler.vader | 315 ++++++ .../test/handler/test_typecheck_handler.vader | 24 + .../test/handler/test_unimport_handler.vader | 18 + .../ale/test/handler/test_v_handler.vader | 54 + .../test/handler/test_vala_lint_handler.vader | 54 + .../ale/test/handler/test_vale_handler.vader | 88 ++ .../ale/test/handler/test_vcom_handler.vader | 36 + .../test/handler/test_verilator_handler.vader | 52 + .../ale/test/handler/test_vint_handler.vader | 65 ++ .../ale/test/handler/test_vlog_handler.vader | 47 + .../test/handler/test_vulture_handler.vader | 92 ++ .../handler/test_write_good_handler.vader | 37 + .../test/handler/test_xmllint_handler.vader | 30 + .../ale/test/handler/test_xvhdl_handler.vader | 24 + .../ale/test/handler/test_xvlog_handler.vader | 18 + .../test/handler/test_yamllint_handler.vader | 59 ++ .../ale/test/handler/test_yosys_handler.vader | 27 + .../ale/test/handler/test_zeek_handler.vader | 17 + .../ale/test/jsonnet_files/testfile.jsonnet | 1 + .../ale/test/linter/test_ada_gcc.vader | 42 + .../ale/test/linter/test_adals.vader | 17 + .../ale/test/linter/test_alex.vader | 34 + .../ale/test/linter/test_ameba.vader | 20 + .../ale/test/linter/test_angular.vader | 28 + .../ale/test/linter/test_ansible_lint.vader | 26 + .../test/linter/test_asciidoc_textlint.vader | 65 ++ .../ale/test/linter/test_asm_gcc.vader | 19 + .../ale/test/linter/test_avra_avra.vader | 29 + .../ale/test/linter/test_bandit.vader | 90 ++ .../ale/test/linter/test_bashate.vader | 15 + .../ale/test/linter/test_bib_bibclean.vader | 24 + .../ale/test/linter/test_bingo.vader | 74 ++ .../ale/test/linter/test_bitbake.vader | 13 + .../ale/test/linter/test_brakeman.vader | 37 + .../ale/test/linter/test_buf_lint.vader | 22 + .../ale/test/linter/test_c_cc.vader | 55 + .../ale/test/linter/test_c_ccls.vader | 69 ++ .../ale/test/linter/test_c_clang_tidy.vader | 77 ++ .../ale/test/linter/test_c_clangd.vader | 47 + .../ale/test/linter/test_c_cppcheck.vader | 63 ++ .../ale/test/linter/test_c_cquery.vader | 37 + .../ale/test/linter/test_c_flawfinder.vader | 24 + .../ale/test/linter/test_c_import_paths.vader | 162 +++ .../ale/test/linter/test_cargo.vader | 222 ++++ .../ale/test/linter/test_checkov.vader | 14 + .../ale/test/linter/test_checkstyle.vader | 72 ++ .../ale/test/linter/test_circleci.vader | 13 + .../ale/test/linter/test_clang_tidy.vader | 84 ++ .../ale/test/linter/test_clj_kondo.vader | 15 + .../test/linter/test_cmake_cmake_lint.vader | 13 + .../ale/test/linter/test_cookstyle.vader | 19 + .../ale/test/linter/test_cpp_cc.vader | 55 + .../ale/test/linter/test_cpp_ccls.vader | 69 ++ .../ale/test/linter/test_cpp_clangcheck.vader | 35 + .../ale/test/linter/test_cpp_clazy.vader | 56 + .../ale/test/linter/test_cpp_cppcheck.vader | 83 ++ .../ale/test/linter/test_cpp_cquery.vader | 40 + .../ale/test/linter/test_cpp_flawfinder.vader | 26 + .../ale/test/linter/test_cpplint.vader | 17 + .../ale/test/linter/test_cs_csc.vader | 42 + .../ale/test/linter/test_cs_mcs.vader | 13 + .../ale/test/linter/test_cs_mcsc.vader | 42 + .../ale/test/linter/test_cspell.vader | 71 ++ .../ale/test/linter/test_cucumber.vader | 18 + .../ale/test/linter/test_cuda_nvcc.vader | 20 + .../test/linter/test_cypher_cypher_lint.vader | 8 + .../ale/test/linter/test_d_dls.vader | 19 + .../linter/test_dart_analysis_server.vader | 15 + .../linter/test_dart_language_server.vader | 8 + .../linter/test_desktop_file_validate.vader | 15 + .../ale/test/linter/test_dialyxir.vader | 16 + .../test/linter/test_dmd_commandline.vader | 96 ++ .../test/linter/test_dockerfile_lint.vader | 19 + .../ale/test/linter/test_dogma.vader | 16 + .../ale/test/linter/test_eclipselsp.vader | 111 ++ .../ale/test/linter/test_elixir_credo.vader | 43 + .../ale/test/linter/test_elixir_ls.vader | 34 + .../ale/test/linter/test_elixir_mix.vader | 19 + .../ale/test/linter/test_elm_ls.vader | 29 + .../ale/test/linter/test_elm_make.vader | 63 ++ .../test/linter/test_embertemplatelint.vader | 23 + .../ale/test/linter/test_erb.vader | 16 + .../ale/test/linter/test_erblint.vader | 26 + .../test/linter/test_erlang_dialyzer.vader | 45 + .../ale/test/linter/test_erlang_elvis.vader | 16 + .../ale/test/linter/test_erlang_erlc.vader | 62 ++ .../test/linter/test_erlang_syntaxerl.vader | 45 + .../ale/test/linter/test_erubi.vader | 32 + .../ale/test/linter/test_erubis.vader | 16 + .../ale/test/linter/test_eslint.vader | 85 ++ .../ale/test/linter/test_fecs.vader | 9 + .../ale/test/linter/test_flake8.vader | 219 ++++ .../ale/test/linter/test_flakehell.vader | 203 ++++ .../ale/test/linter/test_flow.vader | 42 + .../ale/test/linter/test_foodcritic.vader | 18 + .../ale/test/linter/test_fortran_fortls.vader | 18 + .../ale/test/linter/test_fsc.vader | 13 + .../ale/test/linter/test_fusionlint.vader | 19 + .../ale/test/linter/test_gawk.vader | 25 + .../ale/test/linter/test_gfortran.vader | 24 + .../ale/test/linter/test_ghdl.vader | 19 + .../ale/test/linter/test_gitlint.vader | 43 + .../ale/test/linter/test_glslang.vader | 19 + .../ale/test/linter/test_glslls.vader | 19 + .../ale/test/linter/test_gobuild.vader | 33 + .../ale/test/linter/test_gofmt.vader | 26 + .../ale/test/linter/test_golangci_lint.vader | 50 + .../ale/test/linter/test_golangserver.vader | 76 ++ .../ale/test/linter/test_golint.vader | 30 + .../ale/test/linter/test_gometalinter.vader | 49 + .../ale/test/linter/test_gopls.vader | 96 ++ .../ale/test/linter/test_gosimple.vader | 19 + .../ale/test/linter/test_gotype.vader | 24 + .../ale/test/linter/test_govet.vader | 32 + .../ale/test/linter/test_graphql_gqlint.vader | 9 + .../ale/test/linter/test_haml_hamllint.vader | 43 + .../test/linter/test_haskell_cabal_ghc.vader | 13 + .../ale/test/linter/test_haskell_ghc.vader | 12 + .../test/linter/test_haskell_ghc_mod.vader | 10 + .../test/linter/test_haskell_hdevtools.vader | 16 + .../ale/test/linter/test_haskell_hie.vader | 27 + .../ale/test/linter/test_haskell_hlint.vader | 17 + .../ale/test/linter/test_haskell_hls.vader | 32 + .../linter/test_haskell_stack_build.vader | 13 + .../test/linter/test_haskell_stack_ghc.vader | 18 + .../linter/test_hdl_checker_options.vader | 86 ++ .../ale/test/linter/test_html_stylelint.vader | 60 ++ .../ale/test/linter/test_htmlhint.vader | 51 + .../linter/test_ibm_openapi_validator.vader | 15 + .../ale/test/linter/test_idris.vader | 21 + .../ale/test/linter/test_ink_ls.vader | 22 + .../ale/test/linter/test_inko_inko.vader | 20 + .../ale/test/linter/test_ispc_ispc.vader | 20 + .../ale/test/linter/test_iverilog.vader | 14 + .../ale/test/linter/test_javac.vader | 326 ++++++ .../ale/test/linter/test_javalsp.vader | 80 ++ .../linter/test_javascript_deno_lsp.vader | 79 ++ .../linter/test_javascript_tsserver.vader | 16 + .../ale/test/linter/test_jq.vader | 8 + .../ale/test/linter/test_jscs.vader | 15 + .../ale/test/linter/test_jshint.vader | 17 + .../ale/test/linter/test_jsonnet_lint.vader | 19 + .../ale/test/linter/test_jsonnetfmt.vader | 19 + .../linter/test_julia_languageserver.vader | 30 + .../linter/test_kotlin_languageserver.vader | 23 + .../ale/test/linter/test_kotlinc.vader | 9 + .../ale/test/linter/test_languagetool.vader | 22 + .../ale/test/linter/test_less_stylelint.vader | 32 + .../ale/test/linter/test_lessc.vader | 46 + .../ale/test/linter/test_lintr.vader | 34 + .../ale/test/linter/test_llc.vader | 21 + .../ale/test/linter/test_lua_selene.vader | 19 + .../ale/test/linter/test_luac.vader | 13 + .../ale/test/linter/test_luacheck.vader | 23 + .../linter/test_markdown_markdownlint.vader | 13 + .../ale/test/linter/test_markdown_mdl.vader | 19 + .../ale/test/linter/test_markdown_vale.vader | 32 + .../ale/test/linter/test_mercury_mmc.vader | 22 + .../ale/test/linter/test_mypy.vader | 106 ++ .../ale/test/linter/test_naga.vader | 10 + .../ale/test/linter/test_nagelfar.vader | 19 + .../ale/test/linter/test_nasm_nasm.vader | 32 + .../ale/test/linter/test_nimlsp.vader | 12 + .../ale/test/linter/test_nix_statix.vader | 19 + .../ale/test/linter/test_objc_ccls.vader | 66 ++ .../ale/test/linter/test_ocaml_ocamllsp.vader | 29 + .../ale/test/linter/test_ocaml_ols.vader | 41 + .../linter/test_ocamlinterface_ocamllsp.vader | 29 + .../ale/test/linter/test_perl.vader | 14 + .../ale/test/linter/test_perl6.vader | 14 + .../ale/test/linter/test_perlcritic.vader | 36 + .../ale/test/linter/test_php.vader | 15 + .../test/linter/test_php_intelephense.vader | 26 + .../ale/test/linter/test_php_langserver.vader | 32 + .../ale/test/linter/test_phpactor.vader | 20 + .../ale/test/linter/test_phpcs.vader | 42 + .../ale/test/linter/test_phpmd.vader | 12 + .../ale/test/linter/test_phpstan.vader | 121 +++ .../ale/test/linter/test_pony_ponyc.vader | 12 + .../ale/test/linter/test_prospector.vader | 35 + .../ale/test/linter/test_proto.vader | 16 + .../ale/test/linter/test_protolint.vader | 24 + .../ale/test/linter/test_psalm.vader | 44 + .../ale/test/linter/test_puglint.vader | 48 + .../ale/test/linter/test_purescript_ls.vader | 31 + .../ale/test/linter/test_pycodestyle.vader | 46 + .../ale/test/linter/test_pydocstyle.vader | 45 + .../ale/test/linter/test_pyflakes.vader | 60 ++ .../ale/test/linter/test_pylama.vader | 88 ++ .../ale/test/linter/test_pylint.vader | 96 ++ .../ale/test/linter/test_pylsp.vader | 70 ++ .../ale/test/linter/test_pyre.vader | 67 ++ .../ale/test/linter/test_pyrex_cython.vader | 30 + .../ale/test/linter/test_pyright.vader | 116 +++ .../ale/test/linter/test_qmlfmt.vader | 13 + .../test/linter/test_r_languageserver.vader | 22 + .../test/linter/test_racket_langserver.vader | 45 + .../ale/test/linter/test_racket_raco.vader | 10 + .../linter/test_rails_best_practices.vader | 42 + .../ale/test/linter/test_reason_ls.vader | 21 + .../ale/test/linter/test_reason_ols.vader | 42 + .../ale/test/linter/test_reek.vader | 49 + .../ale/test/linter/test_rego_opacheck.vader | 16 + .../ale/test/linter/test_remark_lint.vader | 37 + .../ale/test/linter/test_revive.vader | 30 + .../ale/test/linter/test_rflint.vader | 20 + .../ale/test/linter/test_rnix.vader | 12 + .../ale/test/linter/test_rst_textlint.vader | 65 ++ .../ale/test/linter/test_rubocop.vader | 26 + .../ale/test/linter/test_ruby.vader | 13 + .../ale/test/linter/test_ruby_debride.vader | 8 + .../test/linter/test_ruby_solargraph.vader | 43 + .../ale/test/linter/test_rust_analyzer.vader | 28 + .../ale/test/linter/test_rust_rls.vader | 33 + .../ale/test/linter/test_rustc.vader | 25 + .../ale/test/linter/test_ruumba.vader | 26 + .../ale/test/linter/test_sass_sasslint.vader | 43 + .../ale/test/linter/test_scala_metals.vader | 21 + .../test/linter/test_scala_sbtserver.vader | 23 + .../ale/test/linter/test_scalac.vader | 13 + .../ale/test/linter/test_scalastyle.vader | 34 + .../ale/test/linter/test_scss_sasslint.vader | 43 + .../ale/test/linter/test_scss_stylelint.vader | 33 + .../ale/test/linter/test_shellcheck.vader | 106 ++ .../ale/test/linter/test_slimlint.vader | 19 + .../ale/test/linter/test_solc.vader | 13 + .../ale/test/linter/test_solc_commit.vader | 14 + .../ale/test/linter/test_solhint.vader | 28 + .../ale/test/linter/test_sorbet.vader | 34 + .../ale/test/linter/test_spectral.vader | 31 + .../ale/test/linter/test_sqllint.vader | 12 + .../ale/test/linter/test_standard.vader | 43 + .../ale/test/linter/test_standardrb.vader | 26 + .../ale/test/linter/test_standardts.vader | 43 + .../ale/test/linter/test_staticcheck.vader | 49 + .../test/linter/test_sugarss_stylelint.vader | 33 + .../ale/test/linter/test_svelteserver.vader | 8 + .../ale/test/linter/test_swaglint.vader | 29 + .../linter/test_swift_appleswiftformat.vader | 42 + .../test/linter/test_swift_sourcekitlsp.vader | 21 + .../ale/test/linter/test_swiftlint.vader | 43 + .../test/linter/test_systemd_analyze.vader | 9 + .../ale/test/linter/test_terraform_ls.vader | 42 + .../ale/test/linter/test_terraform_lsp.vader | 29 + .../linter/test_terraform_terraform.vader | 15 + .../test/linter/test_terraform_tflint.vader | 28 + .../ale/test/linter/test_tex_lacheck.vader | 13 + .../ale/test/linter/test_tex_textlint.vader | 65 ++ .../ale/test/linter/test_texlab.vader | 35 + .../ale/test/linter/test_textlint.vader | 65 ++ .../ale/test/linter/test_thrift.vader | 53 + .../ale/test/linter/test_thriftcheck.vader | 21 + .../ale/test/linter/test_tslint.vader | 23 + .../linter/test_typescript_deno_lsp.vader | 79 ++ .../linter/test_typescript_tsserver.vader | 8 + .../ale/test/linter/test_unimport.vader | 71 ++ .../test/linter/test_v_command_callback.vader | 25 + .../ale/test/linter/test_vcom.vader | 19 + .../ale/test/linter/test_verilator.vader | 14 + .../ale/test/linter/test_vim_vimls.vader | 77 ++ .../ale/test/linter/test_vint.vader | 34 + .../ale/test/linter/test_vlog.vader | 19 + .../ale/test/linter/test_volar.vader | 27 + .../ale/test/linter/test_vulture.vader | 62 ++ .../ale/test/linter/test_write_good.vader | 55 + .../ale/test/linter/test_xmllint.vader | 20 + .../ale/test/linter/test_xo.vader | 23 + .../ale/test/linter/test_xots.vader | 23 + .../ale/test/linter/test_xvhdl.vader | 19 + .../ale/test/linter/test_xvlog.vader | 19 + .../ale/test/linter/test_yaml_ls.vader | 21 + .../ale/test/linter/test_yang_lsp.vader | 12 + .../ale/test/linter/test_zeek.vader | 17 + .../ale/test/linter/test_zig_zls.vader | 15 + .../ale/test/lsp/test_closing_documents.vader | 176 ++++ .../ale/test/lsp/test_did_save_event.vader | 147 +++ .../test_engine_lsp_response_handling.vader | 428 ++++++++ .../lsp/test_handling_window_requests.vader | 94 ++ .../test/lsp/test_lsp_client_messages.vader | 389 +++++++ .../lsp/test_lsp_command_formatting.vader | 44 + .../ale/test/lsp/test_lsp_connections.vader | 227 +++++ .../test/lsp/test_lsp_custom_request.vader | 158 +++ .../ale/test/lsp/test_lsp_error_parsing.vader | 74 ++ .../test/lsp/test_lsp_root_detection.vader | 90 ++ .../ale/test/lsp/test_lsp_startup.vader | 492 +++++++++ ...st_other_initialize_message_handling.vader | 216 ++++ .../test/lsp/test_read_lsp_diagnostics.vader | 257 +++++ .../ale/test/lsp/test_reset_lsp.vader | 98 ++ .../ale/test/lsp/test_update_config.vader | 21 + .../ale/test/python/test_deoplete_source.py | 120 +++ .../ale/test/script/block-padding-checker | 145 +++ .../ale/test/script/check-duplicate-tags | 5 + .../test/script/check-supported-tools-tables | 60 ++ .../ale/test/script/check-tag-alignment | 11 + .../ale/test/script/check-tag-references | 22 + sources_non_forked/ale/test/script/check-toc | 90 ++ .../ale/test/script/custom-checks | 80 ++ .../ale/test/script/custom-linting-rules | 166 +++ .../ale/test/script/dumb_named_pipe_server.py | 42 + .../ale/test/script/dumb_tcp_client.py | 33 + .../ale/test/script/dumb_tcp_server.py | 40 + .../ale/test/script/run-vader-tests | 167 +++ sources_non_forked/ale/test/script/run-vint | 20 + .../test/sign/test_linting_sets_signs.vader | 76 ++ .../sign/test_sign_column_highlighting.vader | 68 ++ .../ale/test/sign/test_sign_limits.vader | 57 ++ .../ale/test/sign/test_sign_parsing.vader | 88 ++ .../ale/test/sign/test_sign_placement.vader | 315 ++++++ sources_non_forked/ale/test/smoke_test.vader | 181 ++++ .../ale/test/test-files/.circleci/config.yml | 0 .../ale/test/test-files/.gitignore | 2 + .../ale/test/test-files/ada/testfile.adb | 0 .../node-modules-2/node_modules/alex/cli.js | 0 .../alex/node-modules/node_modules/.bin/alex | 0 .../@angular/language-server/bin/ngserver | 0 .../@angular/language-service/dummy | 0 .../test/test-files/ant/ant-project/build.xml | 0 .../ale/test/test-files/ant/bin/ant | 0 .../ale/test/test-files/ant/bin/ant.exe | 0 .../ale/test/test-files/bazel/BUILD | 0 .../ale/test/test-files/bazel/WORKSPACE | 0 .../ale/test/test-files/bazel/defs.bzl | 0 .../ale/test/test-files/bib/dummy.bib | 0 .../build/bad_folder_to_test_priority | 0 .../build/compile_commands.json | 0 .../test-files/c/configure_project/Makefile | 0 .../test-files/c/configure_project/configure | 0 .../c/configure_project/include/test.h | 0 .../c/configure_project/subdir/Makefile | 0 .../ale/test/test-files/c/dummy.c | 0 .../c/git_and_nested_makefiles/include/test.h | 0 .../c/git_and_nested_makefiles/src/Makefile | 0 .../c/gnumakefile_project/GNUmakefile | 0 .../test-files/c/gnumakefile_project/file.c | 0 .../test/test-files/c/h_file_project/Makefile | 0 .../test-files/c/h_file_project/subdir/dummy | 0 .../test/test-files/c/h_file_project/test.h | 0 .../test-files/c/hpp_file_project/Makefile | 0 .../c/hpp_file_project/subdir/dummy | 0 .../test-files/c/hpp_file_project/test.hpp | 0 .../json_project/build/compile_commands.json | 0 .../test-files/c/json_project/include/test.h | 0 .../test-files/c/json_project/subdir/dummy | 0 .../test-files/c/makefile_project/Makefile | 0 .../test-files/c/makefile_project/_astylerc | 0 .../test/test-files/c/makefile_project/args | 3 + .../c/makefile_project/include/test.h | 0 .../test-files/c/makefile_project/subdir/args | 1 + .../c/makefile_project/subdir/dummy | 0 .../c/makefile_project/subdir/file.c | 0 .../ale/test/test-files/cargo/Cargo.toml | 0 .../cargo/workspace_paths/Cargo.toml | 0 .../cargo/workspace_paths/subpath/Cargo.toml | 0 .../compile_commands.json | 0 .../test-files/ccls/with_ccls-root/.ccls-root | 0 .../ale/test/test-files/ccls/with_ccls/.ccls | 0 .../compile_commands.json | 0 .../test-files/checkstyle/other_config.xml | 0 .../compile_commands.json | 0 .../compile_commands.json | 0 .../with_clangformat/.clang-format | 0 .../ale/test/test-files/cpp/.astylerc | 0 .../ale/test/test-files/cpp/dummy.cpp | 0 .../cppcheck/one/compile_commands.json | 0 .../test-files/cppcheck/one/two/three/file.c | 0 .../cppcheck/one/two/three/file.cpp | 0 .../build/compile_commands.json | 0 .../cquery/build/compile_commands.json | 0 .../test-files/cquery/with_cquery/.cquery | 0 .../node-modules-2/node_modules/cspell/bin.js | 0 .../node-modules/node_modules/.bin/cspell | 0 .../test-files/csslint/other-app/testfile.css | 0 .../test-files/csslint/some-app/.csslintrc | 0 .../csslint/some-app/subdir/testfile.css | 0 .../test-files/cucumber/features/cuke.feature | 0 .../features/step_definitions/base_steps.rb | 0 .../ale/test/test-files/d/test.d | 0 .../ale/test/test-files/dart/.packages | 0 .../ale/test/test-files/dart/testfile.dart | 0 .../ale/test/test-files/dprint/blank.ts | 0 .../ale/test/test-files/dprint/dprint.json | 0 .../test-files/elixir/mix_project/lib/app.ex | 0 .../test-files/elixir/mix_project/mix.exs | 3 + .../ale/test/test-files/elixir/testfile.ex | 0 .../umbrella_project/apps/app1/lib/app.ex | 0 .../elixir/umbrella_project/apps/app1/mix.exs | 0 .../umbrella_project/apps/app2/lib/app.ex | 0 .../elixir/umbrella_project/apps/app2/mix.exs | 0 .../elixir/umbrella_project/mix.exs | 0 .../test-files/elm/newapp-notests/elm.json | 0 .../elm/newapp-notests/node_modules/.bin/elm | 0 .../elm/newapp-notests/tests/TestMain.elm | 0 .../ale/test/test-files/elm/newapp/elm.json | 0 .../elm/newapp/node_modules/.bin/elm | 0 .../elm/newapp/node_modules/.bin/elm-test | 0 .../test/test-files/elm/newapp/src/Main.elm | 0 .../test-files/elm/newapp/tests/TestSuite.elm | 0 .../elm/node_modules/.bin/elm-format | 0 .../test-files/elm/oldapp/elm-package.json | 0 .../elm/oldapp/node_modules/.bin/elm | 0 .../elm/oldapp/node_modules/.bin/elm-test | 0 .../test/test-files/elm/oldapp/src/Main.elm | 0 .../test-files/elm/oldapp/tests/TestSuite.elm | 0 .../test-files/elm/src/subdir/testfile.elm | 0 .../ale/test/test-files/eruby/dummy.html.erb | 0 .../node_modules/.bin/eslint_d | 0 .../eslint/node_modules/.bin/eslint | 0 .../eslint/other-app/subdir/testfile.js | 0 .../ale/test/test-files/eslint/package.json | 0 .../test-files/eslint/react-app/.eslintrc.js | 0 .../node_modules/eslint/bin/eslint.js | 0 .../node_modules/standard/bin/cmd.js | 0 .../node_modules/stylelint/bin/stylelint.js | 0 .../eslint/react-app/node_modules/xo/cli.js | 0 .../react-app/subdir-with-config/.eslintrc | 0 .../node_modules/.gitkeep | 0 .../subdir-with-package-json/package.json | 0 .../eslint/react-app/subdir/testfile.css | 0 .../eslint/react-app/subdir/testfile.js | 0 .../eslint/react-app/subdir/testfile.ts | 0 .../yarn2-app/.yarn/sdks/eslint/bin/eslint.js | 0 .../eslint/yarn2-app/subdir/testfile.js | 0 .../ale/test/test-files/fecs/fecs | 0 .../ale/test/test-files/fecs/fecs.exe | 0 .../ale/test/test-files/fish/testfile.fish | 0 .../ale/test/test-files/flow/a/.flowconfig | 0 .../ale/test/test-files/flow/a/sub/dummy | 0 .../ale/test/test-files/flow/b/sub/dummy | 0 .../test/test-files/fortls-project/.fortls | 2 + .../ale/test/test-files/go/go.mod | 1 + .../ale/test/test-files/go/go1/prj1/file.go | 0 .../ale/test/test-files/go/go2/prj2/file.go | 0 .../ale/test/test-files/go/gopath/bin/gopls | 0 .../test/test-files/go/gopath/bin/staticcheck | 0 .../ale/test/test-files/go/testfile.go | 0 .../ale/test/test-files/go/testfile2.go | 0 .../gradle/build-gradle-project/build.gradle | 0 .../src/main/kotlin/dummy.kt | 0 .../ale/test/test-files/gradle/gradle | 0 .../src/main/kotlin/dummy.kt | 0 .../settings-gradle-project/settings.gradle | 0 .../src/main/kotlin/dummy.kt | 0 .../gradle/unwrapped-project/build.gradle | 0 .../gradle/unwrapped-project/settings.gradle | 0 .../src/main/kotlin/dummy.kt | 0 .../gradle/wrapped-project/build.gradle | 0 .../test-files/gradle/wrapped-project/gradlew | 0 .../gradle/wrapped-project/settings.gradle | 0 .../wrapped-project/src/main/kotlin/dummy.kt | 0 .../haml-lint-and-rubocop/.haml-lint.yml | 0 .../haml-lint-and-rubocop/.rubocop.yml | 0 .../haml-lint-and-rubocop/subdir/file.haml | 0 .../hamllint/haml-lint-yml/.haml-lint.yml | 0 .../hamllint/haml-lint-yml/subdir/file.haml | 0 .../hamllint/rubocop-yml/.rubocop.yml | 0 .../hamllint/rubocop-yml/subdir/file.haml | 0 .../ale/test/test-files/hdl_server/foo.vhd | 0 .../with_config_file/.hdl_checker.config | 0 .../with_config_file/_hdl_checker.config | 0 .../hdl_server/with_config_file/foo.vhd | 0 .../hdl_server/with_git/files/foo.vhd | 1 + .../ale/test/test-files/hie_paths/file.hs | 0 .../test-files/html_beautify/html-beautify | 0 .../test/test-files/html_beautify/test.html | 0 .../htmlhint/node_modules/.bin/htmlhint | 0 .../htmlhint/with_config/.htmlhintrc | 0 .../ale/test/test-files/ink/story/main.ink | 0 .../ale/test/test-files/inko/test.inko | 0 .../test-files/inko/tests/test/test_foo.inko | 0 .../no_main/src/test/java/com/something/dummy | 0 .../src/main/java/com/something/dummy | 0 .../src/main/jaxb/com/something/dummy | 0 .../build/gen/main/java/com/something/dummy | 0 .../build/gen2/main/java/com/something/dummy | 0 .../src/main/java/com/something/dummy | 0 .../src/test/java/com/something/dummy | 0 .../ale/test/test-files/javascript/test.js | 0 .../javascript_deno/custom_import_map.json | 3 + .../javascript_deno/import_map.json | 3 + .../test/test-files/javascript_deno/main.js | 1 + .../test-files/javascript_deno/tsconfig.json | 16 + .../ale/test/test-files/json/testfile.json | 1 + .../app-without-jsonlint/src/app.json | 0 .../jsonlint/app/node_modules/.bin/jsonlint | 0 .../test/test-files/jsonlint/app/src/app.json | 0 .../jsonlint/node_modules/jsonlint/lib/cli.js | 0 .../ale/test/test-files/julia/REQUIRE | 0 .../ale/test/test-files/julia/test.jl | 0 .../ale/test/test-files/kotlin/testfile.kt | 0 .../test-files/lessc/node_modules/.bin/lessc | 0 .../ale/test/test-files/long-line/setup.cfg | 2 + .../ale/test/test-files/lua/testfile.lua | 0 .../ale/test/test-files/markdown/testfile.md | 0 .../maven/maven-java-project/module1/mvnw | 0 .../maven/maven-java-project/module1/mvnw.cmd | 0 .../maven/maven-java-project/module1/pom.xml | 1 + .../module1/src/main/java/dummy1.java | 0 .../maven/maven-java-project/module2/pom.xml | 1 + .../module2/src/main/java/dummy2.java | 0 .../maven/maven-kotlin-project/pom.xml | 1 + .../src/main/kotlin/dummy.kt | 1 + .../ale/test/test-files/maven/mvn | 0 .../src/main/java/dummy.java | 0 .../test-files/nim/with-git/src/source.nim | 0 .../ale/test/test-files/ocaml/testfile.ml | 0 .../ale/test/test-files/ocamllsp/dune-project | 0 .../ale/test/test-files/ols/.merlin | 0 .../node_modules/.bin/ocaml-language-server | 0 .../ale/test/test-files/pascal/test.pas | 0 .../php/project-with-php-cs-fixer/test.php | 0 .../vendor/bin/php-cs-fixer | 0 .../php/project-with-phpcbf/foo/test.php | 0 .../php/project-with-phpcbf/vendor/bin/phpcbf | 0 .../php/project-without-php-cs-fixer/test.php | 0 .../php/project-without-phpcbf/foo/test.php | 0 .../php/vendor/bin/php-language-server.php | 0 .../php/with-composer/composer.json | 0 .../vendor/bin/php-language-server.php | 0 .../vendor/bin/php-language-server.php | 0 .../phpcs/project-with-phpcs/foo/test.php | 0 .../phpcs/project-with-phpcs/vendor/bin/phpcs | 0 .../phpcs/project-without-phpcs/foo/test.php | 0 .../ale/test/test-files/prettier/testfile | 0 .../ale/test/test-files/prettier/testfile.css | 0 .../ale/test/test-files/prettier/testfile.js | 0 .../test/test-files/prettier/testfile.json | 0 .../test/test-files/prettier/testfile.scss | 0 .../ale/test/test-files/prettier/testfile.ts | 0 .../prettier/with_config/.prettierrc | 0 .../prettier/with_config/testfile.js | 0 .../with_prettierignore/.prettierignore | 0 .../with_prettierignore/src/testfile.js | 0 .../ale/test/test-files/proto/testfile.proto | 0 .../test/test-files/psalm/vendor/bin/psalm | 0 .../puglint/node_modules/.bin/pug-lint | 0 .../ale/test/test-files/puglint/package.json | 0 .../puglint/puglint_rc_dir/.pug-lintrc | 0 .../puglint/puglint_rc_js_dir/.pug-lintrc.js | 0 .../puglint_rc_json_dir/.pug-lintrc.json | 0 .../ale/test/test-files/puppet/dummy.pp | 0 .../lib/puppet/types/exampletype.rb | 0 .../puppet/new-style-module/metadata.json | 0 .../new-style-module/template/template.epp | 0 .../puppet/old-style-module/manifests/init.pp | 0 .../old-style-module/templates/template.epp | 0 .../test/test-files/purescript/bower/Foo.purs | 0 .../test-files/purescript/bower/bower.json | 0 .../purescript/psc-package/Foo.purs | 0 .../purescript/psc-package/psc-package.json | 0 .../test/test-files/purescript/spago/Foo.purs | 0 .../test-files/purescript/spago/spago.dhall | 0 .../namespace_package_manifest/MANIFEST.in | 3 + .../namespace/foo/__init__.py | 0 .../namespace/foo/bar.py | 0 .../namespace/foo/__init__.py | 0 .../namespace/foo/bar.py | 0 .../namespace_package_pytest/pytest.ini | 2 + .../namespace/foo/__init__.py | 0 .../namespace/foo/bar.py | 0 .../python/namespace_package_setup/setup.cfg | 2 + .../namespace/foo/__init__.py | 0 .../namespace/foo/bar.py | 0 .../python/namespace_package_tox/tox.ini | 3 + .../no_virtualenv/subdir/foo/COMMIT_EDITMSG | 0 .../no_virtualenv/subdir/foo/__init__.py | 0 .../python/no_virtualenv/subdir/foo/bar.py | 0 .../test-files/python/pipenv/Pipfile.lock | 0 .../test/test-files/python/poetry/poetry.lock | 0 .../.pyre_configuration.local | 0 .../pyre_configuration_dir/foo/__init__.py | 0 .../python/pyre_configuration_dir/foo/bar.py | 0 .../python/python-package-project/.flake8 | 0 .../package-name/module.py | 0 .../test-files/python/with_bandit/.bandit | 0 .../with_bandit/namespace/foo/__init__.py | 0 .../python/with_bandit/namespace/foo/bar.py | 0 .../with_mypy_ini_and_pytest_ini/mypy.ini | 0 .../tests/pytest.ini | 0 .../tests/testsubfolder/my_tests.py | 0 .../dir_with_yapf_config/.style.yapf | 0 .../with_virtualenv/env/Scripts/activate | 0 .../with_virtualenv/env/Scripts/autoflake.exe | 0 .../env/Scripts/autoimport.exe | 0 .../with_virtualenv/env/Scripts/autopep8.exe | 0 .../with_virtualenv/env/Scripts/black.exe | 0 .../with_virtualenv/env/Scripts/flake8.exe | 0 .../with_virtualenv/env/Scripts/flakehell.exe | 0 .../with_virtualenv/env/Scripts/gitlint.exe | 0 .../with_virtualenv/env/Scripts/isort.exe | 0 .../with_virtualenv/env/Scripts/mypy.exe | 0 .../with_virtualenv/env/Scripts/pyflakes.exe | 0 .../with_virtualenv/env/Scripts/pylama.exe | 0 .../with_virtualenv/env/Scripts/pylint.exe | 0 .../with_virtualenv/env/Scripts/pylsp.exe | 0 .../with_virtualenv/env/Scripts/pyre.exe | 0 .../env/Scripts/reorder-python-imports.exe | 0 .../with_virtualenv/env/Scripts/unimport.exe | 0 .../with_virtualenv/env/Scripts/vulture.exe | 0 .../with_virtualenv/env/Scripts/yamlfix.exe | 0 .../with_virtualenv/env/Scripts/yapf.exe | 0 .../python/with_virtualenv/env/bin/activate | 0 .../python/with_virtualenv/env/bin/autoflake | 0 .../python/with_virtualenv/env/bin/autoimport | 0 .../python/with_virtualenv/env/bin/autopep8 | 0 .../python/with_virtualenv/env/bin/black | 0 .../python/with_virtualenv/env/bin/flake8 | 0 .../python/with_virtualenv/env/bin/flakehell | 0 .../python/with_virtualenv/env/bin/gitlint | 0 .../python/with_virtualenv/env/bin/isort | 0 .../python/with_virtualenv/env/bin/mypy | 0 .../python/with_virtualenv/env/bin/pyflakes | 0 .../python/with_virtualenv/env/bin/pylama | 0 .../python/with_virtualenv/env/bin/pylint | 0 .../python/with_virtualenv/env/bin/pylsp | 0 .../python/with_virtualenv/env/bin/pyre | 0 .../env/bin/reorder-python-imports | 0 .../python/with_virtualenv/env/bin/unimport | 0 .../python/with_virtualenv/env/bin/vulture | 0 .../python/with_virtualenv/env/bin/yamlfix | 0 .../python/with_virtualenv/env/bin/yapf | 0 .../with_virtualenv/subdir/foo/COMMIT_EDITMSG | 0 .../with_virtualenv/subdir/foo/__init__.py | 0 .../python/with_virtualenv/subdir/foo/bar.py | 0 .../python/with_virtualenv/subdir/foo/bar.pyi | 0 .../ale/test/test-files/r/.Rprofile | 0 .../racket/many-inits/a/b/c/foo.rkt | 3 + .../racket/many-inits/a/b/c/init.rkt | 1 + .../test-files/racket/many-inits/a/b/foo.rkt | 3 + .../test-files/racket/many-inits/a/b/init.rkt | 1 + .../test-files/racket/many-inits/a/foo.rkt | 3 + .../test-files/racket/many-inits/a/init.rkt | 1 + .../test/test-files/racket/many-inits/foo.rkt | 3 + .../test-files/racket/many-inits/init.rkt | 1 + .../test-files/racket/simple-script/foo.rkt | 3 + .../test/test-files/reasonml/bsconfig.json | 0 .../ale/test/test-files/reasonml/testfile.re | 0 .../with_bin_path/node_modules/.bin/remark | 0 .../ale/test/test-files/ruby/dummy.rb | 0 .../test-files/ruby/not_a_rails_app/file.rb | 0 .../ruby/valid_rails_app/app/dummy.rb | 0 .../ruby/valid_rails_app/app/models/thing.rb | 0 .../app/views/my_great_view.html.erb | 0 .../ruby/valid_rails_app/config/dummy.rb | 0 .../ruby/valid_rails_app/db/dummy.rb | 0 .../test-files/ruby/valid_ruby_app1/Rakefile | 0 .../ruby/valid_ruby_app1/lib/file.rb | 0 .../test-files/ruby/valid_ruby_app2/Gemfile | 0 .../ruby/valid_ruby_app2/lib/file.rb | 0 .../ruby/valid_ruby_app3/.solargraph.yml | 0 .../ruby/valid_ruby_app3/lib/file.rb | 0 .../test-files/ruby/with_config/.rubocop.yml | 0 .../test-files/ruby/with_config/.standard.yml | 0 .../ale/test/test-files/rust/cargo/Cargo.toml | 0 .../test/test-files/rust/cargo/testfile.rs | 0 .../rust/rust-project/rust-project.json | 0 .../test-files/rust/rust-project/testfile.rs | 0 .../with-bin/node_modules/.bin/sass-lint | 0 .../node_modules/sass-lint/bin/sass-lint.js | 0 .../ale/test/test-files/scala/dummy.scala | 0 .../scala/invalid_sbt_project/Main.scala | 0 .../scala/valid_sbt_project/Main.scala | 0 .../scala/valid_sbt_project/build.sbt | 0 .../ale/test/test-files/slimlint/.rubocop.yml | 0 .../test/test-files/slimlint/subdir/file.slim | 0 .../ale/test/test-files/smlnj/cm/foo.sml | 0 .../test/test-files/smlnj/cm/path/to/bar.sml | 0 .../ale/test/test-files/smlnj/cm/sources.cm | 0 .../ale/test/test-files/smlnj/file/qux.sml | 0 .../ale/test/test-files/solhint/Contract.sol | 0 .../solhint/node_modules/.bin/solhint | 0 .../solhint/node_modules/solhint/index.js | 0 .../ale/test/test-files/solhint/package.json | 0 .../spectral/node_modules/.bin/spectral | 0 .../ale/test/test-files/spectral/openapi.yaml | 0 .../ale/test/test-files/stack/stack.yaml | 0 .../with-bin/node_modules/.bin/standard | 0 .../with-cmd/node_modules/standard/bin/cmd.js | 0 .../stylelint/node_modules/.bin/stylelint | 0 .../test-files/swaglint/docs/swagger.yaml | 0 .../swaglint/node_modules/.bin/swaglint | 0 .../ale/test/test-files/swift/dummy.swift | 0 .../src/folder/dummy.swift | 0 .../.swift-format | 10 + .../Package.swift | 0 .../src/folder/dummy.swift | 0 .../swift/swift-package-project/Package.swift | 0 .../src/folder/dummy.swift | 0 .../Pods/SwiftLint/swiftlint | 0 .../ios/Pods/SwiftLint/swiftlint | 0 .../cocoapods/Pods/SwiftLint/swiftlint | 0 .../react-native/ios/Pods/SwiftLint/swiftlint | 0 .../test-files/terraform/.terraform/dummy | 0 .../ale/test/test-files/terraform/main.tf | 0 .../ale/test/test-files/tex/sample1.tex | 0 .../ale/test/test-files/tex/sample2.tex | 0 .../ale/test/test-files/tex/testfile.tex | 0 .../with_bin_path/node_modules/.bin/textlint | 0 .../node_modules/textlint/bin/textlint.js | 0 .../test/test-files/tflint/foo/.tflint.hcl | 0 .../ale/test/test-files/tflint/foo/bar.tf | 0 .../ale/test/test-files/tidy/.tidyrc | 0 .../ale/test/test-files/tidy/test.html | 0 .../ale/test/test-files/tidy/tidy | 0 .../ale/test/test-files/tidy/tidy.exe | 0 .../empty-file | 0 .../ale/test/test-files/top/example.ini | 0 .../test-files/top/middle/bottom/dummy.txt | 0 .../ale/test/test-files/tsserver/src/file1.ts | 0 .../test-files/tsserver/src/level-1/file2.ts | 0 .../tsserver/src/level-1/level-2/file3.ts | 0 .../tsserver/src/level-1/tsconfig.json | 0 .../test/test-files/tsserver/tsconfig.json | 0 .../typescript/custom_import_map.json | 0 .../test-files/typescript/import_map.json | 0 .../ale/test/test-files/typescript/test.ts | 0 .../test/test-files/typescript/tsconfig.json | 0 .../vim/invalid_vim_project/test.vim | 0 .../vim/node_modules/.bin/vim-language-server | 0 .../vim/path_with_autoload/autoload/test.vim | 0 .../vim/path_with_autoload/test.vim | 0 .../test-files/vim/path_with_initvim/init.vim | 0 .../vim/path_with_plugin/plugin/test.vim | 0 .../test-files/vim/path_with_plugin/test.vim | 0 .../test-files/vim/path_with_vimrc/.vimrc | 0 .../volar/node_modules/.bin/volar-server | 0 .../typescript/lib/tsserverlibrary.js | 0 .../ale/test/test-files/volar/package.json | 0 .../ale/test/test-files/volar/src/App.vue | 0 .../node_modules/write-good/bin/write-good.js | 0 .../node-modules/node_modules/.bin/write-good | 0 .../xo/monorepo/node_modules/xo/cli.js | 0 .../test/test-files/xo/monorepo/package.json | 0 .../xo/monorepo/packages/a/index.js | 0 .../xo/monorepo/packages/a/index.ts | 0 .../xo/monorepo/packages/a/package.json | 0 .../ale/test/test-files/yaml/test.yaml | 0 .../ale/test/test-files/zig/build.zig | 0 .../ale/test/test_ale_has.vader | 13 + .../ale/test/test_ale_info.vader | 777 ++++++++++++++ .../ale/test/test_ale_info_to_clipboard.vader | 15 + .../ale/test/test_ale_lint_command.vader | 77 ++ .../ale/test/test_ale_lint_stop_command.vader | 27 + .../ale/test/test_ale_populate_command.vader | 96 ++ .../ale/test/test_ale_toggle.vader | 444 ++++++++ .../ale/test/test_ale_var.vader | 24 + .../ale/test/test_alejobstarted_autocmd.vader | 46 + .../ale/test/test_alelint_autocmd.vader | 40 + .../test_ant_build_classpath_command.vader | 27 + .../ale/test/test_ant_find_project_root.vader | 35 + .../ale/test/test_autocmd_commands.vader | 238 +++++ .../test/test_backwards_compatibility.vader | 19 + .../ale/test/test_balloon_messages.vader | 87 ++ .../ale/test/test_c_flag_parsing.vader | 689 +++++++++++++ .../test/test_checkingbuffer_autocmd.vader | 57 ++ .../ale/test/test_cleanup.vader | 14 + .../ale/test/test_code_action.vader | 605 +++++++++++ .../test/test_code_action_corner_cases.vader | 141 +++ .../ale/test/test_code_action_python.vader | 59 ++ .../ale/test/test_codefix.vader | 549 ++++++++++ .../test/test_computed_lint_file_values.vader | 150 +++ .../test/test_csslint_config_detection.vader | 29 + .../ale/test/test_cursor_warnings.vader | 256 +++++ .../test/test_deferred_command_string.vader | 50 + .../test_deferred_executable_string.vader | 46 + .../test/test_deno_executable_detection.vader | 20 + .../ale/test/test_disabling_ale.vader | 119 +++ .../test_dockerfile_hadolint_linter.vader | 90 ++ .../ale/test/test_env_function.vader | 8 + ...rrors_removed_after_filetype_changed.vader | 78 ++ .../ale/test/test_filename_mapping.vader | 62 ++ .../ale/test/test_filerename.vader | 224 ++++ .../test/test_filetype_linter_defaults.vader | 137 +++ .../ale/test/test_filetype_mapping.vader | 29 + .../test/test_find_nearest_directory.vader | 17 + .../ale/test/test_find_references.vader | 480 +++++++++ .../ale/test/test_floating_preview.vader | 92 ++ .../ale/test/test_format_command.vader | 186 ++++ .../test_format_temporary_file_creation.vader | 63 ++ .../ale/test/test_function_arg_count.vader | 45 + .../ale/test/test_fuzzy_json_decode.vader | 29 + .../ale/test/test_get_abspath.vader | 29 + .../ale/test/test_get_loclist.vader | 31 + .../ale/test/test_getmatches.vader | 163 +++ .../ale/test/test_go_to_definition.vader | 689 +++++++++++++ .../test_gradle_build_classpath_command.vader | 52 + .../test/test_gradle_find_executable.vader | 37 + .../test/test_gradle_find_project_root.vader | 35 + .../ale/test/test_highlight_placement.vader | 465 +++++++++ .../test_highlight_position_chunking.vader | 76 ++ .../ale/test/test_history_saving.vader | 177 ++++ sources_non_forked/ale/test/test_hover.vader | 272 +++++ .../ale/test/test_hover_parsing.vader | 173 ++++ .../ale/test/test_ignoring_linters.vader | 403 ++++++++ .../ale/test/test_jq_linter.vader | 18 + .../test_jsonlint_executable_detection.vader | 45 + .../ale/test/test_line_join.vader | 84 ++ .../ale/test/test_lint_file_linters.vader | 317 ++++++ ...test_lint_on_enter_when_file_changed.vader | 84 ++ .../test/test_lint_on_filetype_changed.vader | 77 ++ .../test_linter_defintion_processing.vader | 501 +++++++++ .../ale/test/test_linter_retrieval.vader | 190 ++++ .../ale/test/test_linter_type_mapping.vader | 120 +++ .../ale/test/test_linting_blacklist.vader | 16 + .../test/test_linting_updates_loclist.vader | 96 ++ .../ale/test/test_list_formatting.vader | 188 ++++ .../ale/test/test_list_opening.vader | 290 ++++++ .../ale/test/test_list_titles.vader | 77 ++ .../ale/test/test_load_all_linters.vader | 6 + .../ale/test/test_loclist_binary_search.vader | 66 ++ .../ale/test/test_loclist_corrections.vader | 469 +++++++++ .../ale/test/test_loclist_jumping.vader | 121 +++ .../ale/test/test_loclist_sorting.vader | 43 + .../test_maven_build_classpath_command.vader | 53 + .../ale/test/test_maven_find_executable.vader | 46 + .../test/test_maven_find_project_root.vader | 28 + .../ale/test/test_nearest_file_search.vader | 15 + .../ale/test/test_nimlsp_project_root.vader | 19 + .../test/test_no_linting_on_write_quit.vader | 118 +++ .../ale/test/test_organize_imports.vader | 172 ++++ .../ale/test/test_other_sources.vader | 153 +++ .../ale/test/test_parse_command_args.vader | 52 + .../ale/test/test_path_dirname.vader | 13 + .../ale/test/test_path_equality.vader | 82 ++ .../ale/test/test_path_upwards.vader | 48 + .../ale/test/test_path_uri.vader | 73 ++ .../ale/test/test_pattern_options.vader | 107 ++ .../ale/test/test_prepare_command.vader | 96 ++ .../ale/test/test_puppet_path_detection.vader | 22 + .../test/test_python_find_project_root.vader | 11 + .../ale/test/test_python_pipenv.vader | 19 + .../ale/test/test_python_poetry.vader | 19 + .../ale/test/test_python_traceback.vader | 79 ++ .../ale/test/test_python_virtualenv.vader | 12 + .../test/test_quickfix_deduplication.vader | 50 + .../ale/test/test_quitting_variable.vader | 39 + ...redundant_tsserver_rendering_avoided.vader | 178 ++++ .../ale/test/test_regex_escaping.vader | 4 + sources_non_forked/ale/test/test_rename.vader | 504 +++++++++ .../ale/test/test_resolve_local_path.vader | 17 + ...lts_not_cleared_when_opening_loclist.vader | 30 + .../ale/test/test_sandbox_execution.vader | 103 ++ .../ale/test/test_semver_utils.vader | 43 + .../ale/test/test_set_list_timers.vader | 29 + ..._setting_loclist_from_another_buffer.vader | 26 + ...g_problems_found_in_previous_buffers.vader | 98 ++ .../ale/test/test_shell_detection.vader | 177 ++++ .../test_should_do_nothing_conditions.vader | 88 ++ .../ale/test/test_sml_command.vader | 45 + .../ale/test/test_socket_connections.vader | 139 +++ .../ale/test/test_statusline.vader | 157 +++ .../test/test_swift_find_project_root.vader | 18 + .../ale/test/test_symbol_search.vader | 189 ++++ .../test/test_temporary_file_management.vader | 146 +++ .../ale/test/test_tmpdir_wrapper.vader | 32 + .../test/test_vim8_processid_parsing.vader | 5 + .../ale/test/test_windows_escaping.vader | 42 + .../ale/test/test_wrap_comand.vader | 48 + .../ale/test/test_writefile_function.vader | 117 +++ .../test/util/test_cd_string_commands.vader | 20 + .../ale/test/v_files/testfile.v | 0 sources_non_forked/ale/test/vimrc | 42 + 1324 files changed, 56041 insertions(+), 437 deletions(-) create mode 100644 sources_non_forked/ale/Dockerfile create mode 100644 sources_non_forked/ale/README.md create mode 100644 sources_non_forked/ale/ale_linters/ada/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/asciidoc/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/avra/avra.vim create mode 100644 sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim create mode 100644 sources_non_forked/ale/ale_linters/c/cpplint.vim create mode 100644 sources_non_forked/ale/ale_linters/c/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim create mode 100644 sources_non_forked/ale/ale_linters/cpp/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/cs/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/css/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/css/vscodecss.vim delete mode 100644 sources_non_forked/ale/ale_linters/dart/dartanalyzer.vim create mode 100644 sources_non_forked/ale/ale_linters/elixir/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/go/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/haskell/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/help/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/html/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/html/vscodehtml.vim create mode 100644 sources_non_forked/ale/ale_linters/java/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/javascript/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/json/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/json/vscodejson.vim create mode 100644 sources_non_forked/ale/ale_linters/lua/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/lua/selene.vim create mode 100644 sources_non_forked/ale/ale_linters/markdown/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/nix/statix.vim create mode 100644 sources_non_forked/ale/ale_linters/php/cspell.vim mode change 100644 => 100755 sources_non_forked/ale/ale_linters/php/intelephense.vim create mode 100644 sources_non_forked/ale/ale_linters/php/phpactor.vim create mode 100644 sources_non_forked/ale/ale_linters/powershell/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/proto/buf_lint.vim create mode 100644 sources_non_forked/ale/ale_linters/python/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/python/unimport.vim create mode 100644 sources_non_forked/ale/ale_linters/rego/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/rego/opacheck.vim create mode 100644 sources_non_forked/ale/ale_linters/rst/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/ruby/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/rust/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/scala/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/sh/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/swift/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/terraform/checkov.vim create mode 100644 sources_non_forked/ale/ale_linters/tex/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/texinfo/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/text/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/typescript/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/vue/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/vue/volar.vim create mode 100644 sources_non_forked/ale/ale_linters/wgsl/naga.vim create mode 100644 sources_non_forked/ale/ale_linters/xhtml/cspell.vim create mode 100644 sources_non_forked/ale/ale_linters/yaml/actionlint.vim create mode 100644 sources_non_forked/ale/ale_linters/yaml/ls.vim create mode 100644 sources_non_forked/ale/autoload/ale/filerename.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/buf_format.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/crystal.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/dprint.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/gofumpt.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/opafmt.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/packer.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/statix.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/zigfmt.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/actionlint.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/cspell.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/naga.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/statix.vim create mode 100644 sources_non_forked/ale/autoload/ale/uri/jdt.vim create mode 100644 sources_non_forked/ale/doc/ale-avra.txt create mode 100644 sources_non_forked/ale/doc/ale-bitbake.txt create mode 100644 sources_non_forked/ale/doc/ale-help.txt create mode 100644 sources_non_forked/ale/doc/ale-packer.txt create mode 100644 sources_non_forked/ale/doc/ale-rego.txt create mode 100644 sources_non_forked/ale/doc/ale-toml.txt create mode 100644 sources_non_forked/ale/doc/ale-wgsl.txt create mode 100755 sources_non_forked/ale/run-tests create mode 100644 sources_non_forked/ale/run-tests.bat create mode 100644 sources_non_forked/ale/test/completion/test_ale_import_command.vader create mode 100644 sources_non_forked/ale/test/completion/test_complete_events.vader create mode 100644 sources_non_forked/ale/test/completion/test_completion_events.vader create mode 100644 sources_non_forked/ale/test/completion/test_completion_filtering.vader create mode 100644 sources_non_forked/ale/test/completion/test_completion_prefixes.vader create mode 100644 sources_non_forked/ale/test/completion/test_lsp_completion_messages.vader create mode 100644 sources_non_forked/ale/test/completion/test_lsp_completion_parsing.vader create mode 100644 sources_non_forked/ale/test/completion/test_omnifunc_completion.vader create mode 100644 sources_non_forked/ale/test/completion/test_public_completion_api.vader create mode 100644 sources_non_forked/ale/test/completion/test_tsserver_completion_parsing.vader create mode 100644 sources_non_forked/ale/test/fix/test_ale_fix.vader create mode 100644 sources_non_forked/ale/test/fix/test_ale_fix_aliases.vader create mode 100644 sources_non_forked/ale/test/fix/test_ale_fix_completion.vader create mode 100644 sources_non_forked/ale/test/fix/test_ale_fix_completion_filter.vader create mode 100644 sources_non_forked/ale/test/fix/test_ale_fix_ignore.vader create mode 100644 sources_non_forked/ale/test/fix/test_ale_fix_suggest.vader create mode 100644 sources_non_forked/ale/test/fixers/test_appleswiftformat_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_astyle_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_autoflake_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_autoimport_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_autopep8_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_bibclean_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_black_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_break_up_long_lines_python_fixer.vader create mode 100644 sources_non_forked/ale/test/fixers/test_brittany_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_buf_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_buildifier_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_clangformat_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_clangtidy_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_cmakeformat_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_crystal_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dart_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dartfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dhall_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dhall_freeze_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dhall_lint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dotnet_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_dprint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_elm_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_erblint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_erlfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_eslint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_fecs_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_fish_indent_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_fixjson_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_floskell_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_gnatpp_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_gofmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_gofumpt_fixer.vader create mode 100644 sources_non_forked/ale/test/fixers/test_goimports_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_golines_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_gomod_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_goofle_java_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_hackfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_hfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_hindent_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_hlint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_html_beautify_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_importjs_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_isort_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_jq_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_jsonnetfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_ktlint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_latexindent_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_lua_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_luafmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_mix_format_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_nimpretty_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_nixfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_nixpkgsfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_ocamlformat_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_ocp_indent_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_opa_fmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_ormolu_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_packer_fmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_pandoc_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_perltidy_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_pgformatter_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_php_cs_fixer.vader create mode 100644 sources_non_forked/ale/test/fixers/test_phpcbf_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_prettier_eslint_fixer.callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_prettier_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_prettier_standard_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_protolint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_ptop_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_puppetlint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_purs_tidy_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_purty_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_python_add_blank_lines_fixer.vader create mode 100644 sources_non_forked/ale/test/fixers/test_qmlfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_refmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_remark_lint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_reorder_python_imports_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_rubocop_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_rufo_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_rustfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_scalafmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_shfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_sorbet_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_sqlfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_sqlformat_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_standard_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_standardrb_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_statix_fixer.vader create mode 100644 sources_non_forked/ale/test/fixers/test_stylelint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_styler_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_stylish_haskell_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_stylua_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_swiftformat_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_terraform_fmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_textlint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_tidy_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_trim_whitespace.vader create mode 100644 sources_non_forked/ale/test/fixers/test_tslint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_uncrustify_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_vfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_vim_help_tags_alignment_fixer.vader create mode 100644 sources_non_forked/ale/test/fixers/test_xmllint_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_xo_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_xots_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_yamlfix_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_yapf_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/fixers/test_zigfmt_fixer_callback.vader create mode 100644 sources_non_forked/ale/test/handler/test_actionlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ada_gcc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_alex_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ameba_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ansible_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_appleswiftformat_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_asm_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_atools_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_avra_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_bandit_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_bashate_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_bibclean_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_bitbake_oelint_adv_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_brakeman_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cfn_python_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_checkmake_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_checkov_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_checkstyle_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_circleci_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_clang_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_clojure_clj_kondo_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_clojure_joker_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cmake_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_coffeelint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_common_handlers.vader create mode 100644 sources_non_forked/ale/test/handler/test_cookstyle_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cppcheck_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cpplint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_credo_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_crystal_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_csc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cspell_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cucumber_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cuda_nvcc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_cypher_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_dafny_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_dart_analyze_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_debride_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_desktop_file_validate_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_dmd_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_dockerfile_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_dogma_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_drafter_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_elmmake_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_embertemplatelint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_erblint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_erlang_dialyzer_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_erlang_elvis_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_eslint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_eslint_json_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_fecs_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_fish_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_flake8_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_flakehell_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_flawfinder_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_flow_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_foodcritic_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_fortran_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_gawk_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_gcc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ghc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ghc_mod_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ghdl_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_gitlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_glslang_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_go_generic_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_gobuild_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_golangci_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_gometalinter_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_hadolint.vader create mode 100644 sources_non_forked/ale/test/handler/test_haskell_stack_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_hlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ibm_openapi_validator_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_idris_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_inko_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ispc_ispc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_javac_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_jscs_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ktlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_lacheck_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_languagetool_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_lessc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_llc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_lua_selene_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_luac_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_luacheck_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_markdownlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_mcs_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_mcsc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_mdl_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_mercury_mmc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_mix_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_msgfmt_hander.vader create mode 100644 sources_non_forked/ale/test/handler/test_mypy_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_naga_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_nagelfar_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_nasm_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_nim_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_nix_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_perl6_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_perl_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_perlcritic_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_php_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_php_phan_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_php_phpmd_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_phpcs_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_phpstan_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pmd_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pony_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_powershell_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_prospector_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_psscriptanalyzer_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_puglint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_puppet_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pycodestyle_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pydocstyle_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pyflakes_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pylama_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pylint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_pyrex_cython_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_qmlfmt_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_qmllint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_raco_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_rails_best_practices_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_redpen_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_reek_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_remark_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_rflint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_rpmlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_rstcheck_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_rubocop_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_ruby_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_rust_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_salt_salt_lint.vader create mode 100644 sources_non_forked/ale/test/handler/test_scala_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_scalastyle_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_shell_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_shellcheck_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_slim_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_sml_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_solc_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_solhint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_spectral_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_sqlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_sqllint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_standard_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_statix_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_stylelint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_swaglint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_swiftlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_swipl_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_syntaxerl_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_systemd_analyze_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_terraform_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_textlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_tflint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_thrift_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_thriftcheck_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_tlint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_tslint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_typecheck_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_unimport_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_v_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_vala_lint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_vale_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_vcom_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_verilator_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_vint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_vlog_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_vulture_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_write_good_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_xmllint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_xvhdl_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_xvlog_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_yamllint_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_yosys_handler.vader create mode 100644 sources_non_forked/ale/test/handler/test_zeek_handler.vader create mode 100644 sources_non_forked/ale/test/jsonnet_files/testfile.jsonnet create mode 100644 sources_non_forked/ale/test/linter/test_ada_gcc.vader create mode 100644 sources_non_forked/ale/test/linter/test_adals.vader create mode 100644 sources_non_forked/ale/test/linter/test_alex.vader create mode 100644 sources_non_forked/ale/test/linter/test_ameba.vader create mode 100644 sources_non_forked/ale/test/linter/test_angular.vader create mode 100644 sources_non_forked/ale/test/linter/test_ansible_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_asciidoc_textlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_asm_gcc.vader create mode 100644 sources_non_forked/ale/test/linter/test_avra_avra.vader create mode 100644 sources_non_forked/ale/test/linter/test_bandit.vader create mode 100644 sources_non_forked/ale/test/linter/test_bashate.vader create mode 100644 sources_non_forked/ale/test/linter/test_bib_bibclean.vader create mode 100644 sources_non_forked/ale/test/linter/test_bingo.vader create mode 100755 sources_non_forked/ale/test/linter/test_bitbake.vader create mode 100644 sources_non_forked/ale/test/linter/test_brakeman.vader create mode 100644 sources_non_forked/ale/test/linter/test_buf_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_cc.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_ccls.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_clang_tidy.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_clangd.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_cppcheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_cquery.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_flawfinder.vader create mode 100644 sources_non_forked/ale/test/linter/test_c_import_paths.vader create mode 100644 sources_non_forked/ale/test/linter/test_cargo.vader create mode 100644 sources_non_forked/ale/test/linter/test_checkov.vader create mode 100644 sources_non_forked/ale/test/linter/test_checkstyle.vader create mode 100644 sources_non_forked/ale/test/linter/test_circleci.vader create mode 100644 sources_non_forked/ale/test/linter/test_clang_tidy.vader create mode 100644 sources_non_forked/ale/test/linter/test_clj_kondo.vader create mode 100644 sources_non_forked/ale/test/linter/test_cmake_cmake_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_cookstyle.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpp_cc.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpp_ccls.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpp_clangcheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpp_clazy.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpp_cppcheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpp_cquery.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpp_flawfinder.vader create mode 100644 sources_non_forked/ale/test/linter/test_cpplint.vader create mode 100644 sources_non_forked/ale/test/linter/test_cs_csc.vader create mode 100644 sources_non_forked/ale/test/linter/test_cs_mcs.vader create mode 100644 sources_non_forked/ale/test/linter/test_cs_mcsc.vader create mode 100644 sources_non_forked/ale/test/linter/test_cspell.vader create mode 100644 sources_non_forked/ale/test/linter/test_cucumber.vader create mode 100644 sources_non_forked/ale/test/linter/test_cuda_nvcc.vader create mode 100644 sources_non_forked/ale/test/linter/test_cypher_cypher_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_d_dls.vader create mode 100644 sources_non_forked/ale/test/linter/test_dart_analysis_server.vader create mode 100644 sources_non_forked/ale/test/linter/test_dart_language_server.vader create mode 100644 sources_non_forked/ale/test/linter/test_desktop_file_validate.vader create mode 100644 sources_non_forked/ale/test/linter/test_dialyxir.vader create mode 100644 sources_non_forked/ale/test/linter/test_dmd_commandline.vader create mode 100644 sources_non_forked/ale/test/linter/test_dockerfile_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_dogma.vader create mode 100644 sources_non_forked/ale/test/linter/test_eclipselsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_elixir_credo.vader create mode 100644 sources_non_forked/ale/test/linter/test_elixir_ls.vader create mode 100644 sources_non_forked/ale/test/linter/test_elixir_mix.vader create mode 100644 sources_non_forked/ale/test/linter/test_elm_ls.vader create mode 100644 sources_non_forked/ale/test/linter/test_elm_make.vader create mode 100644 sources_non_forked/ale/test/linter/test_embertemplatelint.vader create mode 100644 sources_non_forked/ale/test/linter/test_erb.vader create mode 100644 sources_non_forked/ale/test/linter/test_erblint.vader create mode 100644 sources_non_forked/ale/test/linter/test_erlang_dialyzer.vader create mode 100644 sources_non_forked/ale/test/linter/test_erlang_elvis.vader create mode 100644 sources_non_forked/ale/test/linter/test_erlang_erlc.vader create mode 100644 sources_non_forked/ale/test/linter/test_erlang_syntaxerl.vader create mode 100644 sources_non_forked/ale/test/linter/test_erubi.vader create mode 100644 sources_non_forked/ale/test/linter/test_erubis.vader create mode 100644 sources_non_forked/ale/test/linter/test_eslint.vader create mode 100644 sources_non_forked/ale/test/linter/test_fecs.vader create mode 100644 sources_non_forked/ale/test/linter/test_flake8.vader create mode 100644 sources_non_forked/ale/test/linter/test_flakehell.vader create mode 100644 sources_non_forked/ale/test/linter/test_flow.vader create mode 100644 sources_non_forked/ale/test/linter/test_foodcritic.vader create mode 100644 sources_non_forked/ale/test/linter/test_fortran_fortls.vader create mode 100644 sources_non_forked/ale/test/linter/test_fsc.vader create mode 100644 sources_non_forked/ale/test/linter/test_fusionlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_gawk.vader create mode 100644 sources_non_forked/ale/test/linter/test_gfortran.vader create mode 100644 sources_non_forked/ale/test/linter/test_ghdl.vader create mode 100644 sources_non_forked/ale/test/linter/test_gitlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_glslang.vader create mode 100644 sources_non_forked/ale/test/linter/test_glslls.vader create mode 100644 sources_non_forked/ale/test/linter/test_gobuild.vader create mode 100644 sources_non_forked/ale/test/linter/test_gofmt.vader create mode 100644 sources_non_forked/ale/test/linter/test_golangci_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_golangserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_golint.vader create mode 100644 sources_non_forked/ale/test/linter/test_gometalinter.vader create mode 100644 sources_non_forked/ale/test/linter/test_gopls.vader create mode 100644 sources_non_forked/ale/test/linter/test_gosimple.vader create mode 100644 sources_non_forked/ale/test/linter/test_gotype.vader create mode 100644 sources_non_forked/ale/test/linter/test_govet.vader create mode 100644 sources_non_forked/ale/test/linter/test_graphql_gqlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_haml_hamllint.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_cabal_ghc.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_ghc.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_ghc_mod.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_hdevtools.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_hie.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_hlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_hls.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_stack_build.vader create mode 100644 sources_non_forked/ale/test/linter/test_haskell_stack_ghc.vader create mode 100644 sources_non_forked/ale/test/linter/test_hdl_checker_options.vader create mode 100644 sources_non_forked/ale/test/linter/test_html_stylelint.vader create mode 100644 sources_non_forked/ale/test/linter/test_htmlhint.vader create mode 100644 sources_non_forked/ale/test/linter/test_ibm_openapi_validator.vader create mode 100644 sources_non_forked/ale/test/linter/test_idris.vader create mode 100644 sources_non_forked/ale/test/linter/test_ink_ls.vader create mode 100644 sources_non_forked/ale/test/linter/test_inko_inko.vader create mode 100644 sources_non_forked/ale/test/linter/test_ispc_ispc.vader create mode 100644 sources_non_forked/ale/test/linter/test_iverilog.vader create mode 100644 sources_non_forked/ale/test/linter/test_javac.vader create mode 100644 sources_non_forked/ale/test/linter/test_javalsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_javascript_deno_lsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_javascript_tsserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_jq.vader create mode 100644 sources_non_forked/ale/test/linter/test_jscs.vader create mode 100644 sources_non_forked/ale/test/linter/test_jshint.vader create mode 100644 sources_non_forked/ale/test/linter/test_jsonnet_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_jsonnetfmt.vader create mode 100644 sources_non_forked/ale/test/linter/test_julia_languageserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_kotlin_languageserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_kotlinc.vader create mode 100644 sources_non_forked/ale/test/linter/test_languagetool.vader create mode 100644 sources_non_forked/ale/test/linter/test_less_stylelint.vader create mode 100644 sources_non_forked/ale/test/linter/test_lessc.vader create mode 100644 sources_non_forked/ale/test/linter/test_lintr.vader create mode 100644 sources_non_forked/ale/test/linter/test_llc.vader create mode 100644 sources_non_forked/ale/test/linter/test_lua_selene.vader create mode 100644 sources_non_forked/ale/test/linter/test_luac.vader create mode 100644 sources_non_forked/ale/test/linter/test_luacheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_markdown_markdownlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_markdown_mdl.vader create mode 100644 sources_non_forked/ale/test/linter/test_markdown_vale.vader create mode 100644 sources_non_forked/ale/test/linter/test_mercury_mmc.vader create mode 100644 sources_non_forked/ale/test/linter/test_mypy.vader create mode 100644 sources_non_forked/ale/test/linter/test_naga.vader create mode 100644 sources_non_forked/ale/test/linter/test_nagelfar.vader create mode 100644 sources_non_forked/ale/test/linter/test_nasm_nasm.vader create mode 100644 sources_non_forked/ale/test/linter/test_nimlsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_nix_statix.vader create mode 100644 sources_non_forked/ale/test/linter/test_objc_ccls.vader create mode 100644 sources_non_forked/ale/test/linter/test_ocaml_ocamllsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_ocaml_ols.vader create mode 100644 sources_non_forked/ale/test/linter/test_ocamlinterface_ocamllsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_perl.vader create mode 100644 sources_non_forked/ale/test/linter/test_perl6.vader create mode 100644 sources_non_forked/ale/test/linter/test_perlcritic.vader create mode 100644 sources_non_forked/ale/test/linter/test_php.vader create mode 100644 sources_non_forked/ale/test/linter/test_php_intelephense.vader create mode 100644 sources_non_forked/ale/test/linter/test_php_langserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_phpactor.vader create mode 100644 sources_non_forked/ale/test/linter/test_phpcs.vader create mode 100644 sources_non_forked/ale/test/linter/test_phpmd.vader create mode 100644 sources_non_forked/ale/test/linter/test_phpstan.vader create mode 100644 sources_non_forked/ale/test/linter/test_pony_ponyc.vader create mode 100644 sources_non_forked/ale/test/linter/test_prospector.vader create mode 100644 sources_non_forked/ale/test/linter/test_proto.vader create mode 100644 sources_non_forked/ale/test/linter/test_protolint.vader create mode 100644 sources_non_forked/ale/test/linter/test_psalm.vader create mode 100644 sources_non_forked/ale/test/linter/test_puglint.vader create mode 100644 sources_non_forked/ale/test/linter/test_purescript_ls.vader create mode 100644 sources_non_forked/ale/test/linter/test_pycodestyle.vader create mode 100644 sources_non_forked/ale/test/linter/test_pydocstyle.vader create mode 100644 sources_non_forked/ale/test/linter/test_pyflakes.vader create mode 100644 sources_non_forked/ale/test/linter/test_pylama.vader create mode 100644 sources_non_forked/ale/test/linter/test_pylint.vader create mode 100644 sources_non_forked/ale/test/linter/test_pylsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_pyre.vader create mode 100644 sources_non_forked/ale/test/linter/test_pyrex_cython.vader create mode 100644 sources_non_forked/ale/test/linter/test_pyright.vader create mode 100644 sources_non_forked/ale/test/linter/test_qmlfmt.vader create mode 100644 sources_non_forked/ale/test/linter/test_r_languageserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_racket_langserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_racket_raco.vader create mode 100644 sources_non_forked/ale/test/linter/test_rails_best_practices.vader create mode 100644 sources_non_forked/ale/test/linter/test_reason_ls.vader create mode 100644 sources_non_forked/ale/test/linter/test_reason_ols.vader create mode 100644 sources_non_forked/ale/test/linter/test_reek.vader create mode 100644 sources_non_forked/ale/test/linter/test_rego_opacheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_remark_lint.vader create mode 100644 sources_non_forked/ale/test/linter/test_revive.vader create mode 100644 sources_non_forked/ale/test/linter/test_rflint.vader create mode 100644 sources_non_forked/ale/test/linter/test_rnix.vader create mode 100644 sources_non_forked/ale/test/linter/test_rst_textlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_rubocop.vader create mode 100644 sources_non_forked/ale/test/linter/test_ruby.vader create mode 100644 sources_non_forked/ale/test/linter/test_ruby_debride.vader create mode 100644 sources_non_forked/ale/test/linter/test_ruby_solargraph.vader create mode 100644 sources_non_forked/ale/test/linter/test_rust_analyzer.vader create mode 100644 sources_non_forked/ale/test/linter/test_rust_rls.vader create mode 100644 sources_non_forked/ale/test/linter/test_rustc.vader create mode 100644 sources_non_forked/ale/test/linter/test_ruumba.vader create mode 100644 sources_non_forked/ale/test/linter/test_sass_sasslint.vader create mode 100644 sources_non_forked/ale/test/linter/test_scala_metals.vader create mode 100644 sources_non_forked/ale/test/linter/test_scala_sbtserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_scalac.vader create mode 100644 sources_non_forked/ale/test/linter/test_scalastyle.vader create mode 100644 sources_non_forked/ale/test/linter/test_scss_sasslint.vader create mode 100644 sources_non_forked/ale/test/linter/test_scss_stylelint.vader create mode 100644 sources_non_forked/ale/test/linter/test_shellcheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_slimlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_solc.vader create mode 100644 sources_non_forked/ale/test/linter/test_solc_commit.vader create mode 100644 sources_non_forked/ale/test/linter/test_solhint.vader create mode 100644 sources_non_forked/ale/test/linter/test_sorbet.vader create mode 100644 sources_non_forked/ale/test/linter/test_spectral.vader create mode 100644 sources_non_forked/ale/test/linter/test_sqllint.vader create mode 100644 sources_non_forked/ale/test/linter/test_standard.vader create mode 100644 sources_non_forked/ale/test/linter/test_standardrb.vader create mode 100644 sources_non_forked/ale/test/linter/test_standardts.vader create mode 100644 sources_non_forked/ale/test/linter/test_staticcheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_sugarss_stylelint.vader create mode 100644 sources_non_forked/ale/test/linter/test_svelteserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_swaglint.vader create mode 100644 sources_non_forked/ale/test/linter/test_swift_appleswiftformat.vader create mode 100644 sources_non_forked/ale/test/linter/test_swift_sourcekitlsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_swiftlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_systemd_analyze.vader create mode 100644 sources_non_forked/ale/test/linter/test_terraform_ls.vader create mode 100644 sources_non_forked/ale/test/linter/test_terraform_lsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_terraform_terraform.vader create mode 100644 sources_non_forked/ale/test/linter/test_terraform_tflint.vader create mode 100644 sources_non_forked/ale/test/linter/test_tex_lacheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_tex_textlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_texlab.vader create mode 100644 sources_non_forked/ale/test/linter/test_textlint.vader create mode 100644 sources_non_forked/ale/test/linter/test_thrift.vader create mode 100644 sources_non_forked/ale/test/linter/test_thriftcheck.vader create mode 100644 sources_non_forked/ale/test/linter/test_tslint.vader create mode 100644 sources_non_forked/ale/test/linter/test_typescript_deno_lsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_typescript_tsserver.vader create mode 100644 sources_non_forked/ale/test/linter/test_unimport.vader create mode 100644 sources_non_forked/ale/test/linter/test_v_command_callback.vader create mode 100644 sources_non_forked/ale/test/linter/test_vcom.vader create mode 100644 sources_non_forked/ale/test/linter/test_verilator.vader create mode 100644 sources_non_forked/ale/test/linter/test_vim_vimls.vader create mode 100644 sources_non_forked/ale/test/linter/test_vint.vader create mode 100644 sources_non_forked/ale/test/linter/test_vlog.vader create mode 100644 sources_non_forked/ale/test/linter/test_volar.vader create mode 100644 sources_non_forked/ale/test/linter/test_vulture.vader create mode 100644 sources_non_forked/ale/test/linter/test_write_good.vader create mode 100644 sources_non_forked/ale/test/linter/test_xmllint.vader create mode 100644 sources_non_forked/ale/test/linter/test_xo.vader create mode 100644 sources_non_forked/ale/test/linter/test_xots.vader create mode 100644 sources_non_forked/ale/test/linter/test_xvhdl.vader create mode 100644 sources_non_forked/ale/test/linter/test_xvlog.vader create mode 100644 sources_non_forked/ale/test/linter/test_yaml_ls.vader create mode 100644 sources_non_forked/ale/test/linter/test_yang_lsp.vader create mode 100644 sources_non_forked/ale/test/linter/test_zeek.vader create mode 100644 sources_non_forked/ale/test/linter/test_zig_zls.vader create mode 100644 sources_non_forked/ale/test/lsp/test_closing_documents.vader create mode 100644 sources_non_forked/ale/test/lsp/test_did_save_event.vader create mode 100644 sources_non_forked/ale/test/lsp/test_engine_lsp_response_handling.vader create mode 100644 sources_non_forked/ale/test/lsp/test_handling_window_requests.vader create mode 100644 sources_non_forked/ale/test/lsp/test_lsp_client_messages.vader create mode 100644 sources_non_forked/ale/test/lsp/test_lsp_command_formatting.vader create mode 100644 sources_non_forked/ale/test/lsp/test_lsp_connections.vader create mode 100644 sources_non_forked/ale/test/lsp/test_lsp_custom_request.vader create mode 100644 sources_non_forked/ale/test/lsp/test_lsp_error_parsing.vader create mode 100644 sources_non_forked/ale/test/lsp/test_lsp_root_detection.vader create mode 100644 sources_non_forked/ale/test/lsp/test_lsp_startup.vader create mode 100644 sources_non_forked/ale/test/lsp/test_other_initialize_message_handling.vader create mode 100644 sources_non_forked/ale/test/lsp/test_read_lsp_diagnostics.vader create mode 100644 sources_non_forked/ale/test/lsp/test_reset_lsp.vader create mode 100644 sources_non_forked/ale/test/lsp/test_update_config.vader create mode 100644 sources_non_forked/ale/test/python/test_deoplete_source.py create mode 100755 sources_non_forked/ale/test/script/block-padding-checker create mode 100755 sources_non_forked/ale/test/script/check-duplicate-tags create mode 100755 sources_non_forked/ale/test/script/check-supported-tools-tables create mode 100755 sources_non_forked/ale/test/script/check-tag-alignment create mode 100755 sources_non_forked/ale/test/script/check-tag-references create mode 100755 sources_non_forked/ale/test/script/check-toc create mode 100755 sources_non_forked/ale/test/script/custom-checks create mode 100755 sources_non_forked/ale/test/script/custom-linting-rules create mode 100644 sources_non_forked/ale/test/script/dumb_named_pipe_server.py create mode 100644 sources_non_forked/ale/test/script/dumb_tcp_client.py create mode 100644 sources_non_forked/ale/test/script/dumb_tcp_server.py create mode 100755 sources_non_forked/ale/test/script/run-vader-tests create mode 100755 sources_non_forked/ale/test/script/run-vint create mode 100644 sources_non_forked/ale/test/sign/test_linting_sets_signs.vader create mode 100644 sources_non_forked/ale/test/sign/test_sign_column_highlighting.vader create mode 100644 sources_non_forked/ale/test/sign/test_sign_limits.vader create mode 100644 sources_non_forked/ale/test/sign/test_sign_parsing.vader create mode 100644 sources_non_forked/ale/test/sign/test_sign_placement.vader create mode 100644 sources_non_forked/ale/test/smoke_test.vader create mode 100644 sources_non_forked/ale/test/test-files/.circleci/config.yml create mode 100644 sources_non_forked/ale/test/test-files/.gitignore create mode 100644 sources_non_forked/ale/test/test-files/ada/testfile.adb create mode 100644 sources_non_forked/ale/test/test-files/alex/node-modules-2/node_modules/alex/cli.js create mode 100644 sources_non_forked/ale/test/test-files/alex/node-modules/node_modules/.bin/alex create mode 100644 sources_non_forked/ale/test/test-files/angular/node_modules/@angular/language-server/bin/ngserver create mode 100644 sources_non_forked/ale/test/test-files/angular/node_modules/@angular/language-service/dummy create mode 100644 sources_non_forked/ale/test/test-files/ant/ant-project/build.xml create mode 100755 sources_non_forked/ale/test/test-files/ant/bin/ant create mode 100755 sources_non_forked/ale/test/test-files/ant/bin/ant.exe create mode 100644 sources_non_forked/ale/test/test-files/bazel/BUILD create mode 100644 sources_non_forked/ale/test/test-files/bazel/WORKSPACE create mode 100644 sources_non_forked/ale/test/test-files/bazel/defs.bzl create mode 100644 sources_non_forked/ale/test/test-files/bib/dummy.bib create mode 100644 sources_non_forked/ale/test/test-files/c/build_compile_commands_project/build/bad_folder_to_test_priority create mode 100644 sources_non_forked/ale/test/test-files/c/build_compile_commands_project/build/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/c/configure_project/Makefile create mode 100644 sources_non_forked/ale/test/test-files/c/configure_project/configure create mode 100644 sources_non_forked/ale/test/test-files/c/configure_project/include/test.h create mode 100644 sources_non_forked/ale/test/test-files/c/configure_project/subdir/Makefile create mode 100644 sources_non_forked/ale/test/test-files/c/dummy.c create mode 100644 sources_non_forked/ale/test/test-files/c/git_and_nested_makefiles/include/test.h create mode 100644 sources_non_forked/ale/test/test-files/c/git_and_nested_makefiles/src/Makefile create mode 100644 sources_non_forked/ale/test/test-files/c/gnumakefile_project/GNUmakefile create mode 100644 sources_non_forked/ale/test/test-files/c/gnumakefile_project/file.c create mode 100644 sources_non_forked/ale/test/test-files/c/h_file_project/Makefile create mode 100644 sources_non_forked/ale/test/test-files/c/h_file_project/subdir/dummy create mode 100644 sources_non_forked/ale/test/test-files/c/h_file_project/test.h create mode 100644 sources_non_forked/ale/test/test-files/c/hpp_file_project/Makefile create mode 100644 sources_non_forked/ale/test/test-files/c/hpp_file_project/subdir/dummy create mode 100644 sources_non_forked/ale/test/test-files/c/hpp_file_project/test.hpp create mode 100644 sources_non_forked/ale/test/test-files/c/json_project/build/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/c/json_project/include/test.h create mode 100644 sources_non_forked/ale/test/test-files/c/json_project/subdir/dummy create mode 100644 sources_non_forked/ale/test/test-files/c/makefile_project/Makefile create mode 100644 sources_non_forked/ale/test/test-files/c/makefile_project/_astylerc create mode 100644 sources_non_forked/ale/test/test-files/c/makefile_project/args create mode 100644 sources_non_forked/ale/test/test-files/c/makefile_project/include/test.h create mode 100644 sources_non_forked/ale/test/test-files/c/makefile_project/subdir/args create mode 100644 sources_non_forked/ale/test/test-files/c/makefile_project/subdir/dummy create mode 100644 sources_non_forked/ale/test/test-files/c/makefile_project/subdir/file.c create mode 100644 sources_non_forked/ale/test/test-files/cargo/Cargo.toml create mode 100644 sources_non_forked/ale/test/test-files/cargo/workspace_paths/Cargo.toml create mode 100644 sources_non_forked/ale/test/test-files/cargo/workspace_paths/subpath/Cargo.toml create mode 100644 sources_non_forked/ale/test/test-files/ccls/with_build_dir/unusual_build_dir_name/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/ccls/with_ccls-root/.ccls-root create mode 100644 sources_non_forked/ale/test/test-files/ccls/with_ccls/.ccls create mode 100644 sources_non_forked/ale/test/test-files/ccls/with_compile_commands_json/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/checkstyle/other_config.xml create mode 100644 sources_non_forked/ale/test/test-files/clangd/with_build_dir/unusual_build_dir_name/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/clangd/with_compile_commands/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/clangformat/with_clangformat/.clang-format create mode 100644 sources_non_forked/ale/test/test-files/cpp/.astylerc create mode 100644 sources_non_forked/ale/test/test-files/cpp/dummy.cpp create mode 100644 sources_non_forked/ale/test/test-files/cppcheck/one/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/cppcheck/one/two/three/file.c create mode 100644 sources_non_forked/ale/test/test-files/cppcheck/one/two/three/file.cpp create mode 100644 sources_non_forked/ale/test/test-files/cppcheck/with_build_dir/build/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/cquery/build/compile_commands.json create mode 100644 sources_non_forked/ale/test/test-files/cquery/with_cquery/.cquery create mode 100755 sources_non_forked/ale/test/test-files/cspell/node-modules-2/node_modules/cspell/bin.js create mode 100755 sources_non_forked/ale/test/test-files/cspell/node-modules/node_modules/.bin/cspell create mode 100644 sources_non_forked/ale/test/test-files/csslint/other-app/testfile.css create mode 100644 sources_non_forked/ale/test/test-files/csslint/some-app/.csslintrc create mode 100644 sources_non_forked/ale/test/test-files/csslint/some-app/subdir/testfile.css create mode 100644 sources_non_forked/ale/test/test-files/cucumber/features/cuke.feature create mode 100644 sources_non_forked/ale/test/test-files/cucumber/features/step_definitions/base_steps.rb create mode 100644 sources_non_forked/ale/test/test-files/d/test.d create mode 100644 sources_non_forked/ale/test/test-files/dart/.packages create mode 100644 sources_non_forked/ale/test/test-files/dart/testfile.dart create mode 100644 sources_non_forked/ale/test/test-files/dprint/blank.ts create mode 100644 sources_non_forked/ale/test/test-files/dprint/dprint.json create mode 100644 sources_non_forked/ale/test/test-files/elixir/mix_project/lib/app.ex create mode 100644 sources_non_forked/ale/test/test-files/elixir/mix_project/mix.exs create mode 100644 sources_non_forked/ale/test/test-files/elixir/testfile.ex create mode 100644 sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app1/lib/app.ex create mode 100644 sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app1/mix.exs create mode 100644 sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app2/lib/app.ex create mode 100644 sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app2/mix.exs create mode 100644 sources_non_forked/ale/test/test-files/elixir/umbrella_project/mix.exs create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp-notests/elm.json create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp-notests/node_modules/.bin/elm create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp-notests/tests/TestMain.elm create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp/elm.json create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp/node_modules/.bin/elm create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp/node_modules/.bin/elm-test create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp/src/Main.elm create mode 100644 sources_non_forked/ale/test/test-files/elm/newapp/tests/TestSuite.elm create mode 100644 sources_non_forked/ale/test/test-files/elm/node_modules/.bin/elm-format create mode 100644 sources_non_forked/ale/test/test-files/elm/oldapp/elm-package.json create mode 100644 sources_non_forked/ale/test/test-files/elm/oldapp/node_modules/.bin/elm create mode 100644 sources_non_forked/ale/test/test-files/elm/oldapp/node_modules/.bin/elm-test create mode 100644 sources_non_forked/ale/test/test-files/elm/oldapp/src/Main.elm create mode 100644 sources_non_forked/ale/test/test-files/elm/oldapp/tests/TestSuite.elm create mode 100644 sources_non_forked/ale/test/test-files/elm/src/subdir/testfile.elm create mode 100644 sources_non_forked/ale/test/test-files/eruby/dummy.html.erb create mode 100644 sources_non_forked/ale/test/test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d create mode 100644 sources_non_forked/ale/test/test-files/eslint/node_modules/.bin/eslint create mode 100644 sources_non_forked/ale/test/test-files/eslint/other-app/subdir/testfile.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/package.json create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/.eslintrc.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/eslint/bin/eslint.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/standard/bin/cmd.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/xo/cli.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-config/.eslintrc create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-package-json/node_modules/.gitkeep create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-package-json/package.json create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.css create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.ts create mode 100644 sources_non_forked/ale/test/test-files/eslint/yarn2-app/.yarn/sdks/eslint/bin/eslint.js create mode 100644 sources_non_forked/ale/test/test-files/eslint/yarn2-app/subdir/testfile.js create mode 100755 sources_non_forked/ale/test/test-files/fecs/fecs create mode 100755 sources_non_forked/ale/test/test-files/fecs/fecs.exe create mode 100644 sources_non_forked/ale/test/test-files/fish/testfile.fish create mode 100644 sources_non_forked/ale/test/test-files/flow/a/.flowconfig create mode 100644 sources_non_forked/ale/test/test-files/flow/a/sub/dummy create mode 100644 sources_non_forked/ale/test/test-files/flow/b/sub/dummy create mode 100644 sources_non_forked/ale/test/test-files/fortls-project/.fortls create mode 100644 sources_non_forked/ale/test/test-files/go/go.mod create mode 100644 sources_non_forked/ale/test/test-files/go/go1/prj1/file.go create mode 100644 sources_non_forked/ale/test/test-files/go/go2/prj2/file.go create mode 100644 sources_non_forked/ale/test/test-files/go/gopath/bin/gopls create mode 100644 sources_non_forked/ale/test/test-files/go/gopath/bin/staticcheck create mode 100644 sources_non_forked/ale/test/test-files/go/testfile.go create mode 100644 sources_non_forked/ale/test/test-files/go/testfile2.go create mode 100644 sources_non_forked/ale/test/test-files/gradle/build-gradle-project/build.gradle create mode 100644 sources_non_forked/ale/test/test-files/gradle/build-gradle-project/src/main/kotlin/dummy.kt create mode 100755 sources_non_forked/ale/test/test-files/gradle/gradle create mode 100644 sources_non_forked/ale/test/test-files/gradle/non-gradle-project/src/main/kotlin/dummy.kt create mode 100644 sources_non_forked/ale/test/test-files/gradle/settings-gradle-project/settings.gradle create mode 100644 sources_non_forked/ale/test/test-files/gradle/settings-gradle-project/src/main/kotlin/dummy.kt create mode 100644 sources_non_forked/ale/test/test-files/gradle/unwrapped-project/build.gradle create mode 100644 sources_non_forked/ale/test/test-files/gradle/unwrapped-project/settings.gradle create mode 100644 sources_non_forked/ale/test/test-files/gradle/unwrapped-project/src/main/kotlin/dummy.kt create mode 100644 sources_non_forked/ale/test/test-files/gradle/wrapped-project/build.gradle create mode 100644 sources_non_forked/ale/test/test-files/gradle/wrapped-project/gradlew create mode 100644 sources_non_forked/ale/test/test-files/gradle/wrapped-project/settings.gradle create mode 100644 sources_non_forked/ale/test/test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt create mode 100644 sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/.haml-lint.yml create mode 100644 sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/.rubocop.yml create mode 100644 sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/subdir/file.haml create mode 100644 sources_non_forked/ale/test/test-files/hamllint/haml-lint-yml/.haml-lint.yml create mode 100644 sources_non_forked/ale/test/test-files/hamllint/haml-lint-yml/subdir/file.haml create mode 100644 sources_non_forked/ale/test/test-files/hamllint/rubocop-yml/.rubocop.yml create mode 100644 sources_non_forked/ale/test/test-files/hamllint/rubocop-yml/subdir/file.haml create mode 100644 sources_non_forked/ale/test/test-files/hdl_server/foo.vhd create mode 100644 sources_non_forked/ale/test/test-files/hdl_server/with_config_file/.hdl_checker.config create mode 100644 sources_non_forked/ale/test/test-files/hdl_server/with_config_file/_hdl_checker.config create mode 100644 sources_non_forked/ale/test/test-files/hdl_server/with_config_file/foo.vhd create mode 100644 sources_non_forked/ale/test/test-files/hdl_server/with_git/files/foo.vhd create mode 100644 sources_non_forked/ale/test/test-files/hie_paths/file.hs create mode 100755 sources_non_forked/ale/test/test-files/html_beautify/html-beautify create mode 100644 sources_non_forked/ale/test/test-files/html_beautify/test.html create mode 100755 sources_non_forked/ale/test/test-files/htmlhint/node_modules/.bin/htmlhint create mode 100644 sources_non_forked/ale/test/test-files/htmlhint/with_config/.htmlhintrc create mode 100644 sources_non_forked/ale/test/test-files/ink/story/main.ink create mode 100644 sources_non_forked/ale/test/test-files/inko/test.inko create mode 100644 sources_non_forked/ale/test/test-files/inko/tests/test/test_foo.inko create mode 100644 sources_non_forked/ale/test/test-files/java/no_main/src/test/java/com/something/dummy create mode 100644 sources_non_forked/ale/test/test-files/java/with_jaxb/src/main/java/com/something/dummy create mode 100644 sources_non_forked/ale/test/test-files/java/with_jaxb/src/main/jaxb/com/something/dummy create mode 100644 sources_non_forked/ale/test/test-files/java/with_main/build/gen/main/java/com/something/dummy create mode 100644 sources_non_forked/ale/test/test-files/java/with_main/build/gen2/main/java/com/something/dummy create mode 100644 sources_non_forked/ale/test/test-files/java/with_main/src/main/java/com/something/dummy create mode 100644 sources_non_forked/ale/test/test-files/java/with_main/src/test/java/com/something/dummy create mode 100644 sources_non_forked/ale/test/test-files/javascript/test.js create mode 100644 sources_non_forked/ale/test/test-files/javascript_deno/custom_import_map.json create mode 100644 sources_non_forked/ale/test/test-files/javascript_deno/import_map.json create mode 100644 sources_non_forked/ale/test/test-files/javascript_deno/main.js create mode 100644 sources_non_forked/ale/test/test-files/javascript_deno/tsconfig.json create mode 100644 sources_non_forked/ale/test/test-files/json/testfile.json create mode 100644 sources_non_forked/ale/test/test-files/jsonlint/app-without-jsonlint/src/app.json create mode 100644 sources_non_forked/ale/test/test-files/jsonlint/app/node_modules/.bin/jsonlint create mode 100644 sources_non_forked/ale/test/test-files/jsonlint/app/src/app.json create mode 100644 sources_non_forked/ale/test/test-files/jsonlint/node_modules/jsonlint/lib/cli.js create mode 100644 sources_non_forked/ale/test/test-files/julia/REQUIRE create mode 100644 sources_non_forked/ale/test/test-files/julia/test.jl create mode 100644 sources_non_forked/ale/test/test-files/kotlin/testfile.kt create mode 100755 sources_non_forked/ale/test/test-files/lessc/node_modules/.bin/lessc create mode 100644 sources_non_forked/ale/test/test-files/long-line/setup.cfg create mode 100644 sources_non_forked/ale/test/test-files/lua/testfile.lua create mode 100644 sources_non_forked/ale/test/test-files/markdown/testfile.md create mode 100755 sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/mvnw create mode 100755 sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/mvnw.cmd create mode 100644 sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/pom.xml create mode 100644 sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/src/main/java/dummy1.java create mode 100644 sources_non_forked/ale/test/test-files/maven/maven-java-project/module2/pom.xml create mode 100644 sources_non_forked/ale/test/test-files/maven/maven-java-project/module2/src/main/java/dummy2.java create mode 100644 sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/pom.xml create mode 100644 sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/src/main/kotlin/dummy.kt create mode 100755 sources_non_forked/ale/test/test-files/maven/mvn create mode 100644 sources_non_forked/ale/test/test-files/maven/non-maven-project/src/main/java/dummy.java create mode 100644 sources_non_forked/ale/test/test-files/nim/with-git/src/source.nim create mode 100644 sources_non_forked/ale/test/test-files/ocaml/testfile.ml create mode 100644 sources_non_forked/ale/test/test-files/ocamllsp/dune-project create mode 100644 sources_non_forked/ale/test/test-files/ols/.merlin create mode 100644 sources_non_forked/ale/test/test-files/ols/node_modules/.bin/ocaml-language-server create mode 100644 sources_non_forked/ale/test/test-files/pascal/test.pas create mode 100644 sources_non_forked/ale/test/test-files/php/project-with-php-cs-fixer/test.php create mode 100644 sources_non_forked/ale/test/test-files/php/project-with-php-cs-fixer/vendor/bin/php-cs-fixer create mode 100644 sources_non_forked/ale/test/test-files/php/project-with-phpcbf/foo/test.php create mode 100644 sources_non_forked/ale/test/test-files/php/project-with-phpcbf/vendor/bin/phpcbf create mode 100644 sources_non_forked/ale/test/test-files/php/project-without-php-cs-fixer/test.php create mode 100644 sources_non_forked/ale/test/test-files/php/project-without-phpcbf/foo/test.php create mode 100755 sources_non_forked/ale/test/test-files/php/vendor/bin/php-language-server.php create mode 100644 sources_non_forked/ale/test/test-files/php/with-composer/composer.json create mode 100755 sources_non_forked/ale/test/test-files/php/with-composer/vendor/bin/php-language-server.php create mode 100755 sources_non_forked/ale/test/test-files/php/with-git/vendor/bin/php-language-server.php create mode 100644 sources_non_forked/ale/test/test-files/phpcs/project-with-phpcs/foo/test.php create mode 100644 sources_non_forked/ale/test/test-files/phpcs/project-with-phpcs/vendor/bin/phpcs create mode 100644 sources_non_forked/ale/test/test-files/phpcs/project-without-phpcs/foo/test.php create mode 100644 sources_non_forked/ale/test/test-files/prettier/testfile create mode 100644 sources_non_forked/ale/test/test-files/prettier/testfile.css create mode 100644 sources_non_forked/ale/test/test-files/prettier/testfile.js create mode 100644 sources_non_forked/ale/test/test-files/prettier/testfile.json create mode 100644 sources_non_forked/ale/test/test-files/prettier/testfile.scss create mode 100644 sources_non_forked/ale/test/test-files/prettier/testfile.ts create mode 100644 sources_non_forked/ale/test/test-files/prettier/with_config/.prettierrc create mode 100644 sources_non_forked/ale/test/test-files/prettier/with_config/testfile.js create mode 100644 sources_non_forked/ale/test/test-files/prettier/with_prettierignore/.prettierignore create mode 100644 sources_non_forked/ale/test/test-files/prettier/with_prettierignore/src/testfile.js create mode 100644 sources_non_forked/ale/test/test-files/proto/testfile.proto create mode 100755 sources_non_forked/ale/test/test-files/psalm/vendor/bin/psalm create mode 100644 sources_non_forked/ale/test/test-files/puglint/node_modules/.bin/pug-lint create mode 100644 sources_non_forked/ale/test/test-files/puglint/package.json create mode 100644 sources_non_forked/ale/test/test-files/puglint/puglint_rc_dir/.pug-lintrc create mode 100644 sources_non_forked/ale/test/test-files/puglint/puglint_rc_js_dir/.pug-lintrc.js create mode 100644 sources_non_forked/ale/test/test-files/puglint/puglint_rc_json_dir/.pug-lintrc.json create mode 100644 sources_non_forked/ale/test/test-files/puppet/dummy.pp create mode 100644 sources_non_forked/ale/test/test-files/puppet/new-style-module/lib/puppet/types/exampletype.rb create mode 100644 sources_non_forked/ale/test/test-files/puppet/new-style-module/metadata.json create mode 100644 sources_non_forked/ale/test/test-files/puppet/new-style-module/template/template.epp create mode 100644 sources_non_forked/ale/test/test-files/puppet/old-style-module/manifests/init.pp create mode 100644 sources_non_forked/ale/test/test-files/puppet/old-style-module/templates/template.epp create mode 100644 sources_non_forked/ale/test/test-files/purescript/bower/Foo.purs create mode 100644 sources_non_forked/ale/test/test-files/purescript/bower/bower.json create mode 100644 sources_non_forked/ale/test/test-files/purescript/psc-package/Foo.purs create mode 100644 sources_non_forked/ale/test/test-files/purescript/psc-package/psc-package.json create mode 100644 sources_non_forked/ale/test/test-files/purescript/spago/Foo.purs create mode 100644 sources_non_forked/ale/test/test-files/purescript/spago/spago.dhall create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_manifest/MANIFEST.in create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_manifest/namespace/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_manifest/namespace/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_pytest/namespace/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_pytest/namespace/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_pytest/pytest.ini create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_setup/namespace/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_setup/namespace/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_setup/setup.cfg create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_tox/namespace/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_tox/namespace/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/namespace_package_tox/tox.ini create mode 100644 sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/COMMIT_EDITMSG create mode 100644 sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/pipenv/Pipfile.lock create mode 100644 sources_non_forked/ale/test/test-files/python/poetry/poetry.lock create mode 100644 sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/.pyre_configuration.local create mode 100644 sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/python-package-project/.flake8 create mode 100644 sources_non_forked/ale/test/test-files/python/python-package-project/package-name/module.py create mode 100644 sources_non_forked/ale/test/test-files/python/with_bandit/.bandit create mode 100644 sources_non_forked/ale/test/test-files/python/with_bandit/namespace/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/with_bandit/namespace/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/mypy.ini create mode 100644 sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/tests/pytest.ini create mode 100644 sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/tests/testsubfolder/my_tests.py create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/dir_with_yapf_config/.style.yapf create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/activate create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autoflake.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autoimport.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autopep8.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/black.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/flake8.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/flakehell.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/gitlint.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/isort.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/mypy.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pyflakes.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylama.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylint.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylsp.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pyre.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/reorder-python-imports.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/unimport.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/vulture.exe create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/yamlfix.exe create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/yapf.exe create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/activate create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autoflake create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autoimport create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autopep8 create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/black create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/flake8 create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/flakehell create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/gitlint create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/isort create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/mypy create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pyflakes create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylama create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylint create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylsp create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pyre create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/reorder-python-imports create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/unimport create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/vulture create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/yamlfix create mode 100755 sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/yapf create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/COMMIT_EDITMSG create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/__init__.py create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/bar.py create mode 100644 sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/bar.pyi create mode 100644 sources_non_forked/ale/test/test-files/r/.Rprofile create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/foo.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/init.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/a/b/foo.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/a/b/init.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/a/foo.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/a/init.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/foo.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/many-inits/init.rkt create mode 100644 sources_non_forked/ale/test/test-files/racket/simple-script/foo.rkt create mode 100644 sources_non_forked/ale/test/test-files/reasonml/bsconfig.json create mode 100644 sources_non_forked/ale/test/test-files/reasonml/testfile.re create mode 100755 sources_non_forked/ale/test/test-files/remark_lint/with_bin_path/node_modules/.bin/remark create mode 100644 sources_non_forked/ale/test/test-files/ruby/dummy.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/not_a_rails_app/file.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/dummy.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/models/thing.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_rails_app/config/dummy.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_rails_app/db/dummy.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_ruby_app1/Rakefile create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_ruby_app1/lib/file.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_ruby_app2/Gemfile create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_ruby_app2/lib/file.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_ruby_app3/.solargraph.yml create mode 100644 sources_non_forked/ale/test/test-files/ruby/valid_ruby_app3/lib/file.rb create mode 100644 sources_non_forked/ale/test/test-files/ruby/with_config/.rubocop.yml create mode 100644 sources_non_forked/ale/test/test-files/ruby/with_config/.standard.yml create mode 100644 sources_non_forked/ale/test/test-files/rust/cargo/Cargo.toml create mode 100644 sources_non_forked/ale/test/test-files/rust/cargo/testfile.rs create mode 100644 sources_non_forked/ale/test/test-files/rust/rust-project/rust-project.json create mode 100644 sources_non_forked/ale/test/test-files/rust/rust-project/testfile.rs create mode 100755 sources_non_forked/ale/test/test-files/sasslint/with-bin/node_modules/.bin/sass-lint create mode 100755 sources_non_forked/ale/test/test-files/sasslint/with-source/node_modules/sass-lint/bin/sass-lint.js create mode 100644 sources_non_forked/ale/test/test-files/scala/dummy.scala create mode 100644 sources_non_forked/ale/test/test-files/scala/invalid_sbt_project/Main.scala create mode 100644 sources_non_forked/ale/test/test-files/scala/valid_sbt_project/Main.scala create mode 100644 sources_non_forked/ale/test/test-files/scala/valid_sbt_project/build.sbt create mode 100644 sources_non_forked/ale/test/test-files/slimlint/.rubocop.yml create mode 100644 sources_non_forked/ale/test/test-files/slimlint/subdir/file.slim create mode 100644 sources_non_forked/ale/test/test-files/smlnj/cm/foo.sml create mode 100644 sources_non_forked/ale/test/test-files/smlnj/cm/path/to/bar.sml create mode 100644 sources_non_forked/ale/test/test-files/smlnj/cm/sources.cm create mode 100644 sources_non_forked/ale/test/test-files/smlnj/file/qux.sml create mode 100644 sources_non_forked/ale/test/test-files/solhint/Contract.sol create mode 100644 sources_non_forked/ale/test/test-files/solhint/node_modules/.bin/solhint create mode 100644 sources_non_forked/ale/test/test-files/solhint/node_modules/solhint/index.js create mode 100644 sources_non_forked/ale/test/test-files/solhint/package.json create mode 100644 sources_non_forked/ale/test/test-files/spectral/node_modules/.bin/spectral create mode 100644 sources_non_forked/ale/test/test-files/spectral/openapi.yaml create mode 100644 sources_non_forked/ale/test/test-files/stack/stack.yaml create mode 100755 sources_non_forked/ale/test/test-files/standard/with-bin/node_modules/.bin/standard create mode 100755 sources_non_forked/ale/test/test-files/standard/with-cmd/node_modules/standard/bin/cmd.js create mode 100755 sources_non_forked/ale/test/test-files/stylelint/node_modules/.bin/stylelint create mode 100644 sources_non_forked/ale/test/test-files/swaglint/docs/swagger.yaml create mode 100644 sources_non_forked/ale/test/test-files/swaglint/node_modules/.bin/swaglint create mode 100644 sources_non_forked/ale/test/test-files/swift/dummy.swift create mode 100644 sources_non_forked/ale/test/test-files/swift/non-swift-package-project/src/folder/dummy.swift create mode 100644 sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/.swift-format create mode 100644 sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/Package.swift create mode 100644 sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/src/folder/dummy.swift create mode 100644 sources_non_forked/ale/test/test-files/swift/swift-package-project/Package.swift create mode 100644 sources_non_forked/ale/test/test-files/swift/swift-package-project/src/folder/dummy.swift create mode 100644 sources_non_forked/ale/test/test-files/swiftlint/cocoapods-and-react-native/Pods/SwiftLint/swiftlint create mode 100644 sources_non_forked/ale/test/test-files/swiftlint/cocoapods-and-react-native/ios/Pods/SwiftLint/swiftlint create mode 100644 sources_non_forked/ale/test/test-files/swiftlint/cocoapods/Pods/SwiftLint/swiftlint create mode 100644 sources_non_forked/ale/test/test-files/swiftlint/react-native/ios/Pods/SwiftLint/swiftlint create mode 100644 sources_non_forked/ale/test/test-files/terraform/.terraform/dummy create mode 100644 sources_non_forked/ale/test/test-files/terraform/main.tf create mode 100644 sources_non_forked/ale/test/test-files/tex/sample1.tex create mode 100644 sources_non_forked/ale/test/test-files/tex/sample2.tex create mode 100644 sources_non_forked/ale/test/test-files/tex/testfile.tex create mode 100755 sources_non_forked/ale/test/test-files/textlint/with_bin_path/node_modules/.bin/textlint create mode 100755 sources_non_forked/ale/test/test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js create mode 100644 sources_non_forked/ale/test/test-files/tflint/foo/.tflint.hcl create mode 100644 sources_non_forked/ale/test/test-files/tflint/foo/bar.tf create mode 100644 sources_non_forked/ale/test/test-files/tidy/.tidyrc create mode 100644 sources_non_forked/ale/test/test-files/tidy/test.html create mode 100755 sources_non_forked/ale/test/test-files/tidy/tidy create mode 100755 sources_non_forked/ale/test/test-files/tidy/tidy.exe create mode 100644 sources_non_forked/ale/test/test-files/top/ale-special-directory-name-dont-use-this-please/empty-file create mode 100644 sources_non_forked/ale/test/test-files/top/example.ini create mode 100644 sources_non_forked/ale/test/test-files/top/middle/bottom/dummy.txt create mode 100644 sources_non_forked/ale/test/test-files/tsserver/src/file1.ts create mode 100644 sources_non_forked/ale/test/test-files/tsserver/src/level-1/file2.ts create mode 100644 sources_non_forked/ale/test/test-files/tsserver/src/level-1/level-2/file3.ts create mode 100644 sources_non_forked/ale/test/test-files/tsserver/src/level-1/tsconfig.json create mode 100644 sources_non_forked/ale/test/test-files/tsserver/tsconfig.json create mode 100644 sources_non_forked/ale/test/test-files/typescript/custom_import_map.json create mode 100644 sources_non_forked/ale/test/test-files/typescript/import_map.json create mode 100644 sources_non_forked/ale/test/test-files/typescript/test.ts create mode 100644 sources_non_forked/ale/test/test-files/typescript/tsconfig.json create mode 100644 sources_non_forked/ale/test/test-files/vim/invalid_vim_project/test.vim create mode 100644 sources_non_forked/ale/test/test-files/vim/node_modules/.bin/vim-language-server create mode 100644 sources_non_forked/ale/test/test-files/vim/path_with_autoload/autoload/test.vim create mode 100644 sources_non_forked/ale/test/test-files/vim/path_with_autoload/test.vim create mode 100644 sources_non_forked/ale/test/test-files/vim/path_with_initvim/init.vim create mode 100644 sources_non_forked/ale/test/test-files/vim/path_with_plugin/plugin/test.vim create mode 100644 sources_non_forked/ale/test/test-files/vim/path_with_plugin/test.vim create mode 100644 sources_non_forked/ale/test/test-files/vim/path_with_vimrc/.vimrc create mode 100755 sources_non_forked/ale/test/test-files/volar/node_modules/.bin/volar-server create mode 100644 sources_non_forked/ale/test/test-files/volar/node_modules/typescript/lib/tsserverlibrary.js create mode 100644 sources_non_forked/ale/test/test-files/volar/package.json create mode 100644 sources_non_forked/ale/test/test-files/volar/src/App.vue create mode 100644 sources_non_forked/ale/test/test-files/write-good/node-modules-2/node_modules/write-good/bin/write-good.js create mode 100644 sources_non_forked/ale/test/test-files/write-good/node-modules/node_modules/.bin/write-good create mode 100644 sources_non_forked/ale/test/test-files/xo/monorepo/node_modules/xo/cli.js create mode 100644 sources_non_forked/ale/test/test-files/xo/monorepo/package.json create mode 100644 sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/index.js create mode 100644 sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/index.ts create mode 100644 sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/package.json create mode 100644 sources_non_forked/ale/test/test-files/yaml/test.yaml create mode 100644 sources_non_forked/ale/test/test-files/zig/build.zig create mode 100644 sources_non_forked/ale/test/test_ale_has.vader create mode 100644 sources_non_forked/ale/test/test_ale_info.vader create mode 100644 sources_non_forked/ale/test/test_ale_info_to_clipboard.vader create mode 100644 sources_non_forked/ale/test/test_ale_lint_command.vader create mode 100644 sources_non_forked/ale/test/test_ale_lint_stop_command.vader create mode 100644 sources_non_forked/ale/test/test_ale_populate_command.vader create mode 100644 sources_non_forked/ale/test/test_ale_toggle.vader create mode 100644 sources_non_forked/ale/test/test_ale_var.vader create mode 100644 sources_non_forked/ale/test/test_alejobstarted_autocmd.vader create mode 100644 sources_non_forked/ale/test/test_alelint_autocmd.vader create mode 100644 sources_non_forked/ale/test/test_ant_build_classpath_command.vader create mode 100644 sources_non_forked/ale/test/test_ant_find_project_root.vader create mode 100644 sources_non_forked/ale/test/test_autocmd_commands.vader create mode 100644 sources_non_forked/ale/test/test_backwards_compatibility.vader create mode 100644 sources_non_forked/ale/test/test_balloon_messages.vader create mode 100644 sources_non_forked/ale/test/test_c_flag_parsing.vader create mode 100644 sources_non_forked/ale/test/test_checkingbuffer_autocmd.vader create mode 100644 sources_non_forked/ale/test/test_cleanup.vader create mode 100644 sources_non_forked/ale/test/test_code_action.vader create mode 100644 sources_non_forked/ale/test/test_code_action_corner_cases.vader create mode 100644 sources_non_forked/ale/test/test_code_action_python.vader create mode 100644 sources_non_forked/ale/test/test_codefix.vader create mode 100644 sources_non_forked/ale/test/test_computed_lint_file_values.vader create mode 100644 sources_non_forked/ale/test/test_csslint_config_detection.vader create mode 100644 sources_non_forked/ale/test/test_cursor_warnings.vader create mode 100644 sources_non_forked/ale/test/test_deferred_command_string.vader create mode 100644 sources_non_forked/ale/test/test_deferred_executable_string.vader create mode 100644 sources_non_forked/ale/test/test_deno_executable_detection.vader create mode 100644 sources_non_forked/ale/test/test_disabling_ale.vader create mode 100644 sources_non_forked/ale/test/test_dockerfile_hadolint_linter.vader create mode 100644 sources_non_forked/ale/test/test_env_function.vader create mode 100644 sources_non_forked/ale/test/test_errors_removed_after_filetype_changed.vader create mode 100644 sources_non_forked/ale/test/test_filename_mapping.vader create mode 100644 sources_non_forked/ale/test/test_filerename.vader create mode 100644 sources_non_forked/ale/test/test_filetype_linter_defaults.vader create mode 100644 sources_non_forked/ale/test/test_filetype_mapping.vader create mode 100644 sources_non_forked/ale/test/test_find_nearest_directory.vader create mode 100644 sources_non_forked/ale/test/test_find_references.vader create mode 100644 sources_non_forked/ale/test/test_floating_preview.vader create mode 100644 sources_non_forked/ale/test/test_format_command.vader create mode 100644 sources_non_forked/ale/test/test_format_temporary_file_creation.vader create mode 100644 sources_non_forked/ale/test/test_function_arg_count.vader create mode 100644 sources_non_forked/ale/test/test_fuzzy_json_decode.vader create mode 100644 sources_non_forked/ale/test/test_get_abspath.vader create mode 100644 sources_non_forked/ale/test/test_get_loclist.vader create mode 100644 sources_non_forked/ale/test/test_getmatches.vader create mode 100644 sources_non_forked/ale/test/test_go_to_definition.vader create mode 100644 sources_non_forked/ale/test/test_gradle_build_classpath_command.vader create mode 100644 sources_non_forked/ale/test/test_gradle_find_executable.vader create mode 100644 sources_non_forked/ale/test/test_gradle_find_project_root.vader create mode 100644 sources_non_forked/ale/test/test_highlight_placement.vader create mode 100644 sources_non_forked/ale/test/test_highlight_position_chunking.vader create mode 100644 sources_non_forked/ale/test/test_history_saving.vader create mode 100644 sources_non_forked/ale/test/test_hover.vader create mode 100644 sources_non_forked/ale/test/test_hover_parsing.vader create mode 100644 sources_non_forked/ale/test/test_ignoring_linters.vader create mode 100644 sources_non_forked/ale/test/test_jq_linter.vader create mode 100644 sources_non_forked/ale/test/test_jsonlint_executable_detection.vader create mode 100644 sources_non_forked/ale/test/test_line_join.vader create mode 100644 sources_non_forked/ale/test/test_lint_file_linters.vader create mode 100644 sources_non_forked/ale/test/test_lint_on_enter_when_file_changed.vader create mode 100644 sources_non_forked/ale/test/test_lint_on_filetype_changed.vader create mode 100644 sources_non_forked/ale/test/test_linter_defintion_processing.vader create mode 100644 sources_non_forked/ale/test/test_linter_retrieval.vader create mode 100644 sources_non_forked/ale/test/test_linter_type_mapping.vader create mode 100644 sources_non_forked/ale/test/test_linting_blacklist.vader create mode 100644 sources_non_forked/ale/test/test_linting_updates_loclist.vader create mode 100644 sources_non_forked/ale/test/test_list_formatting.vader create mode 100644 sources_non_forked/ale/test/test_list_opening.vader create mode 100644 sources_non_forked/ale/test/test_list_titles.vader create mode 100644 sources_non_forked/ale/test/test_load_all_linters.vader create mode 100644 sources_non_forked/ale/test/test_loclist_binary_search.vader create mode 100644 sources_non_forked/ale/test/test_loclist_corrections.vader create mode 100644 sources_non_forked/ale/test/test_loclist_jumping.vader create mode 100644 sources_non_forked/ale/test/test_loclist_sorting.vader create mode 100644 sources_non_forked/ale/test/test_maven_build_classpath_command.vader create mode 100644 sources_non_forked/ale/test/test_maven_find_executable.vader create mode 100644 sources_non_forked/ale/test/test_maven_find_project_root.vader create mode 100644 sources_non_forked/ale/test/test_nearest_file_search.vader create mode 100644 sources_non_forked/ale/test/test_nimlsp_project_root.vader create mode 100644 sources_non_forked/ale/test/test_no_linting_on_write_quit.vader create mode 100644 sources_non_forked/ale/test/test_organize_imports.vader create mode 100644 sources_non_forked/ale/test/test_other_sources.vader create mode 100644 sources_non_forked/ale/test/test_parse_command_args.vader create mode 100644 sources_non_forked/ale/test/test_path_dirname.vader create mode 100644 sources_non_forked/ale/test/test_path_equality.vader create mode 100644 sources_non_forked/ale/test/test_path_upwards.vader create mode 100644 sources_non_forked/ale/test/test_path_uri.vader create mode 100644 sources_non_forked/ale/test/test_pattern_options.vader create mode 100644 sources_non_forked/ale/test/test_prepare_command.vader create mode 100644 sources_non_forked/ale/test/test_puppet_path_detection.vader create mode 100644 sources_non_forked/ale/test/test_python_find_project_root.vader create mode 100644 sources_non_forked/ale/test/test_python_pipenv.vader create mode 100644 sources_non_forked/ale/test/test_python_poetry.vader create mode 100644 sources_non_forked/ale/test/test_python_traceback.vader create mode 100644 sources_non_forked/ale/test/test_python_virtualenv.vader create mode 100644 sources_non_forked/ale/test/test_quickfix_deduplication.vader create mode 100644 sources_non_forked/ale/test/test_quitting_variable.vader create mode 100644 sources_non_forked/ale/test/test_redundant_tsserver_rendering_avoided.vader create mode 100644 sources_non_forked/ale/test/test_regex_escaping.vader create mode 100644 sources_non_forked/ale/test/test_rename.vader create mode 100644 sources_non_forked/ale/test/test_resolve_local_path.vader create mode 100644 sources_non_forked/ale/test/test_results_not_cleared_when_opening_loclist.vader create mode 100644 sources_non_forked/ale/test/test_sandbox_execution.vader create mode 100644 sources_non_forked/ale/test/test_semver_utils.vader create mode 100644 sources_non_forked/ale/test/test_set_list_timers.vader create mode 100644 sources_non_forked/ale/test/test_setting_loclist_from_another_buffer.vader create mode 100644 sources_non_forked/ale/test/test_setting_problems_found_in_previous_buffers.vader create mode 100644 sources_non_forked/ale/test/test_shell_detection.vader create mode 100644 sources_non_forked/ale/test/test_should_do_nothing_conditions.vader create mode 100644 sources_non_forked/ale/test/test_sml_command.vader create mode 100644 sources_non_forked/ale/test/test_socket_connections.vader create mode 100644 sources_non_forked/ale/test/test_statusline.vader create mode 100644 sources_non_forked/ale/test/test_swift_find_project_root.vader create mode 100644 sources_non_forked/ale/test/test_symbol_search.vader create mode 100644 sources_non_forked/ale/test/test_temporary_file_management.vader create mode 100644 sources_non_forked/ale/test/test_tmpdir_wrapper.vader create mode 100644 sources_non_forked/ale/test/test_vim8_processid_parsing.vader create mode 100644 sources_non_forked/ale/test/test_windows_escaping.vader create mode 100644 sources_non_forked/ale/test/test_wrap_comand.vader create mode 100644 sources_non_forked/ale/test/test_writefile_function.vader create mode 100644 sources_non_forked/ale/test/util/test_cd_string_commands.vader create mode 100644 sources_non_forked/ale/test/v_files/testfile.v create mode 100644 sources_non_forked/ale/test/vimrc diff --git a/sources_non_forked/ale/Dockerfile b/sources_non_forked/ale/Dockerfile new file mode 100644 index 00000000..e7b0cfb0 --- /dev/null +++ b/sources_non_forked/ale/Dockerfile @@ -0,0 +1,27 @@ +FROM testbed/vim:20 + +RUN install_vim -tag v8.0.0027 -build \ + -tag v8.2.4693 -build \ + -tag neovim:v0.2.0 -build \ + -tag neovim:v0.6.1 -build + +ENV PACKAGES="\ + bash \ + git \ + python2 \ + python3 \ + py3-pip \ + grep \ + sed \ +" +RUN apk --update add $PACKAGES && \ + rm -rf /var/cache/apk/* /tmp/* /var/tmp/* + +RUN pip install vim-vint==0.3.21 + +RUN git clone https://github.com/junegunn/vader.vim vader && \ + cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af + +ARG GIT_VERSION +LABEL Version=${GIT_VERSION} +LABEL Name=denseanalysis/ale diff --git a/sources_non_forked/ale/README.md b/sources_non_forked/ale/README.md new file mode 100644 index 00000000..793148d7 --- /dev/null +++ b/sources_non_forked/ale/README.md @@ -0,0 +1,963 @@ +# Asynchronous Lint Engine [![GitHub Build Status](https://github.com/dense-analysis/ale/workflows/CI/badge.svg)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the chat at https://gitter.im/vim-ale/Lobby](https://badges.gitter.im/vim-ale/Lobby.svg)](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + +![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg) + +ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking +and semantic errors) in NeoVim 0.2.0+ and Vim 8 while you edit your text files, +and acts as a Vim [Language Server Protocol](https://langserver.org/) client. + +A linting example with the darkspectrum color scheme in GVim. + +ALE makes use of NeoVim and Vim 8 job control functions and timers to +run linters on the contents of text buffers and return errors as +text is changed in Vim. This allows for displaying warnings and +errors in files being edited in Vim before files have been saved +back to a filesystem. + +In other words, this plugin allows you to lint while you type. + +ALE offers support for fixing code with command line tools in a non-blocking +manner with the `:ALEFix` feature, supporting tools in many languages, like +`prettier`, `eslint`, `autopep8`, and more. + +ALE acts as a "language client" to support a variety of Language Server Protocol +features, including: + +* Diagnostics (via Language Server Protocol linters) +* Go To Definition (`:ALEGoToDefinition`) +* Completion (Built in completion support, or with Deoplete) +* Finding references (`:ALEFindReferences`) +* Hover information (`:ALEHover`) +* Symbol search (`:ALESymbolSearch`) + +If you don't care about Language Server Protocol, ALE won't load any of the code +for working with it unless needed. One of ALE's general missions is that you +won't pay for the features that you don't use. + +**Help Wanted:** If you would like to help maintain this plugin by managing the +many issues and pull requests that are submitted, please send the author an +email at [dev@w0rp.com](mailto:dev@w0rp.com?subject=Helping%20with%20ALE). + +If you enjoy this plugin, feel free to contribute or check out the author's +other content at [w0rp.com](https://w0rp.com). + +## Table of Contents + +1. [Supported Languages and Tools](#supported-languages) +2. [Usage](#usage) + 1. [Linting](#usage-linting) + 2. [Fixing](#usage-fixing) + 3. [Completion](#usage-completion) + 4. [Go To Definition](#usage-go-to-definition) + 5. [Find References](#usage-find-references) + 6. [Hovering](#usage-hover) + 7. [Symbol Search](#usage-symbol-search) + 8. [Refactoring: Rename, Actions](#usage-refactoring) +3. [Installation](#installation) + 1. [Installation with Vim package management](#standard-installation) + 2. [Installation with Pathogen](#installation-with-pathogen) + 3. [Installation with Vundle](#installation-with-vundle) + 4. [Installation with Vim-Plug](#installation-with-vim-plug) +4. [Contributing](#contributing) +5. [FAQ](#faq) + 1. [How do I disable particular linters?](#faq-disable-linters) + 2. [How can I see what ALE has configured for the current file?](#faq-get-info) + 3. [How can I use ALE and coc.nvim together?](#faq-coc-nvim) + 4. [How can I keep the sign gutter open?](#faq-keep-signs) + 5. [How can I change the signs ALE uses?](#faq-change-signs) + 6. [How can I change or disable the highlights ALE uses?](#faq-change-highlights) + 7. [How can I show errors or warnings in my statusline?](#faq-statusline) + 8. [How can I show errors or warnings in my lightline?](#faq-lightline) + 9. [How can I change the format for echo messages?](#faq-echo-format) + 10. [How can I execute some code when ALE starts or stops linting?](#faq-autocmd) + 11. [How can I navigate between errors quickly?](#faq-navigation) + 12. [How can I run linters only when I save files?](#faq-lint-on-save) + 13. [How can I use the quickfix list instead of the loclist?](#faq-quickfix) + 14. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint) + 15. [How can I check Vue files with ESLint?](#faq-vue-eslint) + 16. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad) + 17. [How can I configure my C or C++ project?](#faq-c-configuration) + 18. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration) + 19. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height) + 20. [How can I run linters or fixers via Docker or a VM?](#faq-vm) + 21. [How can I change the borders for floating preview windows?](#faq-window-borders) + 22. [How can I use ALE and vim-lsp together?](#faq-vim-lsp) + + + +## 1. Supported Languages and Tools + +ALE supports a wide variety of languages and tools. See the +[full list](supported-tools.md) in the +[Supported Languages and Tools](supported-tools.md) page. + + + +## 2. Usage + + + +### 2.i Linting + +Once this plugin is installed, while editing your files in supported +languages and tools which have been correctly installed, +this plugin will send the contents of your text buffers to a variety of +programs for checking the syntax and semantics of your programs. By default, +linters will be re-run in the background to check your syntax when you open +new buffers or as you make edits to your files. + +The behavior of linting can be configured with a variety of options, +documented in [the Vim help file](doc/ale.txt). For more information on the +options ALE offers, consult `:help ale-options` for global options and `:help +ale-integration-options` for options specified to particular linters. + + + +### 2.ii Fixing + +ALE can fix files with the `ALEFix` command. Functions need to be configured +either in each buffer with a `b:ale_fixers`, or globally with `g:ale_fixers`. + +The recommended way to configure fixers is to define a List in an ftplugin file. + +```vim +" In ~/.vim/ftplugin/javascript.vim, or somewhere similar. + +" Fix files with prettier, and then ESLint. +let b:ale_fixers = ['prettier', 'eslint'] +" Equivalent to the above. +let b:ale_fixers = {'javascript': ['prettier', 'eslint']} +``` + +You can also configure your fixers from vimrc using `g:ale_fixers`, before or +after ALE has been loaded. + +A `*` in place of the filetype will apply a List of fixers to all files which +do not match some filetype in the Dictionary. + +Note that using a plain List for `g:ale_fixers` is not supported. + +```vim +" In ~/.vim/vimrc, or somewhere similar. +let g:ale_fixers = { +\ '*': ['remove_trailing_lines', 'trim_whitespace'], +\ 'javascript': ['eslint'], +\} +``` + +If you want to automatically fix files when you save them, you need to turn +a setting on in vimrc. + +```vim +" Set this variable to 1 to fix files when you save them. +let g:ale_fix_on_save = 1 +``` + +The `:ALEFixSuggest` command will suggest some supported tools for fixing code. +Both `g:ale_fixers` and `b:ale_fixers` can also accept functions, including +lambda functions, as fixers, for fixing files with custom tools. + +See `:help ale-fix` for complete information on how to fix files with ALE. + + + +### 2.iii Completion + +ALE offers some support for completion via hijacking of omnicompletion while you +type. All of ALE's completion information must come from Language Server +Protocol linters, or from `tsserver` for TypeScript. + +ALE integrates with [Deoplete](https://github.com/Shougo/deoplete.nvim) as a +completion source, named `'ale'`. You can configure Deoplete to only use ALE as +the source of completion information, or mix it with other sources. + +```vim +" Use ALE and also some plugin 'foobar' as completion sources for all code. +call deoplete#custom#option('sources', { +\ '_': ['ale', 'foobar'], +\}) +``` + +ALE also offers its own automatic completion support, which does not require any +other plugins, and can be enabled by changing a setting before ALE is loaded. + +```vim +" Enable completion where available. +" This setting must be set before ALE is loaded. +" +" You should not turn this setting on if you wish to use ALE as a completion +" source for other completion plugins, like Deoplete. +let g:ale_completion_enabled = 1 +``` + +ALE provides an omni-completion function you can use for triggering +completion manually with ``. + +```vim +set omnifunc=ale#completion#OmniFunc +``` + +ALE supports automatic imports from external modules. This behavior is enabled +by default and can be disabled by setting: + +```vim +let g:ale_completion_autoimport = 0 +``` + +Note that disabling auto import can result in missing completion items from some +LSP servers (e.g. eclipselsp). See `:help ale-completion` for more information. + + + +### 2.iv Go To Definition + +ALE supports jumping to the definition of words under your cursor with the +`:ALEGoToDefinition` command using any enabled Language Server Protocol linters +and `tsserver`. + +See `:help ale-go-to-definition` for more information. + + + +### 2.v Find References + +ALE supports finding references for words under your cursor with the +`:ALEFindReferences` command using any enabled Language Server Protocol linters +and `tsserver`. + +See `:help ale-find-references` for more information. + + + +### 2.vi Hovering + +ALE supports "hover" information for printing brief information about symbols at +the cursor taken from Language Server Protocol linters and `tsserver` with the +`ALEHover` command. + +Truncated information will be displayed when the cursor rests on a symbol by +default, as long as there are no problems on the same line. + +The information can be displayed in a `balloon` tooltip in Vim or GVim by +hovering your mouse over symbols. Mouse hovering is enabled by default in GVim, +and needs to be configured for Vim 8.1+ in terminals. + +See `:help ale-hover` for more information. + + + +### 2.vii Symbol Search + +ALE supports searching for workspace symbols via Language Server Protocol +linters with the `ALESymbolSearch` command. + +Search queries can be performed to find functions, types, and more which are +similar to a given query string. + +See `:help ale-symbol-search` for more information. + + + +### 2.viii Refactoring: Rename, Actions + +ALE supports renaming symbols in symbols in code such as variables or class +names with the `ALERename` command. + +`ALEFileRename` will rename file and fix import paths (tsserver +only). + +`ALECodeAction` will execute actions on the cursor or applied to a visual +range selection, such as automatically fixing errors. + +See `:help ale-refactor` for more information. + + + +## 3. Installation + +To install this plugin, you should use one of the following methods. +For Windows users, replace usage of the Unix `~/.vim` directory with +`%USERPROFILE%\vimfiles`, or another directory if you have configured +Vim differently. On Windows, your `~/.vimrc` file will be similarly +stored in `%USERPROFILE%\_vimrc`. + + + +### 3.i. Installation with Vim package management + +In Vim 8 and NeoVim, you can install plugins easily without needing to use +any other tools. Simply clone the plugin into your `pack` directory. + +#### Vim 8 on Unix + +```bash +mkdir -p ~/.vim/pack/git-plugins/start +git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.vim/pack/git-plugins/start/ale +``` + +#### NeoVim on Unix + +```bash +mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start +git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale +``` + +#### Vim 8 on Windows + +```bash +# Run these commands in the "Git for Windows" Bash terminal +mkdir -p ~/vimfiles/pack/git-plugins/start +git clone --depth 1 https://github.com/dense-analysis/ale.git ~/vimfiles/pack/git-plugins/start/ale +``` + +#### Generating Vim help files + +You can add the following line to your vimrc files to generate documentation +tags automatically, if you don't have something similar already, so you can use +the `:help` command to consult ALE's online documentation: + +```vim +" Put these lines at the very end of your vimrc file. + +" Load all plugins now. +" Plugins need to be added to runtimepath before helptags can be generated. +packloadall +" Load all of the helptags now, after plugins have been loaded. +" All messages and errors will be ignored. +silent! helptags ALL +``` + + + +### 3.ii. Installation with Pathogen + +To install this module with [Pathogen](https://github.com/tpope/vim-pathogen), +you should clone this repository to your bundle directory, and ensure +you have the line `execute pathogen#infect()` in your `~/.vimrc` file. +You can run the following commands in your terminal to do so: + +```bash +cd ~/.vim/bundle +git clone https://github.com/dense-analysis/ale.git +``` + + + +### 3.iii. Installation with Vundle + +You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim) +by adding the GitHub path for this repository to your `~/.vimrc`: + +```vim +Plugin 'dense-analysis/ale' +``` + +Then run the command `:PluginInstall` in Vim. + +See the Vundle documentation for more information. + + + +### 3.iiii. Installation with Vim-Plug + +You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug) +by adding the GitHub path for this repository to your `~/.vimrc`: + +```vim +Plug 'dense-analysis/ale' +``` + +Then run the command `:PlugInstall` in Vim. + +See the Vim-Plug documentation for more information. + + + +## 4. Contributing + +If you would like to see support for more languages and tools, please +[create an issue](https://github.com/dense-analysis/ale/issues) +or [create a pull request](https://github.com/dense-analysis/ale/pulls). +If your tool can read from stdin or you have code to suggest which is good, +support can be happily added for it. + +If you are interested in the general direction of the project, check out the +[wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes +a Roadmap for the future, and more. + +If you'd liked to discuss the project more directly, check out the `#vim-ale` channel +on Libera Chat. Web chat is available [here](https://web.libera.chat/#vim-ale). + + + +## 5. FAQ + + + +### 5.i. How do I disable particular linters? + +By default, all available tools for all supported languages will be run. If you +want to only select a subset of the tools, you can define `b:ale_linters` for a +single buffer, or `g:ale_linters` globally. + +The recommended way to configure linters is to define a List in an ftplugin +file. + +```vim +" In ~/.vim/ftplugin/javascript.vim, or somewhere similar. + +" Enable ESLint only for JavaScript. +let b:ale_linters = ['eslint'] + +" Equivalent to the above. +let b:ale_linters = {'javascript': ['eslint']} +``` + +You can also declare which linters you want to run in your vimrc file, before or +after ALE has been loaded. + +```vim +" In ~/.vim/vimrc, or somewhere similar. +let g:ale_linters = { +\ 'javascript': ['eslint'], +\} +``` + +For all languages unspecified in the dictionary, all possible linters will +be run for those languages, just as when the dictionary is not defined. +Running many linters should not typically obstruct editing in Vim, +as they will all be executed in separate processes simultaneously. + +If you don't want ALE to run anything other than what you've explicitly asked +for, you can set `g:ale_linters_explicit` to `1`. + +```vim +" Only run linters named in ale_linters settings. +let g:ale_linters_explicit = 1 +``` + +This plugin will look for linters in the [`ale_linters`](ale_linters) directory. +Each directory within corresponds to a particular filetype in Vim, and each file +in each directory corresponds to the name of a particular linter. + + + +### 5.ii. How can I see what ALE has configured for the current file? + +Run the following to see what is currently configured: + +```vim +:ALEInfo +``` + + + +### 5.iii. How can I use ALE and coc.nvim together? + +[coc.nvim](https://github.com/neoclide/coc.nvim) is a popular Vim plugin written +in TypeScript and dependent on the [npm](https://www.npmjs.com/) ecosystem for +providing full IDE features to Vim. Both ALE and coc.nvim implement +[Language Server Protocol](https://microsoft.github.io/language-server-protocol/) +(LSP) clients for supporting diagnostics (linting with a live server), and other +features like auto-completion, and others listed above. + +ALE is primarily focused on integrating with external programs through virtually +any means, provided the plugin remains almost entirely written in Vim script. +coc.nvim is primarily focused on bringing IDE features to Vim. If you want to +run external programs on your files to check for errors, and also use the most +advanced IDE features, you might want to use both plugins at the same time. + +The easiest way to get both plugins to work together is to configure coc.nvim to +send diagnostics to ALE, so ALE controls how all problems are presented to you, +and to disable all LSP features in ALE, so ALE doesn't try to provide LSP +features already provided by coc.nvim, such as auto-completion. + +1. Open your coc.nvim configuration file with `:CocConfig` and add + `"diagnostic.displayByAle": true` to your settings. +2. Add `let g:ale_disable_lsp = 1` to your vimrc file, before plugins are + loaded. + +You can also use `b:ale_disable_lsp` in your ftplugin files to enable or disable +LSP features in ALE for different filetypes. After you configure coc.nvim and +ALE this way, you can further configure how problems appear to you by using all +of the settings mentioned in ALE's help file, including how often diagnostics +are requested. See `:help ale-lint`. + +The integration between ALE and coc.nvim works using an API ALE offers for +letting any other plugin integrate with ALE. If you are interested in writing a +similar integration, see `:help ale-lint-other-sources`. + + + +### 5.iv. How can I keep the sign gutter open? + +You can keep the sign gutter open at all times by setting the +`g:ale_sign_column_always` to 1 + +```vim +let g:ale_sign_column_always = 1 +``` + + + +### 5.v. How can I change the signs ALE uses? + +Use these options to specify what text should be used for signs: + +```vim +let g:ale_sign_error = '>>' +let g:ale_sign_warning = '--' +``` + +ALE sets some background colors automatically for warnings and errors +in the sign gutter, with the names `ALEErrorSign` and `ALEWarningSign`. +These colors can be customised, or even removed completely: + +```vim +highlight clear ALEErrorSign +highlight clear ALEWarningSign +``` + + + +### 5.vi. How can I change or disable the highlights ALE uses? + +ALE's highlights problems with highlight groups which link to `SpellBad`, +`SpellCap`, `error`, and `todo` groups by default. The characters that are +highlighted depend on the linters being used, and the information provided to +ALE. + +Highlighting can be disabled completely by setting `g:ale_set_highlights` to +`0`. + +```vim +" Set this in your vimrc file to disabling highlighting +let g:ale_set_highlights = 0 +``` + +You can control all of the highlights ALE uses, say if you are using a different +color scheme which produces ugly highlights. For example: + +```vim +highlight ALEWarning ctermbg=DarkMagenta +``` + +See `:help ale-highlights` for more information. + + + +### 5.vii. How can I show errors or warnings in my statusline? + +[vim-airline](https://github.com/vim-airline/vim-airline) integrates with ALE +for displaying error information in the status bar. If you want to see the +status for ALE in a nice format, it is recommended to use vim-airline with ALE. +The airline extension can be enabled by adding the following to your vimrc: + +```vim +" Set this. Airline will handle the rest. +let g:airline#extensions#ale#enabled = 1 +``` + +If you don't want to use vim-airline, you can implement your own statusline +function without adding any other plugins. ALE provides some functions to +assist in this endeavour, including: + +* `ale#statusline#Count`: Which returns the number of problems found by ALE + for a specified buffer. +* `ale#statusline#FirstProblem`: Which returns a dictionary containing the + full loclist details of the first problem of a specified type found by ALE + in a buffer. (e.g. The first style warning in the current buffer.) + This can be useful for displaying more detailed information such as the + line number of the first problem in a file. + +Say you want to display all errors as one figure, and all non-errors as another +figure. You can do the following: + +```vim +function! LinterStatus() abort + let l:counts = ale#statusline#Count(bufnr('')) + + let l:all_errors = l:counts.error + l:counts.style_error + let l:all_non_errors = l:counts.total - l:all_errors + + return l:counts.total == 0 ? 'OK' : printf( + \ '%dW %dE', + \ all_non_errors, + \ all_errors + \) +endfunction + +set statusline=%{LinterStatus()} +``` + +See `:help ale#statusline#Count()` or `:help ale#statusline#FirstProblem()` +for more information. + + + +### 5.viii. How can I show errors or warnings in my lightline? + +[lightline](https://github.com/itchyny/lightline.vim) does not have built-in +support for ALE, nevertheless there is a plugin that adds this functionality: [maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale). + +For more information, check out the sources of that plugin, `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration). + + + +### 5.ix. How can I change the format for echo messages? + +There are 3 global options that allow customizing the echoed message. + +- `g:ale_echo_msg_format` where: + * `%s` is the error message itself + * `%...code...%` is an optional error code, and most characters can be + written between the `%` characters. + * `%linter%` is the linter name + * `%severity%` is the severity type +- `g:ale_echo_msg_error_str` is the string used for error severity. +- `g:ale_echo_msg_warning_str` is the string used for warning severity. + +So for example this: + +```vim +let g:ale_echo_msg_error_str = 'E' +let g:ale_echo_msg_warning_str = 'W' +let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' +``` + +Will give you: + +![Echoed message](https://user-images.githubusercontent.com/3518142/59195927-348bd000-8b85-11e9-88b6-508a094f1548.png) + +See `:help g:ale_echo_msg_format` for more information. + + + +### 5.x. How can I execute some code when ALE starts or stops linting? + +ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html) +events when a lint or fix cycle are started and stopped. There is also an event +that runs when a linter job has been successfully started. These events can be +used to call arbitrary functions during these respective parts of the ALE's +operation. + +```vim +augroup YourGroup + autocmd! + autocmd User ALELintPre call YourFunction() + autocmd User ALELintPost call YourFunction() + + autocmd User ALEJobStarted call YourFunction() + + autocmd User ALEFixPre call YourFunction() + autocmd User ALEFixPost call YourFunction() +augroup END +``` + + + +### 5.xi. How can I navigate between errors quickly? + +ALE offers some commands with `` keybinds for moving between warnings and +errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors +for example: + +```vim +nmap (ale_previous_wrap) +nmap (ale_next_wrap) +``` + +For more information, consult the online documentation with +`:help ale-navigation-commands`. + + + +### 5.xii. How can I run linters only when I save files? + +ALE offers an option `g:ale_lint_on_save` for enabling running the linters +when files are saved. This option is enabled by default. If you only +wish to run linters when files are saved, you can turn the other +options off. + +```vim +" Write this in your vimrc file +let g:ale_lint_on_text_changed = 'never' +let g:ale_lint_on_insert_leave = 0 +" You can disable this option too +" if you don't want linters to run on opening a file +let g:ale_lint_on_enter = 0 +``` + +If for whatever reason you don't wish to run linters again when you save +files, you can set `g:ale_lint_on_save` to `0`. + + + +### 5.xiii. How can I use the quickfix list instead of the loclist? + +The quickfix list can be enabled by turning the `g:ale_set_quickfix` +option on. If you wish to also disable the loclist, you can disable +the `g:ale_set_loclist` option. + +```vim +" Write this in your vimrc file +let g:ale_set_loclist = 0 +let g:ale_set_quickfix = 1 +``` + +If you wish to show Vim windows for the loclist or quickfix items +when a file contains warnings or errors, `g:ale_open_list` can be +set to `1`. `g:ale_keep_list_window_open` can be set to `1` +if you wish to keep the window open even after errors disappear. + +```vim +let g:ale_open_list = 1 +" Set this if you want to. +" This can be useful if you are combining ALE with +" some other plugin which sets quickfix errors, etc. +let g:ale_keep_list_window_open = 1 +``` + +You can also set `let g:ale_list_vertical = 1` to open the windows vertically +instead of the default horizontally. + + + +### 5.xiv. How can I check JSX files with both stylelint and eslint? + +If you configure ALE options correctly in your vimrc file, and install +the right tools, you can check JSX files with stylelint and eslint. + +First, install eslint and install stylelint with +[stylelint-processor-styled-components](https://github.com/styled-components/stylelint-processor-styled-components). + +Supposing you have installed both tools correctly, configure your .jsx files so +`jsx` is included in the filetype. You can use an `autocmd` for this. + +```vim +augroup FiletypeGroup + autocmd! + au BufNewFile,BufRead *.jsx set filetype=javascript.jsx +augroup END +``` + +Supposing the filetype has been set correctly, you can set the following +options in a jsx.vim ftplugin file. + +```vim +" In ~/.vim/ftplugin/jsx.vim, or somewhere similar. +let b:ale_linter_aliases = ['css', 'javascript'] +let b:ale_linters = ['stylelint', 'eslint'] +``` + +Or if you want, you can configure the linters from your vimrc file. + +```vim +" In ~/.vim/vimrc, or somewhere similar. +let g:ale_linter_aliases = {'jsx': ['css', 'javascript']} +let g:ale_linters = {'jsx': ['stylelint', 'eslint']} +``` + +ALE will alias the `jsx` filetype so it uses the `css` filetype linters, and +use the original Array of selected linters for `jsx` from the `g:ale_linters` +object. All available linters will be used for the filetype `javascript`, and +no linter will be run twice for the same file. + + + +### 5.xv. How can I check Vue files with ESLint? + +To check Vue files with ESLint, your ESLint project configuration file must be +configured to use the [Vue plugin](https://github.com/vuejs/eslint-plugin-vue). +After that, you need to configure ALE so it will run the JavaScript ESLint +linter on your files. The settings you need are similar to the settings needed +for checking JSX code with both stylelint and ESLint, in the previous section. + +```vim +" In ~/.vim/ftplugin/vue.vim, or somewhere similar. + +" Run both javascript and vue linters for vue files. +let b:ale_linter_aliases = ['javascript', 'vue'] +" Select the eslint and vls linters. +let b:ale_linters = ['eslint', 'vls'] +``` + +Run `:ALEInfo` to see which linters are available after telling ALE to run +JavaScript linters on Vue files. Not all linters support checking Vue files. + +If you don't want to configure your linters in ftplugin files for some reason, +you can configure them from your vimrc file instead. + +```vim +" In ~/.vim/vimrc, or somewhere similar. +let g:ale_linter_aliases = {'vue': ['vue', 'javascript']} +let g:ale_linters = {'vue': ['eslint', 'vls']} +``` + + + +### 5.xvi. Will this plugin eat all of my laptop battery power? + +ALE takes advantage of the power of various tools to check your code. This of +course means that CPU time will be used to continuously check your code. If you +are concerned about the CPU time ALE will spend, which will of course imply +some cost to battery life, you can adjust your settings to make your CPU do +less work. + +First, consider increasing the delay before which ALE will run any linters +while you type. ALE uses a timeout which is cancelled and reset every time you +type, and this delay can be increased so linters are run less often. See +`:help g:ale_lint_delay` for more information. + +If you don't wish to run linters while you type, you can disable that behavior. +Set `g:ale_lint_on_text_changed` to `never`. You won't get as frequent error +checking, but ALE shouldn't block your ability to edit a document after you save +a file, so the asynchronous nature of the plugin will still be an advantage. + +If you are still concerned, you can turn the automatic linting off altogether, +including the option `g:ale_lint_on_enter`, and you can run ALE manually with +`:ALELint`. + + + +### 5.xvii. How can I configure my C or C++ project? + +The structure of C and C++ projects varies wildly from project to project, with +many different build tools being used for building them, and many different +formats for project configuration files. ALE can run compilers easily, but +ALE cannot easily detect which compiler flags to use. + +Some tools and build configurations can generate +[compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html) +files. The `cppcheck`, `clangcheck`, `clangtidy` and `cquery` linters can read +these files for automatically determining the appropriate compiler flags to +use. + +For linting with compilers like `gcc` and `clang`, and with other tools, you +will need to tell ALE which compiler flags to use yourself. You can use +different options for different projects with the `g:ale_pattern_options` +setting. Consult the documentation for that setting for more information. +`b:ale_linters` can be used to select which tools you want to run, say if you +want to use only `gcc` for one project, and only `clang` for another. + +ALE will attempt to parse `compile_commands.json` files to discover compiler +flags to use when linting code. See `:help g:ale_c_parse_compile_commands` for +more information. See Clang's documentation for +[compile_commands.json files](https://clang.llvm.org/docs/JSONCompilationDatabase.html). +You should strongly consider generating them in your builds, which is easy to do +with CMake. + +You can also configure ALE to automatically run `make -n` to run dry runs on +`Makefile`s to discover compiler flags. This can execute arbitrary code, so the +option is disabled by default. See `:help g:ale_c_parse_makefile`. + +You may also configure buffer-local settings for linters with project-specific +vimrc files. [local_vimrc](https://github.com/LucHermitte/local_vimrc) can be +used for executing local vimrc files which can be shared in your project. + + + +### 5.xviii. How can I configure ALE differently for different buffers? + +ALE offers various ways to configure which linters or fixers are run, and +other settings. For the majority of ALE's settings, they can either be +configured globally with a `g:` variable prefix, or for a specific buffer +with a `b:` variable prefix. For example, you can configure a Python ftplugin +file like so. + +```vim +" In ~/.vim/ftplugin/python.vim + +" Check Python files with flake8 and pylint. +let b:ale_linters = ['flake8', 'pylint'] +" Fix Python files with autopep8 and yapf. +let b:ale_fixers = ['autopep8', 'yapf'] +" Disable warnings about trailing whitespace for Python files. +let b:ale_warn_about_trailing_whitespace = 0 +``` + +For configuring files based on regular expression patterns matched against the +absolute path to a file, you can use `g:ale_pattern_options`. + +```vim +" Do not lint or fix minified files. +let g:ale_pattern_options = { +\ '\.min\.js$': {'ale_linters': [], 'ale_fixers': []}, +\ '\.min\.css$': {'ale_linters': [], 'ale_fixers': []}, +\} +" If you configure g:ale_pattern_options outside of vimrc, you need this. +let g:ale_pattern_options_enabled = 1 +``` + +Buffer-local variables for settings always override the global settings. + + + +### 5.xix. How can I configure the height of the list in which ALE displays errors? + +To set a default height for the error list, use the `g:ale_list_window_size` variable. + +```vim +" Show 5 lines of errors (default: 10) +let g:ale_list_window_size = 5 +``` + + + +### 5.xx. How can I run linters or fixers via Docker or a VM? + +ALE supports running linters or fixers via Docker, virtual machines, or in +combination with any remote machine with a different file system, so long as the +tools are well-integrated with ALE, and ALE is properly configured to run the +correct commands and map filename paths between different file systems. See +`:help ale-lint-other-machines` for the full documentation on how to configure +ALE to support this. + + + +### 5.xxi. How can I change the borders for floating preview windows? + +Borders for floating preview windows are enabled by default. You can use the +`g:ale_floating_window_border` setting to configure them. + +You could disable the border with an empty list. + +```vim +let g:ale_floating_window_border = [] +``` + +If the terminal supports Unicode, you might try setting the value like below, to +make it look nicer. + +```vim +let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰'] +``` + +Since vim's default uses nice unicode characters when possible, you can trick +ale into using that default with + +```vim +let g:ale_floating_window_border = repeat([''], 6) +``` + + + +### 5.xxii. How can I use ALE and vim-lsp together? + +[vim-lsp](https://github.com/prabirshrestha/vim-lsp) is a popular plugin as +implementation of Language Server Protocol (LSP) client for Vim. It provides +all the LSP features including auto completion, diagnostics, go to definitions, +etc. + +ALE also provides LSP support for diagnostics. When you use both ALE and +vim-lsp, one option is disabling ALE's LSP support by +`let g:ale_disable_lsp = 1`. However ALE provides integration of external +programs. Showing errors from language servers by vim-lsp and showing errors +from other external programs by ALE are confusing and problematic. + +[vim-lsp-ale](https://github.com/rhysd/vim-lsp-ale) is a bridge plugin to solve +the problem when using both ALE and vim-lsp. With the plugin, diagnostics are +provided by vim-lsp and ALE can handle all the errors. Please read +[vim-lsp-ale's documentation](https://github.com/rhysd/vim-lsp-ale/blob/master/doc/vim-lsp-ale.txt) +for more details. diff --git a/sources_non_forked/ale/ale_linters/ada/cspell.vim b/sources_non_forked/ale/ale_linters/ada/cspell.vim new file mode 100644 index 00000000..7342d2b6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ada/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Ada files. + +call ale#handlers#cspell#DefineLinter('ada') diff --git a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim index 3b443369..d5d98bc4 100644 --- a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim +++ b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim @@ -18,9 +18,30 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort endif endfor - let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0' + let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' : + \ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : + \ '<5.0.0' let l:output = [] + if '>=6.0.0' is# l:version_group + let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' } + let l:linter_issues = json_decode(join(a:lines, '')) + + for l:issue in l:linter_issues + if ale#path#IsBufferPath(a:buffer, l:issue.location.path) + call add(l:output, { + \ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line : + \ l:issue.location.lines.begin, + \ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0, + \ 'text': l:issue.check_name, + \ 'detail': l:issue.description, + \ 'code': l:issue.severity, + \ 'type': l:error_codes[l:issue.severity], + \}) + endif + endfor + endif + if '>=5.0.0' is# l:version_group " Matches patterns line the following: " test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play @@ -73,10 +94,13 @@ endfunction function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort let l:commands = { + \ '>=6.0.0': '%e --nocolor -f json -x yaml %s', \ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s', \ '<5.0.0': '%e --nocolor -p %t' \} - let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0'] + let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] : + \ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : + \ l:commands['<5.0.0'] return l:command endfunction diff --git a/sources_non_forked/ale/ale_linters/asciidoc/cspell.vim b/sources_non_forked/ale/ale_linters/asciidoc/cspell.vim new file mode 100644 index 00000000..b228b2e8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asciidoc/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for ASCIIDoc files. + +call ale#handlers#cspell#DefineLinter('asciidoc') diff --git a/sources_non_forked/ale/ale_linters/avra/avra.vim b/sources_non_forked/ale/ale_linters/avra/avra.vim new file mode 100644 index 00000000..edf15c09 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/avra/avra.vim @@ -0,0 +1,36 @@ +" Author: Utkarsh Verma +" Description: AVRA linter for avra syntax. + +call ale#Set('avra_avra_executable', 'avra') +call ale#Set('avra_avra_options', '') + +function! ale_linters#avra#avra#GetCommand(buffer) abort + return '%e' + \ . ' %t' + \ . ale#Pad(ale#Var(a:buffer, 'avra_avra_options')) + \ . ' -o ' . g:ale#util#nul_file +endfunction + +function! ale_linters#avra#avra#Handle(buffer, lines) abort + " Note that we treat 'fatal' as errors. + let l:pattern = '^\S\+(\(\d\+\))\s\+:\s\+\(\S\+\)\s\+:\s\+\(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'type': l:match[2] =~? 'Error' ? 'E' : 'W', + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('avra', { +\ 'name': 'avra', +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'avra_avra_executable')}, +\ 'command': function('ale_linters#avra#avra#GetCommand'), +\ 'callback': 'ale_linters#avra#avra#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/awk/gawk.vim b/sources_non_forked/ale/ale_linters/awk/gawk.vim index f795c57d..fe961ae3 100644 --- a/sources_non_forked/ale/ale_linters/awk/gawk.vim +++ b/sources_non_forked/ale/ale_linters/awk/gawk.vim @@ -9,8 +9,9 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort " gawk from attempting to execute the body of the script " it is linting. return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }') + \ . ' --lint' \ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options')) - \ . ' -f %t --lint /dev/null' + \ . ' -f %t /dev/null' endfunction call ale#linter#Define('awk', { diff --git a/sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim b/sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim new file mode 100644 index 00000000..fb85a9b9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/bitbake/oelint_adv.vim @@ -0,0 +1,47 @@ +" Author: offa +" Description: oelint-adv for BitBake files + +call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv') +call ale#Set('bitbake_oelint_adv_options', '') +call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg') + +function! ale_linters#bitbake#oelint_adv#Command(buffer) abort + let l:config_file = ale#path#FindNearestFile(a:buffer, + \ ale#Var(a:buffer, 'bitbake_oelint_adv_config')) + + return ((!empty(l:config_file)) + \ ? 'OELINT_CONFIG=' . ale#Escape(l:config_file) . ' ' + \ : '') + \ . '%e --quiet ' + \ . ale#Pad(ale#Var(a:buffer, 'bitbake_oelint_adv_options')) . '%s' +endfunction + +function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort + let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:match[3] is# 'error' + \ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'), + \ 'text': StripAnsiCodes(l:match[5]), + \ 'code': l:match[4] + \ }) + endfor + + return l:output +endfunction + +function! StripAnsiCodes(line) abort + return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g') +endfunction + +call ale#linter#Define('bitbake', { +\ 'name': 'oelint_adv', +\ 'output_stream': 'both', +\ 'executable': {b -> ale#Var(b, 'bitbake_oelint_adv_executable')}, +\ 'cwd': '%s:h', +\ 'command': function('ale_linters#bitbake#oelint_adv#Command'), +\ 'callback': 'ale_linters#bitbake#oelint_adv#Handle', +\ }) diff --git a/sources_non_forked/ale/ale_linters/c/cpplint.vim b/sources_non_forked/ale/ale_linters/c/cpplint.vim new file mode 100644 index 00000000..4b997941 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/cpplint.vim @@ -0,0 +1,20 @@ +" Author: Justin Huang +" Description: cpplint for c files + +call ale#Set('c_cpplint_executable', 'cpplint') +call ale#Set('c_cpplint_options', '') + +function! ale_linters#c#cpplint#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'c_cpplint_options') + + return '%e' . ale#Pad(l:options) . ' %s' +endfunction + +call ale#linter#Define('c', { +\ 'name': 'cpplint', +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')}, +\ 'command': function('ale_linters#c#cpplint#GetCommand'), +\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/c/cspell.vim b/sources_non_forked/ale/ale_linters/c/cspell.vim new file mode 100644 index 00000000..5f016548 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for C files. + +call ale#handlers#cspell#DefineLinter('c') diff --git a/sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim b/sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim new file mode 100644 index 00000000..3c44c92f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cmake/cmake_lint.vim @@ -0,0 +1,43 @@ +" Author: Carl Smedstad +" Description: cmake-lint for cmake files + +let g:ale_cmake_cmake_lint_executable = +\ get(g:, 'ale_cmake_cmake_lint_executable', 'cmake-lint') + +let g:ale_cmake_cmake_lint_options = +\ get(g:, 'ale_cmake_cmake_lint_options', '') + +function! ale_linters#cmake#cmake_lint#Executable(buffer) abort + return ale#Var(a:buffer, 'cmake_cmake_lint_executable') +endfunction + +function! ale_linters#cmake#cmake_lint#Command(buffer) abort + let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer) + let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options') + + return ale#Escape(l:executable) . ' ' . l:options . ' %t' +endfunction + +function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort + let l:pattern = '\v^[^:]+:(\d+),?(\d+)?:\s\[([A-Z]\d+)\]\s(.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': 'W', + \ 'code': l:match[3], + \ 'text': l:match[4], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('cmake', { +\ 'name': 'cmake_lint', +\ 'executable': function('ale_linters#cmake#cmake_lint#Executable'), +\ 'command': function('ale_linters#cmake#cmake_lint#Command'), +\ 'callback': 'ale_linters#cmake#cmake_lint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/cspell.vim b/sources_non_forked/ale/ale_linters/cpp/cspell.vim new file mode 100644 index 00000000..ace4c3b2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for C++ files. + +call ale#handlers#cspell#DefineLinter('cpp') diff --git a/sources_non_forked/ale/ale_linters/cs/cspell.vim b/sources_non_forked/ale/ale_linters/cs/cspell.vim new file mode 100644 index 00000000..c62dd11b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cs/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for C# files. + +call ale#handlers#cspell#DefineLinter('cs') diff --git a/sources_non_forked/ale/ale_linters/css/cspell.vim b/sources_non_forked/ale/ale_linters/css/cspell.vim new file mode 100644 index 00000000..d42375b4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/css/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for CSS files. + +call ale#handlers#cspell#DefineLinter('css') diff --git a/sources_non_forked/ale/ale_linters/css/vscodecss.vim b/sources_non_forked/ale/ale_linters/css/vscodecss.vim new file mode 100644 index 00000000..2d59adf0 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/css/vscodecss.vim @@ -0,0 +1,16 @@ +" Author: Dalius Dobravolskas +" Description: VSCode css language server + +function! ale_linters#css#vscodecss#GetProjectRoot(buffer) abort + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +call ale#linter#Define('css', { +\ 'name': 'vscodecss', +\ 'lsp': 'stdio', +\ 'executable': 'vscode-css-language-server', +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#css#vscodecss#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/dart/dartanalyzer.vim b/sources_non_forked/ale/ale_linters/dart/dartanalyzer.vim deleted file mode 100644 index 0a4d9742..00000000 --- a/sources_non_forked/ale/ale_linters/dart/dartanalyzer.vim +++ /dev/null @@ -1,36 +0,0 @@ -" Author: w0rp -" Description: Check Dart files with dartanalyzer - -call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer') - -function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort - let l:path = ale#path#FindNearestFile(a:buffer, '.packages') - - return '%e' - \ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '') - \ . ' %s' -endfunction - -function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort - let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'type': l:match[1] is# 'error' ? 'E' : 'W', - \ 'text': l:match[6] . ': ' . l:match[2], - \ 'lnum': str2nr(l:match[4]), - \ 'col': str2nr(l:match[5]), - \}) - endfor - - return l:output -endfunction - -call ale#linter#Define('dart', { -\ 'name': 'dartanalyzer', -\ 'executable': {b -> ale#Var(b, 'dart_dartanalyzer_executable')}, -\ 'command': function('ale_linters#dart#dartanalyzer#GetCommand'), -\ 'callback': 'ale_linters#dart#dartanalyzer#Handle', -\ 'lint_file': 1, -\}) diff --git a/sources_non_forked/ale/ale_linters/elixir/cspell.vim b/sources_non_forked/ale/ale_linters/elixir/cspell.vim new file mode 100644 index 00000000..12dc271f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elixir/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Elixir files. + +call ale#handlers#cspell#DefineLinter('elixir') diff --git a/sources_non_forked/ale/ale_linters/erlang/elvis.vim b/sources_non_forked/ale/ale_linters/erlang/elvis.vim index 31dea3dd..0fb85c07 100644 --- a/sources_non_forked/ale/ale_linters/erlang/elvis.vim +++ b/sources_non_forked/ale/ale_linters/erlang/elvis.vim @@ -12,6 +12,7 @@ function! ale_linters#erlang#elvis#Handle(buffer, lines) abort \ 'lnum': str2nr(l:match[1]), \ 'text': s:AbbreviateMessage(l:match[2]), \ 'type': 'W', + \ 'sub_type': 'style', \}) endfor diff --git a/sources_non_forked/ale/ale_linters/go/cspell.vim b/sources_non_forked/ale/ale_linters/go/cspell.vim new file mode 100644 index 00000000..f986a31a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Go files. + +call ale#handlers#cspell#DefineLinter('go') diff --git a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim index 2c4b1a4f..80431b99 100644 --- a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim +++ b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim @@ -24,7 +24,7 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort endfunction function! ale_linters#go#golangci_lint#GetMatches(lines) abort - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$' + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)\s+\((.+)\)$' return ale#util#GetMatches(a:lines, l:pattern) endfunction @@ -34,14 +34,20 @@ function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort let l:output = [] for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines) + if l:match[5] is# 'typecheck' + let l:msg_type = 'E' + else + let l:msg_type = 'W' + endif + " l:match[1] will already be an absolute path, output from " golangci_lint call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, - \ 'type': 'E', - \ 'text': l:match[4], + \ 'type': l:msg_type, + \ 'text': l:match[4] . ' (' . l:match[5] . ')', \}) endfor diff --git a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim index 8362bb1c..17c4d08e 100644 --- a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim +++ b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim @@ -11,10 +11,17 @@ function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort endfunction function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort - " Reading from stdin was introduced in ember-template-lint@1.6.0 - return ale#semver#GTE(a:version, [1, 6, 0]) - \ ? '%e --json --filename %s' - \ : '%e --json %t' + if ale#semver#GTE(a:version, [4, 0, 0]) + " --json was removed in favor of --format=json in ember-template-lint@4.0.0 + return '%e --format=json --filename %s' + endif + + if ale#semver#GTE(a:version, [1, 6, 0]) + " Reading from stdin was introduced in ember-template-lint@1.6.0 + return '%e --json --filename %s' + endif + + return '%e --json %t' endfunction function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/haskell/cspell.vim b/sources_non_forked/ale/ale_linters/haskell/cspell.vim new file mode 100644 index 00000000..b0971a9e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Haskell files. + +call ale#handlers#cspell#DefineLinter('haskell') diff --git a/sources_non_forked/ale/ale_linters/haskell/hls.vim b/sources_non_forked/ale/ale_linters/haskell/hls.vim index ae0556a4..7f9efc38 100644 --- a/sources_non_forked/ale/ale_linters/haskell/hls.vim +++ b/sources_non_forked/ale/ale_linters/haskell/hls.vim @@ -4,6 +4,7 @@ " ). It search more project root files. " call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper') +call ale#Set('haskell_hls_config', {}) function! ale_linters#haskell#hls#FindRootFile(buffer) abort let l:serach_root_files = [ @@ -60,4 +61,5 @@ call ale#linter#Define('haskell', { \ 'command': function('ale_linters#haskell#hls#GetCommand'), \ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')}, \ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'), +\ 'lsp_config': {b -> ale#Var(b, 'haskell_hls_config')}, \}) diff --git a/sources_non_forked/ale/ale_linters/help/cspell.vim b/sources_non_forked/ale/ale_linters/help/cspell.vim new file mode 100644 index 00000000..92eb9501 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/help/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for help files. + +call ale#handlers#cspell#DefineLinter('help') diff --git a/sources_non_forked/ale/ale_linters/html/angular.vim b/sources_non_forked/ale/ale_linters/html/angular.vim index 17c0a751..4f368fb4 100644 --- a/sources_non_forked/ale/ale_linters/html/angular.vim +++ b/sources_non_forked/ale/ale_linters/html/angular.vim @@ -11,10 +11,7 @@ function! ale_linters#html#angular#GetProjectRoot(buffer) abort endfunction function! ale_linters#html#angular#GetExecutable(buffer) abort - return ale#path#FindExecutable(a:buffer, 'html_angular', [ - \ 'node_modules/@angular/language-server/bin/ngserver', - \ 'node_modules/@angular/language-server/index.js', - \]) + return 'node' endfunction function! ale_linters#html#angular#GetCommand(buffer) abort @@ -34,9 +31,16 @@ function! ale_linters#html#angular#GetCommand(buffer) abort \ fnamemodify(l:language_service_dir, ':h:h') \ . '/typescript' \) - let l:executable = ale_linters#html#angular#GetExecutable(a:buffer) + let l:script = ale#path#FindExecutable(a:buffer, 'html_angular', [ + \ 'node_modules/@angular/language-server/bin/ngserver', + \ 'node_modules/@angular/language-server/index.js', + \]) - return ale#node#Executable(a:buffer, l:executable) + if !filereadable(l:script) + return '' + endif + + return ale#Escape('node') . ' ' . ale#Escape(l:script) \ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir) \ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir) \ . ' --stdio' diff --git a/sources_non_forked/ale/ale_linters/html/cspell.vim b/sources_non_forked/ale/ale_linters/html/cspell.vim new file mode 100644 index 00000000..743350ea --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for HTML files. + +call ale#handlers#cspell#DefineLinter('html') diff --git a/sources_non_forked/ale/ale_linters/html/vscodehtml.vim b/sources_non_forked/ale/ale_linters/html/vscodehtml.vim new file mode 100644 index 00000000..46814a0b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/vscodehtml.vim @@ -0,0 +1,16 @@ +" Author: Dalius Dobravolskas +" Description: VSCode html language server + +function! ale_linters#html#vscodehtml#GetProjectRoot(buffer) abort + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +call ale#linter#Define('html', { +\ 'name': 'vscodehtml', +\ 'lsp': 'stdio', +\ 'executable': 'vscode-html-language-server', +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#html#vscodehtml#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/java/cspell.vim b/sources_non_forked/ale/ale_linters/java/cspell.vim new file mode 100644 index 00000000..a6eecc0b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/java/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Java files. + +call ale#handlers#cspell#DefineLinter('java') diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim index adfd1b09..ad7cbeb4 100644 --- a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -192,4 +192,9 @@ call ale#linter#Define('java', { \ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'), \ 'language': 'java', \ 'project_root': function('ale#java#FindProjectRoot'), +\ 'initialization_options': { +\ 'extendedClientCapabilities': { +\ 'classFileContentsSupport': v:true +\ } +\ } \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/cspell.vim b/sources_non_forked/ale/ale_linters/javascript/cspell.vim new file mode 100644 index 00000000..5a496779 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for JavaScript files. + +call ale#handlers#cspell#DefineLinter('javascript') diff --git a/sources_non_forked/ale/ale_linters/json/cspell.vim b/sources_non_forked/ale/ale_linters/json/cspell.vim new file mode 100644 index 00000000..0d7314a4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for JSON files. + +call ale#handlers#cspell#DefineLinter('json') diff --git a/sources_non_forked/ale/ale_linters/json/vscodejson.vim b/sources_non_forked/ale/ale_linters/json/vscodejson.vim new file mode 100644 index 00000000..dcaee010 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/vscodejson.vim @@ -0,0 +1,16 @@ +" Author: Dalius Dobravolskas +" Description: VSCode json language server + +function! ale_linters#json#vscodejson#GetProjectRoot(buffer) abort + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +call ale#linter#Define('json', { +\ 'name': 'vscodejson', +\ 'lsp': 'stdio', +\ 'executable': 'vscode-json-language-server', +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/lua/cspell.vim b/sources_non_forked/ale/ale_linters/lua/cspell.vim new file mode 100644 index 00000000..215b82f8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/lua/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Lua files. + +call ale#handlers#cspell#DefineLinter('lua') diff --git a/sources_non_forked/ale/ale_linters/lua/selene.vim b/sources_non_forked/ale/ale_linters/lua/selene.vim new file mode 100644 index 00000000..6b33cbfd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/lua/selene.vim @@ -0,0 +1,46 @@ +call ale#Set('lua_selene_executable', 'selene') +call ale#Set('lua_selene_options', '') + +function! ale_linters#lua#selene#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_selene_options')) + \ . ' --display-style=json -' +endfunction + +function! ale_linters#lua#selene#Handle(buffer, lines) abort + let l:output = [] + + for l:line in a:lines + " as of version 0.17.0, selene has no way to suppress summary + " information when outputting json, so stop processing when we hit it + " (PR for this here: https://github.com/Kampfkarren/selene/pull/356) + if l:line is# 'Results:' + break + endif + + let l:json = json_decode(l:line) + let l:lint = { + \ 'lnum': l:json.primary_label.span.start_line + 1, + \ 'end_lnum': l:json.primary_label.span.end_line + 1, + \ 'col': l:json.primary_label.span.start_column + 1, + \ 'end_col': l:json.primary_label.span.end_column, + \ 'text': l:json.message, + \ 'code': l:json.code, + \ 'type': l:json.severity is# 'Warning' ? 'W' : 'E', + \} + + if has_key(l:json, 'notes') && len(l:json.notes) > 0 + let l:lint.detail = l:lint.text . "\n\n" . join(l:json.notes, "\n") + endif + + call add(l:output, l:lint) + endfor + + return l:output +endfunction + +call ale#linter#Define('lua', { +\ 'name': 'selene', +\ 'executable': {b -> ale#Var(b, 'lua_selene_executable')}, +\ 'command': function('ale_linters#lua#selene#GetCommand'), +\ 'callback': 'ale_linters#lua#selene#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/make/checkmake.vim b/sources_non_forked/ale/ale_linters/make/checkmake.vim index 5ebdf91e..d5f95d6f 100644 --- a/sources_non_forked/ale/ale_linters/make/checkmake.vim +++ b/sources_non_forked/ale/ale_linters/make/checkmake.vim @@ -20,6 +20,6 @@ endfunction call ale#linter#Define('make', { \ 'name': 'checkmake', \ 'executable': 'checkmake', -\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"', +\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"', \ 'callback': 'ale_linters#make#checkmake#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/markdown/cspell.vim b/sources_non_forked/ale/ale_linters/markdown/cspell.vim new file mode 100644 index 00000000..45c586cc --- /dev/null +++ b/sources_non_forked/ale/ale_linters/markdown/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Markdown files. + +call ale#handlers#cspell#DefineLinter('markdown') diff --git a/sources_non_forked/ale/ale_linters/nix/nix.vim b/sources_non_forked/ale/ale_linters/nix/nix.vim index 3d91a9ec..7c2ce963 100644 --- a/sources_non_forked/ale/ale_linters/nix/nix.vim +++ b/sources_non_forked/ale/ale_linters/nix/nix.vim @@ -5,7 +5,7 @@ function! ale_linters#nix#nix#Command(buffer, output, meta) abort let l:version = a:output[0][22:] - if l:version =~# '^\(2.4\|3\).*' + if l:version =~# '^\(2.[4-9]\|3\).*' return 'nix-instantiate --log-format internal-json --parse -' else return 'nix-instantiate --parse -' diff --git a/sources_non_forked/ale/ale_linters/nix/statix.vim b/sources_non_forked/ale/ale_linters/nix/statix.vim new file mode 100644 index 00000000..a90a68a6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nix/statix.vim @@ -0,0 +1,18 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: statix analysis and suggestions for Nix files + +call ale#Set('nix_statix_check_executable', 'statix') +call ale#Set('nix_statix_check_options', '') + +function! ale_linters#nix#statix#GetCommand(buffer) abort + return '%e check -o errfmt --stdin' + \ . ale#Pad(ale#Var(a:buffer, 'nix_statix_check_options')) +endfunction + +call ale#linter#Define('nix', { +\ 'name': 'statix', +\ 'executable': {b -> ale#Var(b, 'nix_statix_check_executable')}, +\ 'command': function('ale_linters#nix#statix#GetCommand'), +\ 'callback': 'ale#handlers#statix#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/php/cspell.vim b/sources_non_forked/ale/ale_linters/php/cspell.vim new file mode 100644 index 00000000..574df575 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for PHP files. + +call ale#handlers#cspell#DefineLinter('php') diff --git a/sources_non_forked/ale/ale_linters/php/intelephense.vim b/sources_non_forked/ale/ale_linters/php/intelephense.vim old mode 100644 new mode 100755 diff --git a/sources_non_forked/ale/ale_linters/php/phpactor.vim b/sources_non_forked/ale/ale_linters/php/phpactor.vim new file mode 100644 index 00000000..b137eaf1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/phpactor.vim @@ -0,0 +1,23 @@ +" Author: Arizard +" Description: PHPactor integration for ALE + +" Copied from langserver.vim +function! ale_linters#php#phpactor#GetProjectRoot(buffer) abort + let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') + + if (!empty(l:composer_path)) + return fnamemodify(l:composer_path, ':h') + endif + + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +call ale#linter#Define('php', { +\ 'name': 'phpactor', +\ 'lsp': 'stdio', +\ 'executable': 'phpactor', +\ 'command': '%e language-server', +\ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index 58d4dce2..4dce5d5f 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -1,4 +1,4 @@ -" Author: medains , ardis +" Author: medains , ardis , Arizard " Description: phpstan for PHP files " Set to change the ruleset @@ -6,6 +6,7 @@ let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpsta let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '') let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '') +let g:ale_php_phpstan_memory_limit = get(g:, 'ale_php_phpstan_memory_limit', '') call ale#Set('php_phpstan_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#phpstan#GetCommand(buffer, version) abort @@ -19,6 +20,11 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort \ ? ' -a ' . ale#Escape(l:autoload) \ : '' + let l:memory_limit = ale#Var(a:buffer, 'php_phpstan_memory_limit') + let l:memory_limit_option = !empty(l:memory_limit) + \ ? ' --memory-limit ' . ale#Escape(l:memory_limit) + \ : '' + let l:level = ale#Var(a:buffer, 'php_phpstan_level') let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon') let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist') @@ -41,6 +47,7 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort \ . l:configuration_option \ . l:autoload_option \ . l:level_option + \ . l:memory_limit_option \ . ' %s' endfunction diff --git a/sources_non_forked/ale/ale_linters/php/psalm.vim b/sources_non_forked/ale/ale_linters/php/psalm.vim index dbbe9453..f1280057 100644 --- a/sources_non_forked/ale/ale_linters/php/psalm.vim +++ b/sources_non_forked/ale/ale_linters/php/psalm.vim @@ -6,6 +6,12 @@ call ale#Set('php_psalm_options', '') call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#psalm#GetProjectRoot(buffer) abort + let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') + + if (!empty(l:composer_path)) + return fnamemodify(l:composer_path, ':h') + endif + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' diff --git a/sources_non_forked/ale/ale_linters/powershell/cspell.vim b/sources_non_forked/ale/ale_linters/powershell/cspell.vim new file mode 100644 index 00000000..4a66dbaa --- /dev/null +++ b/sources_non_forked/ale/ale_linters/powershell/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for PowerShell files. + +call ale#handlers#cspell#DefineLinter('powershell') diff --git a/sources_non_forked/ale/ale_linters/proto/buf_lint.vim b/sources_non_forked/ale/ale_linters/proto/buf_lint.vim new file mode 100644 index 00000000..e68494a7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/proto/buf_lint.vim @@ -0,0 +1,23 @@ +" Author: Alex McKinney +" Description: Run buf lint. + +call ale#Set('proto_buf_lint_executable', 'buf') +call ale#Set('proto_buf_lint_config', '') + +function! ale_linters#proto#buf_lint#GetCommand(buffer) abort + let l:config = ale#Var(a:buffer, 'proto_buf_lint_config') + + return '%e lint' + \ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '') + \ . ' %s#include_package_files=true' +endfunction + +call ale#linter#Define('proto', { +\ 'name': 'buf_lint', +\ 'aliases': ['buf-lint'], +\ 'lint_file': 1, +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'proto_buf_lint_executable')}, +\ 'command': function('ale_linters#proto#buf_lint#GetCommand'), +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/cspell.vim b/sources_non_forked/ale/ale_linters/python/cspell.vim new file mode 100644 index 00000000..a2325311 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Python files. + +call ale#handlers#cspell#DefineLinter('python') diff --git a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim index aa0e8b20..ef0d818c 100644 --- a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim @@ -29,7 +29,7 @@ function! ale_linters#python#pydocstyle#GetCommand(buffer) abort return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options')) - \ . ' %s:t' + \ . ' %s' endfunction function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort diff --git a/sources_non_forked/ale/ale_linters/python/pylama.vim b/sources_non_forked/ale/ale_linters/python/pylama.vim index 73b59b07..14f8071a 100644 --- a/sources_non_forked/ale/ale_linters/python/pylama.vim +++ b/sources_non_forked/ale/ale_linters/python/pylama.vim @@ -22,6 +22,22 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama']) endfunction +function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort + let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'pipenv\|poetry$' + \ ? ' run pylama' + \ : '' + + let l:command = ale#Escape(l:executable) . l:exec_args . ' --version' + + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale_linters#python#pylama#GetCommand'), + \) +endfunction + function! ale_linters#python#pylama#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pylama_change_directory') " Pylama loads its configuration from the current directory only, and @@ -35,27 +51,33 @@ function! ale_linters#python#pylama#GetCwd(buffer) abort return '' endfunction -function! ale_linters#python#pylama#GetCommand(buffer) abort +function! ale_linters#python#pylama#GetCommand(buffer, version) abort let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pylama' \ : '' + " json format is added in version 8.1.4 + " https://github.com/klen/pylama/blob/develop/Changelog + let l:format_json_args = ale#semver#GTE(a:version, [8, 1, 4]) + \ ? ' --format json' + \ : '' + " Note: Using %t to lint changes would be preferable, but many pylama " checks use surrounding paths (e.g. C0103 module name, E0402 relative " import beyond top, etc.). Neither is ideal. return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options')) + \ . l:format_json_args \ . ' %s' endfunction -function! ale_linters#python#pylama#Handle(buffer, lines) abort +function! ale_linters#python#pylama#Handle(buffer, version, lines) abort if empty(a:lines) return [] endif let l:output = ale#python#HandleTraceback(a:lines, 1) - let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$' " First letter of error code is a pylint-compatible message type " http://pylint.pycqa.org/en/latest/user_guide/output.html#source-code-analysis-section @@ -75,16 +97,41 @@ function! ale_linters#python#pylama#Handle(buffer, lines) abort \ 'D': 'style', \} - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'lnum': str2nr(l:match[1]), - \ 'col': str2nr(l:match[2]), - \ 'code': l:match[3], - \ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'), - \ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''), - \ 'text': l:match[4], - \}) - endfor + if ale#semver#GTE(a:version, [8, 1, 4]) + try + let l:errors = json_decode(join(a:lines, '')) + catch + return l:output + endtry + + if empty(l:errors) + return l:output + endif + + for l:error in l:errors + call add(l:output, { + \ 'lnum': l:error['lnum'], + \ 'col': l:error['col'], + \ 'code': l:error['number'], + \ 'type': get(l:pylint_type_to_ale_type, l:error['etype'], 'W'), + \ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:error['etype'], ''), + \ 'text': printf('%s [%s]', l:error['message'], l:error['source']), + \}) + endfor + else + let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'code': l:match[3], + \ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'), + \ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''), + \ 'text': l:match[4], + \}) + endfor + endif return l:output endfunction @@ -93,7 +140,15 @@ call ale#linter#Define('python', { \ 'name': 'pylama', \ 'executable': function('ale_linters#python#pylama#GetExecutable'), \ 'cwd': function('ale_linters#python#pylama#GetCwd'), -\ 'command': function('ale_linters#python#pylama#GetCommand'), -\ 'callback': 'ale_linters#python#pylama#Handle', +\ 'command': function('ale_linters#python#pylama#RunWithVersionCheck'), +\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#python#pylama#GetExecutable(buffer), +\ '%e --version', +\ {buffer, version -> ale_linters#python#pylama#Handle( +\ buffer, +\ l:version, +\ lines)}, +\ )}, \ 'lint_file': 1, \}) diff --git a/sources_non_forked/ale/ale_linters/python/unimport.vim b/sources_non_forked/ale/ale_linters/python/unimport.vim new file mode 100644 index 00000000..71fd80f0 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/unimport.vim @@ -0,0 +1,75 @@ +" Author: Author: Jon Parise + +call ale#Set('python_unimport_executable', 'unimport') +call ale#Set('python_unimport_options', '') +call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_unimport_auto_pipenv', 0) +call ale#Set('python_unimport_auto_poetry', 0) + +function! ale_linters#python#unimport#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_unimport_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + + return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport']) +endfunction + +function! ale_linters#python#unimport#GetCommand(buffer) abort + let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'pipenv\|poetry$' + \ ? ' run unimport' + \ : '' + + return '%e' . l:exec_args + \ . ale#Pad(ale#Var(a:buffer, 'python_unimport_options')) + \ . ' --check' + \ . ' %t' +endfunction + + +function! ale_linters#python#unimport#GetCwd(buffer) abort + let l:project_root = ale#python#FindProjectRoot(a:buffer) + + return !empty(l:project_root) + \ ? l:project_root + \ : expand('#' . a:buffer . ':p:h') +endfunction + + +function! ale_linters#python#unimport#Handle(buffer, lines) abort + let l:output = ale#python#HandleTraceback(a:lines, 10) + + if !empty(l:output) + return l:output + endif + + " Matches lines like: + " + " urllib.parse at path/to/file.py:9 + let l:pattern = '\v(.+) at [^:]+:(\d+)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'type': 'W', + \ 'text': 'unused: ' . l:match[1], + \}) + endfor + + return l:output +endfunction + + +call ale#linter#Define('python', { +\ 'name': 'unimport', +\ 'executable': function('ale_linters#python#unimport#GetExecutable'), +\ 'cwd': function('ale_linters#python#unimport#GetCwd'), +\ 'command': function('ale_linters#python#unimport#GetCommand'), +\ 'callback': 'ale_linters#python#unimport#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/rego/cspell.vim b/sources_non_forked/ale/ale_linters/rego/cspell.vim new file mode 100644 index 00000000..a54a5379 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rego/cspell.vim @@ -0,0 +1,4 @@ +scriptencoding utf-8 +" Description: cspell support for rego files. + +call ale#handlers#cspell#DefineLinter('rego') diff --git a/sources_non_forked/ale/ale_linters/rego/opacheck.vim b/sources_non_forked/ale/ale_linters/rego/opacheck.vim new file mode 100644 index 00000000..77d8c93a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rego/opacheck.vim @@ -0,0 +1,56 @@ +" Description: opa check for rego files + +call ale#Set('rego_opacheck_executable', 'opa') +call ale#Set('rego_opacheck_options', '') + +function! ale_linters#rego#opacheck#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'rego_opacheck_executable') +endfunction + +function! ale_linters#rego#opacheck#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'rego_opacheck_options') + + return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer)) + \ . ' check %s --format json ' + \ . (!empty(l:options) ? ' ' . l:options : '') +endfunction + +function! ale_linters#rego#opacheck#Handle(buffer, lines) abort + let l:output = [] + + let l:errors = ale#util#FuzzyJSONDecode(a:lines, {'errors': []}) + let l:dir = expand('#' . a:buffer . ':p:h') + let l:file = expand('#' . a:buffer . ':p') + + for l:error in l:errors['errors'] + if has_key(l:error, 'location') + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:error['location']['file']), + \ 'lnum': l:error['location']['row'], + \ 'col': l:error['location']['col'], + \ 'text': l:error['message'], + \ 'code': l:error['code'], + \ 'type': 'E', + \}) + else + call add(l:output, { + \ 'filename': l:file, + \ 'lnum': 0, + \ 'col': 0, + \ 'text': l:error['message'], + \ 'code': l:error['code'], + \ 'type': 'E', + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('rego', { +\ 'name': 'opacheck', +\ 'output_stream': 'both', +\ 'executable': function('ale_linters#rego#opacheck#GetExecutable'), +\ 'command': function('ale_linters#rego#opacheck#GetCommand'), +\ 'callback': 'ale_linters#rego#opacheck#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/rst/cspell.vim b/sources_non_forked/ale/ale_linters/rst/cspell.vim new file mode 100644 index 00000000..14cfb42e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rst/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for ReStructuredText files. + +call ale#handlers#cspell#DefineLinter('rst') diff --git a/sources_non_forked/ale/ale_linters/ruby/cspell.vim b/sources_non_forked/ale/ale_linters/ruby/cspell.vim new file mode 100644 index 00000000..780356b1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Ruby files. + +call ale#handlers#cspell#DefineLinter('ruby') diff --git a/sources_non_forked/ale/ale_linters/ruby/reek.vim b/sources_non_forked/ale/ale_linters/ruby/reek.vim index 226b452e..b6fa9d76 100644 --- a/sources_non_forked/ale/ale_linters/ruby/reek.vim +++ b/sources_non_forked/ale/ale_linters/ruby/reek.vim @@ -19,6 +19,10 @@ function! ale_linters#ruby#reek#GetCommand(buffer, version) abort \ . l:display_name_args endfunction +function! s:GetDocumentationLink(error) abort + return get(a:error, 'documentation_link', get(a:error, 'wiki_link', '')) +endfunction + function! s:BuildText(buffer, error) abort let l:parts = [] @@ -29,7 +33,7 @@ function! s:BuildText(buffer, error) abort call add(l:parts, a:error.message) if ale#Var(a:buffer, 'ruby_reek_show_wiki_link') - call add(l:parts, '[' . a:error.wiki_link . ']') + call add(l:parts, '[' . s:GetDocumentationLink(a:error) . ']') endif return join(l:parts, ' ') diff --git a/sources_non_forked/ale/ale_linters/rust/analyzer.vim b/sources_non_forked/ale/ale_linters/rust/analyzer.vim index 77d946f7..3ead3871 100644 --- a/sources_non_forked/ale/ale_linters/rust/analyzer.vim +++ b/sources_non_forked/ale/ale_linters/rust/analyzer.vim @@ -9,9 +9,21 @@ function! ale_linters#rust#analyzer#GetCommand(buffer) abort endfunction function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort + " Try to find nearest Cargo.toml for cargo projects let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') - return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : '' + if !empty(l:cargo_file) + return fnamemodify(l:cargo_file, ':h') + endif + + " Try to find nearest rust-project.json for non-cargo projects + let l:rust_project = ale#path#FindNearestFile(a:buffer, 'rust-project.json') + + if !empty(l:rust_project) + return fnamemodify(l:rust_project, ':h') + endif + + return '' endfunction call ale#linter#Define('rust', { diff --git a/sources_non_forked/ale/ale_linters/rust/cspell.vim b/sources_non_forked/ale/ale_linters/rust/cspell.vim new file mode 100644 index 00000000..d2523c7d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rust/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Rust files. + +call ale#handlers#cspell#DefineLinter('rust') diff --git a/sources_non_forked/ale/ale_linters/rust/rustc.vim b/sources_non_forked/ale/ale_linters/rust/rustc.vim index f140b58b..bc6431ba 100644 --- a/sources_non_forked/ale/ale_linters/rust/rustc.vim +++ b/sources_non_forked/ale/ale_linters/rust/rustc.vim @@ -1,7 +1,7 @@ " Author: Daniel Schemala " Description: rustc for rust files -call ale#Set('rust_rustc_options', '-Z no-codegen') +call ale#Set('rust_rustc_options', '--emit=mir -o /dev/null') function! ale_linters#rust#rustc#RustcCommand(buffer) abort " Try to guess the library search path. If the project is managed by cargo, diff --git a/sources_non_forked/ale/ale_linters/scala/cspell.vim b/sources_non_forked/ale/ale_linters/scala/cspell.vim new file mode 100644 index 00000000..fa09d420 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scala/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Scala files. + +call ale#handlers#cspell#DefineLinter('scala') diff --git a/sources_non_forked/ale/ale_linters/sh/cspell.vim b/sources_non_forked/ale/ale_linters/sh/cspell.vim new file mode 100644 index 00000000..e3c5a6f0 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sh/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for shell scripts. + +call ale#handlers#cspell#DefineLinter('sh') diff --git a/sources_non_forked/ale/ale_linters/swift/cspell.vim b/sources_non_forked/ale/ale_linters/swift/cspell.vim new file mode 100644 index 00000000..25451e9d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Swift files. + +call ale#handlers#cspell#DefineLinter('swift') diff --git a/sources_non_forked/ale/ale_linters/terraform/checkov.vim b/sources_non_forked/ale/ale_linters/terraform/checkov.vim new file mode 100644 index 00000000..568b46e1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/checkov.vim @@ -0,0 +1,41 @@ +" Author: Thyme-87 +" Description: use checkov for providing warnings via ale + +call ale#Set('terraform_checkov_executable', 'checkov') +call ale#Set('terraform_checkov_options', '') + +function! ale_linters#terraform#checkov#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'terraform_checkov_executable') +endfunction + +function! ale_linters#terraform#checkov#GetCommand(buffer) abort + return '%e ' . '-f %t -o json --quiet ' . ale#Var(a:buffer, 'terraform_checkov_options') +endfunction + +function! ale_linters#terraform#checkov#Handle(buffer, lines) abort + let l:output = [] + + let l:results = get(get(ale#util#FuzzyJSONDecode(a:lines, {}), 'results', []), 'failed_checks', []) + + for l:violation in l:results + call add(l:output, { + \ 'filename': l:violation['file_path'], + \ 'lnum': l:violation['file_line_range'][0], + \ 'end_lnum': l:violation['file_line_range'][1], + \ 'text': l:violation['check_name'] . ' [' . l:violation['check_id'] . ']', + \ 'detail': l:violation['check_id'] . ': ' . l:violation['check_name'] . "\n" . + \ 'For more information, see: '. l:violation['guideline'], + \ 'type': 'W', + \ }) + endfor + + return l:output +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'checkov', +\ 'output_stream': 'stdout', +\ 'executable': function('ale_linters#terraform#checkov#GetExecutable'), +\ 'command': function('ale_linters#terraform#checkov#GetCommand'), +\ 'callback': 'ale_linters#terraform#checkov#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform.vim b/sources_non_forked/ale/ale_linters/terraform/terraform.vim index cf134460..1beb8501 100644 --- a/sources_non_forked/ale/ale_linters/terraform/terraform.vim +++ b/sources_non_forked/ale/ale_linters/terraform/terraform.vim @@ -21,7 +21,13 @@ function! ale_linters#terraform#terraform#GetType(severity) abort endfunction function! ale_linters#terraform#terraform#GetDetail(error) abort - return get(a:error, 'detail', get(a:error, 'summary', '')) + let l:detail = get(a:error, 'detail', '') + + if strlen(l:detail) > 0 + return l:detail + else + return get(a:error, 'summary', '') + endif endfunction function! ale_linters#terraform#terraform#Handle(buffer, lines) abort diff --git a/sources_non_forked/ale/ale_linters/tex/cspell.vim b/sources_non_forked/ale/ale_linters/tex/cspell.vim new file mode 100644 index 00000000..4cf2b08e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for TeX files. + +call ale#handlers#cspell#DefineLinter('tex') diff --git a/sources_non_forked/ale/ale_linters/tex/texlab.vim b/sources_non_forked/ale/ale_linters/tex/texlab.vim index 0794bf51..8e96b80b 100644 --- a/sources_non_forked/ale/ale_linters/tex/texlab.vim +++ b/sources_non_forked/ale/ale_linters/tex/texlab.vim @@ -4,6 +4,7 @@ call ale#Set('tex_texlab_executable', 'texlab') call ale#Set('tex_texlab_options', '') +call ale#Set('tex_texlab_config', {}) function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') @@ -21,4 +22,5 @@ call ale#linter#Define('tex', { \ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')}, \ 'command': function('ale_linters#tex#texlab#GetCommand'), \ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'), +\ 'lsp_config': {b -> ale#Var(b, 'tex_texlab_config')}, \}) diff --git a/sources_non_forked/ale/ale_linters/texinfo/cspell.vim b/sources_non_forked/ale/ale_linters/texinfo/cspell.vim new file mode 100644 index 00000000..d691b3a7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/texinfo/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for TeXInfo files. + +call ale#handlers#cspell#DefineLinter('texinfo') diff --git a/sources_non_forked/ale/ale_linters/text/cspell.vim b/sources_non_forked/ale/ale_linters/text/cspell.vim new file mode 100644 index 00000000..813ef3b8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/text/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for general text files. + +call ale#handlers#cspell#DefineLinter('text') diff --git a/sources_non_forked/ale/ale_linters/typescript/cspell.vim b/sources_non_forked/ale/ale_linters/typescript/cspell.vim new file mode 100644 index 00000000..6061b75c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for TypeScript files. + +call ale#handlers#cspell#DefineLinter('typescript') diff --git a/sources_non_forked/ale/ale_linters/vue/cspell.vim b/sources_non_forked/ale/ale_linters/vue/cspell.vim new file mode 100644 index 00000000..2d8bfdc3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vue/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for Vue files. + +call ale#handlers#cspell#DefineLinter('vue') diff --git a/sources_non_forked/ale/ale_linters/vue/volar.vim b/sources_non_forked/ale/ale_linters/vue/volar.vim new file mode 100644 index 00000000..360b1aa5 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vue/volar.vim @@ -0,0 +1,80 @@ +" Author: Arnold Chand +" Description: Volar Language Server integration for ALE adopted from +" nvim-lspconfig and volar/packages/shared/src/types.ts + +call ale#Set('vue_volar_executable', 'volar-server') +call ale#Set('vue_volar_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('vue_volar_init_options', { +\ 'documentFeatures': { +\ 'documentColor': v:false, +\ 'documentFormatting': { +\ 'defaultPrintWidth': 100, +\ }, +\ 'documentSymbol': v:true, +\ 'foldingRange': v:true, +\ 'linkedEditingRange': v:true, +\ 'selectionRange': v:true, +\ }, +\ 'languageFeatures': { +\ 'callHierarchy': v:true, +\ 'codeAction': v:true, +\ 'codeLens': v:true, +\ 'completion': { +\ 'defaultAttrNameCase': 'kebabCase', +\ 'defaultTagNameCase': 'both', +\ 'getDocumentNameCaseRequest': v:false, +\ 'getDocumentSelectionRequest': v:false, +\ }, +\ 'definition': v:true, +\ 'diagnostics': v:true, +\ 'documentHighlight': v:true, +\ 'documentLink': v:true, +\ 'hover': v:true, +\ 'references': v:true, +\ 'rename': v:true, +\ 'renameFileRefactoring': v:true, +\ 'schemaRequestService': v:true, +\ 'semanticTokens': v:false, +\ 'signatureHelp': v:true, +\ 'typeDefinition': v:true, +\ 'workspaceSymbol': v:false, +\ }, +\ 'typescript': { +\ 'serverPath': '', +\ 'localizedPath': v:null, +\ }, +\}) + +function! ale_linters#vue#volar#GetProjectRoot(buffer) abort + let l:project_roots = ['package.json', 'vite.config.js', '.git', bufname(a:buffer)] + + for l:project_root in l:project_roots + let l:nearest_filepath = ale#path#FindNearestFile(a:buffer, l:project_root) + + if !empty(l:nearest_filepath) + return fnamemodify(l:nearest_filepath, ':h') + endif + endfor + + return '' +endfunction + +function! ale_linters#vue#volar#GetInitializationOptions(buffer) abort + let l:tsserver_path = ale#path#FindNearestExecutable(a:buffer, [ + \ 'node_modules/typescript/lib/tsserverlibrary.js' + \ ]) + let l:init_options = ale#Var(a:buffer, 'vue_volar_init_options') + let l:init_options.typescript.serverPath = l:tsserver_path + + return l:init_options +endfunction + +call ale#linter#Define('vue', { +\ 'name': 'volar', +\ 'language': 'vue', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/volar-server'])}, +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#vue#volar#GetProjectRoot'), +\ 'initialization_options': function('ale_linters#vue#volar#GetInitializationOptions'), +\}) diff --git a/sources_non_forked/ale/ale_linters/wgsl/naga.vim b/sources_non_forked/ale/ale_linters/wgsl/naga.vim new file mode 100644 index 00000000..2816751b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/wgsl/naga.vim @@ -0,0 +1,12 @@ +" Author: rhysd +" Description: naga-cli linter for WGSL syntax. + +call ale#Set('wgsl_naga_executable', 'naga') + +call ale#linter#Define('wgsl', { +\ 'name': 'naga', +\ 'executable': {b -> ale#Var(b, 'wgsl_naga_executable')}, +\ 'output_stream': 'stderr', +\ 'command': {b -> '%e --stdin-file-path %s'}, +\ 'callback': 'ale#handlers#naga#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/xhtml/cspell.vim b/sources_non_forked/ale/ale_linters/xhtml/cspell.vim new file mode 100644 index 00000000..c465b41b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/xhtml/cspell.vim @@ -0,0 +1,5 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: cspell support for XHTML files. + +call ale#handlers#cspell#DefineLinter('xhtml') diff --git a/sources_non_forked/ale/ale_linters/yaml/actionlint.vim b/sources_non_forked/ale/ale_linters/yaml/actionlint.vim new file mode 100644 index 00000000..e51cf5f0 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/actionlint.vim @@ -0,0 +1,10 @@ +" Author: bretello + +call ale#Set('yaml_actionlint_executable', 'actionlint') + +call ale#linter#Define('yaml', { +\ 'name': 'actionlint', +\ 'executable': {b -> ale#Var(b, 'yaml_actionlint_executable')}, +\ 'command': function('ale#handlers#actionlint#GetCommand'), +\ 'callback': 'ale#handlers#actionlint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/yaml/ls.vim b/sources_non_forked/ale/ale_linters/yaml/ls.vim new file mode 100644 index 00000000..8e3f6d00 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/ls.vim @@ -0,0 +1,34 @@ +" Author: Jeffrey Lau - https://github.com/zoonfafer +" Description: YAML Language Server https://github.com/redhat-developer/yaml-language-server + +call ale#Set('yaml_ls_executable', 'yaml-language-server') +call ale#Set('yaml_ls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('yaml_ls_config', {}) + +function! ale_linters#yaml#ls#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'yaml_ls', [ + \ 'node_modules/.bin/yaml-language-server', + \]) +endfunction + +function! ale_linters#yaml#ls#GetCommand(buffer) abort + let l:executable = ale_linters#yaml#ls#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' --stdio' +endfunction + +" Just use the current file +function! ale_linters#yaml#ls#FindProjectRoot(buffer) abort + let l:project_file = expand('#' . a:buffer . ':p') + + return fnamemodify(l:project_file, ':h') +endfunction + +call ale#linter#Define('yaml', { +\ 'name': 'yaml-language-server', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#yaml#ls#GetExecutable'), +\ 'command': function('ale_linters#yaml#ls#GetCommand'), +\ 'project_root': function('ale_linters#yaml#ls#FindProjectRoot'), +\ 'lsp_config': {b -> ale#Var(b, 'yaml_ls_config')}, +\}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 97483b45..029472ad 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -157,7 +157,7 @@ function! ale#Queue(delay, ...) abort endif endfunction -let s:current_ale_version = [3, 1, 0] +let s:current_ale_version = [3, 2, 0] " A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort diff --git a/sources_non_forked/ale/autoload/ale/code_action.vim b/sources_non_forked/ale/autoload/ale/code_action.vim index 917190be..60106a24 100644 --- a/sources_non_forked/ale/autoload/ale/code_action.vim +++ b/sources_non_forked/ale/autoload/ale/code_action.vim @@ -16,13 +16,12 @@ endfunction function! ale#code_action#HandleCodeAction(code_action, options) abort let l:current_buffer = bufnr('') let l:changes = a:code_action.changes - let l:should_save = get(a:options, 'should_save') for l:file_code_edit in l:changes call ale#code_action#ApplyChanges( \ l:file_code_edit.fileName, \ l:file_code_edit.textChanges, - \ l:should_save, + \ a:options, \) endfor endfunction @@ -63,29 +62,29 @@ function! s:ChangeCmp(left, right) abort return 0 endfunction -function! ale#code_action#ApplyChanges(filename, changes, should_save) abort - let l:current_buffer = bufnr('') +function! ale#code_action#ApplyChanges(filename, changes, options) abort + let l:should_save = get(a:options, 'should_save') + let l:conn_id = get(a:options, 'conn_id') + + let l:orig_buffer = bufnr('') + " The buffer is used to determine the fileformat, if available. let l:buffer = bufnr(a:filename) - let l:is_current_buffer = l:buffer > 0 && l:buffer == l:current_buffer - if l:buffer > 0 - let l:lines = getbufline(l:buffer, 1, '$') - - " Add empty line if there's trailing newline, like readfile() does. - if getbufvar(l:buffer, '&eol') - let l:lines += [''] - endif - else - let l:lines = readfile(a:filename, 'b') + if l:buffer != l:orig_buffer + call ale#util#Execute('silent edit ' . a:filename) + let l:buffer = bufnr('') endif - if l:is_current_buffer - let l:pos = getpos('.')[1:2] - else - let l:pos = [1, 1] + let l:lines = getbufline(l:buffer, 1, '$') + + " Add empty line if there's trailing newline, like readfile() does. + if getbufvar(l:buffer, '&eol') + let l:lines += [''] endif + let l:pos = getpos('.')[1:2] + " Changes have to be sorted so we apply them from bottom-to-top for l:code_edit in reverse(sort(copy(a:changes), function('s:ChangeCmp'))) let l:line = l:code_edit.start.line @@ -155,46 +154,25 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort endif endfor - if l:buffer > 0 - " Make sure ale#util#{Writefile,SetBufferContents} add trailing - " newline if and only if it should be added. - if l:lines[-1] is# '' && getbufvar(l:buffer, '&eol') - call remove(l:lines, -1) - else - call setbufvar(l:buffer, '&eol', 0) - endif - elseif exists('+fixeol') && &fixeol && l:lines[-1] is# '' - " Not in buffer, ale#util#Writefile can't check &eol and always adds - " newline if &fixeol: remove to prevent double trailing newline. + " Make sure to add a trailing newline if and only if it should be added. + if l:lines[-1] is# '' && getbufvar(l:buffer, '&eol') call remove(l:lines, -1) - endif - - if a:should_save || l:buffer < 0 - call ale#util#Writefile(l:buffer, l:lines, a:filename) else - call ale#util#SetBufferContents(l:buffer, l:lines) + call setbufvar(l:buffer, '&eol', 0) endif - if l:is_current_buffer - if a:should_save - call ale#util#Execute(':e!') - endif + call ale#util#SetBufferContents(l:buffer, l:lines) - call setpos('.', [0, l:pos[0], l:pos[1], 0]) + call ale#lsp#NotifyForChanges(l:conn_id, l:buffer) + + if l:should_save + call ale#util#Execute('silent w!') endif - if a:should_save && l:buffer > 0 && !l:is_current_buffer - " Set up a one-time use event that will delete itself to reload the - " buffer next time it's entered to view the changes made to it. - execute 'augroup ALECodeActionReloadGroup' . l:buffer - autocmd! + call setpos('.', [0, l:pos[0], l:pos[1], 0]) - execute printf( - \ 'autocmd BufEnter ' - \ . ' call ale#code_action#ReloadBuffer()', - \ l:buffer - \) - augroup END + if l:orig_buffer != l:buffer && bufexists(l:orig_buffer) + call ale#util#Execute('silent buf ' . string(l:orig_buffer)) endif endfunction @@ -300,7 +278,7 @@ function! ale#code_action#BuildChangesList(changes_map) abort endfor call add(l:changes, { - \ 'fileName': ale#path#FromURI(l:file_name), + \ 'fileName': ale#util#ToResource(l:file_name), \ 'textChanges': l:text_changes, \}) endfor diff --git a/sources_non_forked/ale/autoload/ale/codefix.vim b/sources_non_forked/ale/autoload/ale/codefix.vim index 853ee4e8..34ce3e15 100644 --- a/sources_non_forked/ale/autoload/ale/codefix.vim +++ b/sources_non_forked/ale/autoload/ale/codefix.vim @@ -391,8 +391,8 @@ function! s:OnReady( \ 'character': l:nearest_error.col - 1, \ }, \ 'end': { - \ 'line': l:nearest_error.end_lnum - 1, - \ 'character': l:nearest_error.end_col, + \ 'line': get(l:nearest_error, 'end_lnum', 1) - 1, + \ 'character': get(l:nearest_error, 'end_col', 0) \ }, \ }, \ }, @@ -457,7 +457,7 @@ function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort let [l:end_line, l:end_column] = getpos("'>")[1:2] endif - let l:column = min([l:column, len(getline(l:line))]) + let l:column = max([min([l:column, len(getline(l:line))]), 1]) let l:end_column = min([l:end_column, len(getline(l:end_line))]) let l:Callback = function( diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index e139feaa..bb664e03 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -16,7 +16,7 @@ onoremap (ale_show_completion_menu) let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100) let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', []) let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50) -let g:ale_completion_autoimport = get(g:, 'ale_completion_autoimport', 0) +let g:ale_completion_autoimport = get(g:, 'ale_completion_autoimport', 1) let g:ale_completion_tsserver_remove_warnings = get(g:, 'ale_completion_tsserver_remove_warnings', 0) let s:timer_id = -1 @@ -581,7 +581,7 @@ function! ale#completion#ParseLSPCompletions(response) abort continue endif - if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN + if get(l:item, 'insertTextFormat', s:LSP_INSERT_TEXT_FORMAT_PLAIN) is s:LSP_INSERT_TEXT_FORMAT_PLAIN \&& type(get(l:item, 'textEdit')) is v:t_dict let l:text = l:item.textEdit.newText elseif type(get(l:item, 'insertText')) is v:t_string @@ -776,7 +776,8 @@ function! s:OnReady(linter, lsp_details) abort if a:linter.lsp is# 'tsserver' if get(g:, 'ale_completion_tsserver_autoimport') is 1 - execute 'echom `g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.''' + " no-custom-checks + echom '`g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.' endif let l:message = ale#lsp#tsserver_message#Completions( @@ -911,7 +912,8 @@ function! ale#completion#Import() abort endif let [l:line, l:column] = getpos('.')[1:2] - let l:column = searchpos('\V' . escape(l:word, '/\'), 'bn', l:line)[1] + let l:column = searchpos('\V' . escape(l:word, '/\'), 'bnc', l:line)[1] + let l:column = l:column + len(l:word) - 1 if l:column isnot 0 let l:started = ale#completion#GetCompletions('ale-import', { diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index e8478e93..c83bbcb6 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -10,12 +10,21 @@ let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s') let s:cursor_timer = -1 +" A wrapper for echon so we can test messages we echo in Vader tests. +function! ale#cursor#Echom(message) abort + " no-custom-checks + exec "norm! :echom a:message\n" +endfunction + function! ale#cursor#TruncatedEcho(original_message) abort let l:message = a:original_message " Change tabs to spaces. let l:message = substitute(l:message, "\t", ' ', 'g') " Remove any newlines in the message. let l:message = substitute(l:message, "\n", '', 'g') + " Convert indentation groups into single spaces for better legibility when + " put on a single line + let l:message = substitute(l:message, ' \+', ' ', 'g') " We need to remember the setting for shortmess and reset it again. let l:shortmess_options = &l:shortmess @@ -27,7 +36,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort silent! setlocal shortmess+=T try - exec "norm! :echomsg l:message\n" + call ale#cursor#Echom(l:message) catch /^Vim\%((\a\+)\)\=:E523/ " Fallback into manual truncate (#1987) let l:winwidth = winwidth(0) @@ -87,7 +96,9 @@ function! ale#cursor#EchoCursorWarning(...) abort elseif get(l:info, 'echoed') " We'll only clear the echoed message when moving off errors once, " so we don't continually clear the echo line. - execute 'echo' + " + " no-custom-checks + echo let l:info.echoed = 0 endif endif @@ -150,7 +161,8 @@ function! s:ShowCursorDetailForItem(loc, options) abort " Clear the echo message if we manually displayed details. if !l:stay_here - execute 'echo' + " no-custom-checks + echo endif endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index efd52776..31f3078c 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -62,7 +62,8 @@ let s:global_variable_list = [ \] function! s:Echo(message) abort - execute 'echo a:message' + " no-custom-checks + echo a:message endfunction function! s:GetLinterVariables(filetype, exclude_linter_names) abort diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index 9574017b..fd6cd2e1 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -68,18 +68,27 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort for l:item in l:result if has_key(l:item, 'targetUri') " LocationLink items use targetUri - let l:filename = ale#path#FromURI(l:item.targetUri) + let l:uri = l:item.targetUri let l:line = l:item.targetRange.start.line + 1 let l:column = l:item.targetRange.start.character + 1 else " LocationLink items use uri - let l:filename = ale#path#FromURI(l:item.uri) + let l:uri = l:item.uri let l:line = l:item.range.start.line + 1 let l:column = l:item.range.start.character + 1 endif call ale#definition#UpdateTagStack() - call ale#util#Open(l:filename, l:line, l:column, l:options) + + let l:uri_handler = ale#uri#GetURIHandler(l:uri) + + if l:uri_handler is# v:null + let l:filename = ale#path#FromFileURI(l:uri) + call ale#util#Open(l:filename, l:line, l:column, l:options) + else + call l:uri_handler.OpenURILink(l:uri, l:line, l:column, l:options, a:conn_id) + endif + break endfor endif @@ -112,6 +121,12 @@ function! s:OnReady(line, column, options, capability, linter, lsp_details) abor \ a:line, \ a:column \) + elseif a:capability is# 'implementation' + let l:message = ale#lsp#tsserver_message#Implementation( + \ l:buffer, + \ a:line, + \ a:column + \) endif else " Send a message saying the buffer has changed first, or the @@ -125,6 +140,8 @@ function! s:OnReady(line, column, options, capability, linter, lsp_details) abor let l:message = ale#lsp#message#Definition(l:buffer, a:line, a:column) elseif a:capability is# 'typeDefinition' let l:message = ale#lsp#message#TypeDefinition(l:buffer, a:line, a:column) + elseif a:capability is# 'implementation' + let l:message = ale#lsp#message#Implementation(l:buffer, a:line, a:column) else " XXX: log here? return @@ -166,6 +183,14 @@ function! ale#definition#GoToType(options) abort endfor endfunction +function! ale#definition#GoToImpl(options) abort + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + call s:GoToLSPDefinition(l:linter, a:options, 'implementation') + endif + endfor +endfunction + function! ale#definition#GoToCommandHandler(command, ...) abort let l:options = {} @@ -191,6 +216,8 @@ function! ale#definition#GoToCommandHandler(command, ...) abort if a:command is# 'type' call ale#definition#GoToType(l:options) + elseif a:command is# 'implementation' + call ale#definition#GoToImpl(l:options) else call ale#definition#GoTo(l:options) endif diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 5b9b1fca..00789a2d 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -347,6 +347,12 @@ function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist) if has_key(l:old_item, 'end_lnum') let l:item.end_lnum = str2nr(l:old_item.end_lnum) + + " When the error ends after the end of the file, put it at the + " end. This is only done for the current buffer. + if l:item.bufnr == a:buffer && l:item.end_lnum > l:last_line_number + let l:item.end_lnum = l:last_line_number + endif endif if has_key(l:old_item, 'sub_type') diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim index 3568c117..b8350c79 100644 --- a/sources_non_forked/ale/autoload/ale/events.vim +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -156,4 +156,10 @@ function! ale#events#Init() abort endif endif augroup END + + augroup AleURISchemes + autocmd! + + autocmd BufNewFile,BufReadPre jdt://** call ale#uri#jdt#ReadJDTLink(expand('')) + augroup END endfunction diff --git a/sources_non_forked/ale/autoload/ale/filerename.vim b/sources_non_forked/ale/autoload/ale/filerename.vim new file mode 100644 index 00000000..ec20d279 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/filerename.vim @@ -0,0 +1,133 @@ +" Author: Dalius Dobravolskas +" Description: Rename file support for tsserver + +let s:filerename_map = {} + +" Used to get the rename map in tests. +function! ale#filerename#GetMap() abort + return deepcopy(s:filerename_map) +endfunction + +" Used to set the rename map in tests. +function! ale#filerename#SetMap(map) abort + let s:filerename_map = a:map +endfunction + +function! ale#filerename#ClearLSPData() abort + let s:filerename_map = {} +endfunction + +function! s:message(message) abort + call ale#util#Execute('echom ' . string(a:message)) +endfunction + +function! ale#filerename#HandleTSServerResponse(conn_id, response) abort + if get(a:response, 'command', '') isnot# 'getEditsForFileRename' + return + endif + + if !has_key(s:filerename_map, a:response.request_seq) + return + endif + + let l:options = remove(s:filerename_map, a:response.request_seq) + + let l:old_name = l:options.old_name + let l:new_name = l:options.new_name + + if get(a:response, 'success', v:false) is v:false + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error renaming file "' . l:old_name . '" to "' . l:new_name + \ . '". Reason: ' . l:message) + + return + endif + + let l:changes = a:response.body + + if empty(l:changes) + call s:message('No changes while renaming "' . l:old_name . '" to "' . l:new_name . '"') + else + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'filerename', + \ 'changes': l:changes, + \ }, + \ { + \ 'should_save': 1, + \ }, + \) + endif + + silent! noautocmd execute 'saveas ' . l:new_name + call delete(l:old_name) +endfunction + +function! s:OnReady(options, linter, lsp_details) abort + let l:id = a:lsp_details.connection_id + + if !ale#lsp#HasCapability(l:id, 'filerename') + return + endif + + let l:buffer = a:lsp_details.buffer + + let l:Callback = function('ale#filerename#HandleTSServerResponse') + + call ale#lsp#RegisterCallback(l:id, l:Callback) + + let l:message = ale#lsp#tsserver_message#GetEditsForFileRename( + \ a:options.old_name, + \ a:options.new_name, + \) + + let l:request_id = ale#lsp#Send(l:id, l:message) + + let s:filerename_map[l:request_id] = a:options +endfunction + +function! s:ExecuteFileRename(linter, options) abort + let l:buffer = bufnr('') + + let l:Callback = function('s:OnReady', [a:options]) + call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) +endfunction + +function! ale#filerename#Execute() abort + let l:lsp_linters = [] + + for l:linter in ale#linter#Get(&filetype) + if l:linter.lsp is# 'tsserver' + call add(l:lsp_linters, l:linter) + endif + endfor + + if empty(l:lsp_linters) + call s:message('No active tsserver LSPs') + + return + endif + + let l:buffer = bufnr('') + let l:old_name = expand('#' . l:buffer . ':p') + let l:new_name = ale#util#Input('New file name: ', l:old_name, 'file') + + if l:old_name is# l:new_name + call s:message('New file name matches old file name') + + return + endif + + if empty(l:new_name) + call s:message('New name cannot be empty!') + + return + endif + + for l:lsp_linter in l:lsp_linters + call s:ExecuteFileRename(l:lsp_linter, { + \ 'old_name': l:old_name, + \ 'new_name': l:new_name, + \}) + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index 8ebba9fe..d9820847 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -77,7 +77,8 @@ function! ale#fix#ApplyFixes(buffer, output) abort call remove(g:ale_fix_buffer_data, a:buffer) if !l:data.ignore_file_changed_errors - execute 'echoerr ''The file was changed before fixing finished''' + " no-custom-checks + echoerr 'The file was changed before fixing finished' endif return @@ -358,7 +359,8 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort \ 'There is no fixer named `%s`. Check :ALEFixSuggest', \ l:function_name, \) - execute 'echom l:echo_message' + " no-custom-checks + echom l:echo_message endif return 0 @@ -366,7 +368,8 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort if empty(l:callback_list) if a:fixing_flag is# '' - execute 'echom ''No fixers have been defined. Try :ALEFixSuggest''' + " no-custom-checks + echom 'No fixers have been defined. Try :ALEFixSuggest' endif return 0 diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index c6764daf..2e772419 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -37,6 +37,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with black.', \ }, +\ 'buf-format': { +\ 'function': 'ale#fixers#buf_format#Fix', +\ 'suggested_filetypes': ['proto'], +\ 'description': 'Fix .proto files with buf format.', +\ }, \ 'buildifier': { \ 'function': 'ale#fixers#buildifier#Fix', \ 'suggested_filetypes': ['bzl'], @@ -191,6 +196,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['ruby'], \ 'description': 'Fix ruby files with standardrb --fix', \ }, +\ 'statix': { +\ 'function': 'ale#fixers#statix#Fix', +\ 'suggested_filetypes': ['nix'], +\ 'description': 'Fix common Nix antipatterns with statix fix', +\ }, \ 'stylelint': { \ 'function': 'ale#fixers#stylelint#Fix', \ 'suggested_filetypes': ['css', 'sass', 'scss', 'sugarss', 'stylus'], @@ -246,6 +256,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files with go fmt.', \ }, +\ 'gofumpt': { +\ 'function': 'ale#fixers#gofumpt#Fix', +\ 'suggested_filetypes': ['go'], +\ 'description': 'Fix Go files with gofumpt, a stricter go fmt.', +\ }, \ 'goimports': { \ 'function': 'ale#fixers#goimports#Fix', \ 'suggested_filetypes': ['go'], @@ -421,6 +436,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['hcl', 'terraform'], \ 'description': 'Fix tf and hcl files with terraform fmt.', \ }, +\ 'packer': { +\ 'function': 'ale#fixers#packer#Fix', +\ 'suggested_filetypes': ['hcl', 'packer'], +\ 'description': 'Fix Packer HCL files with packer fmt.', +\ }, +\ 'crystal': { +\ 'function': 'ale#fixers#crystal#Fix', +\ 'suggested_filetypes': ['cr'], +\ 'description': 'Fix cr (crystal).', +\ }, \ 'ktlint': { \ 'function': 'ale#fixers#ktlint#Fix', \ 'suggested_filetypes': ['kt', 'kotlin'], @@ -481,6 +506,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['lua'], \ 'description': 'Fix Lua files with luafmt.', \ }, +\ 'dprint': { +\ 'function': 'ale#fixers#dprint#Fix', +\ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'markdown'], +\ 'description': 'Pluggable and configurable code formatting platform', +\ }, \ 'stylua': { \ 'function': 'ale#fixers#stylua#Fix', \ 'suggested_filetypes': ['lua'], @@ -501,10 +531,20 @@ let s:default_registry = { \ 'suggested_filetypes': ['pascal'], \ 'description': 'Fix Pascal files with ptop.', \ }, +\ 'opafmt': { +\ 'function': 'ale#fixers#opafmt#Fix', +\ 'suggested_filetypes': ['rego'], +\ 'description': 'Fix rego files with opa fmt.', +\ }, \ 'vfmt': { \ 'function': 'ale#fixers#vfmt#Fix', \ 'suggested_filetypes': ['v'], \ 'description': 'A formatter for V source code.', +\ }, +\ 'zigfmt': { +\ 'function': 'ale#fixers#zigfmt#Fix', +\ 'suggested_filetypes': ['zig'], +\ 'description': 'Official formatter for Zig', \ } \} diff --git a/sources_non_forked/ale/autoload/ale/fixers/buf_format.vim b/sources_non_forked/ale/autoload/ale/fixers/buf_format.vim new file mode 100644 index 00000000..c2c156b7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/buf_format.vim @@ -0,0 +1,12 @@ +" Author: Alex McKinney +" Description: Run buf format. + +call ale#Set('proto_buf_format_executable', 'buf') + +function! ale#fixers#buf_format#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'proto_buf_format_executable') + + return { + \ 'command': ale#Escape(l:executable) . ' format %t', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/crystal.vim b/sources_non_forked/ale/autoload/ale/fixers/crystal.vim new file mode 100644 index 00000000..4ba702ba --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/crystal.vim @@ -0,0 +1,14 @@ +call ale#Set('crystal_format_executable', 'crystal') +call ale#Set('crystal_format_options', '') + +function! ale#fixers#crystal#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'crystal_format_executable') + let l:options = ale#Var(a:buffer, 'crystal_format_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' tool format' + \ . ale#Pad(l:options) + \ . ' -' + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dprint.vim b/sources_non_forked/ale/autoload/ale/fixers/dprint.vim new file mode 100644 index 00000000..99e590df --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dprint.vim @@ -0,0 +1,29 @@ +call ale#Set('dprint_executable', 'dprint') +call ale#Set('dprint_executable_override', 0) +call ale#Set('dprint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('dprint_options', '') +call ale#Set('dprint_config', 'dprint.json') + +function! ale#fixers#dprint#Fix(buffer) abort + let l:executable = ale#path#FindExecutable(a:buffer, 'dprint', ['dprint']) + let l:executable_override = ale#Var(a:buffer, 'dprint_executable_override') + + if !executable(l:executable) && !l:executable_override + return 0 + endif + + let l:options = ale#Var(a:buffer, 'dprint_options') + let l:config = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'dprint_config')) + + if !empty(l:config) + let l:options = l:options . ' -c ' . ale#Escape(l:config) + endif + + let l:options = l:options . ' --stdin %s' + + return { + \ 'command': ale#Escape(l:executable) + \ . ' fmt ' + \ . l:options + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/gofumpt.vim b/sources_non_forked/ale/autoload/ale/fixers/gofumpt.vim new file mode 100644 index 00000000..99753209 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/gofumpt.vim @@ -0,0 +1,17 @@ +" Author: David Houston +" Description: A stricter gofmt implementation. + +call ale#Set('go_gofumpt_executable', 'gofumpt') +call ale#Set('go_gofumpt_options', '') + +function! ale#fixers#gofumpt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'go_gofumpt_executable') + let l:options = ale#Var(a:buffer, 'go_gofumpt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ale#Pad(l:options) + \ . ' -w -- %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/opafmt.vim b/sources_non_forked/ale/autoload/ale/fixers/opafmt.vim new file mode 100644 index 00000000..a0999b70 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/opafmt.vim @@ -0,0 +1,15 @@ +" Description: Fixer for rego files + +call ale#Set('opa_fmt_executable', 'opa') +call ale#Set('opa_fmt_options', '') + +function! ale#fixers#opafmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'opa_fmt_executable') + let l:options = ale#Var(a:buffer, 'opa_fmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' fmt' + \ . (empty(l:options) ? '' : ' ' . l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/packer.vim b/sources_non_forked/ale/autoload/ale/fixers/packer.vim new file mode 100644 index 00000000..8770550d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/packer.vim @@ -0,0 +1,17 @@ +" Author: Zhuoyun Wei +" Description: Fixer for Packer HCL files + +call ale#Set('packer_fmt_executable', 'packer') +call ale#Set('packer_fmt_options', '') + +function! ale#fixers#packer#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'packer_fmt_executable') + let l:options = ale#Var(a:buffer, 'packer_fmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' fmt' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' -' + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/statix.vim b/sources_non_forked/ale/autoload/ale/fixers/statix.vim new file mode 100644 index 00000000..5991c925 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/statix.vim @@ -0,0 +1,17 @@ +" Author: David Houston +" Description: Provide statix fix as a fixer for simple Nix antipatterns. + +call ale#Set('nix_statix_fix_executable', 'statix') +call ale#Set('nix_statix_fix_options', '') + +function! ale#fixers#statix#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'nix_statix_fix_executable') + let l:options = ale#Var(a:buffer, 'nix_statix_fix_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ale#Pad('fix') + \ . ale#Pad('--stdin') + \ . ale#Pad(l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim b/sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim index ffec18ef..0e8271ec 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/uncrustify.vim @@ -4,13 +4,30 @@ call ale#Set('c_uncrustify_executable', 'uncrustify') call ale#Set('c_uncrustify_options', '') +let s:languages = { +\ 'c': 'C', +\ 'cpp': 'CPP', +\ 'cs': 'CS', +\ 'objc': 'OC', +\ 'objcpp': 'OC+', +\ 'd': 'D', +\ 'java': 'JAVA', +\ 'vala': 'VALA', +\ 'p': 'PAWN', +\} + +function! ale#fixers#uncrustify#Language(buffer) abort + return get(s:languages, &filetype, 'C') +endfunction + 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) + \ . ' --no-backup ' + \ . '-l' . ale#Pad(ale#fixers#uncrustify#Language(a:buffer)) + \ . ale#Pad(l:options) \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/zigfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/zigfmt.vim new file mode 100644 index 00000000..b22e5b83 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/zigfmt.vim @@ -0,0 +1,14 @@ +scriptencoding utf-8 +" Author: Arash Mousavi +" Description: Official formatter for Zig. + +call ale#Set('zig_zigfmt_executable', 'zig') + +function! ale#fixers#zigfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'zig_zigfmt_executable') + + return { + \ 'command': ale#Escape(l:executable) . ' fmt %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/floating_preview.vim b/sources_non_forked/ale/autoload/ale/floating_preview.vim index f0bc8f80..e953c363 100644 --- a/sources_non_forked/ale/autoload/ale/floating_preview.vim +++ b/sources_non_forked/ale/autoload/ale/floating_preview.vim @@ -7,7 +7,8 @@ function! ale#floating_preview#Show(lines, ...) abort if !exists('*nvim_open_win') && !has('popupwin') - execute 'echom ''Floating windows not supported in this vim instance.''' + " no-custom-checks + echom 'Floating windows not supported in this vim instance.' return endif diff --git a/sources_non_forked/ale/autoload/ale/handlers/actionlint.vim b/sources_non_forked/ale/autoload/ale/handlers/actionlint.vim new file mode 100644 index 00000000..9a6f1909 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/actionlint.vim @@ -0,0 +1,24 @@ +function! ale#handlers#actionlint#GetCommand(buffer) abort + return '%e --no-color --oneline %t' +endfunction + +function! ale#handlers#actionlint#Handle(buffer, lines) abort + " Matches patterns line the following: + ".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax] + let l:pattern = '\v^.*:(\d+):(\d+): (.+) \[(.+)\]$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \ 'code': l:match[4], + \ 'type': 'E', + \} + + call add(l:output, l:item) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/alex.vim b/sources_non_forked/ale/autoload/ale/handlers/alex.vim index 6ef4867f..1a92bd14 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/alex.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/alex.vim @@ -11,8 +11,9 @@ endfunction function! ale#handlers#alex#CreateCommandCallback(flags) abort return {b -> ale#node#Executable(b, ale#handlers#alex#GetExecutable(b)) - \ . ' %s ' - \ . a:flags} + \ . ' --stdin ' + \ . a:flags + \} endfunction function! ale#handlers#alex#Handle(buffer, lines) abort @@ -38,6 +39,7 @@ endfunction " Define a linter for a specific filetype. Accept flags to adapt to the filetype. " no flags treat input as markdown " --html treat input as HTML +" --mdx treat input as MDX " --text treat input as plaintext function! ale#handlers#alex#DefineLinter(filetype, flags) abort call ale#Set('alex_executable', 'alex') @@ -49,6 +51,5 @@ function! ale#handlers#alex#DefineLinter(filetype, flags) abort \ 'command': ale#handlers#alex#CreateCommandCallback(a:flags), \ 'output_stream': 'stderr', \ 'callback': 'ale#handlers#alex#Handle', - \ 'lint_file': 1, \}) endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim index a07d0aed..150bb007 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim @@ -19,6 +19,18 @@ function! ale#handlers#cppcheck#GetBufferPathIncludeOptions(buffer) abort endfunction function! ale#handlers#cppcheck#GetCompileCommandsOptions(buffer) abort + " The compile_commands.json doesn't apply to headers and cppheck will + " bail out if it cannot find a file matching the filter, below. Skip out + " now, for headers. Also, suppress FPs; cppcheck is not meant to + " process lone header files. + let b:buffer_name = bufname(a:buffer) + let b:file_extension = fnamemodify(b:buffer_name, ':e') + + if b:file_extension is# 'h' || b:file_extension is# 'hpp' + return ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) + \ . ' --suppress=unusedStructMember' + endif + " If the current buffer is modified, using compile_commands.json does no " good, so include the file's directory instead. It's not quite as good as " using --project, but is at least equivalent to running cppcheck on this @@ -35,8 +47,10 @@ function! ale#handlers#cppcheck#GetCompileCommandsOptions(buffer) abort " then use the file to set up import paths, etc. let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) + " By default, cppcheck processes every config in compile_commands.json. + " Use --file-filter to limit to just the buffer file. return !empty(l:json_path) - \ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ]) + \ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ]) . ' --file-filter=' . ale#Escape(bufname(a:buffer)) \ : '' endfunction @@ -50,7 +64,12 @@ function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort "test.cpp:974:{column}: error:{inconclusive:inconclusive} Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\ " n[3]=3; " ^ - let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(\w+)\]\' + " + "" OR if using the misra addon: + "test.c:1:16: style: misra violation (use --rule-texts= to get proper output) [misra-c2012-2.7]\' + "void test( int parm ) {} + " ^ + let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(%(\w[-.]?)+)\]\' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) diff --git a/sources_non_forked/ale/autoload/ale/handlers/cspell.vim b/sources_non_forked/ale/autoload/ale/handlers/cspell.vim new file mode 100644 index 00000000..2cd02d5c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/cspell.vim @@ -0,0 +1,54 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: Define a handler function for cspell's output + +function! ale#handlers#cspell#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, + \ 'cspell', [ + \ 'node_modules/.bin/cspell', + \ 'node_modules/cspell/bin.js', + \ ] + \) +endfunction + +function! ale#handlers#cspell#GetCommand(buffer) abort + let l:executable = ale#handlers#cspell#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'cspell_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . ' lint --no-color --no-progress --no-summary' + \ . ale#Pad(l:options) + \ . ' -- stdin' +endfunction + +function! ale#handlers#cspell#Handle(buffer, lines) abort + " Look for lines like the following: + " + " /home/user/repos/ale/README.md:723:48 - Unknown word (stylelint) + let l:pattern = '\v^.*:(\d+):(\d+) - (.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +function! ale#handlers#cspell#DefineLinter(filetype) abort + call ale#Set('cspell_executable', 'cspell') + call ale#Set('cspell_options', '') + call ale#Set('cspell_use_global', get(g:, 'ale_use_global_executables', 0)) + + call ale#linter#Define(a:filetype, { + \ 'name': 'cspell', + \ 'executable': function('ale#handlers#cspell#GetExecutable'), + \ 'command': function('ale#handlers#cspell#GetCommand'), + \ 'callback': 'ale#handlers#cspell#Handle', + \}) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/haskell.vim b/sources_non_forked/ale/autoload/ale/handlers/haskell.vim index 3613b1bb..70a3a7ea 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/haskell.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/haskell.vim @@ -19,6 +19,16 @@ let s:temp_regex_prefix = \ . substitute(s:temp_dir, '\\', '\\\\', 'g') \ . '\.\{-}' +function! s:PanicOutput(lines) abort + return [{ + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'ghc panic!', + \ 'type': 'E', + \ 'detail' : join(a:lines, "\n"), + \}] +endfunction + function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort " Look for lines like the following. " @@ -34,6 +44,14 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort let l:corrected_lines = [] + " If ghc panic error, put the whole message in details and exit. + let l:panic_position = match(a:lines,'ghc: panic!') + let l:panic_end = match(a:lines,'Please report this as a GHC bug:') + + if l:panic_position >= 0 + return s:PanicOutput(a:lines[l:panic_position : l:panic_end]) + endif + " Group the lines into smaller lists. for l:line in a:lines if len(matchlist(l:line, l:pattern)) > 0 diff --git a/sources_non_forked/ale/autoload/ale/handlers/naga.vim b/sources_non_forked/ale/autoload/ale/handlers/naga.vim new file mode 100644 index 00000000..6480aba6 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/naga.vim @@ -0,0 +1,30 @@ +" Author: rhysd +" Description: Handle errors for naga-cli. + +function! ale#handlers#naga#Handle(buffer, lines) abort + let l:errors = [] + let l:current_error = v:null + + for l:line in a:lines + if l:line =~# '^error: ' + let l:text = l:line[7:] + let l:current_error = { 'text': l:text, 'type': 'E' } + continue + endif + + if l:current_error isnot v:null + let l:matches = matchlist(l:line, '\v:(\d+):(\d+)$') + + if !empty(l:matches) + let l:current_error.lnum = str2nr(l:matches[1]) + let l:current_error.col = str2nr(l:matches[2]) + call add(l:errors, l:current_error) + let l:current_error = v:null + continue + endif + endif + endfor + + return l:errors +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/sml.vim b/sources_non_forked/ale/autoload/ale/handlers/sml.vim index f5365dd6..403b25fa 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/sml.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/sml.vim @@ -63,26 +63,35 @@ function! ale#handlers#sml#Handle(buffer, lines) abort let l:match2 = matchlist(l:line, l:pattern2) if len(l:match2) != 0 - call add(l:out, { - \ 'filename': l:match2[1], + if l:match2[1] =~# 'stdIn$' + let l:loc = {'bufnr': a:buffer} + else + let l:loc = {'filename': l:match2[1]} + endif + + call add(l:out, extend(l:loc, { \ 'lnum': l:match2[2] + 0, \ 'col' : l:match2[3] - 1, \ 'text': l:match2[4], \ 'type': l:match2[4] =~# '^Warning' ? 'W' : 'E', - \}) - + \})) continue endif let l:match = matchlist(l:line, l:pattern) if len(l:match) != 0 - call add(l:out, { - \ 'filename': l:match[1], + if l:match[1] =~# 'stdIn$' + let l:loc = {'bufnr': a:buffer} + else + let l:loc = {'filename': l:match[1]} + endif + + call add(l:out, extend(l:loc, { \ 'lnum': l:match[2] + 0, \ 'text': l:match[3] . ': ' . l:match[4], \ 'type': l:match[3] is# 'error' ? 'E' : 'W', - \}) + \})) continue endif endfor diff --git a/sources_non_forked/ale/autoload/ale/handlers/statix.vim b/sources_non_forked/ale/autoload/ale/handlers/statix.vim new file mode 100644 index 00000000..eeef4107 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/statix.vim @@ -0,0 +1,24 @@ +scriptencoding utf-8 +" Author: David Houston +" Description: This file defines a handler function for statix's errorformat +" output. + +function! ale#handlers#statix#Handle(buffer, lines) abort + " Look for lines like the following. + " + " flake.nix>46:13:W:3:This assignment is better written with `inherit` + let l:pattern = '\v^.*\>(\d+):(\d+):([A-Z]):(\d+):(.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3], + \ 'code': l:match[4], + \ 'text': l:match[5], + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/highlight.vim b/sources_non_forked/ale/autoload/ale/highlight.vim index 473ad354..c284f5ca 100644 --- a/sources_non_forked/ale/autoload/ale/highlight.vim +++ b/sources_non_forked/ale/autoload/ale/highlight.vim @@ -22,6 +22,26 @@ if !hlexists('ALEInfo') highlight link ALEInfo ALEWarning endif +if !hlexists('ALEVirtualTextError') + highlight link ALEVirtualTextError ALEError +endif + +if !hlexists('ALEVirtualTextStyleError') + highlight link ALEVirtualTextStyleError ALEVirtualTextError +endif + +if !hlexists('ALEVirtualTextWarning') + highlight link ALEVirtualTextWarning ALEWarning +endif + +if !hlexists('ALEVirtualTextStyleWarning') + highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning +endif + +if !hlexists('ALEVirtualTextInfo') + highlight link ALEVirtualTextInfo ALEVirtualTextWarning +endif + " The maximum number of items for the second argument of matchaddpos() let s:MAX_POS_VALUES = 8 let s:MAX_COL_SIZE = 1073741824 " pow(2, 30) diff --git a/sources_non_forked/ale/autoload/ale/hover.vim b/sources_non_forked/ale/autoload/ale/hover.vim index 4513c6ad..5b14df8c 100644 --- a/sources_non_forked/ale/autoload/ale/hover.vim +++ b/sources_non_forked/ale/autoload/ale/hover.vim @@ -46,7 +46,7 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort call balloon_show(a:response.body.displayString) elseif get(l:options, 'truncated_echo', 0) if !empty(a:response.body.displayString) - call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0]) + call ale#cursor#TruncatedEcho(a:response.body.displayString) endif elseif g:ale_hover_to_floating_preview || g:ale_floating_preview call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), { @@ -231,7 +231,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort \&& (l:set_balloons is 1 || l:set_balloons is# 'hover') call balloon_show(join(l:lines, "\n")) elseif get(l:options, 'truncated_echo', 0) - call ale#cursor#TruncatedEcho(l:lines[0]) + if type(l:lines[0]) is# v:t_list + call ale#cursor#TruncatedEcho(join(l:lines[0], '\n')) + else + call ale#cursor#TruncatedEcho(l:lines[0]) + endif elseif g:ale_hover_to_floating_preview || g:ale_floating_preview call ale#floating_preview#Show(l:lines, { \ 'filetype': 'ale-preview.message', diff --git a/sources_non_forked/ale/autoload/ale/job.vim b/sources_non_forked/ale/autoload/ale/job.vim index 14b3e484..b4a7a2e8 100644 --- a/sources_non_forked/ale/autoload/ale/job.vim +++ b/sources_non_forked/ale/autoload/ale/job.vim @@ -187,10 +187,16 @@ function! ale#job#PrepareCommand(buffer, command) abort \ : a:command " If a custom shell is specified, use that. - if exists('g:ale_shell') - let l:shell_arguments = get(g:, 'ale_shell_arguments', &shellcmdflag) + if exists('b:ale_shell') + let l:ale_shell = b:ale_shell + elseif exists('g:ale_shell') + let l:ale_shell = g:ale_shell + endif - return split(g:ale_shell) + split(l:shell_arguments) + [l:command] + if exists('l:ale_shell') + let l:shell_arguments = get(b:, 'ale_shell_arguments', get(g:, 'ale_shell_arguments', &shellcmdflag)) + + return split(l:ale_shell) + split(l:shell_arguments) + [l:command] endif if has('win32') diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index cbc79064..99faa357 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -19,6 +19,7 @@ let s:default_ale_linter_aliases = { \ 'rmd': 'r', \ 'systemverilog': 'verilog', \ 'typescriptreact': ['typescript', 'tsx'], +\ 'vader': ['vim', 'vader'], \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], @@ -45,15 +46,20 @@ let s:default_ale_linters = { \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], +\ 'json': ['jsonlint', 'spectral', 'vscodejson'], +\ 'json5': [], +\ 'jsonc': [], \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], \ 'rust': ['cargo', 'rls'], \ 'spec': [], \ 'text': [], +\ 'vader': ['vimls'], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], \ 'v': ['v'], +\ 'yaml': ['spectral', 'yaml-language-server', 'yamllint'], \} " Testing/debugging helper to unload all linters. diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index 089aa2c0..f10d0910 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -36,12 +36,22 @@ function! ale#list#IsQuickfixOpen() abort endfunction " Check if we should open the list, based on the save event being fired, and -" that setting being on, or the setting just being set to `1`. -function! s:ShouldOpen(buffer) abort +" that setting being on, or that the error count is at least as high as the +" setting when set to an integer value. +function! s:ShouldOpen(buffer, loclist_len) abort let l:val = ale#Var(a:buffer, 'open_list') let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0) - return l:val is 1 || (l:val is# 'on_save' && l:saved) + return l:val > 0 ? a:loclist_len >= l:val : l:val is# 'on_save' && l:saved +endfunction + +" Check if we should close the list, based on the save event being fired, and +" that setting being on, or the setting just being set to an integer value. +function! s:ShouldClose(buffer) abort + let l:val = ale#Var(a:buffer, 'open_list') + let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0) + + return !((l:val >= 1) || (l:val is# 'on_save' && l:saved)) endfunction function! s:Deduplicate(list) abort @@ -122,9 +132,9 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort " Open a window to show the problems if we need to. " - " We'll check if the current buffer's List is not empty here, so the - " window will only be opened if the current buffer has problems. - if s:ShouldOpen(a:buffer) && !empty(a:loclist) + " ShouldOpen() checks if the current buffer has enough problems to be + " opened. + if s:ShouldOpen(a:buffer, len(a:loclist)) let l:winnr = winnr() let l:mode = mode() @@ -212,8 +222,25 @@ function! ale#list#SetLists(buffer, loclist) abort endif endfunction +function! ale#list#ForcePopulateErrorList(populate_quickfix) abort + let l:quickfix_bak = g:ale_set_quickfix + let g:ale_set_quickfix = a:populate_quickfix + let l:loclist_bak = g:ale_set_loclist + let g:ale_set_loclist = !a:populate_quickfix + let l:open_list_bak = g:ale_open_list + let g:ale_open_list = 1 + + let l:buffer = bufnr('') + let l:loclist = get(g:ale_buffer_info, l:buffer, {'loclist': []}).loclist + call s:SetListsImpl(-1, l:buffer, l:loclist) + + let g:ale_open_list = l:open_list_bak + let g:ale_set_loclist = l:loclist_bak + let g:ale_set_quickfix = l:quickfix_bak +endfunction + function! s:CloseWindowIfNeeded(buffer) abort - if ale#Var(a:buffer, 'keep_list_window_open') || !s:ShouldOpen(a:buffer) + if ale#Var(a:buffer, 'keep_list_window_open') || s:ShouldClose(a:buffer) return endif diff --git a/sources_non_forked/ale/autoload/ale/lsp.vim b/sources_non_forked/ale/autoload/ale/lsp.vim index 75d81525..daaed6fa 100644 --- a/sources_non_forked/ale/autoload/ale/lsp.vim +++ b/sources_non_forked/ale/autoload/ale/lsp.vim @@ -38,11 +38,13 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort \ 'capabilities': { \ 'hover': 0, \ 'rename': 0, + \ 'filerename': 0, \ 'references': 0, \ 'completion': 0, \ 'completion_trigger_characters': [], \ 'definition': 0, \ 'typeDefinition': 0, + \ 'implementation': 0, \ 'symbol_search': 0, \ 'code_actions': 0, \ 'did_save': 0, @@ -258,6 +260,14 @@ function! s:UpdateCapabilities(conn, capabilities) abort let a:conn.capabilities.typeDefinition = 1 endif + if get(a:capabilities, 'implementationProvider') is v:true + let a:conn.capabilities.implementation = 1 + endif + + if type(get(a:capabilities, 'implementationProvider')) is v:t_dict + let a:conn.capabilities.implementation = 1 + endif + if get(a:capabilities, 'workspaceSymbolProvider') is v:true let a:conn.capabilities.symbol_search = 1 endif @@ -378,8 +388,10 @@ function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort let l:conn.capabilities.completion_trigger_characters = ['.'] let l:conn.capabilities.definition = 1 let l:conn.capabilities.typeDefinition = 1 + let l:conn.capabilities.implementation = 1 let l:conn.capabilities.symbol_search = 1 let l:conn.capabilities.rename = 1 + let l:conn.capabilities.filerename = 1 let l:conn.capabilities.code_actions = 1 endfunction @@ -436,11 +448,20 @@ function! s:SendInitMessage(conn) abort \ 'typeDefinition': { \ 'dynamicRegistration': v:false, \ }, + \ 'implementation': { + \ 'dynamicRegistration': v:false, + \ 'linkSupport': v:false, + \ }, \ 'publishDiagnostics': { \ 'relatedInformation': v:true, \ }, \ 'codeAction': { \ 'dynamicRegistration': v:false, + \ 'codeActionLiteralSupport': { + \ 'codeActionKind': { + \ 'valueSet': [] + \ } + \ } \ }, \ 'rename': { \ 'dynamicRegistration': v:false, @@ -465,6 +486,7 @@ function! ale#lsp#StartProgram(conn_id, executable, command) abort let l:options = { \ 'mode': 'raw', \ 'out_cb': {_, message -> ale#lsp#HandleMessage(a:conn_id, message)}, + \ 'exit_cb': { -> ale#lsp#Stop(a:conn_id) }, \} if has('win32') diff --git a/sources_non_forked/ale/autoload/ale/lsp/message.vim b/sources_non_forked/ale/autoload/ale/lsp/message.vim index b40c4407..c2238dec 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/message.vim @@ -35,7 +35,7 @@ function! ale#lsp#message#Initialize(root_path, options, capabilities) abort \ 'rootPath': a:root_path, \ 'capabilities': a:capabilities, \ 'initializationOptions': a:options, - \ 'rootUri': ale#path#ToURI(a:root_path), + \ 'rootUri': ale#util#ToURI(a:root_path), \}] endfunction @@ -56,7 +56,7 @@ function! ale#lsp#message#DidOpen(buffer, language_id) abort return [1, 'textDocument/didOpen', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ 'languageId': a:language_id, \ 'version': ale#lsp#message#GetNextVersionID(), \ 'text': join(l:lines, "\n") . "\n", @@ -70,21 +70,21 @@ function! ale#lsp#message#DidChange(buffer) abort " For changes, we simply send the full text of the document to the server. return [1, 'textDocument/didChange', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ 'version': ale#lsp#message#GetNextVersionID(), \ }, \ 'contentChanges': [{'text': join(l:lines, "\n") . "\n"}] \}] endfunction -function! ale#lsp#message#DidSave(buffer, includeText) abort +function! ale#lsp#message#DidSave(buffer, include_text) abort let l:response = [1, 'textDocument/didSave', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \}] - if a:includeText + if a:include_text let l:response[2].textDocument.version = ale#lsp#message#GetNextVersionID() let l:response[2].text = ale#util#GetBufferContents(a:buffer) endif @@ -95,7 +95,7 @@ endfunction function! ale#lsp#message#DidClose(buffer) abort return [1, 'textDocument/didClose', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \}] endfunction @@ -106,7 +106,7 @@ let s:COMPLETION_TRIGGER_CHARACTER = 2 function! ale#lsp#message#Completion(buffer, line, column, trigger_character) abort let l:message = [0, 'textDocument/completion', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] @@ -124,7 +124,7 @@ endfunction function! ale#lsp#message#Definition(buffer, line, column) abort return [0, 'textDocument/definition', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] @@ -133,7 +133,16 @@ endfunction function! ale#lsp#message#TypeDefinition(buffer, line, column) abort return [0, 'textDocument/typeDefinition', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \ 'position': {'line': a:line - 1, 'character': a:column - 1}, + \}] +endfunction + +function! ale#lsp#message#Implementation(buffer, line, column) abort + return [0, 'textDocument/implementation', { + \ 'textDocument': { + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] @@ -142,7 +151,7 @@ endfunction function! ale#lsp#message#References(buffer, line, column) abort return [0, 'textDocument/references', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \ 'context': {'includeDeclaration': v:false}, @@ -158,7 +167,7 @@ endfunction function! ale#lsp#message#Hover(buffer, line, column) abort return [0, 'textDocument/hover', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] @@ -173,7 +182,7 @@ endfunction function! ale#lsp#message#Rename(buffer, line, column, new_name) abort return [0, 'textDocument/rename', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \ 'newName': a:new_name, @@ -183,7 +192,7 @@ endfunction function! ale#lsp#message#CodeAction(buffer, line, column, end_line, end_column, diagnostics) abort return [0, 'textDocument/codeAction', { \ 'textDocument': { - \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'range': { \ 'start': {'line': a:line - 1, 'character': a:column - 1}, diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim index a4f80980..498ec508 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/response.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -59,7 +59,7 @@ function! ale#lsp#response#ReadDiagnostics(response) abort \ && l:diagnostic.relatedInformation isnot v:null let l:related = deepcopy(l:diagnostic.relatedInformation) call map(l:related, {key, val -> - \ ale#path#FromURI(val.location.uri) . + \ ale#util#ToResource(val.location.uri) . \ ':' . (val.location.range.start.line + 1) . \ ':' . (val.location.range.start.character + 1) . \ ":\n\t" . val.message diff --git a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim index 00213a75..02e57899 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim @@ -72,6 +72,14 @@ function! ale#lsp#tsserver_message#TypeDefinition(buffer, line, column) abort \}] endfunction +function! ale#lsp#tsserver_message#Implementation(buffer, line, column) abort + return [0, 'ts@implementation', { + \ 'line': a:line, + \ 'offset': a:column, + \ 'file': expand('#' . a:buffer . ':p'), + \}] +endfunction + function! ale#lsp#tsserver_message#References(buffer, line, column) abort return [0, 'ts@references', { \ 'line': a:line, @@ -101,6 +109,14 @@ function! ale#lsp#tsserver_message#Rename( \}] endfunction +function! ale#lsp#tsserver_message#GetEditsForFileRename( +\ oldFilePath, newFilePath) abort + return [0, 'ts@getEditsForFileRename', { + \ 'oldFilePath': a:oldFilePath, + \ 'newFilePath': a:newFilePath, + \}] +endfunction + function! ale#lsp#tsserver_message#OrganizeImports(buffer) abort return [0, 'ts@organizeImports', { \ 'scope': { diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index 230b3141..39e3e322 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -11,6 +11,22 @@ endif " A Dictionary to track one-shot handlers for custom LSP requests let s:custom_handlers_map = get(s:, 'custom_handlers_map', {}) +" Clear LSP linter data for the linting engine. +function! ale#lsp_linter#ClearLSPData() abort + let s:lsp_linter_map = {} + let s:custom_handlers_map = {} +endfunction + +" Only for internal use. +function! ale#lsp_linter#GetLSPLinterMap() abort + return s:lsp_linter_map +endfunction + +" Just for tests. +function! ale#lsp_linter#SetLSPLinterMap(replacement_map) abort + let s:lsp_linter_map = a:replacement_map +endfunction + " Check if diagnostics for a particular linter should be ignored. function! s:ShouldIgnore(buffer, linter_name) abort " Ignore all diagnostics if LSP integration is disabled. @@ -33,7 +49,7 @@ endfunction function! s:HandleLSPDiagnostics(conn_id, response) abort let l:linter_name = s:lsp_linter_map[a:conn_id] - let l:filename = ale#path#FromURI(a:response.params.uri) + let l:filename = ale#util#ToResource(a:response.params.uri) let l:escaped_name = escape( \ fnameescape(l:filename), \ has('win32') ? '^' : '^,}]' @@ -466,8 +482,8 @@ function! s:CheckWithLSP(linter, details) abort " If this was a file save event, also notify the server of that. if a:linter.lsp isnot# 'tsserver' \&& getbufvar(l:buffer, 'ale_save_event_fired', 0) - \&& ale#lsp#HasCapability(l:buffer, 'did_save') - let l:include_text = ale#lsp#HasCapability(l:buffer, 'includeText') + \&& ale#lsp#HasCapability(l:id, 'did_save') + let l:include_text = ale#lsp#HasCapability(l:id, 'includeText') let l:save_message = ale#lsp#message#DidSave(l:buffer, l:include_text) let l:notified = ale#lsp#Send(l:id, l:save_message) != 0 endif @@ -477,17 +493,6 @@ function! ale#lsp_linter#CheckWithLSP(buffer, linter) abort return ale#lsp_linter#StartLSP(a:buffer, a:linter, function('s:CheckWithLSP')) endfunction -" Clear LSP linter data for the linting engine. -function! ale#lsp_linter#ClearLSPData() abort - let s:lsp_linter_map = {} - let s:custom_handlers_map = {} -endfunction - -" Just for tests. -function! ale#lsp_linter#SetLSPLinterMap(replacement_map) abort - let s:lsp_linter_map = a:replacement_map -endfunction - function! s:HandleLSPResponseToCustomRequests(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:custom_handlers_map, a:response.id) diff --git a/sources_non_forked/ale/autoload/ale/organize_imports.vim b/sources_non_forked/ale/autoload/ale/organize_imports.vim index e2b1c0d2..a6e77863 100644 --- a/sources_non_forked/ale/autoload/ale/organize_imports.vim +++ b/sources_non_forked/ale/autoload/ale/organize_imports.vim @@ -1,6 +1,6 @@ " Author: Jerko Steiner " Description: Organize imports support for tsserver -" + function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') isnot# 'organizeImports' return @@ -17,7 +17,10 @@ function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort \ 'description': 'Organize Imports', \ 'changes': l:file_code_edits, \ }, - \ {} + \ { + \ 'conn_id': a:conn_id, + \ 'should_save': !&hidden, + \ }, \) endfunction diff --git a/sources_non_forked/ale/autoload/ale/path.vim b/sources_non_forked/ale/autoload/ale/path.vim index c7bfd47e..cc5c6658 100644 --- a/sources_non_forked/ale/autoload/ale/path.vim +++ b/sources_non_forked/ale/autoload/ale/path.vim @@ -218,7 +218,7 @@ endfunction " Convert a filesystem path to a file:// URI " relatives paths will not be prefixed with the protocol. " For Windows paths, the `:` in C:\ etc. will not be percent-encoded. -function! ale#path#ToURI(path) abort +function! ale#path#ToFileURI(path) abort let l:has_drive_letter = a:path[1:2] is# ':\' return substitute( @@ -231,7 +231,7 @@ function! ale#path#ToURI(path) abort \) endfunction -function! ale#path#FromURI(uri) abort +function! ale#path#FromFileURI(uri) abort if a:uri[:6] is? 'file://' let l:encoded_path = a:uri[7:] elseif a:uri[:4] is? 'file:' diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim index 81cb06e0..4dc01798 100644 --- a/sources_non_forked/ale/autoload/ale/python.vim +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -26,6 +26,7 @@ function! ale#python#FindProjectRootIni(buffer) abort \|| filereadable(l:path . '/tox.ini') \|| filereadable(l:path . '/.pyre_configuration.local') \|| filereadable(l:path . '/mypy.ini') + \|| filereadable(l:path . '/.mypy.ini') \|| filereadable(l:path . '/pycodestyle.cfg') \|| filereadable(l:path . '/.flake8') \|| filereadable(l:path . '/.flake8rc') diff --git a/sources_non_forked/ale/autoload/ale/references.vim b/sources_non_forked/ale/autoload/ale/references.vim index 38ff0d3d..c32663fe 100644 --- a/sources_non_forked/ale/autoload/ale/references.vim +++ b/sources_non_forked/ale/autoload/ale/references.vim @@ -16,6 +16,23 @@ function! ale#references#ClearLSPData() abort let s:references_map = {} endfunction +function! ale#references#FormatTSResponseItem(response_item, options) abort + if get(a:options, 'open_in') is# 'quickfix' + return { + \ 'filename': a:response_item.file, + \ 'lnum': a:response_item.start.line, + \ 'col': a:response_item.start.offset, + \} + else + return { + \ 'filename': a:response_item.file, + \ 'line': a:response_item.start.line, + \ 'column': a:response_item.start.offset, + \ 'match': substitute(a:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', ''), + \} + endif +endfunction + function! ale#references#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') is# 'references' \&& has_key(s:references_map, a:response.request_seq) @@ -25,23 +42,43 @@ function! ale#references#HandleTSServerResponse(conn_id, response) abort let l:item_list = [] for l:response_item in a:response.body.refs - call add(l:item_list, { - \ 'filename': l:response_item.file, - \ 'line': l:response_item.start.line, - \ 'column': l:response_item.start.offset, - \ 'match': substitute(l:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', ''), - \}) + call add( + \ l:item_list, + \ ale#references#FormatTSResponseItem(l:response_item, l:options) + \) endfor if empty(l:item_list) call ale#util#Execute('echom ''No references found.''') else - call ale#preview#ShowSelection(l:item_list, l:options) + if get(l:options, 'open_in') is# 'quickfix' + call setqflist([], 'r') + call setqflist(l:item_list, 'a') + call ale#util#Execute('cc 1') + else + call ale#preview#ShowSelection(l:item_list, l:options) + endif endif endif endif endfunction +function! ale#references#FormatLSPResponseItem(response_item, options) abort + if get(a:options, 'open_in') is# 'quickfix' + return { + \ 'filename': ale#util#ToResource(a:response_item.uri), + \ 'lnum': a:response_item.range.start.line + 1, + \ 'col': a:response_item.range.start.character + 1, + \} + else + return { + \ 'filename': ale#util#ToResource(a:response_item.uri), + \ 'line': a:response_item.range.start.line + 1, + \ 'column': a:response_item.range.start.character + 1, + \} + endif +endfunction + function! ale#references#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:references_map, a:response.id) @@ -53,18 +90,22 @@ function! ale#references#HandleLSPResponse(conn_id, response) abort if type(l:result) is v:t_list for l:response_item in l:result - call add(l:item_list, { - \ 'filename': ale#path#FromURI(l:response_item.uri), - \ 'line': l:response_item.range.start.line + 1, - \ 'column': l:response_item.range.start.character + 1, - \}) + call add(l:item_list, + \ ale#references#FormatLSPResponseItem(l:response_item, l:options) + \) endfor endif if empty(l:item_list) call ale#util#Execute('echom ''No references found.''') else - call ale#preview#ShowSelection(l:item_list, l:options) + if get(l:options, 'open_in') is# 'quickfix' + call setqflist([], 'r') + call setqflist(l:item_list, 'a') + call ale#util#Execute('cc 1') + else + call ale#preview#ShowSelection(l:item_list, l:options) + endif endif endif endfunction @@ -119,6 +160,8 @@ function! ale#references#Find(...) abort let l:options.open_in = 'split' elseif l:option is? '-vsplit' let l:options.open_in = 'vsplit' + elseif l:option is? '-quickfix' + let l:options.open_in = 'quickfix' endif endfor endif diff --git a/sources_non_forked/ale/autoload/ale/rename.vim b/sources_non_forked/ale/autoload/ale/rename.vim index 9030618e..a722cc94 100644 --- a/sources_non_forked/ale/autoload/ale/rename.vim +++ b/sources_non_forked/ale/autoload/ale/rename.vim @@ -84,7 +84,8 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort \ 'changes': l:changes, \ }, \ { - \ 'should_save': 1, + \ 'conn_id': a:conn_id, + \ 'should_save': !&hidden, \ }, \) endfunction @@ -116,7 +117,8 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort \ 'changes': l:changes, \ }, \ { - \ 'should_save': 1, + \ 'conn_id': a:conn_id, + \ 'should_save': !&hidden, \ }, \) endif diff --git a/sources_non_forked/ale/autoload/ale/symbol.vim b/sources_non_forked/ale/autoload/ale/symbol.vim index ae4151ab..6c65f1b2 100644 --- a/sources_non_forked/ale/autoload/ale/symbol.vim +++ b/sources_non_forked/ale/autoload/ale/symbol.vim @@ -41,7 +41,7 @@ function! ale#symbol#HandleLSPResponse(conn_id, response) abort let l:location = l:response_item.location call add(l:item_list, { - \ 'filename': ale#path#FromURI(l:location.uri), + \ 'filename': ale#util#ToResource(l:location.uri), \ 'line': l:location.range.start.line + 1, \ 'column': l:location.range.start.character + 1, \ 'match': l:response_item.name, diff --git a/sources_non_forked/ale/autoload/ale/test.vim b/sources_non_forked/ale/autoload/ale/test.vim index 4d75d515..e03ecb65 100644 --- a/sources_non_forked/ale/autoload/ale/test.vim +++ b/sources_non_forked/ale/autoload/ale/test.vim @@ -62,25 +62,34 @@ function! ale#test#SetFilename(path) abort silent! noautocmd execute 'file ' . fnameescape(l:full_path) endfunction -function! s:RemoveModule(results) abort +function! RemoveNewerKeys(results) abort for l:item in a:results if has_key(l:item, 'module') call remove(l:item, 'module') endif + + if has_key(l:item, 'end_col') + call remove(l:item, 'end_col') + endif + + if has_key(l:item, 'end_lnum') + call remove(l:item, 'end_lnum') + endif endfor endfunction -" Return loclist data without the module string, only in newer Vim versions. -function! ale#test#GetLoclistWithoutModule() abort +" Return loclist data with only the keys supported by the lowest Vim versions. +function! ale#test#GetLoclistWithoutNewerKeys() abort let l:results = getloclist(0) - call s:RemoveModule(l:results) + call RemoveNewerKeys(l:results) return l:results endfunction -function! ale#test#GetQflistWithoutModule() abort +" Return quickfix data with only the keys supported by the lowest Vim versions. +function! ale#test#GetQflistWithoutNewerKeys() abort let l:results = getqflist() - call s:RemoveModule(l:results) + call RemoveNewerKeys(l:results) return l:results endfunction diff --git a/sources_non_forked/ale/autoload/ale/toggle.vim b/sources_non_forked/ale/autoload/ale/toggle.vim index 1311e527..122d6cc4 100644 --- a/sources_non_forked/ale/autoload/ale/toggle.vim +++ b/sources_non_forked/ale/autoload/ale/toggle.vim @@ -64,7 +64,8 @@ function! ale#toggle#ToggleBuffer(buffer) abort " Disabling ALE globally removes autocmd events, so we cannot enable " linting locally when linting is disabled globally if l:enabled && !g:ale_enabled - execute 'echom ''ALE cannot be enabled locally when disabled globally''' + " no-custom-checks + echom 'ALE cannot be enabled locally when disabled globally' return endif diff --git a/sources_non_forked/ale/autoload/ale/uri.vim b/sources_non_forked/ale/autoload/ale/uri.vim index e71c6340..d696f03d 100644 --- a/sources_non_forked/ale/autoload/ale/uri.vim +++ b/sources_non_forked/ale/autoload/ale/uri.vim @@ -25,3 +25,19 @@ function! ale#uri#Decode(value) abort \ 'g' \) endfunction + +let s:uri_handlers = { +\ 'jdt': { +\ 'OpenURILink': function('ale#uri#jdt#OpenJDTLink'), +\ } +\} + +function! ale#uri#GetURIHandler(uri) abort + for l:scheme in keys(s:uri_handlers) + if a:uri =~# '^'.l:scheme.'://' + return s:uri_handlers[scheme] + endif + endfor + + return v:null +endfunction diff --git a/sources_non_forked/ale/autoload/ale/uri/jdt.vim b/sources_non_forked/ale/autoload/ale/uri/jdt.vim new file mode 100644 index 00000000..46cea268 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/uri/jdt.vim @@ -0,0 +1,110 @@ +" Author: yoshi1123 +" Description: Functions for working with jdt:// URIs. + +function! s:OpenJDTLink(root, uri, line, column, options, result) abort + if has_key(a:result, 'error') + " no-custom-checks + echoerr a:result.error.message + + return + endif + + let l:contents = a:result['result'] + + if type(l:contents) is# type(v:null) + " no-custom-checks + echoerr 'File content not found' + endif + + " disable autocmd when opening buffer + autocmd! AleURISchemes + call ale#util#Open(a:uri, a:line, a:column, a:options) + autocmd AleURISchemes BufNewFile,BufReadPre jdt://** call ale#uri#jdt#ReadJDTLink(expand('')) + + if !empty(getbufvar(bufnr(''), 'ale_lsp_root', '')) + return + endif + + let b:ale_lsp_root = a:root + set filetype=java + + call setline(1, split(l:contents, '\n')) + call cursor(a:line, a:column) + normal! zz + + setlocal buftype=nofile nomodified nomodifiable readonly +endfunction + +" Load new buffer with jdt:// contents and jump to line and column. +function! ale#uri#jdt#OpenJDTLink(encoded_uri, line, column, options, conn_id) abort + let l:found_eclipselsp = v:false + + for l:linter in ale#linter#Get('java') + if l:linter.name is# 'eclipselsp' + let l:found_eclipselsp = v:true + endif + endfor + + if !l:found_eclipselsp + throw 'eclipselsp not running' + endif + + let l:root = a:conn_id[stridx(a:conn_id, ':')+1:] + let l:uri = a:encoded_uri + call ale#lsp_linter#SendRequest( + \ bufnr(''), + \ 'eclipselsp', + \ [0, 'java/classFileContents', {'uri': ale#util#ToURI(l:uri)}], + \ function('s:OpenJDTLink', [l:root, l:uri, a:line, a:column, a:options]) + \) +endfunction + +function! s:ReadClassFileContents(uri, result) abort + if has_key(a:result, 'error') + " no-custom-checks + echoerr a:result.error.message + + return + endif + + let l:contents = a:result['result'] + + if type(l:contents) is# type(v:null) + " no-custom-checks + echoerr 'File content not found' + endif + + call setline(1, split(l:contents, '\n')) + + setlocal buftype=nofile nomodified nomodifiable readonly +endfunction + +" Read jdt:// contents, as part of current project, into current buffer. +function! ale#uri#jdt#ReadJDTLink(encoded_uri) abort + if !empty(getbufvar(bufnr(''), 'ale_lsp_root', '')) + return + endif + + let l:linter_map = ale#lsp_linter#GetLSPLinterMap() + + for l:conn_id in keys(l:linter_map) + if l:linter_map[l:conn_id] is# 'eclipselsp' + let l:root = l:conn_id[stridx(l:conn_id, ':')+1:] + endif + endfor + + if l:root is# v:null + throw 'eclipselsp not running' + endif + + let l:uri = a:encoded_uri + let b:ale_lsp_root = l:root + set filetype=java + + call ale#lsp_linter#SendRequest( + \ bufnr(''), + \ 'eclipselsp', + \ [0, 'java/classFileContents', {'uri': ale#util#ToURI(l:uri)}], + \ function('s:ReadClassFileContents', [l:uri]) + \) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index ec9383ac..c884076a 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -25,7 +25,8 @@ function! ale#util#ShowMessage(string, ...) abort " We have to assume the user is using a monospace font. if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns) - execute 'echo a:string' + " no-custom-checks + echo a:string else call ale#preview#Show(split(a:string, "\n"), extend( \ { @@ -491,8 +492,12 @@ function! ale#util#FindItemAtCursor(buffer) abort return [l:info, l:loc] endfunction -function! ale#util#Input(message, value) abort - return input(a:message, a:value) +function! ale#util#Input(message, value, ...) abort + if a:0 > 0 + return input(a:message, a:value, a:1) + else + return input(a:message, a:value) + endif endfunction function! ale#util#HasBuflineApi() abort @@ -539,3 +544,31 @@ endfunction function! ale#util#GetBufferContents(buffer) abort return join(getbufline(a:buffer, 1, '$'), '\n') . '\n' endfunction + +function! ale#util#ToURI(resource) abort + let l:uri_handler = ale#uri#GetURIHandler(a:resource) + + if l:uri_handler is# v:null + " resource is a filesystem path + let l:uri = ale#path#ToFileURI(a:resource) + else + " resource is a URI + let l:uri = a:resource + endif + + return l:uri +endfunction + +function! ale#util#ToResource(uri) abort + let l:uri_handler = ale#uri#GetURIHandler(a:uri) + + if l:uri_handler is# v:null + " resource is a filesystem path + let l:resource = ale#path#FromFileURI(a:uri) + else + " resource is a URI + let l:resource = a:uri + endif + + return l:resource +endfunction diff --git a/sources_non_forked/ale/autoload/ale/virtualtext.vim b/sources_non_forked/ale/autoload/ale/virtualtext.vim index 598bc1bf..345deb70 100644 --- a/sources_non_forked/ale/autoload/ale/virtualtext.vim +++ b/sources_non_forked/ale/autoload/ale/virtualtext.vim @@ -18,26 +18,6 @@ elseif has('textprop') && has('popupwin') let s:has_virt_text = 1 endif -if !hlexists('ALEVirtualTextError') - highlight link ALEVirtualTextError ALEError -endif - -if !hlexists('ALEVirtualTextStyleError') - highlight link ALEVirtualTextStyleError ALEVirtualTextError -endif - -if !hlexists('ALEVirtualTextWarning') - highlight link ALEVirtualTextWarning ALEWarning -endif - -if !hlexists('ALEVirtualTextStyleWarning') - highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning -endif - -if !hlexists('ALEVirtualTextInfo') - highlight link ALEVirtualTextInfo ALEVirtualTextWarning -endif - function! ale#virtualtext#Clear() abort if !s:has_virt_text return diff --git a/sources_non_forked/ale/doc/ale-ada.txt b/sources_non_forked/ale/doc/ale-ada.txt index 0fc55a9c..80321dbb 100644 --- a/sources_non_forked/ale/doc/ale-ada.txt +++ b/sources_non_forked/ale/doc/ale-ada.txt @@ -2,6 +2,11 @@ ALE Ada Integration *ale-ada-options* +=============================================================================== +cspell *ale-ada-cspell* + +See |ale-cspell-options| + =============================================================================== gcc *ale-ada-gcc* diff --git a/sources_non_forked/ale/doc/ale-asciidoc.txt b/sources_non_forked/ale/doc/ale-asciidoc.txt index 86629fd4..dd8b12ff 100644 --- a/sources_non_forked/ale/doc/ale-asciidoc.txt +++ b/sources_non_forked/ale/doc/ale-asciidoc.txt @@ -2,6 +2,12 @@ ALE AsciiDoc Integration *ale-asciidoc-options* +=============================================================================== +cspell *ale-asciidoc-cspell* + +See |ale-cspell-options| + + =============================================================================== write-good *ale-asciidoc-write-good* diff --git a/sources_non_forked/ale/doc/ale-avra.txt b/sources_non_forked/ale/doc/ale-avra.txt new file mode 100644 index 00000000..a61913ad --- /dev/null +++ b/sources_non_forked/ale/doc/ale-avra.txt @@ -0,0 +1,26 @@ +=============================================================================== +ALE AVRA Integration *ale-avra-options* + + +=============================================================================== +avra *ale-avra-avra* + +g:ale_avra_avra_executable *g:ale_avra_avra_executable* + *b:ale_avra_avra_executable* + + Type: |String| + Default `'avra'` + + This variable can be changed to use different executable for AVRA. + + +g:ale_avra_avra_options *g:ale_avra_avra_options* + *b:ale_avra_avra_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to AVRA. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-bitbake.txt b/sources_non_forked/ale/doc/ale-bitbake.txt new file mode 100644 index 00000000..4c480fd4 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-bitbake.txt @@ -0,0 +1,31 @@ +=============================================================================== +ALE BitBake Integration *ale-bitbake-options* + + +=============================================================================== +oelint-adv *ale-bitbake-oelint_adv* + +g:ale_bitbake_oelint_adv_executable *g:ale_bitbake_oelint_adv_executable* + + Type: |String| + Default: `'oelint-adv'` + + This variable can be changed to use a different executable for oelint-adv. + +g:ale_bitbake_oelint_adv_options *g:ale_bitbake_oelint_adv_options* + + Type: |String| + Default: `''` + + This variable can be set to pass additional options to oelint-adv. + + g:ale_bitbake_oelint_adv_config *g:ale_bitbake_oelint_adv_config* + + Type: |String| + Default: `'.oelint.cfg'` + + This variable can be set to use a different config file. + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt index 3b9fbc44..bd8c4937 100644 --- a/sources_non_forked/ale/doc/ale-c.txt +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -352,6 +352,12 @@ g:ale_cpp_cquery_cache_directory *g:ale_c_cquery_cache_directory* cache. +=============================================================================== +cspell *ale-c-cspell* + +See |ale-cspell-options| + + =============================================================================== flawfinder *ale-c-flawfinder* diff --git a/sources_non_forked/ale/doc/ale-cmake.txt b/sources_non_forked/ale/doc/ale-cmake.txt index 602637b1..e44c328e 100644 --- a/sources_non_forked/ale/doc/ale-cmake.txt +++ b/sources_non_forked/ale/doc/ale-cmake.txt @@ -21,6 +21,25 @@ g:ale_cmake_cmakelint_options *g:ale_cmake_cmakelint_options* This variable can be set to pass additional options to cmakelint. +=============================================================================== +cmake-lint *ale-cmake-cmake-lint* + +g:ale_cmake_cmake_lint_executable *g:ale_cmake_cmake_lint_executable* + *b:ale_cmake_cmake_lint_executable* + Type: |String| + Default: `'cmake-lint'` + + This variable can be set to change the path the cmake-lint. + + +g:ale_cmake_cmake_lint_options *g:ale_cmake_cmake_lint_options* + *b:ale_cmake_cmake_lint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to cmake-lint. + + =============================================================================== cmake-format *ale-cmake-cmakeformat* diff --git a/sources_non_forked/ale/doc/ale-cpp.txt b/sources_non_forked/ale/doc/ale-cpp.txt index 17894e6e..1f079205 100644 --- a/sources_non_forked/ale/doc/ale-cpp.txt +++ b/sources_non_forked/ale/doc/ale-cpp.txt @@ -287,6 +287,21 @@ g:ale_cpp_cpplint_options *g:ale_cpp_cpplint_options* This variable can be changed to modify flags given to cpplint. +g:ale_c_cpplint_executable *g:ale_c_cpplint_executable* + *b:ale_c_cpplint_executable* + Type: |String| + Default: `'cpplint'` + + This variable can be changed to use a different executable for cpplint. + + +g:ale_c_cpplint_options *g:ale_c_cpplint_options* + *b:ale_c_cpplint_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to cpplint. + =============================================================================== cquery *ale-cpp-cquery* @@ -308,6 +323,12 @@ g:ale_cpp_cquery_cache_directory *g:ale_cpp_cquery_cache_directory* cache. +=============================================================================== +cspell *ale-cpp-cspell* + +See |ale-cspell-options| + + =============================================================================== flawfinder *ale-cpp-flawfinder* diff --git a/sources_non_forked/ale/doc/ale-cs.txt b/sources_non_forked/ale/doc/ale-cs.txt index bef495b9..26e2b023 100644 --- a/sources_non_forked/ale/doc/ale-cs.txt +++ b/sources_non_forked/ale/doc/ale-cs.txt @@ -90,6 +90,12 @@ g:ale_cs_csc_assemblies *g:ale_cs_csc_assemblies* \] < +=============================================================================== +cspell *ale-cs-cspell* + +See |ale-cspell-options| + + =============================================================================== dotnet-format *ale-cs-dotnet-format* diff --git a/sources_non_forked/ale/doc/ale-css.txt b/sources_non_forked/ale/doc/ale-css.txt index ff74b263..f5c240e8 100644 --- a/sources_non_forked/ale/doc/ale-css.txt +++ b/sources_non_forked/ale/doc/ale-css.txt @@ -2,6 +2,12 @@ ALE CSS Integration *ale-css-options* +=============================================================================== +cspell *ale-css-cspell* + +See |ale-cspell-options| + + =============================================================================== fecs *ale-css-fecs* @@ -43,5 +49,18 @@ g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global* See |ale-integrations-local-executables| +=============================================================================== +vscodecss *ale-css-vscode* + +Website: https://github.com/hrsh7th/vscode-langservers-extracted + +Installation +------------------------------------------------------------------------------- + +Install VSCode css language server either globally or locally: > + + npm install -g vscode-langservers-extracted +< + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-dart.txt b/sources_non_forked/ale/doc/ale-dart.txt index a046808b..4824e82e 100644 --- a/sources_non_forked/ale/doc/ale-dart.txt +++ b/sources_non_forked/ale/doc/ale-dart.txt @@ -87,39 +87,6 @@ g:ale_dart_format_options *g:ale_dart_format_options* This variable can be set to pass additional options to the dart format fixer. - -=============================================================================== -dartanalyzer *ale-dart-dartanalyzer* - -Installation -------------------------------------------------------------------------------- - -Install Dart via whatever means. `dartanalyzer` will be included in the SDK. - -You can add the SDK to `$PATH`, as described here: -https://www.dartlang.org/tools/sdk - -If you have installed Dart on Linux, you can also try the following: > - " Set the executable path for dartanalyzer to the absolute path to it. - let g:ale_dart_dartanalyzer_executable = '/usr/lib/dart/bin/dartanalyzer' -< -... or similarly for wherever your Dart SDK lives. This should work without -having to modify `$PATH`. - -ALE can only check for problems with `dartanalyzer` with the file on disk. -See |ale-lint-file-linters| - -Options -------------------------------------------------------------------------------- - -g:ale_dart_dartanalyzer_executable *g:ale_dart_dartanalyzer_executable* - *b:ale_dart_dartanalyzer_executable* - Type: |String| - Default: `'dartanalyzer'` - - This variable can be set to change the path to dartanalyzer. - - =============================================================================== dartfmt *ale-dart-dartfmt* diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index 3d0dd524..4b4b4c77 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -14,6 +14,7 @@ CONTENTS *ale-development-contents* 4.1. Writing Linter Tests.............|ale-development-linter-tests| 4.2. Writing Fixer Tests..............|ale-development-fixer-tests| 4.3. Running Tests in a Windows VM....|ale-development-windows-tests| + 5. Contributing.........................|ale-development-contributing| =============================================================================== 1. Introduction *ale-development-introduction* @@ -97,8 +98,8 @@ should also follow some additional rules designed to prevent mistakes. Some of these are reported with ALE's `custom-linting-rules` script. See |ale-development-tests|. -* Don't leave stray `:echo` lines in code. Use `execute 'echo' ...` if you must - echo something. +* Don't leave stray `:echo` lines in code. Write `" no-custom-checks` above + the line if you must echo something. * For strings use |is#| instead of |==#|, `is?` instead of `==?`, `isnot#` instead of `!=#`, and `isnot?` instead of `!=?`. This is because `'x' ==# 0` returns 1, while `'x' is# 0` returns 0, so you will experience fewer issues @@ -153,10 +154,10 @@ ALE runs tests with the following versions of Vim in the following environments. 1. Vim 8.0.0027 on Linux via GitHub Actions. -2. Vim 8.2.2401 on Linux via GitHub Actions. +2. Vim 8.2.4693 on Linux via GitHub Actions. 3. NeoVim 0.2.0 on Linux via GitHub Actions. 4. NeoVim 0.4.4 on Linux via GitHub Actions. -5. NeoVim 0.5.0 on Linux via GitHub Actions. +5. NeoVim 0.6.1 on Linux via GitHub Actions. 6. Vim 8 (stable builds) on Windows via AppVeyor. If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs @@ -444,5 +445,23 @@ You can run a specific test by passing the filename as an argument to the batch file, for example: `run-tests test/test_c_flag_parsing.vader` . This will give you results much more quickly. +=============================================================================== +5. Contributing *ale-development-contributing* + +All integration of new code into ALE is done through GitHub pull requests. +Using that tool streamlines the process and minimizes the time and effort +required to e.g. ensure test suites are run for every change. + +As for any project hosted by GitHub, the choice of platform demands every +contributor to take care to setup an account and configure it accordingly. + +Due to details of our process, a difference to many other GitHub hosted +projects is that contributors who wish to keep the author fields for their +commits unaltered need to configure a public email address in their account +and profile settings. See: https://docs.github.com/en/account-and-profile/ + +Unless configuring GitHub to expose contact details, commits will be rewritten +to appear by `USERNAME ` . + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-dockerfile.txt b/sources_non_forked/ale/doc/ale-dockerfile.txt index 284c6a10..b6e87623 100644 --- a/sources_non_forked/ale/doc/ale-dockerfile.txt +++ b/sources_non_forked/ale/doc/ale-dockerfile.txt @@ -25,6 +25,12 @@ g:ale_dockerfile_dockerfile_lint_options the dockerfile lint invocation - like custom rule file definitions. +=============================================================================== +dprint *ale-dockerfile-dprint* + +See |ale-dprint-options| and https://dprint.dev/plugins/dockerfile + + =============================================================================== hadolint *ale-dockerfile-hadolint* diff --git a/sources_non_forked/ale/doc/ale-elixir.txt b/sources_non_forked/ale/doc/ale-elixir.txt index a4e5c2c6..693db5aa 100644 --- a/sources_non_forked/ale/doc/ale-elixir.txt +++ b/sources_non_forked/ale/doc/ale-elixir.txt @@ -5,7 +5,6 @@ ALE Elixir Integration *ale-elixir-options* =============================================================================== mix *ale-elixir-mix* - The `mix` linter is disabled by default, as it can be too expensive to run. See `:help g:ale_linters` @@ -18,6 +17,7 @@ g:ale_elixir_mix_options *g:ale_elixir_mix_options* This variable can be changed to specify the mix executable. + =============================================================================== mix_format *ale-elixir-mix-format* @@ -30,6 +30,7 @@ g:ale_elixir_mix_format_options *g:ale_elixir_mix_format_options* This variable can be changed to specify the mix options passed to the mix_format fixer + =============================================================================== dialyxir *ale-elixir-dialyxir* @@ -45,6 +46,7 @@ configured on your project's `mix.exs`. See https://github.com/jeremyjh/dialyxir#with-explaining-stuff for more information. + =============================================================================== elixir-ls *ale-elixir-elixir-ls* @@ -72,6 +74,8 @@ g:ale_elixir_elixir_ls_config *g:ale_elixir_elixir_ls_config* \ } < Consult the ElixirLS documentation for more information about settings. + + =============================================================================== credo *ale-elixir-credo* @@ -79,18 +83,26 @@ Credo (https://github.com/rrrene/credo) g:ale_elixir_credo_strict *g:ale_elixir_credo_strict* - Type: Integer - Default: 0 + Type: |Integer| + Default: `0` Tells credo to run in strict mode or suggest mode. Set variable to 1 to enable --strict mode. -g:ale_elixir_credo_config_file g:ale_elixir_credo_config_file - Type: String - Default: '' +g:ale_elixir_credo_config_file *g:ale_elixir_credo_config_file* + + Type: |String| + Default: `''` Tells credo to use a custom configuration file. + +=============================================================================== +cspell *ale-elixir-cspell* + +See |ale-cspell-options| + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-go.txt b/sources_non_forked/ale/doc/ale-go.txt index 2f1e4c1c..bce85470 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -39,7 +39,6 @@ g:ale_go_go111module *g:ale_go_go111module* golang tools. - =============================================================================== bingo *ale-go-bingo* @@ -57,6 +56,11 @@ g:ale_go_bingo_options *g:ale_go_bingo_options* Default: `''` +=============================================================================== +cspell *ale-go-cspell* + +See |ale-cspell-options| + =============================================================================== gobuild *ale-go-gobuild* @@ -80,6 +84,24 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options* This variable can be set to pass additional options to the gofmt fixer. +=============================================================================== +gofumpt *ale-go-gofumpt* + +g:ale_go_gofumpt_executable *g:ale_go_gofumpt_executable* + *b:ale_go_gofumpt_executable* + Type: |String| + Default: `'gofumpt'` + + Executable to run to use as the gofumpt fixer. + +g:ale_go_gofumpt_options *g:ale_go_gofumpt_options* + *b:ale_go_gofumpt_options* + Type: |String| + Default: `''` + + Options to pass to the gofumpt fixer. + + =============================================================================== golangci-lint *ale-go-golangci-lint* @@ -133,6 +155,7 @@ g:ale_go_langserver_options *g:ale_go_langserver_options* `-gocodecompletion` option is ignored because it is handled automatically by the |g:ale_completion_enabled| variable. + =============================================================================== golines *ale-go-golines* @@ -148,9 +171,10 @@ g:ale_go_golines_options *g:ale_go_golines_options* Type: |String| Default: '' - Additional options passed to the golines command. By default golines has + Additional options passed to the golines command. By default golines has --max-length=100 (lines above 100 characters will be wrapped) + =============================================================================== golint *ale-go-golint* @@ -330,7 +354,7 @@ g:ale_go_staticcheck_options *g:ale_go_staticcheck_options* g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package* *b:ale_go_staticcheck_lint_package* Type: |Number| - Default: `0` + Default: `1` When set to `1`, the whole Go package will be checked instead of only the current file. diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt index 09894340..9e65cc62 100644 --- a/sources_non_forked/ale/doc/ale-haskell.txt +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -13,6 +13,12 @@ g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable* This variable can be changed to use a different executable for brittany. +=============================================================================== +cspell *ale-haskell-cspell* + +See |ale-cspell-options| + + =============================================================================== floskell *ale-haskell-floskell* @@ -136,6 +142,20 @@ g:ale_haskell_hls_executable *g:ale_haskell_hls_executable* language server. +g:ale_haskell_hls_config *g:ale_haskell_hls_config* + *b:ale_haskell_hls_config* + Type: |Dictionary| + Default: `{}` + + Dictionary with configuration settings for HLS. For example, to see more + completions: +> + let g:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}} +< + Refer to HLS documentation for possible settings: + https://haskell-language-server.readthedocs.io/en/latest/configuration.html#language-specific-server-options + + =============================================================================== stack-build *ale-haskell-stack-build* diff --git a/sources_non_forked/ale/doc/ale-hcl.txt b/sources_non_forked/ale/doc/ale-hcl.txt index 59b0a9da..71e1114e 100644 --- a/sources_non_forked/ale/doc/ale-hcl.txt +++ b/sources_non_forked/ale/doc/ale-hcl.txt @@ -2,6 +2,11 @@ ALE HCL Integration *ale-hcl-options* +=============================================================================== +packer-fmt *ale-hcl-packer-fmt* + +See |ale-packer-fmt-fixer| for information about the available options. + =============================================================================== terraform-fmt *ale-hcl-terraform-fmt* diff --git a/sources_non_forked/ale/doc/ale-help.txt b/sources_non_forked/ale/doc/ale-help.txt new file mode 100644 index 00000000..89872545 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-help.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE Help Integration *ale-help-options* + + +=============================================================================== +cspell *ale-help-cspell* + +See |ale-cspell-options| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-html.txt b/sources_non_forked/ale/doc/ale-html.txt index 2c048148..d945acdf 100644 --- a/sources_non_forked/ale/doc/ale-html.txt +++ b/sources_non_forked/ale/doc/ale-html.txt @@ -28,6 +28,11 @@ g:ale_html_angular_use_global *g:ale_html_angular_use_global* See |ale-integrations-local-executables| +=============================================================================== +cspell *ale-html-cspell* + +See |ale-cspell-options| + =============================================================================== fecs *ale-html-fecs* @@ -159,6 +164,19 @@ g:ale_html_tidy_use_global *g:html_tidy_use_global* See |ale-integrations-local-executables| +=============================================================================== +vscodehtml *ale-html-vscode* + +Website: https://github.com/hrsh7th/vscode-langservers-extracted + +Installation +------------------------------------------------------------------------------- + +Install VSCode html language server either globally or locally: > + + npm install -g vscode-langservers-extracted +< + =============================================================================== write-good *ale-html-write-good* diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index 6bd04ef9..fa38fd3a 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -41,6 +41,12 @@ g:ale_java_checkstyle_options *g:ale_java_checkstyle_options* configuration files set with |g:ale_java_checkstyle_config|. +=============================================================================== +cspell *ale-java-cspell* + +See |ale-cspell-options| + + =============================================================================== javac *ale-java-javac* @@ -91,7 +97,6 @@ List type: \ ] < - =============================================================================== google-java-format *ale-java-google-java-format* @@ -190,6 +195,7 @@ The Java language server will look for the dependencies you specify in `externalDependencies` array in your Maven and Gradle caches ~/.m2 and ~/.gradle. + =============================================================================== eclipselsp *ale-java-eclipselsp* @@ -218,8 +224,9 @@ g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path* Default: `'$HOME/eclipse.jdt.ls'` Absolute path to the location of the eclipse.jdt.ls repository folder. Or if - you have VSCode extension installed the absolute path to the VSCode extensions - folder (e.g. $HOME/.vscode/extensions/redhat.java-0.4x.0 in Linux). + you have VSCode extension installed the absolute path to the VSCode + extensions folder (e.g. $HOME/.vscode/extensions/redhat.java-0.4x.0 in + Linux). g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable* @@ -261,7 +268,8 @@ g:ale_java_eclipselsp_javaagent *g:ale_java_eclipselsp_javaagent* Default: `''` A variable to add java agent for annotation processing such as Lombok. - If you have multiple java agent files, use space to separate them. For example: + If you have multiple java agent files, use space to separate them. + For example: > let g:ale_java_eclipselsp_javaagent='/eclipse/lombok.jar /eclipse/jacoco.jar' < diff --git a/sources_non_forked/ale/doc/ale-javascript.txt b/sources_non_forked/ale/doc/ale-javascript.txt index acd886c9..7d626efe 100644 --- a/sources_non_forked/ale/doc/ale-javascript.txt +++ b/sources_non_forked/ale/doc/ale-javascript.txt @@ -23,11 +23,24 @@ To this: > /path/foo/bar/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] < +=============================================================================== +cspell *ale-javascript-cspell* + +See |ale-cspell-options| + + =============================================================================== deno *ale-javascript-deno* Check the docs over at |ale-typescript-deno|. + +=============================================================================== +dprint *ale-javascript-dprint* + +See |ale-dprint-options| and https://dprint.dev/plugins/typescript + + =============================================================================== eslint *ale-javascript-eslint* diff --git a/sources_non_forked/ale/doc/ale-json.txt b/sources_non_forked/ale/doc/ale-json.txt index ad0a05b1..154aee62 100644 --- a/sources_non_forked/ale/doc/ale-json.txt +++ b/sources_non_forked/ale/doc/ale-json.txt @@ -2,6 +2,18 @@ ALE JSON Integration *ale-json-options* +=============================================================================== +cspell *ale-json-cspell* + +See |ale-cspell-options| + + +=============================================================================== +dprint *ale-json-dprint* + +See |ale-dprint-options| and https://dprint.dev/plugins/json + + =============================================================================== eslint *ale-json-eslint* @@ -141,6 +153,18 @@ g:ale_json_spectral_use_global *g:ale_json_spectral_use_global* See |ale-integrations-local-executables| +=============================================================================== +vscodejson *ale-json-vscode* + +Website: https://github.com/hrsh7th/vscode-langservers-extracted + +Installation +------------------------------------------------------------------------------- + +Install VSCode json language server either globally or locally: > + + npm install -g vscode-langservers-extracted +< =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-latex.txt b/sources_non_forked/ale/doc/ale-latex.txt index bedbabcd..b3029a5b 100644 --- a/sources_non_forked/ale/doc/ale-latex.txt +++ b/sources_non_forked/ale/doc/ale-latex.txt @@ -2,6 +2,9 @@ ALE LaTeX Integration *ale-latex-options* +=============================================================================== +cspell *ale-latex-cspell* + =============================================================================== write-good *ale-latex-write-good* @@ -9,10 +12,10 @@ See |ale-write-good-options| =============================================================================== -textlint *ale-latex-textlint* +textlint *ale-latex-textlint* See |ale-text-textlint| =============================================================================== -vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-lua.txt b/sources_non_forked/ale/doc/ale-lua.txt index ac92b9ac..7ee60d0e 100644 --- a/sources_non_forked/ale/doc/ale-lua.txt +++ b/sources_non_forked/ale/doc/ale-lua.txt @@ -1,6 +1,13 @@ =============================================================================== ALE Lua Integration *ale-lua-options* + +=============================================================================== +cspell *ale-lua-cspell* + +See |ale-cspell-options| + + =============================================================================== lua-format *ale-lua-lua-format* @@ -11,6 +18,7 @@ g:ale_lua_lua_format_executable *g:ale_lua_lua_format_executable* This variable can be changed to change the path to lua-format. + g:ale_lua_lua_format_options *g:ale_lua_lua_format_options* *b:ale_lua_lua_format_options* Type: |String| @@ -29,6 +37,7 @@ g:ale_lua_luac_executable *g:ale_lua_luac_executable* This variable can be changed to change the path to luac. + =============================================================================== luacheck *ale-lua-luacheck* @@ -58,6 +67,7 @@ g:ale_lua_luafmt_executable *g:ale_lua_luafmt_executable* This variable can be set to use a different executable for luafmt. + g:ale_lua_luafmt_options *g:ale_lua_luafmt_options* *b:ale_lua_luafmt_options* Type: |String| @@ -66,6 +76,25 @@ g:ale_lua_luafmt_options *g:ale_lua_luafmt_options* This variable can be set to pass additional options to the luafmt fixer. +=============================================================================== +selene *ale-lua-selene* + +g:ale_lua_selene_executable *g:ale_lua_selene_executable* + *b:ale_lua_selene_executable* + Type: |String| + Default: `'selene'` + + This variable can be set to use a different executable for selene. + + +g:ale_lua_selene_options *g:ale_lua_selene_options* + *b:ale_lua_selene_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to selene. + + =============================================================================== stylua *ale-lua-stylua* @@ -76,6 +105,7 @@ g:ale_lua_stylua_executable *g:ale_lua_stylua_executable* This variable can be set to use a different executable for stylua. + g:ale_lua_stylua_options *g:ale_lua_stylua_options* *b:ale_lua_stylua_options* Type: |String| diff --git a/sources_non_forked/ale/doc/ale-markdown.txt b/sources_non_forked/ale/doc/ale-markdown.txt index feb37fc9..6ba78ff0 100644 --- a/sources_non_forked/ale/doc/ale-markdown.txt +++ b/sources_non_forked/ale/doc/ale-markdown.txt @@ -2,6 +2,18 @@ ALE Markdown Integration *ale-markdown-options* +=============================================================================== +cspell *ale-markdown-cspell* + +See |ale-cspell-options| + + +=============================================================================== +dprint *ale-markdown-dprint* + +See |ale-dprint-options| and https://dprint.dev/plugins/markdown + + =============================================================================== markdownlint *ale-markdown-markdownlint* @@ -98,4 +110,4 @@ See |ale-write-good-options| =============================================================================== -vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-nix.txt b/sources_non_forked/ale/doc/ale-nix.txt index c38b93db..1df7caff 100644 --- a/sources_non_forked/ale/doc/ale-nix.txt +++ b/sources_non_forked/ale/doc/ale-nix.txt @@ -7,24 +7,24 @@ nixfmt *ale-nix-nixfmt* g:ale_nix_nixfmt_executable *g:ale_nix_nixfmt_executable* *b:ale_nix_nixfmt_executable* - Type: String - Default: 'nixfmt' + Type: |String| + Default: `'nixfmt'` This variable sets the executable used for nixfmt. g:ale_nix_nixfmt_options *g:ale_nix_nixfmt_options* *b:ale_nix_nixfmt_options* - Type: String - Default: '' + Type: |String| + Default: `''` This variable can be set to pass additional options to the nixfmt fixer. =============================================================================== -nixpkgs-fmt *ale-nix-nixpkgs-fmt* +nixpkgs-fmt *ale-nix-nixpkgs-fmt* -g:ale_nix_nixpkgsfmt_executable *g:ale_nix_nixpkgsfmt_executable* - *b:ale_nix_nixpkgsfmt_executable* +g:ale_nix_nixpkgsfmt_executable *g:ale_nix_nixpkgsfmt_executable* + *b:ale_nix_nixpkgsfmt_executable* Type: |String| Default: `'nixpkgs-fmt'` @@ -35,7 +35,44 @@ g:ale_nix_nixpkgsfmt_options *g:ale_nix_nixpkgsfmt_options* Type: |String| Default: `''` - This variable can be set to pass additional options to the nixpkgs-fmt fixer. + This variable can be set to pass additional options to the nixpkgs-fmt + fixer. + + +=============================================================================== +statix *ale-nix-statix* + +g:ale_nix_statix_check_executable *g:ale_nix_statix_check_executable* + *b:ale_nix_statix_check_executable* + Type: |String| + Default: `'statix'` + + This variable sets the executable used for statix when running it as a + linter. + +g:ale_nix_statix_check_options *g:ale_nix_statix_check_options* + *b:ale_nix_statix_check_options* + Type: |String| + Default: `''` + + This variable can be used to pass additional options to statix when running + it as a linter. + +g:ale_nix_statix_fix_executable *g:ale_nix_fix_check_executable* + *b:ale_nix_fix_check_executable* + Type: |String| + Default: `'statix'` + + This variable sets the executable used for statix when running it as a + fixer. + +g:ale_nix_statix_fix_options *g:ale_nix_statix_fix_options* + *b:ale_nix_statix_fix_options* + Type: |String| + Default: `''` + + This variable can be used to pass additional options to statix when running + it as a fixer. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-packer.txt b/sources_non_forked/ale/doc/ale-packer.txt new file mode 100644 index 00000000..11b7cc22 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-packer.txt @@ -0,0 +1,24 @@ +=============================================================================== +ALE Packer Integration *ale-packer-options* + + +=============================================================================== +packer-fmt-fixer *ale-packer-fmt-fixer* + +g:ale_packer_fmt_executable *g:ale_packer_fmt_executable* + *b:ale_packer_fmt_executable* + + Type: |String| + Default: `'packer'` + + This variable can be changed to use a different executable for packer. + + +g:ale_packer_fmt_options *g:ale_packer_fmt_options* + *b:ale_packer_fmt_options* + Type: |String| + Default: `''` + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-php.txt b/sources_non_forked/ale/doc/ale-php.txt index 4ee016fb..e4da97d3 100644 --- a/sources_non_forked/ale/doc/ale-php.txt +++ b/sources_non_forked/ale/doc/ale-php.txt @@ -1,6 +1,13 @@ =============================================================================== ALE PHP Integration *ale-php-options* + +=============================================================================== +cspell *ale-php-cspell* + +See |ale-cspell-options| + + =============================================================================== langserver *ale-php-langserver* @@ -41,6 +48,7 @@ g:ale_php_phan_minimum_severity *g:ale_php_phan_minimum_severity* This variable defines the minimum severity level. + g:ale_php_phan_executable *g:ale_php_phan_executable* *b:ale_php_phan_executable* Type: |String| @@ -48,6 +56,7 @@ g:ale_php_phan_executable *g:ale_php_phan_executable* This variable sets executable used for phan or phan_client. + g:ale_php_phan_use_client *g:ale_php_phan_use_client* *b:ale_php_phan_use_client* Type: |Number| @@ -56,6 +65,7 @@ g:ale_php_phan_use_client *g:ale_php_phan_use_client* This variable can be set to 1 to use the phan_client with phan daemon mode instead of the phan standalone. + =============================================================================== phpcbf *ale-php-phpcbf* @@ -129,6 +139,7 @@ g:ale_php_phpcs_options *g:ale_php_phpcs_options* This variable can be set to pass additional options to php-cs + =============================================================================== phpmd *ale-php-phpmd* @@ -187,6 +198,15 @@ g:ale_php_phpstan_autoload *g:ale_php_phpstan_autoload* This variable sets path to phpstan autoload file. +g:ale_php_phpstan_memory_limit *g:ale_php_phpstan_memory-limit* + *b:ale_php_phpstan_memory-limit* + Type: |String| + Default: `''` + + This variable sets the memory limit for phpstan analysis. This is a string + in the same format as `php.ini` accepts, e.g. `128M`, `1G`. + + =============================================================================== psalm *ale-php-psalm* diff --git a/sources_non_forked/ale/doc/ale-powershell.txt b/sources_non_forked/ale/doc/ale-powershell.txt index 485c9bd0..46bc6cfb 100644 --- a/sources_non_forked/ale/doc/ale-powershell.txt +++ b/sources_non_forked/ale/doc/ale-powershell.txt @@ -2,11 +2,17 @@ ALE PowerShell Integration *ale-powershell-options* +=============================================================================== +cspell *ale-powershell-cspell* + +See |ale-cspell-options| + + =============================================================================== powershell *ale-powershell-powershell* -g:ale_powershell_powershell_executable *g:ale_powershell_powershell_executable* - *b:ale_powershell_powershell_executable* +g:ale_powershell_powershell_executable *g:ale_powershell_powershell_executable* + *b:ale_powershell_powershell_executable* Type: String Default: `'pwsh'` @@ -33,7 +39,7 @@ g:ale_powershell_psscriptanalyzer_executable Default: `'pwsh'` This variable sets executable used for powershell. - + For example, on Windows you could set powershell to be Windows Powershell: > let g:ale_powershell_psscriptanalyzer_executable = 'powershell.exe' @@ -49,7 +55,7 @@ g:ale_powershell_psscriptanalyzer_module for psscriptanalyzer invocation. -g:ale_powershell_psscriptanalyzer_exclusions +g:ale_powershell_psscriptanalyzer_exclusions *g:ale_powershell_psscriptanalyzer_exclusions* *b:ale_powershell_psscriptanalyzer_exclusions* Type: |String| @@ -65,6 +71,5 @@ g:ale_powershell_psscriptanalyzer_exclusions \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' < - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-proto.txt b/sources_non_forked/ale/doc/ale-proto.txt index 8ab56a14..a1bf1303 100644 --- a/sources_non_forked/ale/doc/ale-proto.txt +++ b/sources_non_forked/ale/doc/ale-proto.txt @@ -8,13 +8,51 @@ Integration Information To enable `.proto` file linting, update |g:ale_linters| as appropriate: > " Enable linter for .proto files - let g:ale_linters = {'proto': ['protoc-gen-lint', 'protolint']} + let g:ale_linters = {'proto': ['buf-lint', 'protoc-gen-lint', 'protolint']} To enable `.proto` file fixing, update |g:ale_fixers| as appropriate: > " Enable linter for .proto files - let b:ale_fixers = {'proto': ['protolint']} + let b:ale_fixers = {'proto': ['buf-format', 'protolint']} < +=============================================================================== +buf-format *ale-proto-buf-format* + + The formatter uses `buf`, a fully-featured Protobuf compiler that doesn't depend + on `protoc`. Make sure the `buf` binary is available in the system path, or + set ale_proto_buf_format_executable. + +g:ale_proto_buf_format_executable *g:ale_proto_buf_format_executable* + + Type: |String| + Default: 'buf' + + This variable can be changed to modify the executable used for buf. + +=============================================================================== +buf-lint *ale-proto-buf-lint* + + The linter uses `buf`, a fully-featured Protobuf compiler that doesn't depend + on `protoc`. Make sure the `buf` binary is available in the system path, or + set ale_proto_buf_lint_executable. + +g:ale_proto_buf_lint_executable *g:ale_proto_buf_lint_executable* + + Type: |String| + Default: 'buf' + + This variable can be changed to modify the executable used for buf. + +g:ale_proto_buf_lint_config *g:ale_proto_buf_lint_config* + + Type: |String| + Default: `''` + + A path to a buf configuration file. + + The path to the configuration file can be an absolute path or a relative + path. ALE will search for the relative path in parent directories. + =============================================================================== protoc-gen-lint *ale-proto-protoc-gen-lint* diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index 10cc2897..8c380e25 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -10,6 +10,7 @@ g:ale_python_auto_pipenv *g:ale_python_auto_pipenv* Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. + g:ale_python_auto_poetry *g:ale_python_auto_poetry* *b:ale_python_auto_poetry* Type: |Number| @@ -18,6 +19,7 @@ g:ale_python_auto_poetry *g:ale_python_auto_poetry* Detect whether the file is inside a poetry, and set the executable to `poetry` if true. This is overridden by a manually-set executable. + =============================================================================== ALE Python Project Root Behavior *ale-python-root* @@ -37,6 +39,7 @@ ALE will look for configuration files with the following filenames. > tox.ini .pyre_configuration.local mypy.ini + .mypy.ini pycodestyle.cfg .flake8 .flake8rc @@ -229,6 +232,7 @@ g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv* Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. + g:ale_python_black_auto_poetry *g:ale_python_black_auto_poetry* *b:ale_python_black_auto_poetry* Type: |Number| @@ -237,6 +241,7 @@ g:ale_python_black_auto_poetry *g:ale_python_black_auto_poetry* Detect whether the file is inside a poetry, and set the executable to `poetry` if true. This is overridden by a manually-set executable. + g:ale_python_black_change_directory *g:ale_python_black_change_directory* *b:ale_python_black_change_directory* Type: |Number| @@ -248,13 +253,19 @@ g:ale_python_black_change_directory *g:ale_python_black_change_directory* to control the directory Python is executed from yourself. +=============================================================================== +cspell *ale-python-cspell* + +See |ale-cspell-options| + + =============================================================================== flake8 *ale-python-flake8* g:ale_python_flake8_change_directory *g:ale_python_flake8_change_directory* *b:ale_python_flake8_change_directory* Type: |String| - Default: `project` + Default: `'project'` If set to `project`, ALE will switch to the project root before checking file. If set to `file`, ALE will switch to directory the Python file being @@ -320,6 +331,7 @@ g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry* Detect whether the file is inside a poetry, and set the executable to `poetry` if true. This is overridden by a manually-set executable. + =============================================================================== flakehell *ale-python-flakehell* @@ -384,6 +396,7 @@ g:ale_python_flakehell_auto_poetry *g:ale_python_flakehell_auto_poetry* Detect whether the file is inside a poetry, and set the executable to `poetry` if true. This is overridden by a manually-set executable. + =============================================================================== isort *ale-python-isort* @@ -504,7 +517,6 @@ g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* See |ale-integrations-local-executables| - =============================================================================== prospector *ale-python-prospector* @@ -569,7 +581,6 @@ g:ale_python_prospector_auto_poetry *g:ale_python_prospector_auto_poetry* =============================================================================== pycodestyle *ale-python-pycodestyle* - g:ale_python_pycodestyle_executable *g:ale_python_pycodestyle_executable* *b:ale_python_pycodestyle_executable* Type: |String| @@ -619,7 +630,6 @@ g:ale_python_pycodestyle_auto_poetry *g:ale_python_pycodestyle_auto_poetry* =============================================================================== pydocstyle *ale-python-pydocstyle* - g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable* *b:ale_python_pydocstyle_executable* Type: |String| @@ -669,7 +679,6 @@ g:ale_python_pydocstyle_auto_poetry *g:ale_python_pydocstyle_auto_poetry* =============================================================================== pyflakes *ale-python-pyflakes* - g:ale_python_pyflakes_executable *g:ale_python_pyflakes_executable* *b:ale_python_pyflakes_executable* Type: |String| @@ -925,6 +934,7 @@ g:ale_python_pylsp_options *g:ale_python_pylsp_options An example stragety for installing `pylsp`: `python3 -m pip install --user pylsp` + =============================================================================== pyre *ale-python-pyre* @@ -1057,6 +1067,58 @@ g:ale_python_reorder_python_imports_use_global See |ale-integrations-local-executables| +=============================================================================== +unimport *ale-python-unimport* + +`unimport` will be run from a detected project root, per |ale-python-root|. + + +g:ale_python_unimport_auto_pipenv *g:ale_python_unimport_auto_pipenv* + *b:ale_python_unimport_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + +g:ale_python_unimport_auto_poetry *g:ale_python_unimport_auto_poetry* + *b:ale_python_unimport_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + +g:ale_python_unimport_executable *g:ale_python_unimport_executable* + *b:ale_python_unimport_executable* + Type: |String| + Default: `'unimport'` + + See |ale-integrations-local-executables| + + Set this to `'pipenv'` to invoke `'pipenv` `run` `unimport'`. + Set this to `'poetry'` to invoke `'poetry` `run` `unimport'`. + + +g:ale_python_unimport_options *g:ale_python_unimport_options* + *b:ale_python_unimport_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the unimport + invocation. + + +g:ale_python_unimport_use_global *g:ale_python_unimport_use_global* + *b:ale_python_unimport_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vulture *ale-python-vulture* diff --git a/sources_non_forked/ale/doc/ale-rego.txt b/sources_non_forked/ale/doc/ale-rego.txt new file mode 100644 index 00000000..9a39dbf0 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-rego.txt @@ -0,0 +1,50 @@ +=============================================================================== +ALE Rego Integration *ale-rego-options* + + +=============================================================================== +cspell *ale-rego-cspell* + +See |ale-cspell-options| + + +=============================================================================== +opacheck *ale-rego-opa-check* + +g:ale_rego_opacheck_executable *g:rego_opacheck_executable* + *b:rego_opacheck_executable* + + Type: |String| + Default: `'opa'` + + This variable can be changed to use a different executable for opa. + + +g:rego_opacheck_options *g:rego_opacheck_options* + *b:rego_opacheck_options* + Type: |String| + Default: `''` + + This variable can be changed to pass custom CLI flags to opa check. + + +=============================================================================== +opafmt *ale-rego-opa-fmt-fixer* + +g:ale_opa_fmt_executable *g:ale_opa_fmt_executable* + *b:ale_opa_fmt_executable* + + Type: |String| + Default: `'opa'` + + This variable can be changed to use a different executable for opa. + + +g:ale_opa_fmt_options *g:ale_opa_fmt_options* + *b:ale_opa_fmt_options* + Type: |String| + Default: `''` + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-restructuredtext.txt b/sources_non_forked/ale/doc/ale-restructuredtext.txt index e308b072..7af62133 100644 --- a/sources_non_forked/ale/doc/ale-restructuredtext.txt +++ b/sources_non_forked/ale/doc/ale-restructuredtext.txt @@ -2,6 +2,12 @@ ALE reStructuredText Integration *ale-restructuredtext-options* +=============================================================================== +cspell *ale-restructuredtext-cspell* + +See |ale-cspell-options| + + =============================================================================== textlint *ale-restructuredtext-textlint* @@ -16,6 +22,7 @@ See: https://github.com/jimo1001/docutils-ast-writer See |ale-text-textlint| + =============================================================================== write-good *ale-restructuredtext-write-good* @@ -23,4 +30,4 @@ See |ale-write-good-options| =============================================================================== -vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index 69c643a9..4bc25b1a 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -21,6 +21,13 @@ g:ale_ruby_brakeman_options *g:ale_ruby_brakeman_options* The contents of this variable will be passed through to brakeman. + +=============================================================================== +cspell *ale-ruby-cspell* + +See |ale-cspell-options| + + =============================================================================== debride *ale-ruby-debride* @@ -212,7 +219,5 @@ g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options* This variable can be changed to modify flags given to standardrb. -=============================================================================== - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt index 3aa63673..c8ec9b13 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -26,8 +26,10 @@ Integration Information 4. analyzer -- If you have rust-analyzer installed, you might prefer using this linter over cargo and rls. rust-analyzer also implements the Language Server Protocol for incremental compilation of Rust code, and is - the next iteration of rls. rust-analyzer, like rls, requires Rust files - to be contained in Cargo projects. + the next iteration of rls. rust-analyzer either requires Rust files to be + contained in Cargo projects or requires the project to be described in + the rust-project.json format: + https://rust-analyzer.github.io/manual.html#non-cargo-based-projects 5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to consistently reformat your Rust code. @@ -38,7 +40,7 @@ Integration Information let g:ale_linters = {'rust': ['rustc', 'rls']} < - Also note that rustc 1.12. or later is needed. + Also note that rustc 1.18. or later is needed. =============================================================================== @@ -145,8 +147,7 @@ g:ale_rust_cargo_avoid_whole_workspace *g:ale_rust_cargo_avoid_whole_workspace* in the crate's directory. Otherwise, behave as usual. -g:ale_rust_cargo_use_clippy - *g:ale_rust_cargo_use_clippy* +g:ale_rust_cargo_use_clippy *g:ale_rust_cargo_use_clippy* *b:ale_rust_cargo_use_clippy* Type: |Number| Default: `0` @@ -163,8 +164,7 @@ g:ale_rust_cargo_use_clippy let g:ale_rust_cargo_use_clippy = executable('cargo-clippy') < -g:ale_rust_cargo_clippy_options - *g:ale_rust_cargo_clippy_options* +g:ale_rust_cargo_clippy_options *g:ale_rust_cargo_clippy_options* *b:ale_rust_cargo_clippy_options* Type: |String| @@ -175,8 +175,7 @@ g:ale_rust_cargo_clippy_options only `cargo clippy` supports (e.g. `--deny`). -g:ale_rust_cargo_target_dir - *g:ale_rust_cargo_target_dir* +g:ale_rust_cargo_target_dir *g:ale_rust_cargo_target_dir* *b:ale_rust_cargo_target_dir* Type: |String| @@ -187,6 +186,12 @@ g:ale_rust_cargo_target_dir running `cargo` commands manually while ALE is performing its checks. +=============================================================================== +cspell *ale-rust-cspell* + +See |ale-cspell-options| + + =============================================================================== rls *ale-rust-rls* @@ -234,13 +239,13 @@ rustc *ale-rust-rustc* g:ale_rust_rustc_options *g:ale_rust_rustc_options* *b:ale_rust_rustc_options* Type: |String| - Default: `'-Z no-codegen'` + Default: `'--emit=mir -o /dev/null'` The variable can be used to change the options passed to `rustc`. - `-Z no-codegen` should only work with nightly builds of Rust. Be careful when - setting the options, as running `rustc` could execute code or generate - binary files. + Users of nightly builds of Rust might want to use `-Z no-codegen` instead. + Be careful when setting the options, as running `rustc` could execute code + or generate binary files. g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* diff --git a/sources_non_forked/ale/doc/ale-scala.txt b/sources_non_forked/ale/doc/ale-scala.txt index c9638baf..0b0f1a9a 100644 --- a/sources_non_forked/ale/doc/ale-scala.txt +++ b/sources_non_forked/ale/doc/ale-scala.txt @@ -2,6 +2,12 @@ ALE Scala Integration *ale-scala-options* +=============================================================================== +cspell *ale-scala-cspell* + +See |ale-cspell-options| + + =============================================================================== metals *ale-scala-metals* diff --git a/sources_non_forked/ale/doc/ale-sh.txt b/sources_non_forked/ale/doc/ale-sh.txt index c06f737a..9a1928c4 100644 --- a/sources_non_forked/ale/doc/ale-sh.txt +++ b/sources_non_forked/ale/doc/ale-sh.txt @@ -25,6 +25,12 @@ g:ale_sh_bashate_options *g:ale_sh_bashate_options* let g:ale_sh_bashate_options = '-i E003' < +=============================================================================== +cspell *ale-sh-cspell* + +See |ale-cspell-options| + + =============================================================================== sh-language-server *ale-sh-language-server* diff --git a/sources_non_forked/ale/doc/ale-sql.txt b/sources_non_forked/ale/doc/ale-sql.txt index 398e24d3..80929264 100644 --- a/sources_non_forked/ale/doc/ale-sql.txt +++ b/sources_non_forked/ale/doc/ale-sql.txt @@ -2,6 +2,13 @@ ALE SQL Integration *ale-sql-options* +=============================================================================== +dprint *ale-sql-dprint* + +See |ale-dprint-options| +and https://github.com/dprint/dprint-plugin-sql/releases + + =============================================================================== pgformatter *ale-sql-pgformatter* diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 36ef83ea..218832bc 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -14,6 +14,7 @@ Notes: * Ada * `ada_language_server` + * `cspell` * `gcc` * `gnatpp` * Ansible @@ -24,7 +25,8 @@ Notes: * `apkbuild-lint` * `secfixes-check` * AsciiDoc - * `alex`!! + * `alex` + * `cspell` * `languagetool`!! * `proselint` * `redpen` @@ -33,10 +35,13 @@ Notes: * `write-good` * ASM * `gcc` +* AVRA + * `avra` * Awk * `gawk` * Bash * `bashate` + * `cspell` * `language-server` * `shell` (-n flag) * `shellcheck` @@ -47,6 +52,8 @@ Notes: * `buildifier` * BibTeX * `bibclean` +* BitBake + * `oelint-adv` * Bourne Shell * `shell` (-n flag) * `shellcheck` @@ -61,11 +68,13 @@ Notes: * `cppcheck` * `cpplint`!! * `cquery` + * `cspell` * `flawfinder` * `gcc` (`cc`) * `uncrustify` * C# * `csc`!! + * `cspell` * `dotnet-format` * `mcs` * `mcsc`!! @@ -82,6 +91,7 @@ Notes: * `cppcheck` * `cpplint`!! * `cquery` + * `cspell` * `flawfinder` * `gcc` (`cc`) * `uncrustify` @@ -95,6 +105,7 @@ Notes: * `cfn-python-lint` * CMake * `cmake-format` + * `cmake-lint` * `cmakelint` * CoffeeScript * `coffee` @@ -103,6 +114,8 @@ Notes: * `ameba`!! * `crystal`!! * CSS + * `VSCode CSS language server` + * `cspell` * `csslint` * `fecs` * `prettier` @@ -127,7 +140,6 @@ Notes: * `analysis_server` * `dart-analyze`!! * `dart-format`!! - * `dartanalyzer`!! * `dartfmt`!! * `language_server` * desktop @@ -138,9 +150,11 @@ Notes: * `dhall-lint` * Dockerfile * `dockerfile_lint` + * `dprint` * `hadolint` * Elixir * `credo` + * `cspell` * `dialyxir` * `dogma`!! * `elixir-ls` @@ -178,10 +192,12 @@ Notes: * `glslls` * Go * `bingo` + * `cspell` * `go build`!! * `go mod`!! * `go vet`!! * `gofmt` + * `gofumpt` * `goimports` * `golangci-lint`!! * `golangserver` @@ -208,6 +224,7 @@ Notes: * Haskell * `brittany` * `cabal-ghc` + * `cspell` * `floskell` * `ghc` * `ghc-mod` @@ -222,10 +239,13 @@ Notes: * `stack-ghc` * `stylish-haskell` * HCL + * `packer-fmt` * `terraform-fmt` * HTML - * `alex`!! + * `VSCode HTML language server` + * `alex` * `angular` + * `cspell` * `fecs` * `html-beautify` * `htmlhint` @@ -244,13 +264,16 @@ Notes: * Java * `PMD` * `checkstyle`!! + * `cspell` * `eclipselsp` * `google-java-format` * `javac` * `javalsp` * `uncrustify` * JavaScript + * `cspell` * `deno` + * `dprint` * `eslint` * `fecs` * `flow` @@ -263,6 +286,9 @@ Notes: * `tsserver` * `xo` * JSON + * `VSCode JSON language server` + * `cspell` + * `dprint` * `eslint` * `fixjson` * `jq` @@ -283,8 +309,9 @@ Notes: * `ktlint` * `languageserver` * LaTeX (tex) - * `alex`!! + * `alex` * `chktex` + * `cspell` * `lacheck` * `proselint` * `redpen` @@ -299,20 +326,23 @@ Notes: * LLVM * `llc` * Lua + * `cspell` * `lua-format` * `luac` * `luacheck` * `luafmt` + * `selene` * `stylua` * Mail - * `alex`!! + * `alex` * `languagetool`!! * `proselint` * `vale` * Make * `checkmake` * Markdown - * `alex`!! + * `alex` + * `cspell` * `languagetool`!! * `markdownlint`!! * `mdl` @@ -339,8 +369,9 @@ Notes: * `nixfmt` * `nixpkgs-fmt` * `rnix-lsp` + * `statix` * nroff - * `alex`!! + * `alex` * `proselint` * `write-good` * Objective-C @@ -362,6 +393,8 @@ Notes: * `ibm_validator` * `prettier` * `yamllint` +* Packer + * `packer-fmt-fixer` * Pascal * `ptop` * Pawn @@ -373,11 +406,13 @@ Notes: * Perl6 * `perl6 -c` * PHP + * `cspell` * `intelephense` * `langserver` * `phan` * `php -l` * `php-cs-fixer` + * `phpactor` * `phpcbf` * `phpcs` * `phpmd` @@ -385,22 +420,25 @@ Notes: * `psalm`!! * `tlint` * PO - * `alex`!! + * `alex` * `msgfmt` * `proselint` * `write-good` * Pod - * `alex`!! + * `alex` * `proselint` * `write-good` * Pony * `ponyc` * PowerShell + * `cspell` * `powershell` * `psscriptanalyzer` * Prolog * `swipl` * proto + * `buf-format`!! + * `buf-lint`!! * `protoc-gen-lint`!! * `protolint`!! * Pug @@ -419,6 +457,7 @@ Notes: * `autopep8` * `bandit` * `black` + * `cspell` * `flake8` * `flakehell` * `isort` @@ -433,6 +472,7 @@ Notes: * `pyre` * `pyright` * `reorder-python-imports` + * `unimport` * `vulture`!! * `yapf` * QML @@ -452,8 +492,13 @@ Notes: * `ols` * `reason-language-server` * `refmt` +* Rego + * `cspell` + * `opacheck` + * `opafmt` * reStructuredText - * `alex`!! + * `alex` + * `cspell` * `proselint` * `redpen` * `rstcheck` @@ -466,6 +511,7 @@ Notes: * `rpmlint` * Ruby * `brakeman`!! + * `cspell` * `debride` * `prettier` * `rails_best_practices`!! @@ -478,6 +524,7 @@ Notes: * `standardrb` * Rust * `cargo`!! + * `cspell` * `rls` * `rust-analyzer` * `rustc` (see |ale-integration-rust|) @@ -488,6 +535,7 @@ Notes: * `sass-lint` * `stylelint` * Scala + * `cspell` * `fsc` * `metals` * `sbtserver` @@ -508,6 +556,7 @@ Notes: * `solhint` * `solium` * SQL + * `dprint` * `pgformatter` * `sql-lint` * `sqlfmt` @@ -522,6 +571,7 @@ Notes: * `svelteserver` * Swift * Apple `swift-format` + * `cspell` * `sourcekit-lsp` * `swiftformat` * `swiftlint` @@ -530,17 +580,20 @@ Notes: * Tcl * `nagelfar`!! * Terraform + * `checkov` * `terraform` * `terraform-fmt-fixer` * `terraform-ls` * `terraform-lsp` * `tflint` * Texinfo - * `alex`!! + * `alex` + * `cspell` * `proselint` * `write-good` * Text^ - * `alex`!! + * `alex` + * `cspell` * `languagetool`!! * `proselint` * `redpen` @@ -550,8 +603,12 @@ Notes: * Thrift * `thrift` * `thriftcheck` +* TOML + * `dprint` * TypeScript + * `cspell` * `deno` + * `dprint` * `eslint` * `fecs` * `prettier` @@ -580,23 +637,30 @@ Notes: * `vimls` * `vint` * Vim help^ - * `alex`!! + * `alex` * `proselint` * `write-good` * Vue + * `cspell` * `prettier` * `vls` + * `volar` +* WGSL + * `naga` * XHTML - * `alex`!! + * `alex` + * `cspell` * `proselint` * `write-good` * XML * `xmllint` * YAML + * `actionlint` * `circleci`!! * `prettier` * `spectral` * `swaglint` + * `yaml-language-server` * `yamlfix` * `yamllint` * YANG @@ -604,6 +668,7 @@ Notes: * Zeek * `zeek`!! * Zig + * `zigfmt` * `zls` =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-swift.txt b/sources_non_forked/ale/doc/ale-swift.txt index 6d53ca7c..a443eab8 100644 --- a/sources_non_forked/ale/doc/ale-swift.txt +++ b/sources_non_forked/ale/doc/ale-swift.txt @@ -19,7 +19,8 @@ Additionally, ALE tries to locate and use the nearest existing `.swift-format` configuration file. -g:ale_swift_appleswiftformat_executable *g:ale_swift_appleswiftformat_executable* +g:ale_swift_appleswiftformat_executable + *g:ale_swift_appleswiftformat_executable* *b:ale_swift_appleswiftformat_executable* Type: |String| Default: `'swift-format'` @@ -28,7 +29,8 @@ g:ale_swift_appleswiftformat_executable *g:ale_swift_appleswiftformat_executable `swift-format`. -g:ale_swift_appleswiftformat_use_swiftpm *g:ale_swift_appleswiftformat_use_swiftpm* +g:ale_swift_appleswiftformat_use_swiftpm + *g:ale_swift_appleswiftformat_use_swiftpm* *b:ale_swift_appleswiftformat_use_swiftpm* Type: |Number| Default: `0` @@ -40,6 +42,12 @@ g:ale_swift_appleswiftformat_use_swiftpm *g:ale_swift_appleswiftformat_use_swift See |ale-integrations-local-executables| +=============================================================================== +cspell *ale-swift-cspell* + +See |ale-cspell-options| + + =============================================================================== sourcekitlsp *ale-swift-sourcekitlsp* @@ -57,4 +65,3 @@ g:ale_sourcekit_lsp_executable *g:ale_sourcekit_lsp_executable* =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: - diff --git a/sources_non_forked/ale/doc/ale-terraform.txt b/sources_non_forked/ale/doc/ale-terraform.txt index 175bdf5c..6acf63ac 100644 --- a/sources_non_forked/ale/doc/ale-terraform.txt +++ b/sources_non_forked/ale/doc/ale-terraform.txt @@ -2,6 +2,25 @@ ALE Terraform Integration *ale-terraform-options* +=============================================================================== +checkov *ale-terraform-checkov* + +g:ale_terraform_checkov_executable *g:ale_terraform_checkov_executable* + *b:ale_terraform_checkov_executable* + + Type: |String| + Default: `'checkov'` + + This variable can be changed to use a different executable for checkov. + + +g:ale_terraform_checkov_options *g:ale_terraform_checkov_options* + *b:ale_terraform_checkov_options* + Type: |String| + Default: `''` + + This variable can be changed to set additional options for checkov. + =============================================================================== terraform-fmt-fixer *ale-terraform-fmt-fixer* diff --git a/sources_non_forked/ale/doc/ale-tex.txt b/sources_non_forked/ale/doc/ale-tex.txt index ceb9fa81..147aacc4 100644 --- a/sources_non_forked/ale/doc/ale-tex.txt +++ b/sources_non_forked/ale/doc/ale-tex.txt @@ -21,7 +21,13 @@ g:ale_tex_chktex_options *g:ale_tex_chktex_options* This variable can be changed to modify flags given to chktex. ------------------------------------------------------------------------------- +=============================================================================== +cspell *ale-tex-cspell* + +See |ale-cspell-options| + + +=============================================================================== lacheck *ale-tex-lacheck* g:ale_lacheck_executable *g:ale_lacheck_executable* @@ -32,12 +38,11 @@ g:ale_lacheck_executable *g:ale_lacheck_executable* This variable can be changed to change the path to lacheck. - =============================================================================== -latexindent *ale-tex-latexindent* +latexindent *ale-tex-latexindent* -g:ale_tex_latexindent_executable *g:ale_tex_latexindent_executable* - *b:ale_tex_latexindent_executable* +g:ale_tex_latexindent_executable *g:ale_tex_latexindent_executable* + *b:ale_tex_latexindent_executable* Type: |String| Default: `'latexindent'` @@ -52,26 +57,39 @@ g:ale_tex_latexindent_options *g:ale_tex_latexindent_options* This variable can be changed to modify flags given to latexindent. - =============================================================================== -texlab *ale-tex-texlab* +texlab *ale-tex-texlab* -g:ale_tex_texlab_executable *g:ale_tex_texlab_executable* - *b:ale_tex_texlab_executable* +g:ale_tex_texlab_executable *g:ale_tex_texlab_executable* + *b:ale_tex_texlab_executable* Type: |String| Default: `'texlab'` This variable can be changed to change the path to texlab. -g:ale_tex_texlab_options *g:ale_tex_texlab_options* - *b:ale_tex_texlab_options* +g:ale_tex_texlab_options *g:ale_tex_texlab_options* + *b:ale_tex_texlab_options* Type: |String| Default: `''` - This variable can be changed to modify flags given to texlab. + This variable can be changed to modify flags given to texlab command. +g:ale_tex_texlab_config *g:ale_tex_texlab_config* + *b:ale_tex_texlab_config* + Type: |Dictionary| + Default: `{}` + Dictionary containing LSP configuration settings used to initialize texlab + language server. Refer to texlab documentation for possible settings: + + https://github.com/latex-lsp/texlab/blob/master/docs/options.md + + For example to set build onSave initialization setting: + +> + let g:ale_tex_texlab_config = {"build":{"onSave":v:true}} +< =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-texinfo.txt b/sources_non_forked/ale/doc/ale-texinfo.txt index f8ed342d..53d42b69 100644 --- a/sources_non_forked/ale/doc/ale-texinfo.txt +++ b/sources_non_forked/ale/doc/ale-texinfo.txt @@ -2,6 +2,12 @@ ALE Texinfo Integration *ale-texinfo-options* +=============================================================================== +cspell *ale-texinfo-cspell* + +See |ale-cspell-options| + + =============================================================================== write-good *ale-texinfo-write-good* @@ -9,4 +15,4 @@ See |ale-write-good-options| =============================================================================== -vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-text.txt b/sources_non_forked/ale/doc/ale-text.txt index 913d7e61..4e4d0b2e 100644 --- a/sources_non_forked/ale/doc/ale-text.txt +++ b/sources_non_forked/ale/doc/ale-text.txt @@ -2,6 +2,12 @@ ALE Text Integration *ale-text-options* +============================================================================== +cspell *ale-text-cspell* + +See |ale-cspell-options| + + =============================================================================== textlint *ale-text-textlint* @@ -39,4 +45,4 @@ See |ale-write-good-options| =============================================================================== -vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-toml.txt b/sources_non_forked/ale/doc/ale-toml.txt new file mode 100644 index 00000000..222a91f4 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-toml.txt @@ -0,0 +1,12 @@ +=============================================================================== +ALE TOML Integration *ale-toml-options* + + +=============================================================================== +dprint *ale-toml-dprint* + +See |ale-dprint-options| and https://dprint.dev/plugins/toml + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-typescript.txt b/sources_non_forked/ale/doc/ale-typescript.txt index 8984e183..788a7a5c 100644 --- a/sources_non_forked/ale/doc/ale-typescript.txt +++ b/sources_non_forked/ale/doc/ale-typescript.txt @@ -2,6 +2,12 @@ ALE TypeScript Integration *ale-typescript-options* +=============================================================================== +cspell *ale-typescript-cspell* + +See |ale-cspell-options| + + =============================================================================== deno *ale-typescript-deno* @@ -27,6 +33,7 @@ g:ale_deno_lsp_project_root *g:ale_deno_lsp_project_root* 3. Use the directory of the current buffer (if the buffer was opened from a file). + g:ale_deno_unstable *g:ale_deno_unstable* *b:ale_deno_unstable* Type: |Number| @@ -34,13 +41,21 @@ g:ale_deno_unstable *g:ale_deno_unstable* Enable or disable unstable Deno features and APIs. -g:ale_deno_importMap *g:ale_deno_importMap* - *b:ale_deno_importMap* + +g:ale_deno_importMap *g:ale_deno_importMap* + *b:ale_deno_importMap* Type: |String| Default: `'import_map.json'` Specify the import map filename to load url maps in a deno project. + +=============================================================================== +dprint *ale-typescript-dprint* + +See |ale-dprint-options| and https://dprint.dev/plugins/typescript + + =============================================================================== eslint *ale-typescript-eslint* diff --git a/sources_non_forked/ale/doc/ale-vue.txt b/sources_non_forked/ale/doc/ale-vue.txt index a2c2786f..98ac5808 100644 --- a/sources_non_forked/ale/doc/ale-vue.txt +++ b/sources_non_forked/ale/doc/ale-vue.txt @@ -2,6 +2,12 @@ ALE Vue Integration *ale-vue-options* +=============================================================================== +cspell *ale-vue-cspell* + +See |ale-cspell-options| + + =============================================================================== prettier *ale-vue-prettier* @@ -27,5 +33,36 @@ g:ale_vue_vls_use_global *g:ale_vue_vls_use_global* See |ale-integrations-local-executables| +=============================================================================== +volar *ale-vue-volar* + + It is required to have typescript installed in your project as your dev + dependency: `npm i -D typescript` + +g:ale_vue_volar_executable *g:ale_vue_volar_executable* + *b:ale_vue_volar_executable* + Type: |String| + Default: `'volar-server'` + + See |ale-integrations-local-executables| + + +g:ale_vue_volar_use_global *g:ale_vue_volar_use_global* + *b:ale_vue_volar_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +g:vue_volar_init_options *g:ale_vue_volar_init_options* + *b:ale_vue_volar_init_options* + Type: |Dictionary| + Default: `{ ... }` + + Default is too long to show here, take a look at it over + `ale_linters/vue/volar.vim` + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-wgsl.txt b/sources_non_forked/ale/doc/ale-wgsl.txt new file mode 100644 index 00000000..5254f43b --- /dev/null +++ b/sources_non_forked/ale/doc/ale-wgsl.txt @@ -0,0 +1,17 @@ +=============================================================================== +ALE WGSL Integration *ale-wgsl-options* + + +=============================================================================== +naga *ale-wgsl-naga* + +g:ale_wgsl_naga_executable *g:ale_wgsl_naga_executable* + *b:ale_wgsl_naga_executable* + Type: |String| + Default: `'naga'` + + The executable that will be run for the `naga` linter. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-xhtml.txt b/sources_non_forked/ale/doc/ale-xhtml.txt index 3cc639ef..10ca5b82 100644 --- a/sources_non_forked/ale/doc/ale-xhtml.txt +++ b/sources_non_forked/ale/doc/ale-xhtml.txt @@ -2,6 +2,12 @@ ALE XHTML Integration *ale-xhtml-options* +=============================================================================== +cspell *ale-xhtml-cspell* + +See |ale-cspell-options| + + =============================================================================== write-good *ale-xhtml-write-good* @@ -9,4 +15,4 @@ See |ale-write-good-options| =============================================================================== -vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-yaml.txt b/sources_non_forked/ale/doc/ale-yaml.txt index 65e0d069..8d44973d 100644 --- a/sources_non_forked/ale/doc/ale-yaml.txt +++ b/sources_non_forked/ale/doc/ale-yaml.txt @@ -2,6 +2,37 @@ ALE YAML Integration *ale-yaml-options* +=============================================================================== +actionlint *ale-yaml-actionlint* + +Website: https://github.com/rhysd/actionlint + + +Installation +------------------------------------------------------------------------------- + +See installation guide: https://github.com/rhysd/actionlint#quick-start + +This linter is disabled by default and must be enabled by setting `g:ale_linters`. +To enable it only for Github Action YAML files a configuration like this is +better: + +> + au BufRead,BufNewFile */.github/*/*.y{,a}ml + \ let b:ale_linters = {'yaml': ['actionlint']} +< + +Options +------------------------------------------------------------------------------- + +g:ale_yaml_actionlint_executable *g:ale_yaml_actionlint_executable* + *b:ale_yaml_actionlint_executable* + Type: |String| + Default: `'actionlint'` + + This variable can be set to change the path to actionlint. + + =============================================================================== circleci *ale-yaml-circleci* @@ -105,6 +136,59 @@ g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global* See |ale-integrations-local-executables| +=============================================================================== +yaml-language-server *ale-yaml-language-server* + +Website: https://github.com/redhat-developer/yaml-language-server + + +Installation +------------------------------------------------------------------------------- + +Install yaml-language-server either globally or locally: > + + npm install yaml-language-server -g # global + npm install yaml-language-server # local + + +Options +------------------------------------------------------------------------------- + +g:ale_yaml_ls_executable *g:ale_yaml_ls_executable* + *b:ale_yaml_ls_executable* + Type: |String| + Default: `'yaml-language-server'` + + This variable can be set to change the path to yaml-language-server. + + +g:ale_yaml_ls_config *g:ale_yaml_ls_config* + *b:ale_yaml_ls_config* + Type: |Dictionary| + Default: `{}` + + Dictionary containing configuration settings that will be passed to the + language server. For example, to enable schema store: > + { + \ 'yaml': { + \ 'schemaStore': { + \ 'enable': v:true, + \ }, + \ }, + \ } +< + Consult the yaml-language-server documentation for more information about + settings. + + +g:ale_yaml_ls_use_global *g:ale_yaml_ls_use_global* + *b:ale_yaml_ls_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== yamlfix *ale-yaml-yamlfix* diff --git a/sources_non_forked/ale/doc/ale-zig.txt b/sources_non_forked/ale/doc/ale-zig.txt index 70a53bbb..cafa12a1 100644 --- a/sources_non_forked/ale/doc/ale-zig.txt +++ b/sources_non_forked/ale/doc/ale-zig.txt @@ -7,6 +7,18 @@ Integration Information Currently, the only supported linter for zig is zls. + +=============================================================================== +zigfmt *ale-zig-zigfmt* + +g:ale_zig_zigfmt_executable *g:ale_zig_zigfmt_executable* + *b:ale_zig_zigfmt_executable* + Type: |String| + Default: `'zig'` + + The executable that will be run for the `zig fmt` fixer. + + =============================================================================== zls *ale-zig-zls* diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 6cc81784..c969cb9e 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -17,17 +17,19 @@ CONTENTS *ale-contents* 5.1 Completion........................|ale-completion| 5.2 Go To Definition..................|ale-go-to-definition| 5.3 Go To Type Definition.............|ale-go-to-type-definition| - 5.4 Find References...................|ale-find-references| - 5.5 Hovering..........................|ale-hover| - 5.6 Symbol Search.....................|ale-symbol-search| - 5.7 Refactoring: Rename, Actions......|ale-refactor| + 5.4 Go To Implementation..............|ale-go-to-type-implementation| + 5.5 Find References...................|ale-find-references| + 5.6 Hovering..........................|ale-hover| + 5.7 Symbol Search.....................|ale-symbol-search| + 5.8 Refactoring: Rename, Actions......|ale-refactor| 6. Global Options.......................|ale-options| 6.1 Highlights........................|ale-highlights| 7. Linter/Fixer Options.................|ale-integration-options| 7.1 Options for alex..................|ale-alex-options| - 7.2 Options for languagetool..........|ale-languagetool-options| - 7.3 Options for write-good............|ale-write-good-options| - 7.4 Other Linter/Fixer Options........|ale-other-integration-options| + 7.2 Options for cspell................|ale-cspell-options| + 7.3 Options for languagetool..........|ale-languagetool-options| + 7.4 Options for write-good............|ale-write-good-options| + 7.5 Other Linter/Fixer Options........|ale-other-integration-options| 8. Commands/Keybinds....................|ale-commands| 9. API..................................|ale-api| 10. Special Thanks......................|ale-special-thanks| @@ -286,6 +288,12 @@ number of the buffer that ALE wants to check. sources should perform their checks on a buffer in the background asynchronously, so they don't interrupt editing. +|ale#other_source#ShowResults()| must not be called synchronously before +ALE's engine executes its code after the |ALEWantResults| event runs. If +there are immediate results to provide to ALE, a 0 millisecond timer with +|timer_start()| can be set instead up to call |ale#other_source#ShowResults()| +after ALE has first executed its engine code for its own sources. + A plugin might integrate its own checks with ALE like so: > augroup SomeGroupName @@ -363,12 +371,16 @@ are supported for running the commands. `process_with` An optional callback for post-processing. - The callback must accept two arguments, - `(buffer, output)`, which can be used for converting - the output from a command into lines to replace the - buffer's contents with. + The callback must accept arguments `(bufnr, output)`: + the buffer number undergoing fixing and the fixer's + output as a |List| of |String|s. It must return a |List| + of |String|s that will be the new contents of the + buffer. + + This callback is useful to remove excess lines from the + command's output or apply additional changes to the + output. - A |List| of |String|s must be returned. `read_buffer` An optional key for disabling reading the buffer. @@ -535,8 +547,10 @@ The |ALEComplete| command can be used to show completion suggestions manually, even when |g:ale_completion_enabled| is set to `0`. For manually requesting completion information with Deoplete, consult Deoplete's documentation. -ALE by can support automatic imports from external modules. This behavior can -be enabled by setting the |g:ale_completion_autoimport| variable to `1`. +ALE supports automatic imports from external modules. This behavior can be +disabled by setting the |g:ale_completion_autoimport| variable to `0`. +Disabling automatic imports can drop some or all completion items from +some LSP servers (e.g. eclipselsp). You can manually request imports for symbols at the cursor with the |ALEImport| command. The word at the cursor must be an exact match for some @@ -624,14 +638,23 @@ documentation for the command for configuring how the location will be displayed. ------------------------------------------------------------------------------- -5.4 Find References *ale-find-references* +5.4 Go To Implementation *ale-go-to-implementation* + +ALE supports jumping to the files and locations where symbols are implemented +through any enabled LSP linters. The locations ALE will jump to depend on the +information returned by LSP servers. The |ALEGoToImplementation| command will +jump to the implementation of symbols under the cursor. See the documentation +for the command for configuring how the location will be displayed. + +------------------------------------------------------------------------------- +5.5 Find References *ale-find-references* ALE supports finding references for symbols though any enabled LSP linters with the |ALEFindReferences| command. See the documentation for the command for a full list of options. ------------------------------------------------------------------------------- -5.5 Hovering *ale-hover* +5.6 Hovering *ale-hover* ALE supports "hover" information for printing brief information about symbols at the cursor taken from LSP linters. The following commands are supported: @@ -673,18 +696,20 @@ Documentation for symbols at the cursor can be retrieved using the |ALEDocumentation| command. This command is only available for `tsserver`. ------------------------------------------------------------------------------- -5.6 Symbol Search *ale-symbol-search* +5.7 Symbol Search *ale-symbol-search* ALE supports searching for workspace symbols via LSP linters with the |ALESymbolSearch| command. See the documentation for the command for a full list of options. ------------------------------------------------------------------------------- -5.7 Refactoring: Rename, Actions *ale-refactor* +5.8 Refactoring: Rename, Actions *ale-refactor* ALE supports renaming symbols in code such as variables or class names with the |ALERename| command. +`ALEFileRename` will rename file and fix import paths (tsserver only). + |ALECodeAction| will execute actions on the cursor or applied to a visual range selection, such as automatically fixing errors. @@ -849,11 +874,13 @@ g:ale_completion_tsserver_remove_warnings g:ale_completion_autoimport *g:ale_completion_autoimport* Type: Number - Default: `0` + Default: `1` - When this option is set to `0`, ALE will not try to automatically import - completion results from external modules. It can be enabled by setting it - to `1`. + When this option is set to `1`, ALE will try to automatically import + completion results from external modules. It can be disabled by setting it + to `0`. Some LSP servers include auto imports on every completion item so + disabling automatic imports may drop some or all completion items returnend + by it (e.g. eclipselsp). g:ale_completion_excluded_words *g:ale_completion_excluded_words* @@ -1439,9 +1466,9 @@ g:ale_linter_aliases *g:ale_linter_aliases* \ 'ps1': 'powershell', \ 'rmarkdown': 'r', \ 'rmd': 'r', - \ 'svelte': ['svelte', 'javascript'], \ 'systemverilog': 'verilog', \ 'typescriptreact': ['typescript', 'tsx'], + \ 'vader': ['vim', 'vader'], \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], @@ -1585,16 +1612,21 @@ g:ale_linters *g:ale_linters* \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], + \ 'json': ['jsonlint', 'spectral'], + \ 'json': ['jsonlint', 'spectral', 'vscodejson'], + \ 'json5': [], + \ 'jsonc': [], \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], \ 'rust': ['cargo', 'rls'], \ 'spec': [], - \ 'svelte': ['eslint', 'svelteserver'], \ 'text': [], + \ 'vader': ['vimls'], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], \ 'v': ['v'], + \ 'yaml': ['spectral', 'yaml-language-server', 'yamllint'], \} < This option can be used to enable only a particular set of linters for a @@ -1790,6 +1822,9 @@ g:ale_open_list *g:ale_open_list* loclist (|lopen|) or for the quickfix list instead if |g:ale_set_quickfix| is `1`. (|copen|) + When set to any higher numberical value, ALE will only open the window when + the number of warnings or errors are at least that many. + When set to `'on_save'`, ALE will only open the loclist after buffers have been saved. The list will be opened some time after buffers are saved and any linter for a buffer returns results. @@ -1810,8 +1845,8 @@ g:ale_open_list *g:ale_open_list* autocmd! autocmd QuitPre * if empty(&buftype) | lclose | endif augroup END -< +< g:ale_pattern_options *g:ale_pattern_options* Type: |Dictionary| @@ -2008,7 +2043,7 @@ g:ale_set_quickfix *g:ale_set_quickfix* This feature should not be used in combination with tools for searching for matches and commands like |:cfdo|, as ALE will replace the quickfix list pretty frequently. If you wish to use such tools, you should populate the - loclist instead. + loclist or use |ALEPopulateQuickfix| instead. g:ale_set_signs *g:ale_set_signs* @@ -2071,6 +2106,7 @@ g:ale_sign_priority *g:ale_sign_priority* g:ale_shell *g:ale_shell* + *b:ale_shell* Type: |String| Default: not set @@ -2088,6 +2124,7 @@ g:ale_shell *g:ale_shell* g:ale_shell_arguments *g:ale_shell_arguments* + *b:ale_shell_arguments* Type: |String| Default: not set @@ -2564,7 +2601,80 @@ g:ale_alex_use_global *g:ale_alex_use_global* ------------------------------------------------------------------------------- -7.2. Options for languagetool *ale-languagetool-options* +7.2. Options for cspell *ale-cspell-options* + +The options for `cspell` are shared between all filetypes, so options can be +configured only once. + +g:ale_cspell_executable *g:ale_cspell_executable* + *b:ale_cspell_executable* + Type: |String| + Default: `'cspell'` + + See |ale-integrations-local-executables| + + +g:ale_cspell_options *g:ale_cspell_options* + *b:ale_cspell_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to `cspell`. + + +g:ale_cspell_use_global *g:ale_cspell_use_global* + *b:ale_cspell_use_global* + Type: |Number| + Default: `get(g: 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +------------------------------------------------------------------------------- +7.3. Options for dprint *ale-dprint-options* + +`dprint` is a fixer for many file types, including: (java|type)script, +json(c?), markdown, and more. See https://dprint.dev/plugins for an up-to-date +list of supported plugins and their configuration options. + +g:ale_dprint_executable *g:ale_dprint_executable* + *b:ale_dprint_executable* + Type: |String| + Default: `'dprint'` + + See |ale-integrations-local-executables| + + +g:ale_dprint_config *g:ale_dprint_config* + *b:ale_dprint_config* + Type: |String| + Default: `'dprint.json'` + + This variable can be changed to provide a config file to `dprint`. The + default is the nearest `dprint.json` searching upward from the current + buffer. + + See https://dprint.dev/config and https://plugins.dprint.dev + + +g:ale_dprint_options *g:ale_dprint_options* + *b:ale_dprint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to `dprint`. + + +g:ale_dprint_use_global *g:ale_dprint_use_global* + *b:ale_dprint_use_global* + Type: |Number| + Default: `get(g: 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +------------------------------------------------------------------------------- +7.4. Options for languagetool *ale-languagetool-options* g:ale_languagetool_executable *g:ale_languagetool_executable* *b:ale_languagetool_executable* @@ -2584,7 +2694,7 @@ g:ale_languagetool_options *g:ale_languagetool_options* ------------------------------------------------------------------------------- -7.3. Options for write-good *ale-write-good-options* +7.5. Options for write-good *ale-write-good-options* The options for `write-good` are shared between all filetypes, so options can be configured once. @@ -2614,12 +2724,13 @@ g:ale_writegood_use_global *g:ale_writegood_use_global* ------------------------------------------------------------------------------- -7.4. Other Linter/Fixer Options *ale-other-integration-options* +7.6. Other Linter/Fixer Options *ale-other-integration-options* ALE supports a very wide variety of tools. Other linter or fixer options are documented in additional help files. ada.....................................|ale-ada-options| + cspell................................|ale-ada-cspell| gcc...................................|ale-ada-gcc| gnatpp................................|ale-ada-gnatpp| ada-language-server...................|ale-ada-language-server| @@ -2629,10 +2740,13 @@ documented in additional help files. apkbuild-lint.........................|ale-apkbuild-apkbuild-lint| secfixes-check........................|ale-apkbuild-secfixes-check| asciidoc................................|ale-asciidoc-options| + cspell................................|ale-asciidoc-cspell| write-good............................|ale-asciidoc-write-good| textlint..............................|ale-asciidoc-textlint| asm.....................................|ale-asm-options| gcc...................................|ale-asm-gcc| + avra....................................|ale-avra-options| + avra..................................|ale-avra-avra| awk.....................................|ale-awk-options| gawk..................................|ale-awk-gawk| bats....................................|ale-bats-options| @@ -2641,6 +2755,8 @@ documented in additional help files. buildifier............................|ale-bazel-buildifier| bib.....................................|ale-bib-options| bibclean..............................|ale-bib-bibclean| + bitbake.................................|ale-bitbake-options| + oelint-adv............................|ale-bitbake-oelint_adv| c.......................................|ale-c-options| astyle................................|ale-c-astyle| cc....................................|ale-c-cc| @@ -2650,6 +2766,7 @@ documented in additional help files. clangtidy.............................|ale-c-clangtidy| cppcheck..............................|ale-c-cppcheck| cquery................................|ale-c-cquery| + cspell................................|ale-c-cspell| flawfinder............................|ale-c-flawfinder| uncrustify............................|ale-c-uncrustify| chef....................................|ale-chef-options| @@ -2662,6 +2779,7 @@ documented in additional help files. cfn-python-lint.......................|ale-cloudformation-cfn-python-lint| cmake...................................|ale-cmake-options| cmakelint.............................|ale-cmake-cmakelint| + cmake-lint............................|ale-cmake-cmake-lint| cmake-format..........................|ale-cmake-cmakeformat| cpp.....................................|ale-cpp-options| astyle................................|ale-cpp-astyle| @@ -2675,18 +2793,22 @@ documented in additional help files. cppcheck..............................|ale-cpp-cppcheck| cpplint...............................|ale-cpp-cpplint| cquery................................|ale-cpp-cquery| + cspell................................|ale-cpp-cspell| flawfinder............................|ale-cpp-flawfinder| uncrustify............................|ale-cpp-uncrustify| c#......................................|ale-cs-options| csc...................................|ale-cs-csc| + cspell................................|ale-cs-cspell| dotnet-format.........................|ale-cs-dotnet-format| mcs...................................|ale-cs-mcs| mcsc..................................|ale-cs-mcsc| uncrustify............................|ale-cs-uncrustify| css.....................................|ale-css-options| + cspell................................|ale-css-cspell| fecs..................................|ale-css-fecs| prettier..............................|ale-css-prettier| stylelint.............................|ale-css-stylelint| + vscodecss.............................|ale-css-vscode| cuda....................................|ale-cuda-options| nvcc..................................|ale-cuda-nvcc| clangd................................|ale-cuda-clangd| @@ -2701,7 +2823,6 @@ documented in additional help files. analysis_server.......................|ale-dart-analysis_server| dart-analyze..........................|ale-dart-analyze| dart-format...........................|ale-dart-format| - dartanalyzer..........................|ale-dart-dartanalyzer| dartfmt...............................|ale-dart-dartfmt| desktop.................................|ale-desktop-options| desktop-file-validate.................|ale-desktop-desktop-file-validate| @@ -2711,6 +2832,7 @@ documented in additional help files. dhall-lint............................|ale-dhall-lint| dockerfile..............................|ale-dockerfile-options| dockerfile_lint.......................|ale-dockerfile-dockerfile_lint| + dprint................................|ale-dockerfile-dprint| hadolint..............................|ale-dockerfile-hadolint| elixir..................................|ale-elixir-options| mix...................................|ale-elixir-mix| @@ -2718,6 +2840,7 @@ documented in additional help files. dialyxir..............................|ale-elixir-dialyxir| elixir-ls.............................|ale-elixir-elixir-ls| credo.................................|ale-elixir-credo| + cspell................................|ale-elixir-cspell| elm.....................................|ale-elm-options| elm-format............................|ale-elm-elm-format| elm-ls................................|ale-elm-elm-ls| @@ -2746,8 +2869,10 @@ documented in additional help files. glslls................................|ale-glsl-glslls| go......................................|ale-go-options| bingo.................................|ale-go-bingo| + cspell................................|ale-go-cspell| gobuild...............................|ale-go-gobuild| gofmt.................................|ale-go-gofmt| + gofumpt...............................|ale-go-gofumpt| golangci-lint.........................|ale-go-golangci-lint| golangserver..........................|ale-go-golangserver| golines...............................|ale-go-golines| @@ -2770,6 +2895,7 @@ documented in additional help files. ember-template-lint...................|ale-handlebars-embertemplatelint| haskell.................................|ale-haskell-options| brittany..............................|ale-haskell-brittany| + cspell................................|ale-haskell-cspell| floskell..............................|ale-haskell-floskell| ghc...................................|ale-haskell-ghc| ghc-mod...............................|ale-haskell-ghc-mod| @@ -2785,15 +2911,20 @@ documented in additional help files. hie...................................|ale-haskell-hie| ormolu................................|ale-haskell-ormolu| hcl.....................................|ale-hcl-options| + packer-fmt............................|ale-hcl-packer-fmt| terraform-fmt.........................|ale-hcl-terraform-fmt| + help....................................|ale-help-options| + cspell................................|ale-help-cspell| html....................................|ale-html-options| angular...............................|ale-html-angular| + cspell................................|ale-html-cspell| fecs..................................|ale-html-fecs| html-beautify.........................|ale-html-beautify| htmlhint..............................|ale-html-htmlhint| prettier..............................|ale-html-prettier| stylelint.............................|ale-html-stylelint| tidy..................................|ale-html-tidy| + vscodehtml............................|ale-html-vscode| write-good............................|ale-html-write-good| idris...................................|ale-idris-options| idris.................................|ale-idris-idris| @@ -2805,6 +2936,7 @@ documented in additional help files. ispc..................................|ale-ispc-ispc| java....................................|ale-java-options| checkstyle............................|ale-java-checkstyle| + cspell................................|ale-java-cspell| javac.................................|ale-java-javac| google-java-format....................|ale-java-google-java-format| pmd...................................|ale-java-pmd| @@ -2812,7 +2944,9 @@ documented in additional help files. eclipselsp............................|ale-java-eclipselsp| uncrustify............................|ale-java-uncrustify| javascript..............................|ale-javascript-options| + cspell................................|ale-javascript-cspell| deno..................................|ale-javascript-deno| + dprint................................|ale-javascript-dprint| eslint................................|ale-javascript-eslint| fecs..................................|ale-javascript-fecs| flow..................................|ale-javascript-flow| @@ -2825,12 +2959,15 @@ documented in additional help files. standard..............................|ale-javascript-standard| xo....................................|ale-javascript-xo| json....................................|ale-json-options| + cspell................................|ale-json-cspell| + dprint................................|ale-json-dprint| eslint................................|ale-json-eslint| fixjson...............................|ale-json-fixjson| jsonlint..............................|ale-json-jsonlint| jq....................................|ale-json-jq| prettier..............................|ale-json-prettier| spectral..............................|ale-json-spectral| + vscodejson............................|ale-json-vscode| jsonc...................................|ale-jsonc-options| eslint................................|ale-jsonc-eslint| jsonnet.................................|ale-jsonnet-options| @@ -2845,6 +2982,7 @@ documented in additional help files. ktlint................................|ale-kotlin-ktlint| languageserver........................|ale-kotlin-languageserver| latex...................................|ale-latex-options| + cspell................................|ale-latex-cspell| write-good............................|ale-latex-write-good| textlint..............................|ale-latex-textlint| less....................................|ale-less-options| @@ -2854,12 +2992,16 @@ documented in additional help files. llvm....................................|ale-llvm-options| llc...................................|ale-llvm-llc| lua.....................................|ale-lua-options| + cspell................................|ale-lua-cspell| lua-format............................|ale-lua-lua-format| luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| luafmt................................|ale-lua-luafmt| + selene................................|ale-lua-selene| stylua................................|ale-lua-stylua| markdown................................|ale-markdown-options| + cspell................................|ale-markdown-cspell| + dprint................................|ale-markdown-dprint| markdownlint..........................|ale-markdown-markdownlint| mdl...................................|ale-markdown-mdl| pandoc................................|ale-markdown-pandoc| @@ -2878,6 +3020,7 @@ documented in additional help files. nix.....................................|ale-nix-options| nixfmt................................|ale-nix-nixfmt| nixpkgs-fmt...........................|ale-nix-nixpkgs-fmt| + statix................................|ale-nix-statix| nroff...................................|ale-nroff-options| write-good............................|ale-nroff-write-good| objc....................................|ale-objc-options| @@ -2899,6 +3042,8 @@ documented in additional help files. ibm_validator.........................|ale-openapi-ibm-validator| prettier..............................|ale-openapi-prettier| yamllint..............................|ale-openapi-yamllint| + packer..................................|ale-packer-options| + packer-fmt-fixer......................|ale-packer-fmt-fixer| pascal..................................|ale-pascal-options| ptop..................................|ale-pascal-ptop| pawn....................................|ale-pawn-options| @@ -2910,6 +3055,7 @@ documented in additional help files. perl6...................................|ale-perl6-options| perl6.................................|ale-perl6-perl6| php.....................................|ale-php-options| + cspell................................|ale-php-cspell| langserver............................|ale-php-langserver| phan..................................|ale-php-phan| phpcbf................................|ale-php-phpcbf| @@ -2927,12 +3073,15 @@ documented in additional help files. write-good............................|ale-pod-write-good| pony....................................|ale-pony-options| ponyc.................................|ale-pony-ponyc| - powershell............................|ale-powershell-options| - powershell..........................|ale-powershell-powershell| - psscriptanalyzer....................|ale-powershell-psscriptanalyzer| + powershell..............................|ale-powershell-options| + cspell................................|ale-powershell-cspell| + powershell............................|ale-powershell-powershell| + psscriptanalyzer......................|ale-powershell-psscriptanalyzer| prolog..................................|ale-prolog-options| swipl.................................|ale-prolog-swipl| proto...................................|ale-proto-options| + buf-format............................|ale-proto-buf-format| + buf-lint..............................|ale-proto-buf-lint| protoc-gen-lint.......................|ale-proto-protoc-gen-lint| protolint.............................|ale-proto-protolint| pug.....................................|ale-pug-options| @@ -2953,6 +3102,7 @@ documented in additional help files. autopep8..............................|ale-python-autopep8| bandit................................|ale-python-bandit| black.................................|ale-python-black| + cspell................................|ale-python-cspell| flake8................................|ale-python-flake8| flakehell.............................|ale-python-flakehell| isort.................................|ale-python-isort| @@ -2967,6 +3117,7 @@ documented in additional help files. pyre..................................|ale-python-pyre| pyright...............................|ale-python-pyright| reorder-python-imports................|ale-python-reorder_python_imports| + unimport..............................|ale-python-unimport| vulture...............................|ale-python-vulture| yapf..................................|ale-python-yapf| qml.....................................|ale-qml-options| @@ -2980,13 +3131,19 @@ documented in additional help files. ols...................................|ale-reasonml-ols| reason-language-server................|ale-reasonml-language-server| refmt.................................|ale-reasonml-refmt| + rego....................................|ale-rego-options| + cspell................................|ale-rego-cspell| + opacheck..............................|ale-rego-opa-check| + opafmt................................|ale-rego-opa-fmt-fixer| restructuredtext........................|ale-restructuredtext-options| + cspell................................|ale-restructuredtext-cspell| textlint..............................|ale-restructuredtext-textlint| write-good............................|ale-restructuredtext-write-good| robot...................................|ale-robot-options| rflint................................|ale-robot-rflint| ruby....................................|ale-ruby-options| brakeman..............................|ale-ruby-brakeman| + cspell................................|ale-ruby-cspell| debride...............................|ale-ruby-debride| prettier..............................|ale-ruby-prettier| rails_best_practices..................|ale-ruby-rails_best_practices| @@ -3000,6 +3157,7 @@ documented in additional help files. rust....................................|ale-rust-options| analyzer..............................|ale-rust-analyzer| cargo.................................|ale-rust-cargo| + cspell................................|ale-rust-cspell| rls...................................|ale-rust-rls| rustc.................................|ale-rust-rustc| rustfmt...............................|ale-rust-rustfmt| @@ -3009,6 +3167,7 @@ documented in additional help files. sasslint..............................|ale-sass-sasslint| stylelint.............................|ale-sass-stylelint| scala...................................|ale-scala-options| + cspell................................|ale-scala-cspell| metals................................|ale-scala-metals| sbtserver.............................|ale-scala-sbtserver| scalafmt..............................|ale-scala-scalafmt| @@ -3019,6 +3178,7 @@ documented in additional help files. stylelint.............................|ale-scss-stylelint| sh......................................|ale-sh-options| bashate...............................|ale-sh-bashate| + cspell................................|ale-sh-cspell| sh-language-server....................|ale-sh-language-server| shell.................................|ale-sh-shell| shellcheck............................|ale-sh-shellcheck| @@ -3032,6 +3192,7 @@ documented in additional help files. spec....................................|ale-spec-options| rpmlint...............................|ale-spec-rpmlint| sql.....................................|ale-sql-options| + dprint................................|ale-sql-dprint| pgformatter...........................|ale-sql-pgformatter| sqlfmt................................|ale-sql-sqlfmt| sqlformat.............................|ale-sql-sqlformat| @@ -3044,12 +3205,14 @@ documented in additional help files. svelteserver..........................|ale-svelte-svelteserver| swift...................................|ale-swift-options| apple-swift-format....................|ale-swift-apple-swift-format| + cspell................................|ale-swift-cspell| sourcekitlsp..........................|ale-swift-sourcekitlsp| systemd.................................|ale-systemd-options| systemd-analyze.......................|ale-systemd-analyze| tcl.....................................|ale-tcl-options| nagelfar..............................|ale-tcl-nagelfar| terraform...............................|ale-terraform-options| + checkov...............................|ale-terraform-checkov| terraform-fmt-fixer...................|ale-terraform-fmt-fixer| terraform.............................|ale-terraform-terraform| terraform-ls..........................|ale-terraform-terraform-ls| @@ -3057,19 +3220,26 @@ documented in additional help files. tflint................................|ale-terraform-tflint| tex.....................................|ale-tex-options| chktex................................|ale-tex-chktex| + cspell................................|ale-tex-cspell| lacheck...............................|ale-tex-lacheck| latexindent...........................|ale-tex-latexindent| texlab................................|ale-tex-texlab| texinfo.................................|ale-texinfo-options| + cspell................................|ale-texinfo-cspell| write-good............................|ale-texinfo-write-good| text....................................|ale-text-options| + cspell................................|ale-text-cspell| textlint..............................|ale-text-textlint| write-good............................|ale-text-write-good| thrift..................................|ale-thrift-options| thrift................................|ale-thrift-thrift| thriftcheck...........................|ale-thrift-thriftcheck| + toml....................................|ale-toml-options| + dprint................................|ale-toml-dprint| typescript..............................|ale-typescript-options| + cspell................................|ale-typescript-cspell| deno..................................|ale-typescript-deno| + dprint................................|ale-typescript-dprint| eslint................................|ale-typescript-eslint| prettier..............................|ale-typescript-prettier| standard..............................|ale-typescript-standard| @@ -3099,17 +3269,24 @@ documented in additional help files. vimls.................................|ale-vim-vimls| vint..................................|ale-vim-vint| vue.....................................|ale-vue-options| + cspell................................|ale-vue-cspell| prettier..............................|ale-vue-prettier| vls...................................|ale-vue-vls| + volar.................................|ale-vue-volar| + wgsl....................................|ale-wgsl-options| + naga..................................|ale-wgsl-naga| xhtml...................................|ale-xhtml-options| + cspell................................|ale-xhtml-cspell| write-good............................|ale-xhtml-write-good| xml.....................................|ale-xml-options| xmllint...............................|ale-xml-xmllint| yaml....................................|ale-yaml-options| + actionlint............................|ale-yaml-actionlint| circleci..............................|ale-yaml-circleci| prettier..............................|ale-yaml-prettier| spectral..............................|ale-yaml-spectral| swaglint..............................|ale-yaml-swaglint| + yaml-language-server..................|ale-yaml-language-server| yamlfix...............................|ale-yaml-yamlfix| yamllint..............................|ale-yaml-yamllint| yang....................................|ale-yang-options| @@ -3117,6 +3294,7 @@ documented in additional help files. zeek....................................|ale-zeek-options| zeek..................................|ale-zeek-zeek| zig.....................................|ale-zig-options| + zigfmt................................|ale-zig-zigfmt| zls...................................|ale-zig-zls| @@ -3157,15 +3335,16 @@ ALEFindReferences *ALEFindReferences* The locations opened in different ways using the following variations. - `:ALEFindReferences -tab` - Open the location in a new tab. - `:ALEFindReferences -split` - Open the location in a horizontal split. - `:ALEFindReferences -vsplit` - Open the location in a vertical split. + `:ALEFindReferences -tab` - Open the location in a new tab. + `:ALEFindReferences -split` - Open the location in a horizontal split. + `:ALEFindReferences -vsplit` - Open the location in a vertical split. + `:ALEFindReferences -quickfix` - Put the locations into quickfix list. The default method used for navigating to a new location can be changed by modifying |g:ale_default_navigation|. You can add `-relative` to the command to view results with relatives paths, - instead of absolute paths. + instead of absolute paths. This option has no effect if `-quickfix` is used. The selection can be opened again with the |ALERepeatSelection| command. @@ -3256,6 +3435,33 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition* `(ale_go_to_type_definition_in_vsplit)` - `:ALEGoToTypeDefinition -vsplit` +ALEGoToImplementation *ALEGoToImplementation* + + This works similar to |ALEGoToDefinition| but instead jumps to the + implementation of symbol under the cursor. ALE will jump to a definition if + an LSP server provides a location to jump to. Otherwise, ALE will do nothing. + + The locations opened in different ways using the following variations. + + `:ALEGoToImplementation -tab` - Open the location in a new tab. + `:ALEGoToImplementation -split` - Open the location in a horizontal split. + `:ALEGoToImplementation -vsplit` - Open the location in a vertical split. + + The default method used for navigating to a new location can be changed + by modifying |g:ale_default_navigation|. + + You can jump back to the position you were at before going to the definition + of something with jump motions like CTRL-O. See |jump-motions|. + + The following Plug mappings are defined for this command, which correspond + to the following commands. + + `(ale_go_to_implementation)` - `:ALEGoToImplementation` + `(ale_go_to_implementation_in_tab)` - `:ALEGoToImplementation -tab` + `(ale_go_to_implementation_in_split)` - `:ALEGoToImplementation -split` + `(ale_go_to_implementation_in_vsplit)` - `:ALEGoToImplementation -vsplit` + + ALEHover *ALEHover* Print brief information about the symbol under the cursor, taken from any @@ -3298,6 +3504,13 @@ ALERename *ALERename* The symbol where the cursor is resting will be the symbol renamed, and a prompt will open to request a new name. + The rename operation will save all modified buffers when `set nohidden` is + set, because that disables leaving unsaved buffers in the background. See + `:help hidden` for more details. + +ALEFileRename *ALEFileRename* + + Rename a file and fix imports using `tsserver`. ALECodeAction *ALECodeAction* @@ -3345,6 +3558,20 @@ ALELintStop *ALELintStop* Any problems from previous linter results will continue to be shown. +ALEPopulateQuickfix *ALEPopulateQuickfix* +ALEPopulateLocList *ALEPopulateLocList* + + Manually populate the |quickfix| or |location-list| and show the + corresponding list. Useful when you have other uses for both the |quickfix| + and |location-list| and don't want them automatically populated. Be sure to + disable auto populating: > + + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 0 +< + With these settings, ALE will still run checking and display it with signs, + highlighting, and other output described in |ale-lint-file-linters|. + ALEPrevious *ALEPrevious* ALEPreviousWrap *ALEPreviousWrap* ALENext *ALENext* diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index d19824b1..8d829ddf 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -24,8 +24,10 @@ endif if !s:has_features " Only output a warning if editing some special files. if index(['', 'gitcommit'], &filetype) == -1 - execute 'echoerr ''ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel''' - execute 'echoerr ''Please update your editor appropriately.''' + " no-custom-checks + echoerr 'ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel' + " no-custom-checks + echoerr 'Please update your editor appropriately.' endif " Stop here, as it won't work. @@ -228,6 +230,10 @@ command! -bar ALELint :call ale#Queue(0, 'lint_file') " Stop current jobs when linting. command! -bar ALELintStop :call ale#engine#Stop(bufnr('')) +" Commands to manually populate the quickfixes. +command! -bar ALEPopulateQuickfix :call ale#list#ForcePopulateErrorList(1) +command! -bar ALEPopulateLocList :call ale#list#ForcePopulateErrorList(0) + " Define a command to get information about current filetype. command! -bar ALEInfo :call ale#debugging#Info() " The same, but copy output to your clipboard. @@ -246,6 +252,9 @@ command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler " Go to type definition for tsserver and LSP command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', ) +" Go to implementation for tsserver and LSP +command! -bar -nargs=* ALEGoToImplementation :call ale#definition#GoToCommandHandler('implementation', ) + " Repeat a previous selection in the preview window command! -bar ALERepeatSelection :call ale#preview#RepeatSelection() @@ -270,6 +279,9 @@ command! -bar ALEImport :call ale#completion#Import() " Rename symbols using tsserver and LSP command! -bar -bang ALERename :call ale#rename#Execute() +" Rename file using tsserver +command! -bar -bang ALEFileRename :call ale#filerename#Execute() + " Apply code actions to a range. command! -bar -range ALECodeAction :call ale#codefix#Execute() @@ -310,12 +322,16 @@ nnoremap (ale_go_to_type_definition) :ALEGoToTypeDefinition (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinition -tab nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinition -split nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionIn -vsplit +nnoremap (ale_go_to_implementation_in_tab) :ALEGoToImplementation -tab +nnoremap (ale_go_to_implementation_in_split) :ALEGoToImplementation -split +nnoremap (ale_go_to_implementation_in_vsplit) :ALEGoToImplementation -vsplit nnoremap (ale_find_references) :ALEFindReferences nnoremap (ale_hover) :ALEHover nnoremap (ale_documentation) :ALEDocumentation inoremap (ale_complete) :ALEComplete nnoremap (ale_import) :ALEImport nnoremap (ale_rename) :ALERename +nnoremap (ale_filerename) :ALEFileRename nnoremap (ale_code_action) :ALECodeAction nnoremap (ale_repeat_selection) :ALERepeatSelection diff --git a/sources_non_forked/ale/run-tests b/sources_non_forked/ale/run-tests new file mode 100755 index 00000000..93e94dec --- /dev/null +++ b/sources_non_forked/ale/run-tests @@ -0,0 +1,270 @@ +#!/usr/bin/env bash + +# Author: w0rp +# +# This script runs tests for the ALE project. Run `./run-tests --help` for +# options, or read the output below. +# + +image=denseanalysis/ale + +# Create docker image tag based on Dockerfile contents +if [ -n "$(command -v md5)" ]; then + image_tag=$(md5 -q Dockerfile) +else + image_tag=$(md5sum Dockerfile | cut -d' ' -f1) +fi +git_version=$(git describe --always --tags) + +# Used in all test scripts for running the selected Docker image. +DOCKER_RUN_IMAGE="$image:$image_tag" +export DOCKER_RUN_IMAGE + +tests='test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader' +# These flags are forwarded to the script for running Vader tests. +verbose_flag='' +quiet_flag='' +run_neovim_02_tests=1 +run_neovim_06_tests=1 +run_vim_80_tests=1 +run_vim_82_tests=1 +run_linters=1 + +while [ $# -ne 0 ]; do + case $1 in + -v) + verbose_flag='-v' + shift + ;; + -q) + quiet_flag='-q' + shift + ;; + --build-image) + run_vim_80_tests=0 + run_vim_82_tests=0 + run_neovim_02_tests=0 + run_neovim_06_tests=0 + run_linters=0 + shift + ;; + --neovim-only) + run_vim_80_tests=0 + run_vim_82_tests=0 + run_linters=0 + shift + ;; + --neovim-02-only) + run_neovim_06_tests=0 + run_vim_80_tests=0 + run_vim_82_tests=0 + run_linters=0 + shift + ;; + --neovim-06-only) + run_neovim_02_tests=0 + run_vim_80_tests=0 + run_vim_82_tests=0 + run_linters=0 + shift + ;; + --vim-only) + run_neovim_02_tests=0 + run_neovim_06_tests=0 + run_linters=0 + shift + ;; + --vim-80-only) + run_neovim_02_tests=0 + run_neovim_06_tests=0 + run_vim_82_tests=0 + run_linters=0 + shift + ;; + --vim-82-only) + run_neovim_02_tests=0 + run_neovim_06_tests=0 + run_vim_80_tests=0 + run_linters=0 + shift + ;; + --linters-only) + run_vim_80_tests=0 + run_vim_82_tests=0 + run_neovim_02_tests=0 + run_neovim_06_tests=0 + shift + ;; + --fast) + run_vim_80_tests=0 + run_vim_82_tests=0 + run_neovim_02_tests=0 + run_neovim_06_tests=1 + shift + ;; + --help) + echo 'Usage: ./run-tests [OPTION]... [FILE]...' + echo + echo 'Filenames can be given as arguments to run a subset of tests.' + echo 'For example: ./run-tests test/test_ale_var.vader' + echo + echo 'Options:' + echo ' -v Enable verbose output' + echo ' -q Hide output for successful tests' + echo ' --build-image Run docker image build only.' + echo ' --neovim-only Run tests only for NeoVim' + echo ' --neovim-02-only Run tests only for NeoVim 0.2' + echo ' --neovim-06-only Run tests only for NeoVim 0.6' + echo ' --vim-only Run tests only for Vim' + echo ' --vim-80-only Run tests only for Vim 8.0' + echo ' --vim-82-only Run tests only for Vim 8.2' + echo ' --linters-only Run only Vint and custom checks' + echo ' --fast Run only the fastest Vim and custom checks' + echo ' --help Show this help text' + echo ' -- Stop parsing options after this' + exit 0 + ;; + --) + shift + break + ;; + -?*) + echo "Invalid argument: $1" 1>&2 + exit 1 + ;; + *) + break + ;; + esac +done + +# Allow tests to be passed as arguments. +if [ $# -ne 0 ]; then + # This doesn't perfectly handle work splitting, but none of our files + # have spaces in the names. + tests="$*" + + # Don't run other tools when targeting tests. + run_linters=0 +fi + +# Delete .swp files in the test directory, which cause Vim 8 to hang. +find test -name '*.swp' -delete + +# Check if docker un image is available locally +has_image=$(docker images --quiet "${image}:${image_tag}" | wc -l) + +if [ "$has_image" -eq 0 ] +then + + echo "Downloading run image ${image}:${image_tag}" + docker pull "${image}:${image_tag}" &> /dev/null + + if [ $? -eq 1 ] + then + echo "Could not pull image ${image}:${image_tag}" + echo "Building run image ${image}:${image_tag}" + docker build --build-arg GIT_VERSION="$git_version" -t "${image}:${image_tag}" . + docker tag "${image}:${image_tag}" "${image}:latest" + + if [[ -z "${DOCKER_HUB_USER:-}" || -z "${DOCKER_HUB_PASS:-}" ]] + then + echo "Docker Hub credentials not set, skip push" + else + echo "Push ${image}:${image_tag} to Docker Hub" + echo "$DOCKER_HUB_PASS" | docker login -u "$DOCKER_HUB_USER" --password-stdin + docker push "${image}:${image_tag}" + fi + fi +else + echo "Docker run image ${image}:${image_tag} ready" +fi + +set -e +set -u + +docker tag "${image}:${image_tag}" "${image}:latest" + +output_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir') + +trap '{ rm -rf "$output_dir"; }' EXIT + +file_number=0 +pid_list='' + +# Used for killing tests when you kill the script. +cancel_tests() { + set +e + + if [ -n "$pid_list" ]; then + for pid in $pid_list; do + kill "$pid" + wait "$pid" + done + fi + + # shellcheck disable=SC2046 + docker kill $(docker ps -a -q --filter ancestor="$image" --format='{{.ID}}') &> /dev/null + + if [ -d "$output_dir" ]; then + rm -rf "$output_dir" + fi + + echo + exit 1 +} + +trap cancel_tests INT TERM + +for vim in $(docker run --rm "$DOCKER_RUN_IMAGE" ls /vim-build/bin | grep '^neovim\|^vim' ); do + if ( [[ $vim =~ ^vim-v8.0 ]] && ((run_vim_80_tests)) ) \ + || ( [[ $vim =~ ^vim-v8.2 ]] && ((run_vim_82_tests)) ) \ + || ( [[ $vim =~ ^neovim-v0.2 ]] && ((run_neovim_02_tests)) ) \ + || ( [[ $vim =~ ^neovim-v0.6 ]] && ((run_neovim_06_tests)) ); then + echo "Starting Vim: $vim..." + file_number=$((file_number+1)) + test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" \ + > "$output_dir/$file_number" 2>&1 & + pid_list="$pid_list $!" + fi +done + +if ((run_linters)); then + echo "Starting Vint..." + file_number=$((file_number+1)) + test/script/run-vint > "$output_dir/$file_number" 2>&1 & + pid_list="$pid_list $!" + + echo "Starting Custom checks..." + file_number=$((file_number+1)) + test/script/custom-checks &> "$output_dir/$file_number" 2>&1 & + pid_list="$pid_list $!" +fi + +echo + +failed=0 +index=0 + +for pid in $pid_list; do + this_failed=0 + index=$((index+1)) + + if ! wait "$pid"; then + failed=1 + this_failed=1 + fi + + # Hide output for things that passed if -q is set. + if [ "$quiet_flag" != '-q' ] || ((this_failed)); then + cat "$output_dir/$index" + fi +done + +if ((failed)); then + echo 'Something went wrong!' +else + echo 'All tests passed!' +fi + +exit $failed diff --git a/sources_non_forked/ale/run-tests.bat b/sources_non_forked/ale/run-tests.bat new file mode 100644 index 00000000..9ba6b554 --- /dev/null +++ b/sources_non_forked/ale/run-tests.bat @@ -0,0 +1,30 @@ +@echo off +REM Run tests on Windows. +REM +REM To run these tests, you should set up your Windows machine with the same +REM paths that are used in AppVeyor. + +set tests=test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*/*.vader + +REM Use the first argument for selecting tests to run. +if not "%1"=="" set tests=%1 + +set VADER_OUTPUT_FILE=%~dp0\vader_output +REM Automatically re-run Windows tests, which can fail some times. +set tries=0 + +:RUN_TESTS +set /a tries=%tries%+1 +type nul > "%VADER_OUTPUT_FILE%" +C:\vim\vim\vim80\vim.exe -u test/vimrc "+Vader! %tests%" +set code=%ERRORLEVEL% + +IF %code% EQU 0 GOTO :SHOW_RESULTS +IF %tries% GEQ 2 GOTO :SHOW_RESULTS +GOTO :RUN_TESTS + +:SHOW_RESULTS +type "%VADER_OUTPUT_FILE%" +del "%VADER_OUTPUT_FILE%" + +exit /B %code% diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index b2c0ec48..24e8de42 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -23,6 +23,7 @@ formatting. * Ada * [ada_language_server](https://github.com/AdaCore/ada_language_server) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [gcc](https://gcc.gnu.org) * [gnatpp](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/gnat_utility_programs.html#the-gnat-pretty-printer-gnatpp) :floppy_disk: * Ansible @@ -33,7 +34,8 @@ formatting. * [apkbuild-lint](https://gitlab.alpinelinux.org/Leo/atools) * [secfixes-check](https://gitlab.alpinelinux.org/Leo/atools) * AsciiDoc - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) @@ -42,10 +44,13 @@ formatting. * [write-good](https://github.com/btford/write-good) * ASM * [gcc](https://gcc.gnu.org) +* AVRA + * [avra](https://github.com/Ro5bert/avra) * Awk * [gawk](https://www.gnu.org/software/gawk/) * Bash * [bashate](https://github.com/openstack/bashate) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [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/) @@ -56,6 +61,8 @@ formatting. * [buildifier](https://github.com/bazelbuild/buildtools) * BibTeX * [bibclean](http://ftp.math.utah.edu/pub/bibclean/) +* BitBake + * [oelint-adv](https://github.com/priv-kweihmann/oelint-adv) * Bourne Shell * shell [-n flag](http://linux.die.net/man/1/sh) * [shellcheck](https://www.shellcheck.net/) @@ -68,13 +75,15 @@ formatting. * [clangd](https://clang.llvm.org/extra/clangd.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) - * [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) + * [cpplint](https://github.com/cpplint/cpplint) * [cquery](https://github.com/cquery-project/cquery) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [flawfinder](https://www.dwheeler.com/flawfinder/) * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * C# * [csc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-csc` for details and configuration + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [dotnet-format](https://github.com/dotnet/format) * [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/) :floppy_disk: see:`help ale-cs-mcsc` for details and configuration @@ -91,6 +100,7 @@ formatting. * [cppcheck](http://cppcheck.sourceforge.net) * [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) :floppy_disk: * [cquery](https://github.com/cquery-project/cquery) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [flawfinder](https://www.dwheeler.com/flawfinder/) * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) @@ -104,7 +114,8 @@ formatting. * [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) * CMake * [cmake-format](https://github.com/cheshirekow/cmake_format) - * [cmakelint](https://github.com/richq/cmake-lint) + * [cmake-lint](https://github.com/cheshirekow/cmake_format) + * [cmakelint](https://github.com/cmake-lint/cmake-lint) * CoffeeScript * [coffee](http://coffeescript.org/) * [coffeelint](https://www.npmjs.com/package/coffeelint) @@ -112,6 +123,8 @@ formatting. * [ameba](https://github.com/veelenga/ameba) :floppy_disk: * [crystal](https://crystal-lang.org/) :floppy_disk: * CSS + * [VSCode CSS language server](https://github.com/hrsh7th/vscode-langservers-extracted) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [csslint](http://csslint.net/) * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) @@ -135,9 +148,8 @@ formatting. * Dart * [analysis_server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server) * [dart-analyze](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: - * [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk: - * [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: - * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk: + * [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) + * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) * [language_server](https://github.com/natebosch/dart_language_server) * desktop * [desktop-file-validate](https://www.freedesktop.org/wiki/Software/desktop-file-utils/) @@ -147,9 +159,11 @@ formatting. * [dhall-lint](https://github.com/dhall-lang/dhall-lang) * Dockerfile * [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) + * [dprint](https://dprint.dev) * [hadolint](https://github.com/hadolint/hadolint) * Elixir * [credo](https://github.com/rrrene/credo) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [dialyxir](https://github.com/jeremyjh/dialyxir) * [dogma](https://github.com/lpil/dogma) :floppy_disk: * [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning: @@ -187,10 +201,12 @@ formatting. * [glslls](https://github.com/svenstaro/glsl-language-server) * Go * [bingo](https://github.com/saibing/bingo) :warning: + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [go build](https://golang.org/cmd/go/) :warning: :floppy_disk: * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: * [go vet](https://golang.org/cmd/vet/) :floppy_disk: * [gofmt](https://golang.org/cmd/gofmt/) + * [gofumpt](https://github.com/mvdan/gofumpt) * [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) :warning: * [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk: * [golangserver](https://github.com/sourcegraph/go-langserver) :warning: @@ -217,6 +233,7 @@ formatting. * Haskell * [brittany](https://github.com/lspitzner/brittany) * [cabal-ghc](https://www.haskell.org/cabal/) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [floskell](https://github.com/ennocramer/floskell) * [ghc](https://www.haskell.org/ghc/) * [ghc-mod](https://github.com/DanielG/ghc-mod) @@ -231,10 +248,13 @@ formatting. * [stack-ghc](https://haskellstack.org/) * [stylish-haskell](https://github.com/jaspervdj/stylish-haskell) * HCL + * [packer-fmt](https://github.com/hashicorp/packer) * [terraform-fmt](https://github.com/hashicorp/terraform) * HTML - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [VSCode HTML language server](https://github.com/hrsh7th/vscode-langservers-extracted) + * [alex](https://github.com/get-alex/alex) * [angular](https://www.npmjs.com/package/@angular/language-server) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [fecs](http://fecs.baidu.com/) * [html-beautify](https://beautifier.io/) * [htmlhint](http://htmlhint.com/) @@ -253,13 +273,16 @@ formatting. * Java * [PMD](https://pmd.github.io/) * [checkstyle](http://checkstyle.sourceforge.net) :floppy_disk: + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls) * [google-java-format](https://github.com/google/google-java-format) * [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [javalsp](https://github.com/georgewfraser/vscode-javac) * [uncrustify](https://github.com/uncrustify/uncrustify) * JavaScript + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [deno](https://deno.land/) + * [dprint](https://dprint.dev/) * [eslint](http://eslint.org/) * [fecs](http://fecs.baidu.com/) * [flow](https://flowtype.org/) @@ -272,16 +295,19 @@ formatting. * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) * [xo](https://github.com/sindresorhus/xo) * JSON - * [eslint](http://eslint.org/) + * [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: + * [dprint](https://dprint.dev) + * [eslint](http://eslint.org/) :warning: * [fixjson](https://github.com/rhysd/fixjson) - * [jq](https://stedolan.github.io/jq/) + * [jq](https://stedolan.github.io/jq/) :warning: * [jsonlint](https://github.com/zaach/jsonlint) * [prettier](https://github.com/prettier/prettier) * [spectral](https://github.com/stoplightio/spectral) * JSON5 - * [eslint](http://eslint.org/) + * [eslint](http://eslint.org/) :warning: * JSONC - * [eslint](http://eslint.org/) + * [eslint](http://eslint.org/) :warning: * Jsonnet * [jsonnet-lint](https://jsonnet.org/learning/tools.html) * [jsonnetfmt](https://jsonnet.org/learning/tools.html) @@ -292,8 +318,9 @@ formatting. * [ktlint](https://ktlint.github.io) * [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions * LaTeX - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) * [chktex](http://www.nongnu.org/chktex/) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [lacheck](https://www.ctan.org/pkg/lacheck) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) @@ -308,20 +335,23 @@ formatting. * LLVM * [llc](https://llvm.org/docs/CommandGuide/llc.html) * Lua + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [lua-format](https://github.com/Koihik/LuaFormatter) * [luac](https://www.lua.org/manual/5.1/luac.html) * [luacheck](https://github.com/mpeterv/luacheck) * [luafmt](https://github.com/trixnz/lua-fmt) + * [selene](https://github.com/Kampfkarren/selene) * [stylua](https://github.com/johnnymorganz/stylua) * Mail - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) * [vale](https://github.com/ValeLint/vale) * Make * [checkmake](https://github.com/mrtazz/checkmake) * Markdown - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [languagetool](https://languagetool.org/) :floppy_disk: * [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk: * [mdl](https://github.com/mivok/markdownlint) @@ -348,8 +378,9 @@ formatting. * [nixfmt](https://github.com/serokell/nixfmt) * [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) * [rnix-lsp](https://github.com/nix-community/rnix-lsp) + * [statix](https://github.com/nerdypepper/statix) * nroff - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Objective-C @@ -371,6 +402,8 @@ formatting. * [ibm_validator](https://github.com/IBM/openapi-validator) * [prettier](https://github.com/prettier/prettier) * [yamllint](https://yamllint.readthedocs.io/) +* Packer (HCL) + * [packer-fmt-fixer](https://github.com/hashicorp/packer) * Pascal * [ptop](https://www.freepascal.org/tools/ptop.var) * Pawn @@ -382,11 +415,13 @@ formatting. * Perl6 * [perl6 -c](https://perl6.org) :warning: * PHP + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [intelephense](https://github.com/bmewburn/intelephense-docs) * [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/) * [php-cs-fixer](http://cs.sensiolabs.org/) + * [phpactor](https://github.com/phpactor/phpactor) * [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) * [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) * [phpmd](https://phpmd.org) @@ -394,22 +429,25 @@ formatting. * [psalm](https://getpsalm.org) :floppy_disk: * [tlint](https://github.com/tightenco/tlint) * PO - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) * [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Pod - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Pony * [ponyc](https://github.com/ponylang/ponyc) * PowerShell + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [powershell](https://github.com/PowerShell/PowerShell) * [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer) * Prolog * [swipl](https://github.com/SWI-Prolog/swipl-devel) * proto + * [buf-format](https://github.com/bufbuild/buf) :floppy_disk: + * [buf-lint](https://github.com/bufbuild/buf) :floppy_disk: * [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) :floppy_disk: * [protolint](https://github.com/yoheimuta/protolint) :floppy_disk: * Pug @@ -427,7 +465,8 @@ formatting. * [autoimport](https://lyz-code.github.io/autoimport/) * [autopep8](https://github.com/hhatto/autopep8) * [bandit](https://github.com/PyCQA/bandit) :warning: - * [black](https://github.com/ambv/black) + * [black](https://github.com/psf/black) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [flake8](http://flake8.pycqa.org/en/latest/) * [flakehell](https://github.com/flakehell/flakehell) * [isort](https://github.com/timothycrosley/isort) @@ -442,6 +481,7 @@ formatting. * [pyre](https://github.com/facebook/pyre-check) :warning: * [pyright](https://github.com/microsoft/pyright) * [reorder-python-imports](https://github.com/asottile/reorder_python_imports) + * [unimport](https://github.com/hakancelik96/unimport) * [vulture](https://github.com/jendrikseipp/vulture) :warning: :floppy_disk: * [yapf](https://github.com/google/yapf) * QML @@ -461,8 +501,13 @@ formatting. * [ols](https://github.com/freebroccolo/ocaml-language-server) * [reason-language-server](https://github.com/jaredly/reason-language-server) * [refmt](https://github.com/reasonml/reason-cli) +* Rego + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) + * [opacheck](https://www.openpolicyagent.org/docs/latest/cli/#opa-check) + * [opafmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt) * reStructuredText - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) * [rstcheck](https://github.com/myint/rstcheck) @@ -475,6 +520,7 @@ formatting. * [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`) * Ruby * [brakeman](http://brakemanscanner.org/) :floppy_disk: + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [debride](https://github.com/seattlerb/debride) * [prettier](https://github.com/prettier/plugin-ruby) * [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) :floppy_disk: @@ -487,6 +533,7 @@ formatting. * [standardrb](https://github.com/testdouble/standard) * Rust * [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [rls](https://github.com/rust-lang-nursery/rls) :warning: * [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) :warning: * [rustc](https://www.rust-lang.org/) :warning: @@ -497,6 +544,7 @@ formatting. * [sass-lint](https://www.npmjs.com/package/sass-lint) * [stylelint](https://github.com/stylelint/stylelint) * Scala + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html) * [metals](https://scalameta.org/metals/) * [sbtserver](https://www.scala-sbt.org/1.x/docs/sbt-server.html) @@ -517,6 +565,7 @@ formatting. * [solhint](https://github.com/protofire/solhint) * [solium](https://github.com/duaraghav8/Solium) * SQL + * [dprint](https://dprint.dev) * [pgformatter](https://github.com/darold/pgFormatter) * [sql-lint](https://github.com/joereynolds/sql-lint) * [sqlfmt](https://github.com/jackc/sqlfmt) @@ -531,6 +580,7 @@ formatting. * [svelteserver](https://github.com/sveltejs/language-tools/tree/master/packages/language-server) * Swift * [Apple swift-format](https://github.com/apple/swift-format) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) * [swiftformat](https://github.com/nicklockwood/SwiftFormat) * [swiftlint](https://github.com/realm/SwiftLint) @@ -539,17 +589,20 @@ formatting. * Tcl * [nagelfar](http://nagelfar.sourceforge.net) :floppy_disk: * Terraform + * [checkov](https://github.com/bridgecrewio/checkov) * [terraform](https://github.com/hashicorp/terraform) * [terraform-fmt-fixer](https://github.com/hashicorp/terraform) * [terraform-ls](https://github.com/hashicorp/terraform-ls) * [terraform-lsp](https://github.com/juliosueiras/terraform-lsp) * [tflint](https://github.com/wata727/tflint) * Texinfo - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Text - * [alex](https://github.com/wooorm/alex) :warning: :floppy_disk: + * [alex](https://github.com/get-alex/alex) :warning: + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) :warning: * [redpen](http://redpen.cc/) :warning: @@ -559,8 +612,12 @@ formatting. * Thrift * [thrift](http://thrift.apache.org/) * [thriftcheck](https://github.com/pinterest/thriftcheck) +* TOML + * [dprint](https://dprint.dev) * TypeScript + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [deno](https://deno.land/) + * [dprint](https://dprint.dev/) * [eslint](http://eslint.org/) * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) @@ -589,23 +646,30 @@ formatting. * [vimls](https://github.com/iamcco/vim-language-server) * [vint](https://github.com/Kuniwak/vint) * Vim help - * [alex](https://github.com/wooorm/alex) :warning: :floppy_disk: + * [alex](https://github.com/get-alex/alex) :warning: * [proselint](http://proselint.com/) :warning: * [write-good](https://github.com/btford/write-good) :warning: * Vue + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [prettier](https://github.com/prettier/prettier) * [vls](https://github.com/vuejs/vetur/tree/master/server) + * [volar](https://github.com/johnsoncodehk/volar) +* WGSL + * [naga](https://github.com/gfx-rs/naga) * XHTML - * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [alex](https://github.com/get-alex/alex) + * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * XML * [xmllint](http://xmlsoft.org/xmllint.html) * YAML - * [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk: + * [actionlint](https://github.com/rhysd/actionlint) :warning: + * [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk: :warning: * [prettier](https://github.com/prettier/prettier) * [spectral](https://github.com/stoplightio/spectral) - * [swaglint](https://github.com/byCedric/swaglint) + * [swaglint](https://github.com/byCedric/swaglint) :warning: + * [yaml-language-server](https://github.com/redhat-developer/yaml-language-server) * [yamlfix](https://lyz-code.github.io/yamlfix) * [yamllint](https://yamllint.readthedocs.io/) * YANG @@ -613,4 +677,5 @@ formatting. * Zeek * [zeek](http://zeek.org) :floppy_disk: * Zig + * [zigfmt](https://github.com/ziglang/zig) * [zls](https://github.com/zigtools/zls) diff --git a/sources_non_forked/ale/test/completion/test_ale_import_command.vader b/sources_non_forked/ale/test/completion/test_ale_import_command.vader new file mode 100644 index 00000000..4770466e --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_ale_import_command.vader @@ -0,0 +1,562 @@ +Before: + Save g:ale_enabled + Save b:ale_enabled + Save g:ale_lint_on_text_changed + Save g:ale_completion_enabled + Save g:ale_completion_autoimport + Save g:ale_completion_max_suggestions + Save g:ale_linters + Save b:ale_linters + + let g:ale_enabled = 0 + let b:ale_enabled = 0 + let g:ale_lint_on_text_changed = 'always' + let g:ale_completion_enabled = 0 + let g:ale_completion_autoimport = 0 + let g:ale_completion_max_suggestions = 50 + let g:ale_linters = {'typescript': ['tsserver'], 'python': ['pyre']} + unlet! b:ale_linters + + let g:server_started_value = 1 + let g:request_id = 0 + let g:LastCallback = v:null + let g:LastHandleCallback = v:null + let g:sent_message_list = [] + let g:code_action_list = [] + let g:execute_list = [] + let g:ale_queue_call_list = [] + + runtime autoload/ale.vim + runtime autoload/ale/util.vim + runtime autoload/ale/code_action.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + + function! ale#util#Execute(expr) abort + call add(g:execute_list, a:expr) + endfunction + + function! ale#Queue(...) abort + call add(g:ale_queue_call_list, a:000) + endfunction + + function! ale#lsp#RegisterCallback(id, Callback) abort + let g:LastHandleCallback = a:Callback + endfunction + + function! ale#lsp#NotifyForChanges(id, buffer) abort + endfunction + + function! ale#lsp#HasCapability(id, capability) abort + return 1 + endfunction + + function! ale#lsp#Send(id, message) abort + let g:request_id += 1 + + call add(g:sent_message_list, a:message) + + return g:request_id + endfunction + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:LastCallback = a:Callback + + return g:server_started_value + endfunction + + function! ale#code_action#HandleCodeAction(code_action, options) abort + Assert !get(a:options, 'should_save') + + call add(g:code_action_list, a:code_action) + endfunction + + function GetLastMessage() + return get(g:execute_list, -1, '') + endfunction + + function CheckLintStates(conn_id, message) + " Check that we request more linter results after adding completions. + AssertEqual [[0, '']], g:ale_queue_call_list + + let g:ale_enabled = 0 + + let g:ale_queue_call_list = [] + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [], g:ale_queue_call_list + + let g:ale_enabled = 1 + let g:ale_lint_on_text_changed = 1 + + let g:ale_queue_call_list = [] + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [[0, '']], g:ale_queue_call_list + + let g:ale_lint_on_text_changed = 'normal' + + let g:ale_queue_call_list = [] + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [[0, '']], g:ale_queue_call_list + + let g:ale_lint_on_text_changed = 'insert' + + let g:ale_queue_call_list = [] + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [[0, '']], g:ale_queue_call_list + + let g:ale_queue_call_list = [] + let g:ale_lint_on_text_changed = 'never' + + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [], g:ale_queue_call_list + + let g:ale_lint_on_text_changed = '0' + + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [], g:ale_queue_call_list + + let g:ale_lint_on_text_changed = 0 + + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [], g:ale_queue_call_list + + let g:ale_lint_on_text_changed = 'xxx' + + call g:LastHandleCallback(a:conn_id, a:message) + AssertEqual [], g:ale_queue_call_list + endfunction + +After: + call ale#linter#Reset() + + Restore + + delfunction GetLastMessage + delfunction CheckLintStates + + unlet! g:LastCallback + unlet! g:LastHandleCallback + unlet! g:request_id + unlet! g:server_started_value + unlet! g:sent_message_list + unlet! g:code_action_list + unlet! g:ale_queue_call_list + unlet! g:execute_list + unlet! g:received_message + unlet! b:ale_old_omnifunc + unlet! b:ale_old_completeopt + unlet! b:ale_completion_info + unlet! b:ale_completion_result + unlet! b:ale_complete_done_time + + runtime autoload/ale.vim + runtime autoload/ale/util.vim + runtime autoload/ale/code_action.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + +Given typescript(Some example TypeScript code): + let xyz = 123 + let foo = missingword + + let abc = 456 + +Execute(ALEImport should complain when there's no word at the cursor): + call setpos('.', [bufnr(''), 3, 1, 0]) + ALEImport + + AssertEqual 'echom ''Nothing to complete at cursor!''', GetLastMessage() + +Execute(ALEImport should tell the user if no LSP is available): + let g:server_started_value = 0 + + call setpos('.', [bufnr(''), 2, 16, 0]) + ALEImport + + AssertEqual + \ 'echom ''No completion providers are available.''', + \ GetLastMessage() + +Execute(ALEImport should request imports correctly for tsserver): + call setpos('.', [bufnr(''), 2, 16, 0]) + + ALEImport + + AssertEqual + \ { + \ 'conn_id': 0, + \ 'request_id': 0, + \ 'source': 'ale-import', + \ 'column': 21, + \ 'line': 2, + \ 'line_length': 21, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ }, + \ b:ale_completion_info + Assert g:LastCallback isnot v:null + + call g:LastCallback(ale#linter#Get(&filetype)[0], { + \ 'connection_id': 347, + \ 'buffer': bufnr(''), + \}) + + AssertEqual + \ { + \ 'conn_id': 347, + \ 'request_id': 1, + \ 'source': 'ale-import', + \ 'column': 21, + \ 'line': 2, + \ 'line_length': 21, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ }, + \ b:ale_completion_info + Assert g:LastHandleCallback isnot v:null + + call g:LastHandleCallback(347, { + \ 'request_seq': 1, + \ 'command': 'completions', + \ 'body': [ + \ {'name': 'missingwordIgnoreMe'}, + \ {'name': 'missingword'}, + \ ], + \}) + + AssertEqual + \ [ + \ [0, 'ts@completions', { + \ 'file': expand('%:p'), + \ 'includeExternalModuleExports': 1, + \ 'offset': 21, + \ 'line': 2, + \ 'prefix': 'missingword', + \ }], + \ [0, 'ts@completionEntryDetails', { + \ 'file': expand('%:p'), + \ 'entryNames': [{'name': 'missingword'}], + \ 'offset': 21, + \ 'line': 2, + \ }] + \ ], + \ g:sent_message_list + AssertEqual 2, b:ale_completion_info.request_id + + let g:ale_enabled = 1 + let g:received_message = { + \ 'request_seq': 2, + \ 'command': 'completionEntryDetails', + \ 'body': [ + \ { + \ 'name': 'missingword', + \ 'kind': 'className', + \ 'displayParts': [], + \ 'codeActions': [{ + \ 'description': 'import { missingword } from "./Something";', + \ 'changes': [], + \ }], + \ }, + \ ], + \} + call g:LastHandleCallback(347, g:received_message) + + AssertEqual + \ [ + \ { + \ 'description': 'import { missingword } from "./Something";', + \ 'changes': [], + \ }, + \ ], + \ g:code_action_list + + call CheckLintStates(347, g:received_message) + +Execute(ALEImport should tell the user when no completions were found from tsserver): + call setpos('.', [bufnr(''), 2, 16, 0]) + + ALEImport + + AssertEqual + \ { + \ 'conn_id': 0, + \ 'request_id': 0, + \ 'source': 'ale-import', + \ 'column': 21, + \ 'line': 2, + \ 'line_length': 21, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ }, + \ b:ale_completion_info + Assert g:LastCallback isnot v:null + + call g:LastCallback(ale#linter#Get(&filetype)[0], { + \ 'connection_id': 347, + \ 'buffer': bufnr(''), + \}) + + AssertEqual + \ { + \ 'conn_id': 347, + \ 'request_id': 1, + \ 'source': 'ale-import', + \ 'column': 21, + \ 'line': 2, + \ 'line_length': 21, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ }, + \ b:ale_completion_info + Assert g:LastHandleCallback isnot v:null + + call g:LastHandleCallback(347, { + \ 'request_seq': 1, + \ 'command': 'completions', + \ 'body': [ + \ {'name': 'missingwordIgnoreMe'}, + \ ], + \}) + + AssertEqual 'echom ''No possible imports found.''', GetLastMessage() + +Given python(Some example Python code): + xyz = 123 + foo = missingword + + abc = 456 + +Execute(ALEImport should request imports correctly for language servers): + call setpos('.', [bufnr(''), 2, 12, 0]) + + ALEImport + + AssertEqual + \ { + \ 'conn_id': 0, + \ 'request_id': 0, + \ 'source': 'ale-import', + \ 'column': 17, + \ 'line': 2, + \ 'line_length': 17, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ }, + \ b:ale_completion_info + Assert g:LastCallback isnot v:null + + call g:LastCallback(ale#linter#Get(&filetype)[0], { + \ 'connection_id': 347, + \ 'buffer': bufnr(''), + \}) + + AssertEqual + \ { + \ 'conn_id': 347, + \ 'request_id': 1, + \ 'source': 'ale-import', + \ 'column': 17, + \ 'line': 2, + \ 'line_length': 17, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', + \ }, + \ b:ale_completion_info + Assert g:LastHandleCallback isnot v:null + + AssertEqual + \ [ + \ [0, 'textDocument/completion', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'character': 16, 'line': 1} + \ }], + \ ], + \ g:sent_message_list + AssertEqual 1, b:ale_completion_info.request_id + + let g:ale_enabled = 1 + let g:received_message = { + \ 'id': 1, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'Some other word we should ignore', + \ 'filterText': 'missingwordIgnoreMe', + \ 'insertText': 'missingwordIgnoreMe', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' missingwordIgnoreMe', + \ 'sortText': '3ee19999missingword', + \ 'additionalTextEdits': [ + \ { + \ 'range': { + \ 'start': {'line': 1, 'character': 1}, + \ 'end': {'line': 2, 'character': 1}, + \ }, + \ 'newText': 'from something import missingwordIgnoreMe', + \ }, + \ ], + \ }, + \ { + \ 'detail': 'Some word without text edits', + \ 'filterText': 'missingword', + \ 'insertText': 'missingword', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' missingword', + \ 'sortText': '3ee19999missingword', + \ }, + \ { + \ 'detail': 'The word we should use', + \ 'filterText': 'missingword', + \ 'insertText': 'missingword', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' missingword', + \ 'sortText': '3ee19999missingword', + \ 'additionalTextEdits': [ + \ { + \ 'range': { + \ 'start': {'line': 1, 'character': 1}, + \ 'end': {'line': 2, 'character': 1}, + \ }, + \ 'newText': 'from something import missingword', + \ }, + \ ], + \ }, + \ { + \ 'detail': 'The other word we should not use', + \ 'filterText': 'missingword', + \ 'insertText': 'missingword', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' missingword', + \ 'sortText': '3ee19999missingword', + \ 'additionalTextEdits': [ + \ { + \ 'range': { + \ 'start': {'line': 1, 'character': 1}, + \ 'end': {'line': 2, 'character': 1}, + \ }, + \ 'newText': 'from something_else import missingword', + \ }, + \ ], + \ }, + \ ], + \ }, + \} + call g:LastHandleCallback(347, g:received_message) + + AssertEqual + \ [ + \ { + \ 'description': 'completion', + \ 'changes': [ + \ { + \ 'fileName': expand('%:p'), + \ 'textChanges': [ + \ { + \ 'start': {'line': 2, 'offset': 2}, + \ 'end': {'line': 3, 'offset': 2}, + \ 'newText': 'from something import missingword', + \ }, + \ ], + \ }, + \ ], + \ }, + \ ], + \ g:code_action_list + + call CheckLintStates(347, g:received_message) + +Execute(ALEImport should tell the user when no completions were found from a language server): + call setpos('.', [bufnr(''), 2, 12, 0]) + + ALEImport + + AssertEqual + \ { + \ 'conn_id': 0, + \ 'request_id': 0, + \ 'source': 'ale-import', + \ 'column': 17, + \ 'line': 2, + \ 'line_length': 17, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ }, + \ b:ale_completion_info + Assert g:LastCallback isnot v:null + + call g:LastCallback(ale#linter#Get(&filetype)[0], { + \ 'connection_id': 347, + \ 'buffer': bufnr(''), + \}) + + AssertEqual + \ { + \ 'conn_id': 347, + \ 'request_id': 1, + \ 'source': 'ale-import', + \ 'column': 17, + \ 'line': 2, + \ 'line_length': 17, + \ 'prefix': 'missingword', + \ 'additional_edits_only': 1, + \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', + \ }, + \ b:ale_completion_info + Assert g:LastHandleCallback isnot v:null + + AssertEqual + \ [ + \ [0, 'textDocument/completion', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'character': 16, 'line': 1} + \ }], + \ ], + \ g:sent_message_list + AssertEqual 1, b:ale_completion_info.request_id + + let g:received_message = { + \ 'id': 1, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'Some other word we should ignore', + \ 'filterText': 'missingwordIgnoreMe', + \ 'insertText': 'missingwordIgnoreMe', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' missingwordIgnoreMe', + \ 'sortText': '3ee19999missingword', + \ 'additionalTextEdits': [ + \ { + \ 'range': { + \ 'start': {'line': 1, 'character': 1}, + \ 'end': {'line': 2, 'character': 1}, + \ }, + \ 'newText': 'from something import missingwordIgnoreMe', + \ }, + \ ], + \ }, + \ { + \ 'detail': 'Some word without text edits', + \ 'filterText': 'missingword', + \ 'insertText': 'missingword', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' missingword', + \ 'sortText': '3ee19999missingword', + \ }, + \ ], + \ }, + \} + call g:LastHandleCallback(347, g:received_message) + + AssertEqual 'echom ''No possible imports found.''', GetLastMessage() diff --git a/sources_non_forked/ale/test/completion/test_complete_events.vader b/sources_non_forked/ale/test/completion/test_complete_events.vader new file mode 100644 index 00000000..cee15985 --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_complete_events.vader @@ -0,0 +1,35 @@ +Before: + let g:complete_post_triggered = 0 + + augroup VaderTest + autocmd! + autocmd User ALECompletePost let g:complete_post_triggered = 1 + augroup END + +After: + unlet! b:ale_completion_info + unlet! g:complete_post_triggered + + augroup VaderTest + autocmd! + augroup END + + augroup! VaderTest + +Execute(ALECompletePost should not be triggered when completion is cancelled): + call ale#completion#HandleUserData({}) + + Assert !g:complete_post_triggered + +Execute(ALECompletePost should not be triggered when tools other than ALE insert completions): + call ale#completion#HandleUserData({'user_data': ''}) + call ale#completion#HandleUserData({'user_data': '{}'}) + + Assert !g:complete_post_triggered + +Execute(ALECompletePost should be triggered when ALE inserts completions): + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({'_ale_completion_item': 1}), + \}) + + Assert g:complete_post_triggered diff --git a/sources_non_forked/ale/test/completion/test_completion_events.vader b/sources_non_forked/ale/test/completion/test_completion_events.vader new file mode 100644 index 00000000..ed6dbea3 --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_completion_events.vader @@ -0,0 +1,486 @@ +Before: + Save g:ale_completion_enabled + Save g:ale_completion_delay + Save g:ale_completion_max_suggestions + Save &l:omnifunc + Save &l:completeopt + + unlet! b:ale_completion_enabled + let g:ale_completion_enabled = 1 + let g:get_completions_called = 0 + let g:feedkeys_calls = [] + let g:fake_mode = 'i' + + let b:ale_linters = { + \ 'typescript': ['tsserver'], + \} + + let &l:completeopt = 'menu,menuone,preview,noselect,noinsert' + + runtime autoload/ale/util.vim + + function! ale#util#FeedKeys(string) abort + call add(g:feedkeys_calls, [a:string]) + endfunction + + " Pretend we're in insert mode for most tests. + function! ale#util#Mode(...) abort + return g:fake_mode + endfunction + + function! CheckCompletionCalled(expect_success) abort + let g:get_completions_called = 0 + + " We just want to check if the function is called. + function! ale#completion#GetCompletions(source) + let g:get_completions_called = 1 + endfunction + + let g:ale_completion_delay = 0 + + " Run this check a few times, as it can fail randomly. + for l:i in range(has('nvim-0.3') || has('win32') ? 5 : 1) + call ale#completion#Queue() + sleep 1m + + if g:get_completions_called is a:expect_success + break + endif + endfor + + AssertEqual a:expect_success, g:get_completions_called + endfunction + + let g:handle_code_action_called = 0 + function! MockHandleCodeAction() abort + " delfunction! ale#code_action#HandleCodeAction + function! ale#code_action#HandleCodeAction(action, options) abort + Assert !get(a:options, 'should_save') + let g:handle_code_action_called += 1 + endfunction + endfunction + +After: + Restore + + unlet! b:ale_completion_enabled + unlet! g:output + unlet! g:fake_mode + unlet! g:get_completions_called + unlet! g:handle_code_action_called + unlet! b:ale_old_omnifunc + unlet! b:ale_old_completeopt + unlet! b:ale_completion_info + unlet! b:ale_completion_result + unlet! b:ale_complete_done_time + unlet! b:ale_linters + + delfunction CheckCompletionCalled + delfunction ale#code_action#HandleCodeAction + delfunction MockHandleCodeAction + + if exists('*CompleteCallback') + delfunction CompleteCallback + endif + + " Stop any timers we left behind. + " This stops the tests from failing randomly. + call ale#completion#StopTimer() + + " Reset the function. The runtime command below should fix this, but doesn't + " seem to fix it. + function! ale#util#Mode(...) abort + return call('mode', a:000) + endfunction + + runtime autoload/ale/completion.vim + runtime autoload/ale/code_action.vim + runtime autoload/ale/util.vim + +Execute(ale#completion#GetCompletions should be called when the cursor position stays the same): + call CheckCompletionCalled(1) + +Execute(ale#completion#GetCompletions should not be called if the global setting is disabled): + let g:ale_completion_enabled = 0 + call CheckCompletionCalled(0) + +Execute(ale#completion#GetCompletions should not be called if the buffer setting is disabled): + let b:ale_completion_enabled = 0 + call CheckCompletionCalled(0) + +Given typescript(): + let abc = y. + let foo = ab + let foo = (ab) + +Execute(ale#completion#GetCompletions should not be called when the cursor position changes): + call setpos('.', [bufnr(''), 1, 2, 0]) + + " We just want to check if the function is called. + function! ale#completion#GetCompletions(source) + let g:get_completions_called = 1 + endfunction + + let g:ale_completion_delay = 0 + call ale#completion#Queue() + + " Change the cursor position before the callback is triggered. + call setpos('.', [bufnr(''), 2, 2, 0]) + + sleep 1m + + Assert !g:get_completions_called + +Execute(ale#completion#GetCompletions should not be called if you switch to normal mode): + let &l:completeopt = 'menu,preview' + let g:fake_mode = 'n' + + " We just want to check if the function is called. + function! ale#completion#GetCompletions(source) + let g:get_completions_called = 1 + endfunction + + let g:ale_completion_delay = 0 + call ale#completion#Queue() + + sleep 1m + + Assert !g:get_completions_called + +Execute(Completion should not be done shortly after the CompleteDone function): + call CheckCompletionCalled(1) + call ale#completion#Done() + call CheckCompletionCalled(0) + +Execute(ale#completion#Show() should remember the omnifunc setting and replace it): + let &l:omnifunc = 'FooBar' + + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + AssertEqual 'FooBar', b:ale_old_omnifunc + AssertEqual 'ale#completion#AutomaticOmniFunc', &l:omnifunc + + AssertEqual [], g:feedkeys_calls + sleep 1ms + AssertEqual [["\(ale_show_completion_menu)"]], g:feedkeys_calls + +Execute(ale#completion#Show() should remember the completeopt setting and replace it): + let &l:completeopt = 'menu' + + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + AssertEqual 'menu', b:ale_old_completeopt + AssertEqual 'menu,menuone,noinsert', &l:completeopt + + AssertEqual [], g:feedkeys_calls + sleep 1ms + AssertEqual [["\(ale_show_completion_menu)"]], g:feedkeys_calls + +Execute(ale#completion#Show() should set the preview option if it's set): + let &l:completeopt = 'menu,preview' + + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + AssertEqual 'menu,preview', b:ale_old_completeopt + AssertEqual 'menu,menuone,noinsert,preview', &l:completeopt + + AssertEqual [], g:feedkeys_calls + sleep 1ms + AssertEqual [["\(ale_show_completion_menu)"]], g:feedkeys_calls + +Execute(ale#completion#Show() should not replace the completeopt setting for manual completion): + let b:ale_completion_info = {'source': 'ale-manual'} + + let &l:completeopt = 'menu,preview' + + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + Assert !exists('b:ale_old_completeopt') + + AssertEqual [], g:feedkeys_calls + sleep 1ms + AssertEqual [["\(ale_show_completion_menu)"]], g:feedkeys_calls + +Execute(ale#completion#AutomaticOmniFunc() should also remember the completeopt setting and replace it): + let &l:completeopt = 'menu,noselect' + + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#AutomaticOmniFunc(0, '') + + AssertEqual 'menu,noselect', b:ale_old_completeopt + AssertEqual 'menu,menuone,noinsert,noselect', &l:completeopt + +Execute(ale#completion#AutomaticOmniFunc() should set the preview option if it's set): + let &l:completeopt = 'menu,preview' + + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#AutomaticOmniFunc(0, '') + + AssertEqual 'menu,preview', b:ale_old_completeopt + AssertEqual 'menu,menuone,noinsert,preview', &l:completeopt + +Execute(ale#completion#Show() should make the correct feedkeys() call for automatic completion): + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + AssertEqual [], g:feedkeys_calls + sleep 1ms + AssertEqual [["\(ale_show_completion_menu)"]], g:feedkeys_calls + +Execute(ale#completion#Show() should make the correct feedkeys() call for manual completion): + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + AssertEqual [], g:feedkeys_calls + sleep 1ms + AssertEqual [["\(ale_show_completion_menu)"]], g:feedkeys_calls + +Execute(ale#completion#Show() should not call feedkeys() for other sources): + let b:ale_completion_info = {'source': 'other-source'} + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + sleep 1ms + AssertEqual [], g:feedkeys_calls + +Execute(ale#completion#Show() shouldn't do anything if you switch back to normal mode): + let &l:completeopt = 'menu,preview' + let g:fake_mode = 'n' + + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + AssertEqual 'menu,preview', &l:completeopt + Assert !exists('b:ale_old_omnifunc') + Assert !exists('b:ale_old_completeopt') + Assert !exists('b:ale_completion_result') + AssertEqual [], g:feedkeys_calls + +Execute(ale#completion#Show() should save the result it is given): + call ale#completion#Show([]) + + AssertEqual [], b:ale_completion_result + + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) + + AssertEqual [{'word': 'x', 'kind': 'v', 'icase': 1}], b:ale_completion_result + +Execute(ale#completion#Done() should restore old omnifunc values): + let b:ale_old_omnifunc = 'FooBar' + + call ale#completion#Done() + + " We reset the old omnifunc setting and remove the buffer variable. + AssertEqual 'FooBar', &l:omnifunc + Assert !has_key(b:, 'ale_old_omnifunc') + +Execute(ale#completion#Done() should restore the old completeopt setting): + let b:ale_old_completeopt = 'menu' + + call ale#completion#Done() + + AssertEqual 'menu', &l:completeopt + Assert !has_key(b:, 'ale_old_completeopt') + +Execute(ale#completion#Done() should leave settings alone when none were remembered): + let &l:omnifunc = 'BazBoz' + let &l:completeopt = 'menu' + + call ale#completion#Done() + + AssertEqual 'BazBoz', &l:omnifunc + AssertEqual 'menu', &l:completeopt + +Execute(The completion request_id should be reset when queuing again): + let b:ale_completion_info = {'request_id': 123} + + let g:ale_completion_delay = 0 + call ale#completion#Queue() + sleep 1m + + AssertEqual 0, b:ale_completion_info.request_id + +Execute(b:ale_completion_info should be set up correctly when requesting completions automatically): + let b:ale_completion_result = [] + call setpos('.', [bufnr(''), 3, 14, 0]) + call ale#completion#GetCompletions('ale-automatic') + + AssertEqual + \ { + \ 'request_id': 0, + \ 'conn_id': 0, + \ 'column': 14, + \ 'line_length': 14, + \ 'line': 3, + \ 'prefix': 'ab', + \ 'source': 'ale-automatic', + \ }, + \ b:ale_completion_info + Assert !exists('b:ale_completion_result') + +Execute(b:ale_completion_info should be set up correctly when requesting completions manually): + let b:ale_completion_result = [] + call setpos('.', [bufnr(''), 3, 14, 0]) + ALEComplete + + AssertEqual + \ { + \ 'request_id': 0, + \ 'conn_id': 0, + \ 'column': 14, + \ 'line_length': 14, + \ 'line': 3, + \ 'prefix': 'ab', + \ 'source': 'ale-manual', + \ }, + \ b:ale_completion_info + Assert !exists('b:ale_completion_result') + +Execute(b:ale_completion_info should be set up correctly for other sources): + let b:ale_completion_result = [] + call setpos('.', [bufnr(''), 3, 14, 0]) + call ale#completion#GetCompletions('ale-callback') + + AssertEqual + \ { + \ 'request_id': 0, + \ 'conn_id': 0, + \ 'column': 14, + \ 'line_length': 14, + \ 'line': 3, + \ 'prefix': 'ab', + \ 'source': 'ale-callback', + \ }, + \ b:ale_completion_info + Assert !exists('b:ale_completion_result') + +Execute(b:ale_completion_info should be set up correctly when requesting completions via callback): + let b:ale_completion_result = [] + call setpos('.', [bufnr(''), 3, 14, 0]) + + function! CompleteCallback() abort + echo 'Called' + endfunction + + + call ale#completion#GetCompletions('ale-callback', {'callback': funcref('CompleteCallback')}) + + AssertEqual + \ { + \ 'request_id': 0, + \ 'conn_id': 0, + \ 'column': 14, + \ 'line_length': 14, + \ 'line': 3, + \ 'prefix': 'ab', + \ 'source': 'ale-callback', + \ }, + \ b:ale_completion_info + Assert !exists('b:ale_completion_result') + +Execute(The correct keybinds should be configured): + redir => g:output + silent map (ale_show_completion_menu) + redir END + + AssertEqual + \ [ + \ 'n (ale_show_completion_menu) * :call ale#completion#RestoreCompletionOptions()', + \ 'o (ale_show_completion_menu) * ', + \ 'v (ale_show_completion_menu) * ', + \ ], + \ sort(split(g:output, "\n")) + +Execute(Running the normal mode keybind should reset the settings): + let b:ale_old_omnifunc = 'FooBar' + let b:ale_old_completeopt = 'menu' + + " We can't run the keybind, but we can call the function. + call ale#completion#RestoreCompletionOptions() + + AssertEqual 'FooBar', &l:omnifunc + AssertEqual 'menu', &l:completeopt + Assert !has_key(b:, 'ale_old_omnifunc') + Assert !has_key(b:, 'ale_old_completeopt') + +Execute(HandleUserData should call ale#code_action#HandleCodeAction): + let b:ale_completion_info = {'source': 'ale-manual'} + call MockHandleCodeAction() + + call ale#completion#HandleUserData({}) + AssertEqual g:handle_code_action_called, 0 + + call ale#completion#HandleUserData({ + \ 'user_data': '' + \}) + AssertEqual g:handle_code_action_called, 0 + + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({}), + \}) + AssertEqual g:handle_code_action_called, 0 + + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [], + \ }), + \}) + AssertEqual g:handle_code_action_called, 0 + + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [ + \ {'description': '', 'changes': []}, + \ ], + \ }), + \}) + AssertEqual g:handle_code_action_called, 1 + + let b:ale_completion_info = {'source': 'ale-automatic'} + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [ + \ {'description': '', 'changes': []}, + \ ], + \ }), + \}) + AssertEqual g:handle_code_action_called, 2 + + let b:ale_completion_info = {'source': 'ale-callback'} + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [ + \ {'description': '', 'changes': []}, + \ ], + \ }), + \}) + AssertEqual g:handle_code_action_called, 3 + + let b:ale_completion_info = {'source': 'ale-omnifunc'} + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [ + \ {'description': '', 'changes': []}, + \ ], + \ }), + \}) + AssertEqual g:handle_code_action_called, 4 + +Execute(ale#code_action#HandleCodeAction should not be called when when source is not ALE): + call MockHandleCodeAction() + let b:ale_completion_info = {'source': 'syntastic'} + call ale#completion#HandleUserData({ + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [ + \ {'description': '', 'changes': []}, + \ ], + \ }), + \}) + AssertEqual g:handle_code_action_called, 0 diff --git a/sources_non_forked/ale/test/completion/test_completion_filtering.vader b/sources_non_forked/ale/test/completion/test_completion_filtering.vader new file mode 100644 index 00000000..172203a4 --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_completion_filtering.vader @@ -0,0 +1,142 @@ +Before: + Save g:ale_completion_excluded_words + + let g:ale_completion_excluded_words = [] + +After: + Restore + + unlet! b:ale_completion_excluded_words + unlet! b:suggestions + +Execute(Prefix filtering should work for Lists of strings): + AssertEqual + \ ['FooBar', 'foo'], + \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], 'foo', 0) + AssertEqual + \ ['FooBar', 'FongBar', 'baz', 'foo'], + \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], '.', 0) + AssertEqual + \ ['FooBar', 'FongBar', 'baz', 'foo'], + \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], '', 0) + +Execute(Exact filtering should work): + AssertEqual + \ ['foo'], + \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], 'foo', 1) + AssertEqual + \ ['FooBar', 'FongBar', 'baz', 'foo'], + \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], '.', 1) + AssertEqual + \ ['Foo'], + \ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'Foo', 'foo'], 'Foo', 1) + +Execute(Prefix filtering should work for completion items): + AssertEqual + \ [{'word': 'FooBar'}, {'word': 'foo'}], + \ ale#completion#Filter( + \ bufnr(''), + \ '', + \ [ + \ {'word': 'FooBar'}, + \ {'word': 'FongBar'}, + \ {'word': 'baz'}, + \ {'word': 'foo'}, + \ ], + \ 'foo', + \ 0, + \ ) + + AssertEqual + \ [ + \ {'word': 'FooBar'}, + \ {'word': 'FongBar'}, + \ {'word': 'baz'}, + \ {'word': 'foo'}, + \ ], + \ ale#completion#Filter( + \ bufnr(''), + \ '', + \ [ + \ {'word': 'FooBar'}, + \ {'word': 'FongBar'}, + \ {'word': 'baz'}, + \ {'word': 'foo'}, + \ ], + \ '.', + \ 0, + \ ) + +Execute(Excluding words from completion results should work): + let b:ale_completion_excluded_words = ['it', 'describe'] + + AssertEqual + \ [{'word': 'Italian'}], + \ ale#completion#Filter( + \ bufnr(''), + \ '', + \ [ + \ {'word': 'Italian'}, + \ {'word': 'it'}, + \ ], + \ 'it', + \ 0, + \ ) + + AssertEqual + \ [{'word': 'Deutsch'}], + \ ale#completion#Filter( + \ bufnr(''), + \ '', + \ [ + \ {'word': 'describe'}, + \ {'word': 'Deutsch'}, + \ ], + \ 'de', + \ 0, + \ ) + + AssertEqual + \ [{'word': 'Deutsch'}], + \ ale#completion#Filter( + \ bufnr(''), + \ '', + \ [ + \ {'word': 'describe'}, + \ {'word': 'Deutsch'}, + \ ], + \ '.', + \ 0, + \ ) + +Execute(Excluding words from completion results should work with lists of Strings): + let b:ale_completion_excluded_words = ['it', 'describe'] + + AssertEqual + \ ['Italian'], + \ ale#completion#Filter(bufnr(''), '', ['Italian', 'it'], 'it', 0) + AssertEqual + \ ['Deutsch'], + \ ale#completion#Filter(bufnr(''), '', ['describe', 'Deutsch'], 'de', 0) + AssertEqual + \ ['Deutsch'], + \ ale#completion#Filter(bufnr(''), '', ['describe', 'Deutsch'], '.', 0) + AssertEqual + \ ['Deutsch'], + \ ale#completion#Filter(bufnr(''), '', ['Deutsch'], '', 0) + +Execute(Filtering shouldn't modify the original list): + let b:ale_completion_excluded_words = ['it', 'describe'] + let b:suggestions = [{'word': 'describe'}] + + AssertEqual [], ale#completion#Filter(bufnr(''), '', b:suggestions, '.', 0) + AssertEqual b:suggestions, [{'word': 'describe'}] + AssertEqual [], ale#completion#Filter(bufnr(''), '', b:suggestions, 'de', 0) + AssertEqual b:suggestions, [{'word': 'describe'}] + +Execute(Filtering should respect filetype triggers): + let b:suggestions = [{'word': 'describe'}] + + AssertEqual b:suggestions, ale#completion#Filter(bufnr(''), '', b:suggestions, '.', 0) + AssertEqual b:suggestions, ale#completion#Filter(bufnr(''), 'rust', b:suggestions, '.', 0) + AssertEqual b:suggestions, ale#completion#Filter(bufnr(''), 'rust', b:suggestions, '::', 0) diff --git a/sources_non_forked/ale/test/completion/test_completion_prefixes.vader b/sources_non_forked/ale/test/completion/test_completion_prefixes.vader new file mode 100644 index 00000000..3f2cab15 --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_completion_prefixes.vader @@ -0,0 +1,65 @@ +Given typescript(): + let abc = y. + let foo = ab + let foo = (ab) + let string1 = ' + let string2 = " + +Execute(Completion should be done after dots in TypeScript): + AssertEqual '.', ale#completion#GetPrefix(&filetype, 1, 13) + +Execute(Completion should be done after words in TypeScript): + AssertEqual 'ab', ale#completion#GetPrefix(&filetype, 2, 13) + +Execute(Completion should be done after words in parens in TypeScript): + AssertEqual 'ab', ale#completion#GetPrefix(&filetype, 3, 14) + +Execute(Completion should not be done after parens in TypeScript): + AssertEqual '', ale#completion#GetPrefix(&filetype, 3, 15) + +Execute(Completion should be done after strings in TypeScript): + AssertEqual '''', ale#completion#GetPrefix(&filetype, 4, 16) + AssertEqual '"', ale#completion#GetPrefix(&filetype, 5, 16) + +Execute(Completion prefixes should work for other filetypes): + AssertEqual 'ab', ale#completion#GetPrefix('xxxyyyzzz', 3, 14) + +Execute(Completion prefixes should work for other filetypes): + AssertEqual 'ab', ale#completion#GetPrefix('xxxyyyzzz', 3, 14) + +Given rust(): + let abc = y. + let abc = String:: + let foo = (ab) + +Execute(Completion should be done after dots in Rust): + AssertEqual '.', ale#completion#GetPrefix(&filetype, 1, 13) + +Execute(Completion should be done after colons in Rust): + AssertEqual '::', ale#completion#GetPrefix(&filetype, 2, 19) + +Execute(Completion should be done after words in parens in Rust): + AssertEqual 'ab', ale#completion#GetPrefix(&filetype, 3, 14) + +Execute(Completion should not be done after parens in Rust): + AssertEqual '', ale#completion#GetPrefix(&filetype, 3, 15) + +Given lisp(): + (minus-name + (full-name) + +Execute(Completion should be done for function names with minuses in Lisp): + AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12) + +Execute(Completion should not be done after parens in Lisp): + AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12) + +Given clojure(): + (minus-name + (full-name) + +Execute(Completion should be done for function names with minuses in Clojure): + AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12) + +Execute(Completion should not be done after parens in Clojure): + AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12) diff --git a/sources_non_forked/ale/test/completion/test_lsp_completion_messages.vader b/sources_non_forked/ale/test/completion/test_lsp_completion_messages.vader new file mode 100644 index 00000000..f6aa332b --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_lsp_completion_messages.vader @@ -0,0 +1,307 @@ +Before: + Save g:ale_completion_delay + Save g:ale_completion_max_suggestions + Save g:ale_completion_info + Save &l:omnifunc + Save &l:completeopt + + let g:ale_completion_enabled = 1 + + call ale#test#SetDirectory('/testplugin/test/completion') + call ale#test#SetFilename('dummy.txt') + + runtime autoload/ale/lsp.vim + + let g:message_list = [] + let g:capability_checked = '' + let g:conn_id = v:null + let g:Callback = '' + let g:init_callback_list = [] + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + + let l:details = { + \ 'command': 'foobar', + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \} + + call add(g:init_callback_list, {-> a:Callback(a:linter, l:details)}) + endfunction + + " Pretend we're in insert mode for most tests. + function! ale#util#Mode(...) abort + return 'i' + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + " Replace the Send function for LSP, so we can monitor calls to it. + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 1 + endfunction + +After: + Restore + + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + unlet! g:message_list + unlet! g:capability_checked + unlet! g:init_callback_list + unlet! g:conn_id + unlet! g:Callback + unlet! b:ale_old_omnifunc + unlet! b:ale_old_completeopt + unlet! b:ale_completion_info + unlet! b:ale_complete_done_time + unlet! b:ale_linters + unlet! b:ale_tsserver_completion_names + + " Reset the function. + function! ale#util#Mode(...) abort + return call('mode', a:000) + endfunction + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + " Stop any timers we left behind. + " This stops the tests from failing randomly. + call ale#completion#StopTimer() + + runtime autoload/ale/completion.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + +Given typescript(Some typescript file): + foo + somelongerline + bazxyzxyzxyz + +Execute(The right message should be sent for the initial tsserver request): + runtime ale_linters/typescript/tsserver.vim + let b:ale_linters = ['tsserver'] + " The cursor position needs to match what was saved before. + call setpos('.', [bufnr(''), 1, 3, 0]) + + call ale#completion#GetCompletions('ale-automatic') + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual 1, len(g:init_callback_list) + call map(g:init_callback_list, 'v:val()') + + AssertEqual 'completion', g:capability_checked + + " We should send the right callback. + AssertEqual + \ 'function(''ale#completion#HandleTSServerResponse'')', + \ string(g:Callback) + " We should send the right message. + AssertEqual + \ [[0, 'ts@completions', { + \ 'file': expand('%:p'), + \ 'line': 1, + \ 'offset': 3, + \ 'prefix': 'fo', + \ 'includeExternalModuleExports': g:ale_completion_autoimport, + \ }]], + \ g:message_list + " We should set up the completion info correctly. + AssertEqual + \ { + \ 'line_length': 3, + \ 'conn_id': g:conn_id, + \ 'column': 3, + \ 'request_id': 1, + \ 'line': 1, + \ 'prefix': 'fo', + \ 'source': 'ale-automatic', + \ }, + \ get(b:, 'ale_completion_info', {}) + +Execute(The right message sent to the tsserver LSP when the first completion message is received): + " The cursor position needs to match what was saved before. + call setpos('.', [bufnr(''), 1, 1, 0]) + let b:ale_completion_info = { + \ 'conn_id': 123, + \ 'prefix': 'f', + \ 'request_id': 4, + \ 'line': 1, + \ 'column': 1, + \} + " We should only show up to this many suggestions. + let g:ale_completion_max_suggestions = 3 + + " Handle the response for completions. + call ale#completion#HandleTSServerResponse(123, { + \ 'request_seq': 4, + \ 'command': 'completions', + \ 'body': [ + \ {'name': 'Baz'}, + \ {'name': 'dingDong'}, + \ {'name': 'Foo', 'source': '/path/to/foo.ts'}, + \ {'name': 'FooBar'}, + \ {'name': 'frazzle'}, + \ {'name': 'FFS'}, + \ ], + \}) + + " We should save the names we got in the buffer, as TSServer doesn't return + " details for every name. + AssertEqual [{ + \ 'word': 'Foo', + \ 'source': '/path/to/foo.ts', + \ }, { + \ 'word': 'FooBar', + \ 'source': '', + \ }, { + \ 'word': 'frazzle', + \ 'source': '', + \}], + \ get(b:, 'ale_tsserver_completion_names', []) + + " The entry details messages should have been sent. + AssertEqual + \ [[ + \ 0, + \ 'ts@completionEntryDetails', + \ { + \ 'file': expand('%:p'), + \ 'entryNames': [{ + \ 'name': 'Foo', + \ 'source': '/path/to/foo.ts', + \ }, { + \ 'name': 'FooBar', + \ }, { + \ 'name': 'frazzle', + \ }], + \ 'offset': 1, + \ 'line': 1, + \ }, + \ ]], + \ g:message_list + +Given python(Some Python file): + foo + somelongerline + bazxyzxyzxyz + +Execute(The right message should be sent for the initial LSP request): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + " The cursor position needs to match what was saved before. + call setpos('.', [bufnr(''), 1, 5, 0]) + + call ale#completion#GetCompletions('ale-automatic') + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual 1, len(g:init_callback_list) + call map(g:init_callback_list, 'v:val()') + + AssertEqual 'completion', g:capability_checked + + " We should send the right callback. + AssertEqual + \ 'function(''ale#completion#HandleLSPResponse'')', + \ string(g:Callback) + " We should send the right message. + " The character index needs to be at most the index of the last character on + " the line, or integration with pylsp will be broken. + " + " We need to send the message for changing the document first. + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/completion', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list + " We should set up the completion info correctly. + AssertEqual + \ { + \ 'line_length': 3, + \ 'conn_id': g:conn_id, + \ 'column': 3, + \ 'request_id': 1, + \ 'line': 1, + \ 'prefix': 'fo', + \ 'source': 'ale-automatic', + \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', + \ }, + \ get(b:, 'ale_completion_info', {}) + +Execute(Two completion requests shouldn't be sent in a row): + call ale#linter#PreventLoading('python') + call ale#linter#Define('python', { + \ 'name': 'foo', + \ 'lsp': 'stdio', + \ 'executable': 'foo', + \ 'command': 'foo', + \ 'project_root': {-> '/foo/bar'}, + \}) + call ale#linter#Define('python', { + \ 'name': 'bar', + \ 'lsp': 'stdio', + \ 'executable': 'foo', + \ 'command': 'foo', + \ 'project_root': {-> '/foo/bar'}, + \}) + let b:ale_linters = ['foo', 'bar'] + + " The cursor position needs to match what was saved before. + call setpos('.', [bufnr(''), 1, 5, 0]) + + call ale#completion#GetCompletions('ale-automatic') + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual 2, len(g:init_callback_list) + call map(g:init_callback_list, 'v:val()') + + AssertEqual 'completion', g:capability_checked + + " We should only send one completion message for two LSP servers. + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/completion', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list diff --git a/sources_non_forked/ale/test/completion/test_lsp_completion_parsing.vader b/sources_non_forked/ale/test/completion/test_lsp_completion_parsing.vader new file mode 100644 index 00000000..7fe22e0c --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_lsp_completion_parsing.vader @@ -0,0 +1,736 @@ +Before: + Save g:ale_completion_autoimport + Save g:ale_completion_max_suggestions + + let g:ale_completion_max_suggestions = 50 + +After: + Restore + + unlet! b:ale_completion_info + +Execute(Should handle Rust completion results correctly): + let g:ale_completion_autoimport = 0 + + AssertEqual + \ [ + \ {'word': 'new', 'dup': 0, 'menu': 'pub fn new() -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'with_capacity', 'dup': 0, 'menu': 'pub fn with_capacity(capacity: usize) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_utf8', 'dup': 0, 'menu': 'pub fn from_utf8(vec: Vec) -> Result', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_utf8_lossy', 'dup': 0, 'menu': 'pub fn from_utf8_lossy<''a>(v: &''a [u8]) -> Cow<''a, str>', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_utf16', 'dup': 0, 'menu': 'pub fn from_utf16(v: &[u16]) -> Result', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_utf16_lossy', 'dup': 0, 'menu': 'pub fn from_utf16_lossy(v: &[u16]) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_raw_parts', 'dup': 0, 'menu': 'pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: usize) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_utf8_unchecked', 'dup': 0, 'menu': 'pub unsafe fn from_utf8_unchecked(bytes: Vec) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_iter', 'dup': 0, 'menu': 'fn from_iter>(iter: I) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_iter', 'dup': 0, 'menu': 'fn from_iter>(iter: I) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_iter', 'dup': 0, 'menu': 'fn from_iter>(iter: I) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_iter', 'dup': 0, 'menu': 'fn from_iter>(iter: I) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_iter', 'dup': 0, 'menu': 'fn from_iter>>(iter: I) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Searcher', 'dup': 0, 'menu': 'type Searcher = <&''b str as Pattern<''a>>::Searcher;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'default', 'dup': 0, 'menu': 'fn default() -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Output', 'dup': 0, 'menu': 'type Output = String;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Output', 'dup': 0, 'menu': 'type Output = str;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Output', 'dup': 0, 'menu': 'type Output = str;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Output', 'dup': 0, 'menu': 'type Output = str;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Output', 'dup': 0, 'menu': 'type Output = str;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Output', 'dup': 0, 'menu': 'type Output = str;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Output', 'dup': 0, 'menu': 'type Output = str;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Target', 'dup': 0, 'menu': 'type Target = str;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'Err', 'dup': 0, 'menu': 'type Err = ParseError;', 'info': '', 'kind': 't', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from_str', 'dup': 0, 'menu': 'fn from_str(s: &str) -> Result', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from', 'dup': 0, 'menu': 'fn from(s: &''a str) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from', 'dup': 0, 'menu': 'fn from(s: Box) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'from', 'dup': 0, 'menu': 'fn from(s: Cow<''a, str>) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'to_vec', 'dup': 0, 'menu': 'pub fn to_vec(&self) -> Vec where T: Clone,', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \], + \ ale#completion#ParseLSPCompletions({ + \ "jsonrpc":"2.0", + \ "id":65, + \ "result":[ + \ { + \ "label":"new", + \ "kind":3, + \ "detail":"pub fn new() -> String" + \ }, + \ { + \ "label":"with_capacity", + \ "kind":3, + \ "detail":"pub fn with_capacity(capacity: usize) -> String" + \ }, + \ { + \ "label":"from_utf8", + \ "kind":3, + \ "detail":"pub fn from_utf8(vec: Vec) -> Result" + \ }, + \ { + \ "label":"from_utf8_lossy", + \ "kind":3, + \ "detail":"pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> Cow<'a, str>" + \ }, + \ { + \ "label":"from_utf16", + \ "kind":3, + \ "detail":"pub fn from_utf16(v: &[u16]) -> Result" + \ }, + \ { + \ "label":"from_utf16_lossy", + \ "kind":3, + \ "detail":"pub fn from_utf16_lossy(v: &[u16]) -> String" + \ }, + \ { + \ "label":"from_raw_parts", + \ "kind":3, + \ "detail":"pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: usize) -> String" + \ }, + \ { + \ "label":"from_utf8_unchecked", + \ "kind":3, + \ "detail":"pub unsafe fn from_utf8_unchecked(bytes: Vec) -> String" + \ }, + \ { + \ "label":"from_iter", + \ "kind":3, + \ "detail":"fn from_iter>(iter: I) -> String" + \ }, + \ { + \ "label":"from_iter", + \ "kind":3, + \ "detail":"fn from_iter>(iter: I) -> String" + \ }, + \ { + \ "label":"from_iter", + \ "kind":3, + \ "detail":"fn from_iter>(iter: I) -> String" + \ }, + \ { + \ "label":"from_iter", + \ "kind":3, + \ "detail":"fn from_iter>(iter: I) -> String" + \ }, + \ { + \ "label":"from_iter", + \ "kind":3, + \ "detail":"fn from_iter>>(iter: I) -> String" + \ }, + \ { + \ "label":"Searcher", + \ "kind":8, + \ "detail":"type Searcher = <&'b str as Pattern<'a>>::Searcher;" + \ }, + \ { + \ "label":"default", + \ "kind":3, + \ "detail":"fn default() -> String" + \ }, + \ { + \ "label":"Output", + \ "kind":8, + \ "detail":"type Output = String;" + \ }, + \ { + \ "label":"Output", + \ "kind":8, + \ "detail":"type Output = str;" + \ }, + \ { + \ "label":"Output", + \ "kind":8, + \ "detail":"type Output = str;" + \ }, + \ { + \ "label":"Output", + \ "kind":8, + \ "detail":"type Output = str;" + \ }, + \ { + \ "label":"Output", + \ "kind":8, + \ "detail":"type Output = str;" + \ }, + \ { + \ "label":"Output", + \ "kind":8, + \ "detail":"type Output = str;" + \ }, + \ { + \ "label":"Output", + \ "kind":8, + \ "detail":"type Output = str;" + \ }, + \ { + \ "label":"Target", + \ "kind":8, + \ "detail":"type Target = str;" + \ }, + \ { + \ "label":"Err", + \ "kind":8, + \ "detail":"type Err = ParseError;" + \ }, + \ { + \ "label":"from_str", + \ "kind":3, + \ "detail":"fn from_str(s: &str) -> Result" + \ }, + \ { + \ "label":"from", + \ "kind":3, + \ "detail":"fn from(s: &'a str) -> String" + \ }, + \ { + \ "label":"from", + \ "kind":3, + \ "detail":"fn from(s: Box) -> String" + \ }, + \ { + \ "label":"from", + \ "kind":3, + \ "detail":"fn from(s: Cow<'a, str>) -> String" + \ }, + \ { + \ "label":"to_vec", + \ "kind":3, + \ "detail":"pub fn to_vec(&self) -> Vec\nwhere\n T: Clone," + \ } + \ ] + \ }) + +Execute(Should handle Python completion results correctly): + let g:ale_completion_autoimport = 0 + let b:ale_completion_info = { + \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', + \} + + AssertEqual + \ [ + \ {'word': 'what', 'dup': 0, 'menu': 'example-python-project.bar.Bar', 'info': "what()\n\n", 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ "jsonrpc":"2.0", + \ "id":6, + \ "result":{ + \ "isIncomplete":v:false, + \ "items":[ + \ { + \ "label":"what()", + \ "kind":3, + \ "detail":"example-python-project.bar.Bar", + \ "documentation":"what()\n\n", + \ "sortText":"awhat", + \ "insertText":"what" + \ }, + \ { + \ "label":"__class__", + \ "kind":7, + \ "detail":"object", + \ "documentation":"type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type", + \ "sortText":"z__class__", + \ "insertText":"__class__" + \ }, + \ { + \ "label":"__delattr__(name)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Implement delattr(self, name).", + \ "sortText":"z__delattr__", + \ "insertText":"__delattr__" + \ }, + \ { + \ "label":"__dir__()", + \ "kind":3, + \ "detail":"object", + \ "documentation":"__dir__() -> list\ndefault dir() implementation", + \ "sortText":"z__dir__", + \ "insertText":"__dir__" + \ }, + \ { + \ "label":"__doc__", + \ "kind":18, + \ "detail":"object", + \ "documentation":"str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'.", + \ "sortText":"z__doc__", + \ "insertText":"__doc__" + \ }, + \ { + \ "label":"__eq__(value)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return self==value.", + \ "sortText":"z__eq__", + \ "insertText":"__eq__" + \ }, + \ { + \ "label":"__format__()", + \ "kind":3, + \ "detail":"object", + \ "documentation":"default object formatter", + \ "sortText":"z__format__", + \ "insertText":"__format__" + \ }, + \ { + \ "label":"__ge__(value)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return self>=value.", + \ "sortText":"z__ge__", + \ "insertText":"__ge__" + \ }, + \ { + \ "label":"__getattribute__(name)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return getattr(self, name).", + \ "sortText":"z__getattribute__", + \ "insertText":"__getattribute__" + \ }, + \ { + \ "label":"__gt__(value)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return self>value.", + \ "sortText":"z__gt__", + \ "insertText":"__gt__" + \ }, + \ { + \ "label":"__hash__()", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return hash(self).", + \ "sortText":"z__hash__", + \ "insertText":"__hash__" + \ }, + \ { + \ "label":"__init__(args, kwargs)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Initialize self.\u00a0\u00a0See help(type(self)) for accurate signature.", + \ "sortText":"z__init__", + \ "insertText":"__init__" + \ }, + \ { + \ "label":"__init_subclass__()", + \ "kind":3, + \ "detail":"object", + \ "documentation":"This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.", + \ "sortText":"z__init_subclass__", + \ "insertText":"__init_subclass__" + \ }, + \ { + \ "label":"__le__(value)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return self<=value.", + \ "sortText":"z__le__", + \ "insertText":"__le__" + \ }, + \ { + \ "label":"__lt__(value)", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return self int\nsize of object in memory, in bytes", + \ "sortText":"z__sizeof__", + \ "insertText":"__sizeof__" + \ }, + \ { + \ "label":"__str__()", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Return str(self).", + \ "sortText":"z__str__", + \ "insertText":"__str__" + \ }, + \ { + \ "label":"__subclasshook__()", + \ "kind":3, + \ "detail":"object", + \ "documentation":"Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented.\u00a0\u00a0If it returns\nNotImplemented, the normal algorithm is used.\u00a0\u00a0Otherwise, it\noverrides the normal algorithm (and the outcome is cached).", + \ "sortText":"z__subclasshook__", + \ "insertText":"__subclasshook__" + \ } + \ ] + \ } + \ }) + +Execute(Should handle extra Python completion results correctly): + let g:ale_completion_autoimport = 0 + + let b:ale_completion_info = { + \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', + \ 'prefix': 'mig', + \} + + AssertEqual + \ [ + \ {'word': 'migrations', 'dup': 0, 'menu': 'xxx', 'info': 'migrations', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ {'word': 'MigEngine', 'dup': 0, 'menu': 'xxx', 'info': 'mig engine', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'jsonrpc': '2.0', + \ 'id': 6, + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'label': 'migrations', + \ 'kind': 3, + \ 'detail': 'xxx', + \ 'documentation': 'migrations', + \ }, + \ { + \ 'label': 'MigEngine', + \ 'kind': 3, + \ 'detail': 'xxx', + \ 'documentation': 'mig engine', + \ }, + \ { + \ 'label': 'ignore me', + \ 'kind': 3, + \ 'detail': 'nope', + \ 'documentation': 'nope', + \ }, + \ ] + \ } + \ }) + +Execute(Should handle missing keys): + let g:ale_completion_autoimport = 0 + + AssertEqual + \ [ + \ {'word': 'x', 'dup': 0, 'menu': '', 'info': '', 'kind': 'v', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'jsonrpc': '2.0', + \ 'id': 6, + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'label': 'x', + \ }, + \ ] + \ } + \ }) + +Execute(Should handle documentation in the markdown format): + let g:ale_completion_autoimport = 0 + + AssertEqual + \ [ + \ {'word': 'migrations', 'dup': 0, 'menu': 'xxx', 'info': 'Markdown documentation', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'jsonrpc': '2.0', + \ 'id': 6, + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'label': 'migrations', + \ 'kind': 3, + \ 'detail': 'xxx', + \ 'documentation': { + \ 'kind': 'markdown', + \ 'value': 'Markdown documentation', + \ }, + \ }, + \ ], + \ }, + \ }) + +Execute(Should handle completion messages with textEdit objects): + let g:ale_completion_autoimport = 0 + + AssertEqual + \ [ + \ {'word': 'next_callback', 'dup': 0, 'menu': 'PlayTimeCallback', 'info': '', 'kind': 'v', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'id': 226, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'PlayTimeCallback', + \ 'filterText': 'next_callback', + \ 'insertText': 'ignoreme', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' next_callback', + \ 'sortText': '3ee19999next_callback', + \ 'textEdit': { + \ 'newText': 'next_callback', + \ 'range': { + \ 'end': {'character': 13, 'line': 12}, + \ 'start': {'character': 4, 'line': 12}, + \ }, + \ }, + \ }, + \ ], + \ }, + \ }) + +Execute(Should handle completion messages with textEdit objects and no insertTextFormat key): + let g:ale_completion_autoimport = 0 + + AssertEqual + \ [ + \ {'word': 'next_callback', 'dup': 0, 'menu': 'PlayTimeCallback', 'info': '', 'kind': 'v', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'id': 226, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'PlayTimeCallback', + \ 'filterText': 'next_callback', + \ 'insertText': 'ignoreme', + \ 'kind': 6, + \ 'label': ' next_callback', + \ 'sortText': '3ee19999next_callback', + \ 'textEdit': { + \ 'newText': 'next_callback', + \ 'range': { + \ 'end': {'character': 13, 'line': 12}, + \ 'start': {'character': 4, 'line': 12}, + \ }, + \ }, + \ }, + \ ], + \ }, + \ }) + +Execute(Should handle completion messages with the deprecated insertText attribute): + let g:ale_completion_autoimport = 0 + + AssertEqual + \ [ + \ {'word': 'next_callback', 'dup': 0, 'menu': 'PlayTimeCallback', 'info': '', 'kind': 'v', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})}, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'id': 226, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'PlayTimeCallback', + \ 'filterText': 'next_callback', + \ 'insertText': 'next_callback', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' next_callback', + \ 'sortText': '3ee19999next_callback', + \ }, + \ ], + \ }, + \ }) + +Execute(Should handle completion messages with additionalTextEdits when ale_completion_autoimport is turned on): + let g:ale_completion_autoimport = 1 + + AssertEqual + \ [ + \ { + \ 'word': 'next_callback', + \ 'dup': 1, + \ 'menu': 'PlayTimeCallback', + \ 'info': '', + \ 'kind': 'v', + \ 'icase': 1, + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [ + \ { + \ 'description': 'completion', + \ 'changes': [ + \ { + \ 'fileName': expand('#' . bufnr('') . ':p'), + \ 'textChanges': [ + \ { + \ 'start': { + \ 'line': 11, + \ 'offset': 2, + \ }, + \ 'end': { + \ 'line': 13, + \ 'offset': 4, + \ }, + \ 'newText': 'from "module" import next_callback', + \ }, + \ ], + \ }, + \ ], + \ }, + \ ], + \ }), + \ }, + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'id': 226, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'PlayTimeCallback', + \ 'filterText': 'next_callback', + \ 'insertText': 'next_callback', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' next_callback', + \ 'sortText': '3ee19999next_callback', + \ 'additionalTextEdits': [ + \ { + \ 'range': { + \ 'start': { + \ 'line': 10, + \ 'character': 1, + \ }, + \ 'end': { + \ 'line': 12, + \ 'character': 3, + \ }, + \ }, + \ 'newText': 'from "module" import next_callback', + \ }, + \ ], + \ }, + \ ], + \ }, + \ }) + +Execute(Should not handle completion messages with additionalTextEdits when ale_completion_autoimport is turned off): + let g:ale_completion_autoimport = 0 + let b:ale_completion_info = {'line': 30} + + AssertEqual + \ [], + \ ale#completion#ParseLSPCompletions({ + \ 'id': 226, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'PlayTimeCallback', + \ 'filterText': 'next_callback', + \ 'insertText': 'next_callback', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' next_callback', + \ 'sortText': '3ee19999next_callback', + \ 'additionalTextEdits': [ + \ { + \ 'range': { + \ 'start': { + \ 'line': 10, + \ 'character': 1, + \ }, + \ 'end': { + \ 'line': 12, + \ 'character': 3, + \ }, + \ }, + \ 'newText': 'from "module" import next_callback', + \ }, + \ ], + \ }, + \ ], + \ }, + \ }) + +Execute(Should still handle completion messages with empty additionalTextEdits with ale_completion_autoimport turned off): + let g:ale_completion_autoimport = 0 + + AssertEqual + \ [ + \ { + \ 'word': 'next_callback', + \ 'dup': 0, + \ 'menu': 'PlayTimeCallback', + \ 'info': '', + \ 'kind': 'v', + \ 'icase': 1, + \ 'user_data': json_encode({'_ale_completion_item': 1}), + \ } + \ ], + \ ale#completion#ParseLSPCompletions({ + \ 'id': 226, + \ 'jsonrpc': '2.0', + \ 'result': { + \ 'isIncomplete': v:false, + \ 'items': [ + \ { + \ 'detail': 'PlayTimeCallback', + \ 'filterText': 'next_callback', + \ 'insertText': 'next_callback', + \ 'insertTextFormat': 1, + \ 'kind': 6, + \ 'label': ' next_callback', + \ 'sortText': '3ee19999next_callback', + \ 'additionalTextEdits': [], + \ }, + \ ], + \ }, + \ }) diff --git a/sources_non_forked/ale/test/completion/test_omnifunc_completion.vader b/sources_non_forked/ale/test/completion/test_omnifunc_completion.vader new file mode 100644 index 00000000..1db64705 --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_omnifunc_completion.vader @@ -0,0 +1,60 @@ +Before: + unlet! b:ale_completion_info + unlet! b:ale_completion_result + + let b:lsp_started = 0 + + runtime autoload/ale/lsp_linter.vim + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + return b:lsp_started + endfunction + + function! SetCompletionResult(...) abort + let b:ale_completion_result = ['foo'] + endfunction + + function! SetCompletionResponse(...) abort + let b:ale_completion_result = ['foo'] + endfunction + +After: + unlet! b:ale_completion_info + unlet! b:ale_completion_result + unlet! b:lsp_started + + delfunction SetCompletionResult + delfunction SetCompletionResponse + + runtime autoload/ale/lsp_linter.vim + + call ale#linter#Reset() + +Given typescript(): + let abc = y. + let foo = ab + let foo = (ab) + +Execute(-3 should be returned when completion results cannot be requested): + AssertEqual -3, ale#completion#OmniFunc(1, '') + +Execute(The start position should be returned when results can be requested): + let b:lsp_started = 1 + call setpos('.', [bufnr(''), 3, 14, 0]) + + AssertEqual 11, ale#completion#OmniFunc(1, '') + +Execute(The omnifunc function should return async results): + " Neovim 0.2.0 and 0.4.4 struggles at running these tests. + if !has('nvim') + call timer_start(0, function('SetCompletionResult')) + + AssertEqual ['foo'], ale#completion#OmniFunc(0, '') + endif + +Execute(The omnifunc function should parse and return async responses): + if !has('nvim') + call timer_start(0, function('SetCompletionResponse')) + + AssertEqual ['foo'], ale#completion#OmniFunc(0, '') + endif diff --git a/sources_non_forked/ale/test/completion/test_public_completion_api.vader b/sources_non_forked/ale/test/completion/test_public_completion_api.vader new file mode 100644 index 00000000..03394820 --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_public_completion_api.vader @@ -0,0 +1,47 @@ +Before: + call ale#linter#Reset() + + unlet! b:ale_linters + unlet! b:ale_completion_info + unlet! b:ale_completion_result + +After: + call ale#linter#Reset() + + unlet! b:ale_linters + unlet! b:ale_completion_info + unlet! b:ale_completion_result + +Execute(ale#completion#GetCompletionResult() should return v:null when there are no results): + AssertEqual v:null, ale#completion#GetCompletionResult() + +Execute(ale#completion#GetCompletionResult() should return a result computed previously): + let b:ale_completion_result = [1] + + AssertEqual [1], ale#completion#GetCompletionResult() + +Execute(ale#completion#GetCompletionPosition() should return 0 when there is no completion information): + AssertEqual 0, ale#completion#GetCompletionPosition() + +Given python(Some Python file): + foo bar + +Execute(ale#completion#GetCompletionPosition() should return the position in the file when information is available): + let b:ale_completion_info = {'line': 1, 'column': 6} + + " This is the first character of 'bar' + AssertEqual 4, ale#completion#GetCompletionPosition() + +Execute(ale#completion#GetCompletionPositionForDeoplete() should return the position on the given input string): + " This is the first character of 'bar' + AssertEqual 4, ale#completion#GetCompletionPositionForDeoplete('foo bar') + +Execute(ale#completion#CanProvideCompletions should return 0 when no completion sources are available): + let b:ale_linters = ['flake8'] + AssertEqual 0, ale#completion#CanProvideCompletions() + +Execute(ale#completion#CanProvideCompletions should return 1 when at least one completion source is available): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + + AssertEqual 1, ale#completion#CanProvideCompletions() diff --git a/sources_non_forked/ale/test/completion/test_tsserver_completion_parsing.vader b/sources_non_forked/ale/test/completion/test_tsserver_completion_parsing.vader new file mode 100644 index 00000000..231c0f95 --- /dev/null +++ b/sources_non_forked/ale/test/completion/test_tsserver_completion_parsing.vader @@ -0,0 +1,309 @@ +Before: + Save g:ale_completion_tsserver_remove_warnings + + let g:ale_completion_tsserver_remove_warnings = 0 + +After: + Restore + + unlet! b:ale_tsserver_completion_names + +Execute(TypeScript completions responses should be parsed correctly): + AssertEqual [], + \ ale#completion#ParseTSServerCompletions({ + \ 'body': [], + \}) + AssertEqual + \ [ + \ { + \ 'word': 'foo', + \ 'source': '/path/to/foo.ts', + \ }, + \ { + \ 'word': 'bar', + \ 'source': '', + \ }, + \ { + \ 'word': 'baz', + \ 'source': '', + \ } + \ ], + \ ale#completion#ParseTSServerCompletions({ + \ 'body': [ + \ {'name': 'foo', 'source': '/path/to/foo.ts'}, + \ {'name': 'bar'}, + \ {'name': 'baz'}, + \ ], + \}) + +Execute(TypeScript completions responses should include warnings): + AssertEqual + \ [ + \ { + \ 'word': 'foo', + \ 'source': '/path/to/foo.ts', + \ }, + \ { + \ 'word': 'bar', + \ 'source': '', + \ }, + \ { + \ 'word': 'baz', + \ 'source': '', + \ } + \ ], + \ ale#completion#ParseTSServerCompletions({ + \ 'body': [ + \ {'name': 'foo', 'source': '/path/to/foo.ts'}, + \ {'name': 'bar', 'kind': 'warning'}, + \ {'name': 'baz'}, + \ ], + \}) + +Execute(TypeScript completions responses should not include warnings if excluded): + let g:ale_completion_tsserver_remove_warnings = 1 + AssertEqual + \ [ + \ { + \ 'word': 'foo', + \ 'source': '/path/to/foo.ts', + \ }, + \ { + \ 'word': 'baz', + \ 'source': '', + \ } + \ ], + \ ale#completion#ParseTSServerCompletions({ + \ 'body': [ + \ {'name': 'foo', 'source': '/path/to/foo.ts'}, + \ {'name': 'bar', 'kind': 'warning'}, + \ {'name': 'baz'}, + \ ], + \}) + +Execute(TypeScript completion details responses should be parsed correctly): + AssertEqual + \ [ + \ { + \ 'word': 'abc', + \ 'menu': '(property) Foo.abc: number', + \ 'info': '', + \ 'kind': 'v', + \ 'icase': 1, + \ 'user_data': json_encode({'_ale_completion_item': 1}), + \ 'dup': g:ale_completion_autoimport, + \ }, + \ { + \ 'word': 'def', + \ 'menu': '(property) Foo.def: number', + \ 'info': 'foo bar baz', + \ 'kind': 'v', + \ 'icase': 1, + \ 'user_data': json_encode({'_ale_completion_item': 1}), + \ 'dup': g:ale_completion_autoimport, + \ }, + \ { + \ 'word': 'ghi', + \ 'menu': '(class) Foo', + \ 'info': '', + \ 'kind': 'v', + \ 'icase': 1, + \ 'user_data': json_encode({'_ale_completion_item': 1}), + \ 'dup': g:ale_completion_autoimport, + \ }, + \ ], + \ ale#completion#ParseTSServerCompletionEntryDetails({ + \ 'body': [ + \ { + \ 'name': 'abc', + \ 'kind': 'parameterName', + \ 'displayParts': [ + \ {'text': '('}, + \ {'text': 'property'}, + \ {'text': ')'}, + \ {'text': ' '}, + \ {'text': 'Foo'}, + \ {'text': '.'}, + \ {'text': 'abc'}, + \ {'text': ':'}, + \ {'text': ' '}, + \ {'text': 'number'}, + \ ], + \ }, + \ { + \ 'name': 'def', + \ 'kind': 'parameterName', + \ 'displayParts': [ + \ {'text': '('}, + \ {'text': 'property'}, + \ {'text': ')'}, + \ {'text': ' '}, + \ {'text': 'Foo'}, + \ {'text': '.'}, + \ {'text': 'def'}, + \ {'text': ':'}, + \ {'text': ' '}, + \ {'text': 'number'}, + \ ], + \ 'documentation': [ + \ {'text': 'foo'}, + \ {'text': ' '}, + \ {'text': 'bar'}, + \ {'text': ' '}, + \ {'text': 'baz'}, + \ ], + \ }, + \ { + \ 'name': 'ghi', + \ 'kind': 'className', + \ 'displayParts': [ + \ {'text': '('}, + \ {'text': 'class'}, + \ {'text': ')'}, + \ {'text': ' '}, + \ {'text': 'Foo'}, + \ ], + \ }, + \ ], + \}) + +Execute(Entries without details should be included in the responses): + let b:ale_tsserver_completion_names = [{ + \ 'word': 'xyz', + \ 'source': '/path/to/xyz.ts', + \ }] + + AssertEqual + \ [ + \ { + \ 'word': 'abc', + \ 'menu': 'import { def } from "./Foo"; (property) Foo.abc: number', + \ 'info': '', + \ 'kind': 'v', + \ 'icase': 1, + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [{ + \ 'description': 'import { def } from "./Foo";', + \ 'changes': [], + \ }], + \ }), + \ 'dup': g:ale_completion_autoimport, + \ }, + \ { + \ 'word': 'def', + \ 'menu': '(property) Foo.def: number', + \ 'info': 'foo bar baz', + \ 'kind': 'v', + \ 'icase': 1, + \ 'user_data': json_encode({'_ale_completion_item': 1}), + \ 'dup': g:ale_completion_autoimport, + \ }, + \ { + \ 'word': 'xyz', + \ 'menu': '', + \ 'info': '', + \ 'kind': 'v', + \ 'user_data': json_encode({'_ale_completion_item': 1}), + \ 'icase': 1, + \ }, + \ ], + \ ale#completion#ParseTSServerCompletionEntryDetails({ + \ 'body': [ + \ { + \ 'name': 'abc', + \ 'kind': 'parameterName', + \ 'displayParts': [ + \ {'text': '('}, + \ {'text': 'property'}, + \ {'text': ')'}, + \ {'text': ' '}, + \ {'text': 'Foo'}, + \ {'text': '.'}, + \ {'text': 'abc'}, + \ {'text': ':'}, + \ {'text': ' '}, + \ {'text': 'number'}, + \ ], + \ 'codeActions': [{ + \ 'description': 'import { def } from "./Foo";', + \ 'changes': [], + \ }], + \ }, + \ { + \ 'name': 'def', + \ 'kind': 'parameterName', + \ 'displayParts': [ + \ {'text': '('}, + \ {'text': 'property'}, + \ {'text': ')'}, + \ {'text': ' '}, + \ {'text': 'Foo'}, + \ {'text': '.'}, + \ {'text': 'def'}, + \ {'text': ':'}, + \ {'text': ' '}, + \ {'text': 'number'}, + \ ], + \ 'documentation': [ + \ {'text': 'foo'}, + \ {'text': ' '}, + \ {'text': 'bar'}, + \ {'text': ' '}, + \ {'text': 'baz'}, + \ ], + \ }, + \ ], + \}) + +Execute(Default imports should be handled correctly): + AssertEqual + \ [ + \ { + \ 'word': 'abcd', + \ 'menu': 'Import default ''abcd'' from module "./foo" (alias) const abcd: 3', + \ 'info': '', + \ 'kind': 't', + \ 'icase': 1, + \ 'user_data': json_encode({ + \ '_ale_completion_item': 1, + \ 'code_actions': [{ + \ 'description': 'Import default ''abcd'' from module "./foo"', + \ 'changes': [], + \ }], + \ }), + \ 'dup': g:ale_completion_autoimport, + \ }, + \ ], + \ ale#completion#ParseTSServerCompletionEntryDetails({ + \ 'body': [ + \ { + \ 'name': 'default', + \ 'kind': 'alias', + \ 'displayParts': [ + \ {'kind': 'punctuation', 'text': '('}, + \ {'kind': 'text', 'text': 'alias'}, + \ {'kind': 'punctuation', 'text': ')'}, + \ {'kind': 'space', 'text': ' '}, + \ {'kind': 'keyword', 'text': 'const'}, + \ {'kind': 'space', 'text': ' '}, + \ {'kind': 'localName', 'text': 'abcd'}, + \ {'kind': 'punctuation', 'text': ':'}, + \ {'kind': 'space', 'text': ' '}, + \ {'kind': 'stringLiteral', 'text': '3'}, + \ {'kind': 'lineBreak', 'text': '^@'}, + \ {'kind': 'keyword', 'text': 'export'}, + \ {'kind': 'space', 'text': ' '}, + \ {'kind': 'keyword', 'text': 'default'}, + \ {'kind': 'space', 'text': ' '}, + \ {'kind': 'aliasName', 'text': 'abcd'} + \ ], + \ 'codeActions': [ + \ { + \ 'description': 'Import default ''abcd'' from module "./foo"', + \ 'changes': [], + \ }, + \ ], + \ }, + \ ], + \ }) diff --git a/sources_non_forked/ale/test/fix/test_ale_fix.vader b/sources_non_forked/ale/test/fix/test_ale_fix.vader new file mode 100644 index 00000000..6529f6f9 --- /dev/null +++ b/sources_non_forked/ale/test/fix/test_ale_fix.vader @@ -0,0 +1,884 @@ +Before: + Save g:ale_fixers + Save &shell + Save g:ale_enabled + Save g:ale_fix_on_save + Save g:ale_lint_on_save + Save g:ale_echo_cursor + Save g:ale_command_wrapper + Save g:ale_filename_mappings + + silent! cd /testplugin/test/fix + + unlet! b:ale_lint_on_save + let g:ale_enabled = 0 + let g:ale_echo_cursor = 0 + let g:ale_command_wrapper = '' + let g:ale_run_synchronously = 1 + let g:ale_set_lists_synchronously = 1 + let g:ale_fix_buffer_data = {} + let g:ale_fixers = { + \ 'testft': [], + \} + let g:ale_filename_mappings = {} + + let g:pre_success = 0 + let g:post_success = 0 + augroup VaderTest + autocmd! + autocmd User ALEFixPre let g:pre_success = 1 + autocmd User ALEFixPost let g:post_success = 1 + augroup END + + if !has('win32') + let &shell = '/bin/bash' + endif + + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('test.txt') + call ale#linter#PreventLoading('testft') + + function AddCarets(buffer, lines) abort + " map() is applied to the original lines here. + " This way, we can ensure that defensive copies are made. + return map(a:lines, '''^'' . v:val') + endfunction + + function Capitalize(buffer, lines) abort + return map(a:lines, 'toupper(v:val)') + endfunction + + function DoNothing(buffer, lines) abort + return 0 + endfunction + + function CatLine(buffer, lines) abort + return {'command': 'cat - <(echo d)'} + endfunction + + function CatLineOneArg(buffer) abort + return {'command': 'cat - <(echo d)'} + endfunction + + function CatLineDeferred(buffer, lines) abort + return ale#command#Run(a:buffer, 'echo', { + \ -> ale#command#Run(a:buffer, 'echo', {-> {'command': 'cat - <(echo d)'}}) + \}) + endfunction + + function ReplaceWithTempFile(buffer, lines) abort + return {'command': 'echo x > %t', 'read_temporary_file': 1} + endfunction + + function CatWithTempFile(buffer, lines) abort + return {'command': 'cat %t <(echo d)'} + endfunction + + function EchoFilename(buffer, lines) abort + return {'command': 'echo %s'} + endfunction + + function RemoveLastLine(buffer, lines) abort + return ['a', 'b'] + endfunction + + function RemoveLastLineOneArg(buffer) abort + return ['a', 'b'] + endfunction + + function! TestCallback(buffer, output) + return [{'lnum': 1, 'col': 1, 'text': 'xxx'}] + endfunction + + " echo will output a single blank line, and we should ingore it. + function! IgnoredEmptyOutput(buffer, output) + return {'command': has('win32') ? 'echo(' : 'echo'} + endfunction + + function! EchoLineNoPipe(buffer, output) + return {'command': 'echo new line', 'read_buffer': 0} + endfunction + + function! SetUpLinters() + call ale#linter#Define('testft', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': 'true', + \ 'command': 'true', + \}) + endfunction + + function GetLastMessage() + redir => l:output + silent mess + redir END + + let l:lines = split(l:output, "\n") + + return empty(l:lines) ? '' : l:lines[-1] + endfunction + + function! FixWithJSONPostProcessing(buffer) abort + let l:ProcessWith = 'JSONPostProcessor' + + " Test with lambdas where support is available. + if has('lambda') + let l:ProcessWith = {buffer, output -> JSONPostProcessor(buffer, output)} + endif + + " Escaping needs to be handled specially for CMD on Windows. + let l:json_string = has('win32') + \ ? '{"output":["x","y","z"]}' + \ : ale#Escape('{"output": ["x", "y", "z"]}') + + return { + \ 'command': 'echo ' . l:json_string, + \ 'read_buffer': 0, + \ 'process_with': l:ProcessWith, + \} + endfunction + + function! JSONPostProcessor(buffer, output) abort + return json_decode(a:output[0]).output + endfunction + +After: + Restore + unlet! g:test_filename + unlet! g:ale_run_synchronously + unlet! g:ale_set_lists_synchronously + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_emulate_job_failure + unlet! b:ale_fixers + unlet! b:ale_lint_on_save + unlet! b:ale_fix_on_save + unlet! b:ale_quitting + delfunction AddCarets + delfunction Capitalize + delfunction DoNothing + delfunction CatLine + delfunction CatLineOneArg + delfunction CatLineDeferred + delfunction ReplaceWithTempFile + delfunction CatWithTempFile + delfunction EchoFilename + delfunction RemoveLastLine + delfunction RemoveLastLineOneArg + delfunction TestCallback + delfunction SetUpLinters + delfunction GetLastMessage + delfunction IgnoredEmptyOutput + delfunction EchoLineNoPipe + delfunction FixWithJSONPostProcessing + delfunction JSONPostProcessor + + augroup VaderTest + autocmd! + augroup END + + augroup! VaderTest + + call ale#test#RestoreDirectory() + + call ale#fix#registry#ResetToDefaults() + call ale#linter#Reset() + + setlocal buftype=nofile + + if exists('g:test_filename') && filereadable(g:test_filename) + call delete(g:test_filename) + endif + + call setloclist(0, []) + + let g:ale_fix_buffer_data = {} + + " Clear the messages between tests. + echomsg '' + + if !exists('g:ale_command_wrapper') + let g:ale_command_wrapper = '' + endif + +Given testft (A file with three lines): + a + b + c + +Execute(ALEFix should complain when there are no functions to call): + ALEFix + call ale#test#FlushJobs() + AssertEqual 'No fixers have been defined. Try :ALEFixSuggest', GetLastMessage() + +Execute(ALEFix should not complain when the command is run with a bang): + echom 'none' + + ALEFix! + call ale#test#FlushJobs() + AssertEqual 'none', GetLastMessage() + +Execute(ALEFix should apply simple functions): + let g:ale_fixers.testft = ['AddCarets'] + ALEFix + call ale#test#FlushJobs() + +Expect(The first function should be used): + ^a + ^b + ^c + +Execute(Should apply filename mpapings): + " The command echos %s, and we'll map the current path so we can check + " that ALEFix applies filename mappings, end-to-end. + let g:ale_filename_mappings = { + \ 'echo_filename': [ + \ [expand('%:p:h') . '/', '/some/fake/path/'], + \ ], + \} + + call ale#fix#registry#Add('echo_filename', 'EchoFilename', [], 'echo filename') + let g:ale_fixers.testft = ['echo_filename'] + ALEFix + call ale#test#FlushJobs() + " Remote trailing whitespace from the line. + call setline(1, substitute(getline(1), '[ \r]\+$', '', '')) + +Expect(The mapped filename should be printed): + /some/fake/path/test.txt + +Execute(ALEFix should apply simple functions in a chain): + let g:ale_fixers.testft = ['AddCarets', 'Capitalize'] + ALEFix + call ale#test#FlushJobs() + +Expect(Both functions should be used): + ^A + ^B + ^C + +Execute(ALEFix should allow 0 to be returned to skip functions): + let g:ale_fixers.testft = ['DoNothing', 'Capitalize'] + ALEFix + call ale#test#FlushJobs() + +Expect(Only the second function should be applied): + A + B + C + +Execute(The * fixers shouldn't be used if an empty list is set for fixers): + let g:ale_fixers.testft = [] + let g:ale_fixers['*'] = ['Capitalize'] + ALEFix + call ale#test#FlushJobs() + +Expect(Nothing should be changed): + a + b + c + +Execute(* fixers should be used if no filetype is matched): + let g:ale_fixers = {'*': ['Capitalize']} + ALEFix + call ale#test#FlushJobs() + +Expect(The file should be changed): + A + B + C + +Execute(ALEFix should allow commands to be run): + if has('win32') + " Just skip this test on Windows, we can't run it. + call setline(1, ['a', 'b', 'c', 'd']) + else + let g:ale_fixers.testft = ['CatLine'] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(An extra line should be added): + a + b + c + d + +Execute(ALEFix should use fixers passed in commandline when provided): + let g:ale_fixers.testft = ['RemoveLastLine'] + ALEFix AddCarets Capitalize + call ale#test#FlushJobs() + +Expect(Only fixers passed via command line should be run): + ^A + ^B + ^C + +Execute(ALEFix should allow temporary files to be read): + if has('win32') + " Just skip this test on Windows, we can't run it. + call setline(1, ['x']) + 2,3d + else + let g:ale_fixers.testft = ['ReplaceWithTempFile'] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(The line we wrote to the temporary file should be used here): + x + +Execute(ALEFix should not read the temporary file when the option is not set): + if has('win32') + " Just skip this test on Windows, we can't run it. + call setline(1, ['a', 'b', 'c', 'd']) + else + let g:ale_fixers.testft = ['CatWithTempFile'] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(An extra line should be added): + a + b + c + d + +Execute(ALEFix should allow jobs and simple functions to be combined): + if has('win32') + " Just skip this test on Windows, we can't run it. + call setline(1, ['X']) + 2,3d + else + let g:ale_fixers.testft = ['ReplaceWithTempFile', 'Capitalize'] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(The lines from the temporary file should be modified): + X + +Execute(ALEFix should send lines modified by functions to jobs): + if has('win32') + " Just skip this test on Windows, we can't run it. + call setline(1, ['A', 'B', 'C', 'd']) + else + let g:ale_fixers.testft = ['Capitalize', 'CatLine'] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(The lines should first be modified by the function, then the job): + A + B + C + d + +Execute(ALEFix should skip commands when jobs fail to run): + let g:ale_emulate_job_failure = 1 + let g:ale_fixers.testft = ['CatLine', 'Capitalize'] + ALEFix + call ale#test#FlushJobs() + +Expect(Only the second function should be applied): + A + B + C + +Execute(ALEFix should handle strings for selecting a single function): + let g:ale_fixers.testft = 'AddCarets' + ALEFix + call ale#test#FlushJobs() + +Expect(The first function should be used): + ^a + ^b + ^c + +Execute(ALEFix should use functions from the registry): + call ale#fix#registry#Add('add_carets', 'AddCarets', [], 'Add some carets') + let g:ale_fixers.testft = ['add_carets'] + ALEFix + call ale#test#FlushJobs() + +Expect(The registry function should be used): + ^a + ^b + ^c + +Execute(ALEFix should be able to remove the last line for files): + let g:ale_fixers.testft = ['RemoveLastLine'] + ALEFix + call ale#test#FlushJobs() + +Expect(There should be only two lines): + a + b + +Execute(ALEFix should accept funcrefs): + let g:ale_fixers.testft = [function('RemoveLastLine')] + ALEFix + call ale#test#FlushJobs() + +Expect(There should be only two lines): + a + b + +Execute(ALEFix should accept lambdas): + if has('nvim') + " NeoVim 0.1.7 can't interpret lambdas correctly, so just set the lines + " to make the test pass. + call setline(1, ['a', 'b', 'c', 'd']) + else + let g:ale_fixers.testft = [{buffer, lines -> lines + ['d']}] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(There should be an extra line): + a + b + c + d + +Execute(ALEFix should user buffer-local fixer settings): + let g:ale_fixers.testft = ['AddCarets', 'Capitalize'] + let b:ale_fixers = {'testft': ['RemoveLastLine']} + ALEFix + call ale#test#FlushJobs() + +Expect(There should be only two lines): + a + b + +Execute(ALEFix should allow Lists to be used for buffer-local fixer settings): + let g:ale_fixers.testft = ['AddCarets', 'Capitalize'] + let b:ale_fixers = ['RemoveLastLine'] + ALEFix + call ale#test#FlushJobs() + +Expect(There should be only two lines): + a + b + +Given testft (A file with three lines): + a + b + c + +Execute(ALEFix should fix files on the save event): + let g:ale_fix_on_save = 1 + let g:ale_lint_on_save = 1 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + call writefile(getline(1, '$'), g:test_filename) + + let g:ale_fixers.testft = ['Capitalize'] + + " We have to set the buftype to empty so the file will be written. + setlocal buftype= + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + " We should save the file. + AssertEqual ['A', 'B', 'C'], readfile(g:test_filename) + Assert !&modified, 'The file was marked as ''modified''' + + if !has('win32') + " We should have run the linter. + AssertEqual [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 1, + \ 'text': 'xxx', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}], ale#test#GetLoclistWithoutNewerKeys() + endif + +Expect(The buffer should be modified): + A + B + C + +Given testft (A file with three lines): + a + b + c + +Execute(ALEFix should run the linters with b:ale_lint_on_save = 1): + let g:ale_fix_on_save = 0 + let b:ale_fix_on_save = 1 + let g:ale_lint_on_save = 1 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + call writefile(getline(1, '$'), g:test_filename) + + let g:ale_fixers.testft = ['Capitalize'] + + " We have to set the buftype to empty so the file will be written. + setlocal buftype= + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + " We should save the file. + AssertEqual ['A', 'B', 'C'], readfile(g:test_filename) + Assert !&modified, 'The file was marked as ''modified''' + + if !has('win32') + " We should have run the linter. + AssertEqual [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 1, + \ 'text': 'xxx', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}], ale#test#GetLoclistWithoutNewerKeys() + endif + +Expect(The buffer should be modified): + A + B + C + +Execute(ALEFix should not fix files on :wq): + let g:ale_fix_on_save = 1 + let g:ale_lint_on_save = 1 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + call writefile(getline(1, '$'), g:test_filename) + + let g:ale_fixers.testft = ['Capitalize'] + + " We have to set the buftype to empty so the file will be written. + setlocal buftype= + + call ale#events#QuitEvent(bufnr('')) + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + + " We should save the file. + AssertEqual ['a', 'b', 'c'], readfile(g:test_filename) + Assert &modified, 'The was not marked as ''modified''' + + " We should not run the linter. + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + +Expect(The buffer should not be modified): + a + b + c + +Given testft (A file with three lines): + a + b + c + +Execute(ALEFix should still lint with no linters to be applied): + let g:ale_fix_on_save = 1 + let g:ale_lint_on_save = 1 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + + let g:ale_fixers.testft = [] + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + Assert !filereadable(g:test_filename), 'The file should not have been saved' + + if !has('win32') + " We have run the linter. + AssertEqual [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 1, + \ 'text': 'xxx', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}], ale#test#GetLoclistWithoutNewerKeys() + endif + +Expect(The buffer should be the same): + a + b + c + +Execute(ALEFix should still lint when nothing was fixed on save): + let g:ale_fix_on_save = 1 + let g:ale_lint_on_save = 1 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + + let g:ale_fixers.testft = ['DoNothing'] + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + Assert !filereadable(g:test_filename), 'The file should not have been saved' + + if !has('win32') + " We should have run the linter. + AssertEqual [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 1, + \ 'text': 'xxx', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}], ale#test#GetLoclistWithoutNewerKeys() + endif + +Expect(The buffer should be the same): + a + b + c + +Execute(ALEFix should not lint the buffer on save if linting on save is disabled globally): + let g:ale_fix_on_save = 1 + let g:ale_lint_on_save = 0 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + + let g:ale_fixers.testft = ['DoNothing'] + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + Assert !filereadable(g:test_filename), 'The file should not have been saved' + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + +Expect(The buffer should be the same): + a + b + c + +Execute(ALEFix should not lint the buffer on save if linting on save is disabled locally): + let g:ale_fix_on_save = 1 + let b:ale_lint_on_save = 0 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + + let g:ale_fixers.testft = ['DoNothing'] + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + Assert !filereadable(g:test_filename), 'The file should not have been saved' + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + +Expect(The buffer should be the same): + a + b + c + +Given testft (A file with three lines): + a + b + c + +Execute(ale#fix#InitBufferData() should set up the correct data): + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + + call ale#fix#InitBufferData(bufnr(''), 'save_file') + + AssertEqual { + \ bufnr(''): { + \ 'temporary_directory_list': [], + \ 'done': 0, + \ 'lines_before': ['a', 'b', 'c'], + \ 'should_save': 1, + \ 'ignore_file_changed_errors': 0, + \ }, + \}, g:ale_fix_buffer_data + + call ale#fix#InitBufferData(bufnr(''), '!') + + AssertEqual { + \ bufnr(''): { + \ 'temporary_directory_list': [], + \ 'done': 0, + \ 'lines_before': ['a', 'b', 'c'], + \ 'should_save': 0, + \ 'ignore_file_changed_errors': 1, + \ }, + \}, g:ale_fix_buffer_data + +Execute(ALEFix simple functions should be able to accept one argument, the buffer): + let g:ale_fixers.testft = ['RemoveLastLineOneArg'] + ALEFix + call ale#test#FlushJobs() + +Expect(There should be only two lines): + a + b + +Execute(ALEFix should modify a buffer that is not modifiable, if it becomes modifiable later): + let g:ale_fixers.testft = ['RemoveLastLineOneArg'] + + set nomodifiable + ALEFix + call ale#test#FlushJobs() + set modifiable + call ale#fix#ApplyQueuedFixes(bufnr('')) + +Expect(There should be only two lines): + a + b + +Execute(b:ale_fix_on_save = 1 should override g:ale_fix_on_save = 0): + let g:ale_fix_on_save = 0 + let b:ale_fix_on_save = 1 + + let g:ale_fixers.testft = ['RemoveLastLineOneArg'] + call ale#events#SaveEvent(bufnr('')) + +Expect(There should be only two lines): + a + b + +Execute(b:ale_fix_on_save = 0 should override g:ale_fix_on_save = 1): + let g:ale_fix_on_save = 1 + let b:ale_fix_on_save = 0 + + let g:ale_fixers.testft = ['RemoveLastLineOneArg'] + call ale#events#SaveEvent(bufnr('')) + +Expect(The lines should be the same): + a + b + c + +Execute(ALEFix functions returning jobs should be able to accept one argument): + if has('win32') + " Just skip this test on Windows, we can't run it. + call setline(1, ['a', 'b', 'c', 'd']) + else + let g:ale_fixers.testft = ['CatLine'] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(An extra line should be added): + a + b + c + d + +Execute(ALE should print a message telling you something isn't a valid fixer when you type some nonsense): + let g:ale_fixers.testft = ['CatLine', 'invalidname'] + ALEFix + call ale#test#FlushJobs() + + AssertEqual 'There is no fixer named `invalidname`. Check :ALEFixSuggest', GetLastMessage() + +Execute(ALE should complain about invalid fixers with minuses in the name): + let g:ale_fixers.testft = ['foo-bar'] + ALEFix + call ale#test#FlushJobs() + + AssertEqual 'There is no fixer named `foo-bar`. Check :ALEFixSuggest', GetLastMessage() + +Execute(ALE should tolerate valid fixers with minuses in the name): + let g:ale_fixers.testft = ['prettier-standard'] + ALEFix + call ale#test#FlushJobs() + +Execute(Empty output should be ignored): + let g:ale_fixers.testft = ['IgnoredEmptyOutput'] + ALEFix + call ale#test#FlushJobs() + +Expect(The lines should be the same): + a + b + c + +Execute(A temporary file shouldn't be piped into the command when disabled): + let g:ale_fixers.testft = ['EchoLineNoPipe'] + ALEFix + call ale#test#FlushJobs() + + AssertEqual + \ string(ale#job#PrepareCommand(bufnr(''), 'echo new line')), + \ string(ale#history#Get(bufnr(''))[-1].command) + + " Remove trailing whitespace for Windows. + if has('win32') + %s/[[:space:]]*$//g + endif + +Expect(The new line should be used): + new line + +Execute(Post-processing should work): + let g:ale_fixers.testft = ['FixWithJSONPostProcessing'] + ALEFix + call ale#test#FlushJobs() + +Expect(The lines in the JSON should be used): + x + y + z + +Execute(ALEFix should apply autocmds): + let g:ale_fixers.testft = ['AddCarets'] + ALEFix + call ale#test#FlushJobs() + + AssertEqual g:pre_success, 1 + AssertEqual g:post_success, 1 + +Execute(ALEFix should support ale#command#Run): + if has('win32') + " Just skip this test on Windows, we can't run it. + call setline(1, ['a', 'b', 'c', 'd']) + else + let g:ale_fixers.testft = ['CatLineDeferred'] + ALEFix + call ale#test#FlushJobs() + endif + +Expect(The extra line should be added): + a + b + c + d diff --git a/sources_non_forked/ale/test/fix/test_ale_fix_aliases.vader b/sources_non_forked/ale/test/fix/test_ale_fix_aliases.vader new file mode 100644 index 00000000..d3c47b34 --- /dev/null +++ b/sources_non_forked/ale/test/fix/test_ale_fix_aliases.vader @@ -0,0 +1,5 @@ +Execute(prettier-eslint should be aliased): + AssertEqual 'ale#fixers#prettier_eslint#Fix', ale#fix#registry#GetFunc('prettier-eslint') + +Execute(prettier-standard should be aliased): + AssertEqual 'ale#fixers#prettier_standard#Fix', ale#fix#registry#GetFunc('prettier-standard') diff --git a/sources_non_forked/ale/test/fix/test_ale_fix_completion.vader b/sources_non_forked/ale/test/fix/test_ale_fix_completion.vader new file mode 100644 index 00000000..6c38bb8d --- /dev/null +++ b/sources_non_forked/ale/test/fix/test_ale_fix_completion.vader @@ -0,0 +1,23 @@ +Execute (List of available fixers is empty): + call ale#fix#registry#Clear() + +Then (List of applicable fixers for python file is empty): + AssertEqual [], ale#fix#registry#GetApplicableFixers('python') + +Execute (Add ruby fixer): + call ale#fix#registry#Add('ruby_fixer', 'fixer_fun', ['ruby'], 'ruby fixer') + +Then (List of applicable fixers for python file is still empty): + AssertEqual [], ale#fix#registry#GetApplicableFixers('python') + +Execute (Add generic fixer): + call ale#fix#registry#Add('generic_fixer', 'fixer_fun', [], 'generic fixer') + +Then (Generic fixer should be returned as applicable for python file): + AssertEqual ['generic_fixer'], ale#fix#registry#GetApplicableFixers('python') + +Execute (Add python fixer): + call ale#fix#registry#Add('python_fixer', 'fixer_func', ['python'], 'python fixer') + +Then (List of fixers should contain both generic and python fixers): + AssertEqual ['generic_fixer', 'python_fixer'], ale#fix#registry#GetApplicableFixers('python') diff --git a/sources_non_forked/ale/test/fix/test_ale_fix_completion_filter.vader b/sources_non_forked/ale/test/fix/test_ale_fix_completion_filter.vader new file mode 100644 index 00000000..536b7138 --- /dev/null +++ b/sources_non_forked/ale/test/fix/test_ale_fix_completion_filter.vader @@ -0,0 +1,14 @@ +Before: + call ale#fix#registry#Clear() + call ale#test#SetFilename('test.js') + call ale#fix#registry#Add('prettier', '', ['javascript'], 'prettier') + call ale#fix#registry#Add('eslint', '', ['javascript'], 'eslint') + setfiletype javascript + +Execute(completeFixers returns all of the applicable fixers without an arglead): + AssertEqual ['eslint', 'prettier'], + \ ale#fix#registry#CompleteFixers('', 'ALEFix ', 7) + +Execute(completeFixers returns all of the applicable fixers without an arglead): + AssertEqual ['prettier'], + \ ale#fix#registry#CompleteFixers('pre', 'ALEFix ', 10) diff --git a/sources_non_forked/ale/test/fix/test_ale_fix_ignore.vader b/sources_non_forked/ale/test/fix/test_ale_fix_ignore.vader new file mode 100644 index 00000000..5eb9b9ab --- /dev/null +++ b/sources_non_forked/ale/test/fix/test_ale_fix_ignore.vader @@ -0,0 +1,110 @@ +Before: + Save g:ale_fixers + Save g:ale_fix_on_save + Save g:ale_fix_on_save_ignore + + let g:ale_fix_on_save = 1 + let g:ale_fixers = {'abc': ['a', 'b'], 'xyz': ['c', 'd']} + unlet! b:ale_fixers + unlet! b:ale_fix_on_save_ignore + + function FixerA(buffer, lines) abort + return a:lines + ['a'] + endfunction + + function FixerB(buffer, lines) abort + return a:lines + ['b'] + endfunction + + function FixerC(buffer, lines) abort + return a:lines + ['c'] + endfunction + + function FixerD(buffer, lines) abort + return a:lines + ['d'] + endfunction + + set filetype=abc.xyz + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + + call ale#fix#registry#Add('a', 'FixerA', ['abc'], '') + call ale#fix#registry#Add('b', 'FixerB', ['abc'], '') + call ale#fix#registry#Add('c', 'FixerC', ['xyz'], '') + call ale#fix#registry#Add('d', 'FixerD', ['xyz'], '') + +After: + Restore + + if exists('g:test_filename') && filereadable(g:test_filename) + call delete(g:test_filename) + endif + + unlet! b:ale_fixers + unlet! b:ale_fix_on_save_ignore + unlet! g:test_filename + + delfunction FixerA + delfunction FixerB + delfunction FixerC + delfunction FixerD + + call ale#fix#registry#ResetToDefaults() + +Given abc.xyz (An empty file): +Execute(Ignoring with a filetype in a global Dictionary should work): + let g:ale_fix_on_save_ignore = {'abc': ['b'], 'xyz': ['c']} + + call ale#events#SaveEvent(bufnr('')) + + AssertEqual ['', 'a', 'd'], getline(1, '$') + +Execute(Ignoring with a filetype in a global List should work): + let g:ale_fix_on_save_ignore = ['b', 'c'] + + call ale#events#SaveEvent(bufnr('')) + + AssertEqual ['', 'a', 'd'], getline(1, '$') + +Execute(Ignoring with a filetype in a local Dictionary should work): + let g:ale_fix_on_save_ignore = {'abc': ['b'], 'xyz': ['c']} + " The local Dictionary should entirely replace the global one. + let b:ale_fix_on_save_ignore = {'abc': ['b']} + + call ale#events#SaveEvent(bufnr('')) + + AssertEqual ['', 'a', 'c', 'd'], getline(1, '$') + +Execute(Ignoring with a filetype in a local List should work): + let g:ale_fix_on_save_ignore = {'abc': ['b'], 'xyz': ['c']} + " The local List should entirely replace the global Dictionary. + let b:ale_fix_on_save_ignore = ['b'] + + call ale#events#SaveEvent(bufnr('')) + + AssertEqual ['', 'a', 'c', 'd'], getline(1, '$') + +Execute(Ignoring functions by reference with a Dictionary should work): + let g:ale_fixers = { + \ 'abc': [function('FixerA'), function('FixerB')], + \ 'xyz': [function('FixerC'), function('FixerD')], + \} + let b:ale_fix_on_save_ignore = { + \ 'abc': [function('FixerB')], + \ 'xyz': [function('FixerC')], + \} + + call ale#events#SaveEvent(bufnr('')) + + AssertEqual ['', 'a', 'd'], getline(1, '$') + +Execute(Ignoring functions by reference with a List should work): + let g:ale_fixers = { + \ 'abc': [function('FixerA'), function('FixerB')], + \ 'xyz': [function('FixerC'), function('FixerD')], + \} + let b:ale_fix_on_save_ignore = [function('FixerB'), function('FixerC')] + + call ale#events#SaveEvent(bufnr('')) + + AssertEqual ['', 'a', 'd'], getline(1, '$') diff --git a/sources_non_forked/ale/test/fix/test_ale_fix_suggest.vader b/sources_non_forked/ale/test/fix/test_ale_fix_suggest.vader new file mode 100644 index 00000000..1100aeed --- /dev/null +++ b/sources_non_forked/ale/test/fix/test_ale_fix_suggest.vader @@ -0,0 +1,102 @@ +Before: + call ale#fix#registry#Clear() + + let g:buffer = bufnr('') + + function GetSuggestions() + silent ALEFixSuggest + + if bufnr('') != g:buffer + let l:lines = getline(1, '$') + else + let l:lines = [] + endif + + return l:lines + endfunction + +After: + if bufnr('') != g:buffer + :q! + endif + + unlet! g:buffer + + call ale#fix#registry#ResetToDefaults() + delfunction GetSuggestions + +Execute(ALEFixSuggest should return something sensible with no suggestions): + AssertEqual + \ [ + \ 'There is nothing in the registry to suggest.', + \ '', + \ 'Press q to close this window', + \ ], + \ GetSuggestions() + +Execute(ALEFixSuggest should set the appropriate settings): + silent ALEFixSuggest + + AssertEqual 'ale-fix-suggest', &filetype + Assert !&modified, 'The buffer was marked as modified' + Assert !&modifiable, 'The buffer was modifiable' + +Execute(ALEFixSuggest output should be correct for only generic handlers): + call ale#fix#registry#Add('zed', 'XYZ', [], 'Zedify things.') + call ale#fix#registry#Add('alpha', 'XYZ', [], 'Alpha things.') + + AssertEqual + \ [ + \ 'Try the following generic fixers:', + \ '', + \ '''alpha'' - Alpha things.', + \ '''zed'' - Zedify things.', + \ '', + \ 'See :help ale-fix-configuration', + \ '', + \ 'Press q to close this window', + \ ], + \ GetSuggestions() + +Execute(ALEFixSuggest output should be correct for only filetype handlers): + let &filetype = 'testft2.testft' + + call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.') + call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.') + + AssertEqual + \ [ + \ 'Try the following fixers appropriate for the filetype:', + \ '', + \ '''alpha'' - Alpha things.', + \ '''zed'' - Zedify things.', + \ '', + \ 'See :help ale-fix-configuration', + \ '', + \ 'Press q to close this window', + \ ], + \ GetSuggestions() + +Execute(ALEFixSuggest should suggest filetype and generic handlers): + let &filetype = 'testft2.testft' + + call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.', ['foobar']) + call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.') + call ale#fix#registry#Add('generic', 'XYZ', [], 'Generic things.') + + AssertEqual + \ [ + \ 'Try the following fixers appropriate for the filetype:', + \ '', + \ '''alpha'' - Alpha things.', + \ '''zed'', ''foobar'' - Zedify things.', + \ '', + \ 'Try the following generic fixers:', + \ '', + \ '''generic'' - Generic things.', + \ '', + \ 'See :help ale-fix-configuration', + \ '', + \ 'Press q to close this window', + \ ], + \ GetSuggestions() diff --git a/sources_non_forked/ale/test/fixers/test_appleswiftformat_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_appleswiftformat_fixer_callback.vader new file mode 100644 index 00000000..72465f4f --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_appleswiftformat_fixer_callback.vader @@ -0,0 +1,47 @@ +Before: + call ale#assert#SetUpFixerTest('swift', 'apple-swift-format') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The swiftformat callback should return the correct default values): + call ale#test#SetFilename('../test-files/swift/dummy.swift') + let g:ale_swift_appleswiftformat_executable = 'xxxinvalid' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_swift_appleswiftformat_executable) + \ . ' format --in-place %t', + \ }, + \ ale#fixers#appleswiftformat#Fix(bufnr('')) + +Execute(The swiftformat callback should return the correct default values and located configuration): + call ale#test#SetDirectory('/testplugin/test/test-files/swift/swift-package-project-with-config') + call ale#test#SetFilename('src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_executable = 'xxxinvalid' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_swift_appleswiftformat_executable) + \ . ' format --in-place %t --configuration ' . glob(g:dir . '/.swift-format'), + \ }, + \ ale#fixers#appleswiftformat#Fix(bufnr('')) + + call ale#test#RestoreDirectory() + +Execute(The swiftformat callback should use swiftpm is use_swiftpm is set to 1): + call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift') + let g:ale_swift_appleswiftformat_use_swiftpm = 1 + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('swift') + \ . ' run swift-format format --in-place %t', + \ }, + \ ale#fixers#appleswiftformat#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_astyle_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_astyle_fixer_callback.vader new file mode 100644 index 00000000..9d2e4c80 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_astyle_fixer_callback.vader @@ -0,0 +1,96 @@ +Before: + Save g:ale_c_astyle_executable + Save g:ale_c_astyle_project_options + Save g:ale_cpp_astyle_project_options + + " Use an invalid global executable, so we don't match it. + let g:ale_c_astyle_executable = 'xxxinvalid' + let g:ale_cpp_astyle_executable = 'invalidpp' + let g:ale_c_astyle_project_options = '' + let g:ale_cpp_astyle_project_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The astyle callback should return the correct default values): + " Because this file doesn't exist, no astylrc config + " exists near it. Therefore, project_options is empty. + call ale#test#SetFilename('../c_files/testfile.c') + let targetfile = bufname(bufnr('%')) + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_astyle_executable) + \ . ' --stdin=' . ale#Escape(targetfile) + \ }, + \ ale#fixers#astyle#Fix(bufnr('')) + +Execute(The astyle callback should support cpp files): + " Because this file doesn't exist, no astylrc config + " exists near it. Therefore, project_options is empty. + call ale#test#SetFilename('../cpp_files/dummy.cpp') + set filetype=cpp " The test fails without this + let targetfile = bufname(bufnr('%')) + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_cpp_astyle_executable) + \ . ' --stdin=' . ale#Escape(targetfile) + \ }, + \ ale#fixers#astyle#Fix(bufnr('')) + +Execute(The astyle callback should support cpp files with option file set): + call ale#test#SetFilename('../cpp_files/dummy.cpp') + let g:ale_cpp_astyle_project_options = '.astylerc_cpp' + let targetfile = bufname(bufnr('%')) + set filetype=cpp " The test fails without this + + AssertEqual + \ { + \ 'command': ale#Escape('invalidpp') + \ . ' --project=' . g:ale_cpp_astyle_project_options + \ . ' --stdin=' . ale#Escape(targetfile) + \ }, + \ ale#fixers#astyle#Fix(bufnr('')) + +Execute(The astyle callback should return the correct default values with a specified option file): + call ale#test#SetFilename('../c_files/testfile.c') + let g:ale_c_astyle_project_options = '.astylerc_c' + let targetfile = bufname(bufnr('%')) + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' --project=' . g:ale_c_astyle_project_options + \ . ' --stdin=' . ale#Escape(targetfile) + \ }, + \ ale#fixers#astyle#Fix(bufnr('')) + +Execute(The astyle callback should find nearest default option file _astylrc): + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.c') + let targetfile = bufname(bufnr('%')) + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' --project=_astylerc' + \ . ' --stdin=' . ale#Escape(targetfile) + \ }, + \ ale#fixers#astyle#Fix(bufnr('')) + +Execute(The astyle callback should find .astylrc in the same directory as src): + call ale#test#SetFilename('../test-files/cpp/dummy.cpp') + set filetype=cpp " The test fails without this + let targetfile = bufname(bufnr('%')) + + AssertEqual + \ { + \ 'command': ale#Escape('invalidpp') + \ . ' --project=.astylerc' + \ . ' --stdin=' . ale#Escape(targetfile) + \ }, + \ ale#fixers#astyle#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_autoflake_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_autoflake_fixer_callback.vader new file mode 100644 index 00000000..91fc62b5 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_autoflake_fixer_callback.vader @@ -0,0 +1,49 @@ +Before: + Save g:ale_python_autoflake_executable + Save g:ale_python_autoflake_options + + " Use an invalid global executable, so we don't match it. + let g:ale_python_autoflake_executable = 'xxxinvalid' + let g:ale_python_autoflake_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + let g:dir = getcwd() + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + Restore + + unlet! b:bin_dir + + call ale#test#RestoreDirectory() + +Execute(The autoflake callback should return the correct default values): + AssertEqual + \ 0, + \ ale#fixers#autoflake#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoflake')) + \ . ' --in-place ' + \ . ' %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#autoflake#Fix(bufnr('')) + + +Execute(The autoflake callback should include options): + let g:ale_python_autoflake_options = '--some-option' + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoflake')) + \ . ' --some-option' + \ . ' --in-place ' + \ . ' %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#autoflake#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_autoimport_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_autoimport_fixer_callback.vader new file mode 100644 index 00000000..edca5c38 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_autoimport_fixer_callback.vader @@ -0,0 +1,47 @@ +Before: + Save g:ale_python_autoimport_executable + Save g:ale_python_autoimport_options + + " Use an invalid global executable, so we don't match it. + let g:ale_python_autoimport_executable = 'xxxinvalid' + let g:ale_python_autoimport_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + Restore + + unlet! b:bin_dir + + call ale#test#RestoreDirectory() + +Execute(The autoimport callback should return the correct default values): + AssertEqual + \ 0, + \ ale#fixers#autoimport#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoimport')) . ' -', + \ }, + \ ale#fixers#autoimport#Fix(bufnr('')) + +Execute(The autoimport callback should respect custom options): + let g:ale_python_autoimport_options = '--multi-line=3 --trailing-comma' + + AssertEqual + \ 0, + \ ale#fixers#autoimport#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoimport')) + \ . ' --multi-line=3 --trailing-comma -', + \ }, + \ ale#fixers#autoimport#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_autopep8_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_autopep8_fixer_callback.vader new file mode 100644 index 00000000..46671eda --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_autopep8_fixer_callback.vader @@ -0,0 +1,37 @@ +Before: + Save g:ale_python_autopep8_executable + Save g:ale_python_autopep8_options + + " Use an invalid global executable, so we don't match it. + let g:ale_python_autopep8_executable = 'xxxinvalid' + let g:ale_python_autopep8_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + let g:dir = getcwd() + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + Restore + + unlet! b:bin_dir + + call ale#test#RestoreDirectory() + +Execute(The autopep8 callback should return the correct default values): + AssertEqual + \ 0, + \ ale#fixers#autopep8#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'}, + \ ale#fixers#autopep8#Fix(bufnr('')) + +Execute(The autopep8 callback should include options): + let g:ale_python_autopep8_options = '--some-option' + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' }, + \ ale#fixers#autopep8#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_bibclean_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_bibclean_fixer_callback.vader new file mode 100644 index 00000000..88412eca --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_bibclean_fixer_callback.vader @@ -0,0 +1,30 @@ +Before: + Save g:ale_bib_bibclean_executable + Save g:ale_bib_bibclean_options + + let g:ale_bib_bibclean_executable = 'xxxinvalid' + let g:ale_bib_bibclean_options = '-align-equals' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + call ale#test#RestoreDirectory() + +Execute(The bibclean callback should return the correct default values): + call ale#test#SetFilename('../test-files/bib/dummy.bib') + + AssertEqual + \ {'command': ale#Escape(g:ale_bib_bibclean_executable) . ' -align-equals'}, + \ ale#fixers#bibclean#Fix(bufnr('')) + +Execute(The bibclean callback should include custom bibclean options): + let g:ale_bib_bibclean_options = '-author -check-values' + call ale#test#SetFilename('../test-files/bib/dummy.bib') + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_bib_bibclean_executable) . ' -author -check-values' + \ }, + \ ale#fixers#bibclean#Fix(bufnr('')) + diff --git a/sources_non_forked/ale/test/fixers/test_black_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_black_fixer_callback.vader new file mode 100644 index 00000000..bb76a1fe --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_black_fixer_callback.vader @@ -0,0 +1,67 @@ +Before: + call ale#assert#SetUpFixerTest('python', 'black') + + let g:dir = getcwd() + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + call ale#assert#TearDownFixerTest() + + unlet! g:dir + unlet! b:bin_dir + +Execute(The black callback should return the correct default values): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' -'}, + \ ale#fixers#black#Fix(bufnr('')) + +Execute(The black callback should include options): + let g:ale_python_black_options = '--some-option' + let g:ale_python_black_change_directory = 0 + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --some-option -' }, + \ ale#fixers#black#Fix(bufnr('')) + +Execute(The black callback should include --pyi for .pyi files): + let g:ale_python_black_change_directory = 0 + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.pyi') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --pyi -' }, + \ ale#fixers#black#Fix(bufnr('')) + +Execute(The black callback should not concatenate options): + let g:ale_python_black_options = '--some-option' + let g:ale_python_black_change_directory = 0 + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.pyi') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --some-option --pyi -' }, + \ ale#fixers#black#Fix(bufnr('')) + +Execute(Pipenv is detected when python_black_auto_pipenv is set): + let g:ale_python_black_auto_pipenv = 1 + let g:ale_python_black_change_directory = 0 + + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertEqual + \ {'command': ale#Escape('pipenv') . ' run black -'}, + \ ale#fixers#black#Fix(bufnr('')) + +Execute(Poetry is detected when python_black_auto_poetry is set): + let g:ale_python_black_auto_poetry = 1 + let g:ale_python_black_change_directory = 0 + + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertEqual + \ {'command': ale#Escape('poetry') . ' run black -'}, + \ ale#fixers#black#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_break_up_long_lines_python_fixer.vader b/sources_non_forked/ale/test/fixers/test_break_up_long_lines_python_fixer.vader new file mode 100644 index 00000000..c7809acd --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_break_up_long_lines_python_fixer.vader @@ -0,0 +1,39 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + call ale#test#RestoreDirectory() + +Execute(Long lines with basic function calls should be broken up correctly): + AssertEqual + \ [ + \ 'def foo():', + \ ' some_variable = this_is_a_longer_function(', + \ 'first_argument,', + \ ' second_argument,', + \ ' third_with_function_call(', + \ 'foo,', + \ ' bar,', + \ '))', + \ ], + \ ale#fixers#generic_python#BreakUpLongLines(bufnr(''), [ + \ 'def foo():', + \ ' some_variable = this_is_a_longer_function(first_argument, second_argument, third_with_function_call(foo, bar))', + \ ]) + +Execute(Longer lines should be permitted if a configuration file allows it): + call ale#test#SetFilename('../test-files/long-line/foo/bar.py') + + AssertEqual + \ [ + \ 'x = this_line_is_between_79_and_90_characters(first, second, third, fourth, fifth)', + \ 'y = this_line_is_longer_than_90_characters(', + \ 'much_longer_word,', + \ ' another_longer_word,', + \ ' a_third_long_word,', + \ ')' + \ ], + \ ale#fixers#generic_python#BreakUpLongLines(bufnr(''), [ + \ 'x = this_line_is_between_79_and_90_characters(first, second, third, fourth, fifth)', + \ 'y = this_line_is_longer_than_90_characters(much_longer_word, another_longer_word, a_third_long_word)', + \ ]) diff --git a/sources_non_forked/ale/test/fixers/test_brittany_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_brittany_fixer_callback.vader new file mode 100644 index 00000000..073e368c --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_brittany_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_haskell_brittany_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_haskell_brittany_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The brittany callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' --write-mode inplace' + \ . ' %t', + \ }, + \ ale#fixers#brittany#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_buf_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_buf_format_fixer_callback.vader new file mode 100644 index 00000000..ee484820 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_buf_format_fixer_callback.vader @@ -0,0 +1,21 @@ +Before: + Save g:ale_proto_buf_format_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_proto_buf_format_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The buf-format callback should return the correct default values): + call ale#test#SetFilename('../test-files/proto/testfile.proto') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' format %t', + \ }, + \ ale#fixers#buf_format#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_buildifier_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_buildifier_fixer_callback.vader new file mode 100644 index 00000000..f82e8e6e --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_buildifier_fixer_callback.vader @@ -0,0 +1,29 @@ +Before: + let g:ale_bazel_buildifier_options = '' + call ale#assert#SetUpFixerTest('bzl', 'buildifier') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The buildifier callback should return the correct default values): + call ale#test#SetFilename('../test-files/bazel/WORKSPACE') + + AssertFixer + \ { + \ 'command': ale#Escape(g:ale_bazel_buildifier_executable) + \ . ' -mode fix -lint fix -path ' + \ . ale#Escape(ale#test#GetFilename('../test-files/bazel/WORKSPACE')) + \ . ' -' + \ } + +Execute(The buildifier callback should include any additional options): + call ale#test#SetFilename('../test-files/bazel/WORKSPACE') + let g:ale_bazel_buildifier_options = '--some-option' + + AssertFixer + \ { + \ 'command': ale#Escape(g:ale_bazel_buildifier_executable) + \ . ' -mode fix -lint fix -path ' + \ . ale#Escape(ale#test#GetFilename('../test-files/bazel/WORKSPACE')) + \ . ' --some-option -' + \ } diff --git a/sources_non_forked/ale/test/fixers/test_clangformat_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_clangformat_fixer_callback.vader new file mode 100644 index 00000000..130ca7f7 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_clangformat_fixer_callback.vader @@ -0,0 +1,64 @@ +Before: + Save g:ale_c_clangformat_executable + Save g:c_clangformat_style_option + Save g:c_clangformat_use_local_file + + " Use an invalid global executable, so we don't match it. + let g:ale_c_clangformat_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + let g:dir = getcwd() + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The clang-format callback should return the correct default values): + call ale#test#SetFilename('../test-files/c/dummy.c') + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_clangformat_executable) + \ . ' --assume-filename=' . ale#Escape(bufname(bufnr(''))) + \ }, + \ ale#fixers#clangformat#Fix(bufnr('')) + +Execute(The clangformat callback should include any additional options): + call ale#test#SetFilename('../test-files/c/dummy.c') + let g:ale_c_clangformat_options = '--some-option' + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_clangformat_executable) + \ . ' --assume-filename=' . ale#Escape(bufname(bufnr(''))) + \ . ' --some-option', + \ }, + \ ale#fixers#clangformat#Fix(bufnr('')) + +Execute(The clangformat callback should include style options as well): + call ale#test#SetFilename('../test-files/c/dummy.c') + let g:ale_c_clangformat_options = '--some-option' + let g:ale_c_clangformat_style_option = '{BasedOnStyle: Microsoft, ColumnLimit:80,}' + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_clangformat_executable) + \ . ' --assume-filename=' . ale#Escape(bufname(bufnr(''))) + \ . ' --some-option' . " -style='{BasedOnStyle: Microsoft, ColumnLimit:80,}'", + \ }, + \ ale#fixers#clangformat#Fix(bufnr('')) + +Execute(The clangformat callback should use local file instead of style options): + call ale#test#SetFilename('../test-files/clangformat/with_clangformat/dummy.c') + let g:ale_c_clangformat_options = '--some-option' + let g:ale_c_clangformat_style_option = '{BasedOnStyle: Microsoft, ColumnLimit:80,}' + let g:ale_c_clangformat_use_local_file = 1 + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_clangformat_executable) + \ . ' --assume-filename=' . ale#Escape(bufname(bufnr(''))) + \ . ' --some-option' . ' -style=file', + \ }, + \ ale#fixers#clangformat#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_clangtidy_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_clangtidy_fixer_callback.vader new file mode 100644 index 00000000..d6678bd9 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_clangtidy_fixer_callback.vader @@ -0,0 +1,47 @@ +Before: + Save g:ale_c_build_dir + Save g:ale_c_clangtidy_executable + Save g:ale_c_clangtidy_checks + Save g:ale_c_clangtidy_extra_options + Save g:ale_cpp_clangtidy_executable + Save g:ale_cpp_clangtidy_checks + Save g:ale_cpp_clangtidy_extra_options + + " Use an invalid global executable, so we don't match it. + let g:ale_c_clangtidy_executable = 'xxxinvalid' + let g:ale_c_clangtidy_checks = [] + let g:ale_c_clangtidy_extra_options = '' + let g:ale_cpp_clangtidy_executable = 'xxxinvalidpp' + let g:ale_cpp_clangtidy_checks = [] + let g:ale_cpp_clangtidy_extra_options = '' + let g:ale_c_build_dir = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The clangtidy callback should return the correct default values): + call ale#test#SetFilename('../test-files/c/dummy.c') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_c_clangtidy_executable) + \ . ' -fix -fix-errors %t' + \ }, + \ ale#fixers#clangtidy#Fix(bufnr('')) + +Execute(The clangtidy callback should include any additional options): + call ale#test#SetFilename('../test-files/c/dummy.c') + let g:ale_c_clangtidy_extra_options = '--some-option' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_c_clangtidy_executable) + \ . ' -fix -fix-errors --some-option %t', + \ }, + \ ale#fixers#clangtidy#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_cmakeformat_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_cmakeformat_fixer_callback.vader new file mode 100644 index 00000000..545fe067 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_cmakeformat_fixer_callback.vader @@ -0,0 +1,36 @@ +Before: + Save g:ale_cmake_cmakeformat_executable + Save g:ale_cmake_cmakeformat_options + + " Use an invalid global executable, so we don't match it. + let g:ale_cmake_cmakeformat_executable = 'xxxinvalid' + let g:ale_cmake_cmakeformat_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The cmakeformat callback should return the correct default values): + call ale#test#SetFilename('../cmake_files/CMakeList.txt') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' -' + \ }, + \ ale#fixers#cmakeformat#Fix(bufnr('')) + +Execute(The cmakeformat callback should include custom cmakeformat options): + let g:ale_cmake_cmakeformat_options = "-r '(a) -> a'" + call ale#test#SetFilename('../cmake_files/CMakeList.txt') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_cmake_cmakeformat_options + \ . ' -', + \ }, + \ ale#fixers#cmakeformat#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_crystal_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_crystal_format_fixer_callback.vader new file mode 100644 index 00000000..d7d9588b --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_crystal_format_fixer_callback.vader @@ -0,0 +1,33 @@ +Before: + Save g:ale_crystal_format_executable + Save g:ale_crystal_format_options + + " Use an invalid global executable, so we don't match it. + let g:ale_crystal_format_executable = 'xxxinvalid' + let g:ale_crystal_format_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The crystal format callback should return the correct default values): + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' tool format -', + \ }, + \ ale#fixers#crystal#Fix(bufnr('')) + +Execute(The crystal format callback should include custom options): + let g:ale_crystal_format_options = "-list=true" + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' tool format ' . g:ale_crystal_format_options + \ . ' -', + \ }, + \ ale#fixers#crystal#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_dart_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dart_format_fixer_callback.vader new file mode 100644 index 00000000..8dfd20b6 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dart_format_fixer_callback.vader @@ -0,0 +1,40 @@ +Before: + Save g:ale_dart_format_executable + Save g:ale_dart_format_options + + " Use an invalid global executable, so we don't match it. + let g:ale_dart_format_executable = 'xxxinvalid' + let g:ale_dart_format_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The dart format callback should return the correct default values): + call ale#test#SetFilename('../test-files/dart/testfile.dart') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' format' + \ . ' %t', + \ }, + \ ale#fixers#dart_format#Fix(bufnr('')) + +Execute(The dart format callback should include custom dart format options): + let g:ale_dart_format_options = "-l 80" + call ale#test#SetFilename('../test-files/dart/testfile.dart') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' format' + \ . ' ' . g:ale_dart_format_options + \ . ' %t', + \ }, + \ ale#fixers#dart_format#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_dartfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dartfmt_fixer_callback.vader new file mode 100644 index 00000000..c783c9a4 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dartfmt_fixer_callback.vader @@ -0,0 +1,40 @@ +Before: + Save g:ale_dart_dartfmt_executable + Save g:ale_dart_dartfmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_dart_dartfmt_executable = 'xxxinvalid' + let g:ale_dart_dartfmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The dartfmt callback should return the correct default values): + call ale#test#SetFilename('../test-files/dart/testfile.dart') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -w' + \ . ' %t', + \ }, + \ ale#fixers#dartfmt#Fix(bufnr('')) + +Execute(The dartfmt callback should include custom dartfmt options): + let g:ale_dart_dartfmt_options = "-l 80" + call ale#test#SetFilename('../test-files/dart/testfile.dart') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -w' + \ . ' ' . g:ale_dart_dartfmt_options + \ . ' %t', + \ }, + \ ale#fixers#dartfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_dfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dfmt_fixer_callback.vader new file mode 100644 index 00000000..5749224e --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dfmt_fixer_callback.vader @@ -0,0 +1,40 @@ +Before: + Save g:ale_d_dfmt_executable + Save g:ale_d_dfmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_d_dfmt_executable = 'xxxinvalid' + let g:ale_d_dfmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The dfmt callback should return the correct default values): + call ale#test#SetFilename('../test-files/d/test.d') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -i' + \ . ' %t', + \ }, + \ ale#fixers#dfmt#Fix(bufnr('')) + +Execute(The dfmt callback should include custom dfmt options): + let g:ale_d_dfmt_options = "--space-after-cast" + call ale#test#SetFilename('../test-files/d/test.d') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -i' + \ . ' ' . g:ale_d_dfmt_options + \ . ' %t', + \ }, + \ ale#fixers#dfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_dhall_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dhall_format_fixer_callback.vader new file mode 100644 index 00000000..8fa2fe7c --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dhall_format_fixer_callback.vader @@ -0,0 +1,22 @@ +Before: + Save g:ale_dhall_executable + Save g:ale_dhall_options + + " Use an invalid global executable, so we don’t match it. + let g:ale_dhall_executable = 'odd-dhall' + let g:ale_dhall_options = '--ascii' + + call ale#assert#SetUpFixerTest('dhall', 'dhall-format') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The dhall-format callback should return the correct options): + call ale#test#SetFilename('../dhall_files/testfile.dhall') + + AssertFixer + \ { + \ 'command': ale#Escape('odd-dhall') + \ . ' --ascii' + \ . ' format' + \ } diff --git a/sources_non_forked/ale/test/fixers/test_dhall_freeze_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dhall_freeze_fixer_callback.vader new file mode 100644 index 00000000..02473697 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dhall_freeze_fixer_callback.vader @@ -0,0 +1,22 @@ +Before: + Save g:ale_dhall_executable + Save g:ale_dhall_options + + " Use an invalid global executable, so we don’t match it. + let g:ale_dhall_executable = 'odd-dhall' + let g:ale_dhall_options = '--ascii' + let g:ale_dhall_freeze_options = '--all' + + call ale#assert#SetUpFixerTest('dhall', 'dhall-freeze') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The dhall-freeze callback should return the correct options): + AssertFixer + \ { + \ 'command': ale#Escape('odd-dhall') + \ . ' --ascii' + \ . ' freeze' + \ . ' --all' + \ } diff --git a/sources_non_forked/ale/test/fixers/test_dhall_lint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dhall_lint_fixer_callback.vader new file mode 100644 index 00000000..e2054eb0 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dhall_lint_fixer_callback.vader @@ -0,0 +1,20 @@ +Before: + Save g:ale_dhall_executable + Save g:ale_dhall_options + + " Use an invalid global executable, so we don’t match it. + let g:ale_dhall_executable = 'odd-dhall' + let g:ale_dhall_options = '--ascii' + + call ale#assert#SetUpFixerTest('dhall', 'dhall-lint') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The dhall-lint callback should return the correct options): + AssertFixer + \ { + \ 'command': ale#Escape('odd-dhall') + \ . ' --ascii' + \ . ' lint' + \ } diff --git a/sources_non_forked/ale/test/fixers/test_dotnet_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dotnet_format_fixer_callback.vader new file mode 100644 index 00000000..a3993573 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dotnet_format_fixer_callback.vader @@ -0,0 +1,41 @@ +Before: + Save g:ale_cs_dotnet_format_executable + Save g:ale_cs_dotnet_format_options + + " Use an invalid global executable, so we don't match it. + let g:ale_cs_dotnet_format_executable = 'xxxinvalid' + let g:ale_cs_dotnet_format_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The dotnet format callback should return the correct default values): + call ale#test#SetFilename('../test-files/cs/testfile.cs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' format' + \ . ' --folder --include %t "$(dirname %t)"', + \ }, + \ ale#fixers#dotnet_format#Fix(bufnr('')) + +Execute(The dotnet format callback should include custom dotnet format options): + let g:ale_cs_dotnet_format_options = "-l 80" + call ale#test#SetFilename('../test-files/cs/testfile.cs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' format' + \ . ' ' . g:ale_cs_dotnet_format_options + \ . ' --folder --include %t "$(dirname %t)"', + \ }, + \ ale#fixers#dotnet_format#Fix(bufnr('')) + diff --git a/sources_non_forked/ale/test/fixers/test_dprint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_dprint_fixer_callback.vader new file mode 100644 index 00000000..6a9d0118 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_dprint_fixer_callback.vader @@ -0,0 +1,44 @@ +Before: + call ale#assert#SetUpFixerTest('typescript', 'dprint') + call ale#test#SetFilename('../test-files/dprint/blank.ts') + let g:ale_dprint_executable_override = 0 + let g:ale_dprint_executable = 'dprint' + let g:ale_dprint_config = '' + +After: + Restore + call ale#assert#TearDownFixerTest() + +Execute(The dprint callback should return 0 for a non-existent executable): + let g:ale_dprint_executable = 'foo' + AssertFixer 0 + +Execute(The dprint callback should return the correct default values): + let g:ale_dprint_executable_override = 1 + AssertFixer { + \ 'command': ale#Escape('dprint') + \ . ' fmt ' + \ . ' --stdin %s' + \ } + +Execute(The dprint callback should include config): + let g:ale_dprint_executable_override = 1 + let g:ale_dprint_config = 'dprint.json' + + AssertFixer { + \ 'command': ale#Escape('dprint') + \ . ' fmt ' + \ . ' -c ' + \ . ale#Escape((has('win32') ? 'C:\testplugin\test\test-files\dprint\dprint.json' : '/testplugin/test/test-files/dprint/dprint.json')) + \ . ' --stdin %s' + \ } + +Execute(The dprint callback should include custom options): + let g:ale_dprint_executable_override = 1 + let g:ale_dprint_options = '--verbose' + + AssertFixer { + \ 'command': ale#Escape('dprint') + \ . ' fmt ' + \ . '--verbose' . ' --stdin %s' + \ } diff --git a/sources_non_forked/ale/test/fixers/test_elm_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_elm_format_fixer_callback.vader new file mode 100644 index 00000000..35244737 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_elm_format_fixer_callback.vader @@ -0,0 +1,74 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + unlet! b:ale_elm_format_executable + unlet! b:ale_elm_format_use_global + unlet! b:ale_elm_format_options + + call ale#test#RestoreDirectory() + +Execute(The elm-format command should have default params): + call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/elm/node_modules/.bin/elm-format')) + \ . ' %t --yes', + \ }, + \ ale#fixers#elm_format#Fix(bufnr('')) + +Execute(The elm-format command should manage use_global = 1 param): + call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm') + let b:ale_elm_format_use_global = 1 + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape('elm-format') + \ . ' %t --yes', + \ }, + \ ale#fixers#elm_format#Fix(bufnr('')) + +Execute(The elm-format command should manage executable param): + call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm') + let b:ale_elm_format_use_global = 1 + let b:ale_elm_format_executable = 'elmformat' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape('elmformat') + \ . ' %t --yes', + \ }, + \ ale#fixers#elm_format#Fix(bufnr('')) + +Execute(The elm-format command should manage empty options): + call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm') + let b:ale_elm_format_options = '' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/elm/node_modules/.bin/elm-format')) + \ . ' %t', + \ }, + \ ale#fixers#elm_format#Fix(bufnr('')) + +Execute(The elm-format command should manage custom options): + call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm') + let b:ale_elm_format_options = '--param1 --param2' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/elm/node_modules/.bin/elm-format')) + \ . ' %t --param1 --param2', + \ }, + \ ale#fixers#elm_format#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_erblint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_erblint_fixer_callback.vader new file mode 100644 index 00000000..7b56e3a9 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_erblint_fixer_callback.vader @@ -0,0 +1,55 @@ +Before: + Save g:ale_eruby_erblint_executable + Save g:ale_eruby_erblint_options + + " Use an invalid global executable, so we don't match it. + let g:ale_eruby_erblint_executable = 'xxxinvalid' + let g:ale_eruby_erblint_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The erblint callback should return the correct default values): + call ale#test#SetFilename('../test-files/eruby/dummy.html.erb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#erblint#PostProcess', + \ 'command': ale#Escape(g:ale_eruby_erblint_executable) + \ . ' --autocorrect --stdin %s', + \ }, + \ ale#fixers#erblint#Fix(bufnr('')) + +Execute(The erblint callback should include custom erblint options): + let g:ale_eruby_erblint_options = '--lint-all' + call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#erblint#PostProcess', + \ 'command': ale#Escape(g:ale_eruby_erblint_executable) + \ . ' --lint-all' + \ . ' --autocorrect --stdin %s', + \ }, + \ ale#fixers#erblint#Fix(bufnr('')) + +Execute(The erblint post-processor should remove diagnostics content): + AssertEqual + \ [ + \ '
', + \ '', + \ '
', + \ ], + \ ale#fixers#erblint#PostProcess(bufnr(''), [ + \ 'Linting 1 files with 11 autocorrectable linters...', + \ '', + \ '1 error(s) corrected in ERB files', + \ '================ /home/user/demo.html.erb ==================', + \ '
', + \ '', + \ '
', + \ ]) diff --git a/sources_non_forked/ale/test/fixers/test_erlfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_erlfmt_fixer_callback.vader new file mode 100644 index 00000000..132cd6ee --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_erlfmt_fixer_callback.vader @@ -0,0 +1,25 @@ +Before: + Save b:ale_elm_format_executable + Save b:ale_elm_format_options + + let b:ale_elm_format_executable = 'erlfmt' + let b:ale_elm_format_options = '' + +After: + Restore + +Execute(The erlfmt command should handle empty options): + AssertEqual + \ { + \ 'command': ale#Escape('erlfmt') . ' %s' + \ }, + \ ale#fixers#erlfmt#Fix(bufnr('')) + +Execute(The erlfmt command should handle custom options): + let b:ale_erlang_erlfmt_options = '--insert-pragma' + + AssertEqual + \ { + \ 'command': ale#Escape('erlfmt') . ' --insert-pragma %s' + \ }, + \ ale#fixers#erlfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_eslint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_eslint_fixer_callback.vader new file mode 100644 index 00000000..4a1dc47c --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_eslint_fixer_callback.vader @@ -0,0 +1,339 @@ +Before: + call ale#assert#SetUpFixerTest('javascript', 'eslint') + Save g:ale_command_wrapper + + runtime autoload/ale/handlers/eslint.vim + + let g:ale_command_wrapper = '' + +After: + call ale#assert#TearDownFixerTest() + +Execute(The executable path should be correct): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js') + + " eslint_d output with an older eslint version is used here. + GivenCommandOutput ['v4.4.1 (eslint_d v5.1.0)'] + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/.eslintrc.js')) + \ . ' --fix %t', + \ } + +Execute(The ESLint fixer shouldn't run if no configuration file can be found): + call ale#test#SetFilename('../no-configuration') + AssertFixerNotExecuted + +Execute(The ESLint fixer should use a config file option if set for old versions): + call ale#test#SetFilename('../no-configuration') + let b:ale_javascript_eslint_options = '-c /foo.cfg' + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': '', + \ 'command': ale#Escape('eslint') . ' -c /foo.cfg --fix %t', + \ } + + let b:ale_javascript_eslint_options = '--bar -c /foo.cfg' + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': '', + \ 'command': ale#Escape('eslint') . ' --bar -c /foo.cfg --fix %t', + \ } + + let b:ale_javascript_eslint_options = '--config /foo.cfg' + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': '', + \ 'command': ale#Escape('eslint') . ' --config /foo.cfg --fix %t', + \ } + + let b:ale_javascript_eslint_options = '--bar --config /foo.cfg' + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': '', + \ 'command': ale#Escape('eslint') . ' --bar --config /foo.cfg --fix %t', + \ } + +Execute(The ESLint fixer should use a -c file option if set for eslint_d): + let b:ale_javascript_eslint_executable = '/bin/eslint_d' + GivenCommandOutput ['v3.19.0 (eslint_d v4.2.0)'] + call ale#test#SetFilename('../no-configuration') + let b:ale_javascript_eslint_options = '-c /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', + \ 'cwd': '', + \ 'command': ale#Escape('/bin/eslint_d') + \ . ' -c /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-to-stdout' + \ } + + let b:ale_javascript_eslint_options = '--bar -c /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', + \ 'cwd': '', + \ 'command': ale#Escape('/bin/eslint_d') + \ . ' --bar -c /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-to-stdout' + \ } + + let b:ale_javascript_eslint_options = '--config /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', + \ 'cwd': '', + \ 'command': ale#Escape('/bin/eslint_d') + \ . ' --config /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-to-stdout' + \ } + + let b:ale_javascript_eslint_options = '--bar --config /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', + \ 'cwd': '', + \ 'command': ale#Escape('/bin/eslint_d') + \ . ' --bar --config /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-to-stdout' + \ } + +Execute(The ESLint fixer should use a config file option if set for new versions): + GivenCommandOutput ['4.9.0'] + call ale#test#SetFilename('../no-configuration') + let b:ale_javascript_eslint_options = '-c /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \ 'cwd': '', + \ 'command': ale#Escape('eslint') + \ . ' -c /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json' + \ } + + let b:ale_javascript_eslint_options = '--bar -c /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \ 'cwd': '', + \ 'command': ale#Escape('eslint') + \ . ' --bar -c /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json' + \ } + + let b:ale_javascript_eslint_options = '--config /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \ 'cwd': '', + \ 'command': ale#Escape('eslint') + \ . ' --config /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json' + \ } + + let b:ale_javascript_eslint_options = '--bar --config /foo.cfg' + + AssertFixer + \ { + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \ 'cwd': '', + \ 'command': ale#Escape('eslint') + \ . ' --bar --config /foo.cfg' + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json' + \ } + +Execute(The lower priority configuration file in a nested directory should be preferred): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-config/testfile.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/subdir-with-config/.eslintrc')) + \ . ' --fix %t', + \ } + +Execute(--config in options should override configuration file detection for old versions): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-config/testfile.js') + + let b:ale_javascript_eslint_options = '--config /foo.cfg' + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' --config /foo.cfg' + \ . ' --fix %t', + \ } + + let b:ale_javascript_eslint_options = '-c /foo.cfg' + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' -c /foo.cfg' + \ . ' --fix %t', + \ } + +Execute(package.json should be used as a last resort): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-package-json/testfile.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/.eslintrc.js')) + \ . ' --fix %t', + \ } + + call ale#test#SetFilename('../test-files/eslint/package.json') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint'), + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/node_modules/.bin/eslint')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/package.json')) + \ . ' --fix %t', + \ } + +Execute(The version check should be correct): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-config/testfile.js') + + " We should run the command to get the version the first time. + GivenCommandOutput ['4.9.0'] + AssertFixer [ + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' --version', + \ { + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \ }, + \] + + AssertFixer [ + \ { + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \ }, + \] + +Execute(--fix-dry-run should be used for 4.9.0 and up): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js') + + GivenCommandOutput ['4.9.0'] + AssertFixer + \ { + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'), + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')) + \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', + \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', + \ } + +Execute(--fix-to-stdout should be used for eslint_d): + call ale#test#SetFilename('../test-files/eslint/app-with-eslint-d/testfile.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d'), + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/package.json')) + \ . ' --fix %t', + \ } + + " The option should be used when eslint_d is new enough. + " We look at the ESLint version instead of the eslint_d version. + GivenCommandOutput ['v3.19.0 (eslint_d v4.2.0)'] + AssertFixer + \ { + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d'), + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d')) + \ . ' --stdin-filename %s --stdin --fix-to-stdout', + \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', + \ } + + " The option should be used for new versions too. + GivenCommandOutput ['4.9.0'] + AssertFixer + \ { + \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d'), + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d')) + \ . ' --stdin-filename %s --stdin --fix-to-stdout', + \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', + \ } + +Execute(The --fix-dry-run post-processor should handle JSON output correctly): + AssertEqual + \ [], + \ ale#fixers#eslint#ProcessFixDryRunOutput(bufnr(''), []) + AssertEqual + \ [], + \ ale#fixers#eslint#ProcessFixDryRunOutput(bufnr(''), ['']) + AssertEqual + \ [], + \ ale#fixers#eslint#ProcessFixDryRunOutput(bufnr(''), ['[{}]']) + AssertEqual + \ ['foo', 'bar'], + \ ale#fixers#eslint#ProcessFixDryRunOutput(bufnr(''), ['[{"output": "foo\nbar"}]']) + +Execute(The eslint_d post-processor should permit regular JavaScript content): + AssertEqual + \ [ + \ 'const x = ''Error: foo''', + \ 'const y = 3', + \ ], + \ ale#fixers#eslint#ProcessEslintDOutput(bufnr(''), [ + \ 'const x = ''Error: foo''', + \ 'const y = 3', + \ ]) + +Execute(The eslint_d post-processor should handle error messages correctly): + AssertEqual + \ [], + \ ale#fixers#eslint#ProcessEslintDOutput(bufnr(''), [ + \ 'Error: No ESLint configuration found.', + \ ]) + +Execute(The eslint_d post-processor should handle failing to connect properly): + AssertEqual + \ [], + \ ale#fixers#eslint#ProcessEslintDOutput(bufnr(''), [ + \ 'Could not connect', + \ ]) diff --git a/sources_non_forked/ale/test/fixers/test_fecs_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_fecs_fixer_callback.vader new file mode 100644 index 00000000..146c0a87 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_fecs_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + call ale#assert#SetUpFixerTest('javascript', 'fecs') + runtime autoload/ale/handlers/fecs.vim + +After: + call ale#assert#TearDownFixerTest() + +Execute(The fecs fixer should respect to g:ale_javascript_fecs_executable): + let g:ale_javascript_fecs_executable = '../test-files/fecs/fecs' + let g:ale_javascript_fecs_use_global = 1 + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_javascript_fecs_executable) . ' format --replace=true %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#fecs#Fix(bufnr('')) + +Execute(The fecs fixer should return 0 when executable not found): + let g:ale_javascript_fecs_executable = 'fecs-invalid' + let g:ale_javascript_fecs_use_global = 1 + AssertEqual + \ 0, + \ ale#fixers#fecs#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_fish_indent_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_fish_indent_fixer_callback.vader new file mode 100644 index 00000000..3555a974 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_fish_indent_fixer_callback.vader @@ -0,0 +1,40 @@ +Before: + Save g:ale_fish_fish_indent_executable + Save g:ale_fish_fish_indent_options + + " Use an invalid global executable, so we don't match it. + let g:ale_fish_fish_indent_executable = 'xxxinvalid' + let g:ale_fish_fish_indent_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The fish_indent callback should return the correct default values): + call ale#test#SetFilename('../test-files/fish/testfile.fish') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -w ' + \ . ' %t', + \ }, + \ ale#fixers#fish_indent#Fix(bufnr('')) + +Execute(The fish_indent callback should include custom fish_indent options): + let g:ale_fish_fish_indent_options = "-d" + call ale#test#SetFilename('../test-files/fish/testfile.fish') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -w ' + \ . ' -d' + \ . ' %t', + \ }, + \ ale#fixers#fish_indent#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_fixjson_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_fixjson_fixer_callback.vader new file mode 100644 index 00000000..2b023fad --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_fixjson_fixer_callback.vader @@ -0,0 +1,50 @@ +Before: + Save g:ale_json_fixjson_executable + Save g:ale_json_fixjson_options + + let g:ale_json_fixjson_executable = '/path/to/fixjson' + let g:ale_json_fixjson_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + +Execute(The fixjson callback should return the correct default command): + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/fixjson') + \ . ' --stdin-filename ' + \ . ale#Escape(bufname(bufnr(''))) + \ }, + \ ale#fixers#fixjson#Fix(bufnr('')) + +Execute(The fixjson callback should set the buffer name as file name): + call ale#test#SetFilename('../test-files/json/testfile.json') + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/fixjson') + \ . ' --stdin-filename ' + \ . ale#Escape(bufname(bufnr(''))) + \ }, + \ ale#fixers#fixjson#Fix(bufnr('')) + + AssertNotEqual + \ stridx( + \ ale#fixers#fixjson#Fix(bufnr('')).command, + \ 'testfile.json', + \ ), + \ -1 + +Execute(The fixjson callback should include additional options): + let g:ale_json_fixjson_options = '-i 2' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/fixjson') + \ . ' --stdin-filename ' + \ . ale#Escape(bufname(bufnr(''))) + \ . ' -i 2' + \ }, + \ ale#fixers#fixjson#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_floskell_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_floskell_fixer_callback.vader new file mode 100644 index 00000000..66fe9200 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_floskell_fixer_callback.vader @@ -0,0 +1,23 @@ +Before: + Save g:ale_haskell_floskell_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_haskell_floskell_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The floskell callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' %t', + \ }, + \ ale#fixers#floskell#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_gnatpp_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_gnatpp_fixer_callback.vader new file mode 100644 index 00000000..7a3ed517 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_gnatpp_fixer_callback.vader @@ -0,0 +1,28 @@ +Before: + call ale#assert#SetUpFixerTest('ada', 'gnatpp') + +After: + " Reset fixers, variables, etc. + " + " Vader's 'Restore' command will be called here. + call ale#assert#TearDownFixerTest() + +Execute(The default command should be correct): + call ale#test#SetFilename('../test-files/ada/testfile.adb') + + AssertFixer + \ { + \ 'command': ale#Escape(g:ale_ada_gnatpp_executable) .' %t', + \ 'read_temporary_file': 1, + \ } + +Execute(The version check should be correct): + call ale#test#SetFilename('../test-files/ada/testfile.adb') + let g:ale_ada_gnatpp_options = '--no-alignment' + + AssertFixer + \ { + \ 'command': ale#Escape(g:ale_ada_gnatpp_executable) + \ . ' --no-alignment %t', + \ 'read_temporary_file': 1, + \ } diff --git a/sources_non_forked/ale/test/fixers/test_gofmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_gofmt_fixer_callback.vader new file mode 100644 index 00000000..579dd3db --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_gofmt_fixer_callback.vader @@ -0,0 +1,50 @@ +Before: + Save g:ale_go_gofmt_executable + Save g:ale_go_gofmt_options + Save g:ale_go_go111module + + " Use an invalid global executable, so we don't match it. + let g:ale_go_gofmt_executable = 'xxxinvalid' + let g:ale_go_gofmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#test#RestoreDirectory() + +Execute(The gofmt callback should return the correct default values): + call ale#test#SetFilename('../test-files/go/testfile.go') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid'), + \ }, + \ ale#fixers#gofmt#Fix(bufnr('')) + +Execute(The gofmt callback should include custom gofmt options): + let g:ale_go_gofmt_options = "-r '(a) -> a'" + + call ale#test#SetFilename('../test-files/go/testfile.go') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_go_gofmt_options, + \ }, + \ ale#fixers#gofmt#Fix(bufnr('')) + +Execute(The gofmt callback should support Go environment variables): + let g:ale_go_go111module = 'off' + + call ale#test#SetFilename('../test-files/go/testfile.go') + + AssertEqual + \ { + \ 'command': ale#Env('GO111MODULE', 'off') + \ . ale#Escape('xxxinvalid') + \ }, + \ ale#fixers#gofmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_gofumpt_fixer.vader b/sources_non_forked/ale/test/fixers/test_gofumpt_fixer.vader new file mode 100644 index 00000000..63e04de8 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_gofumpt_fixer.vader @@ -0,0 +1,27 @@ +Before: + call ale#assert#SetUpFixerTest('go', 'gofumpt') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The gofumpt callback should return the correct default values): + AssertFixer { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('gofumpt') . ' -w -- %t' + \} + +Execute(The gofumpt callback should allow custom gofumpt executables): + let g:ale_go_gofumpt_executable = 'foo/bar' + + AssertFixer { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('foo/bar') . ' -w -- %t' + \} + +Execute(The gofumpt callback should allow custom gofumpt options): + let g:ale_go_gofumpt_options = '--foobar' + + AssertFixer { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('gofumpt') . ' --foobar -w -- %t' + \} diff --git a/sources_non_forked/ale/test/fixers/test_goimports_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_goimports_fixer_callback.vader new file mode 100644 index 00000000..64c75b2d --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_goimports_fixer_callback.vader @@ -0,0 +1,57 @@ +Before: + Save g:ale_go_goimports_executable + Save g:ale_go_goimports_options + Save g:ale_go_go111module + + " Use an invalid global executable, so we don't match it. + let g:ale_go_goimports_executable = 'xxxinvalid' + let g:ale_go_goimports_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + call ale#test#SetFilename('../test-files/go/testfile.go') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#test#RestoreDirectory() + +Execute(The goimports callback should return 0 when the executable isn't executable): + AssertEqual + \ 0, + \ ale#fixers#goimports#Fix(bufnr('')) + +Execute(The goimports callback should the command when the executable test passes): + let g:ale_go_goimports_executable = has('win32') ? 'cmd' : 'echo' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w -srcdir %s %t' + \ }, + \ ale#fixers#goimports#Fix(bufnr('')) + +Execute(The goimports callback should include extra options): + let g:ale_go_goimports_executable = has('win32') ? 'cmd' : 'echo' + let g:ale_go_goimports_options = '--xxx' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w -srcdir %s --xxx %t' + \ }, + \ ale#fixers#goimports#Fix(bufnr('')) + +Execute(The goimports callback should support Go environment variables): + let g:ale_go_goimports_executable = has('win32') ? 'cmd' : 'echo' + let g:ale_go_go111module = 'on' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Env('GO111MODULE', 'on') + \ . ale#Escape(g:ale_go_goimports_executable) + \ . ' -l -w -srcdir %s %t' + \ }, + \ ale#fixers#goimports#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_golines_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_golines_fixer_callback.vader new file mode 100644 index 00000000..87e53c88 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_golines_fixer_callback.vader @@ -0,0 +1,54 @@ +Before: + Save g:ale_go_golines_executable + Save g:ale_go_golines_options + Save g:ale_go_go111module + + " Use an invalid global executable, so we don't match it. + let g:ale_go_golines_executable = 'xxxinvalid' + let g:ale_go_golines_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#test#RestoreDirectory() + +Execute(The golines callback should return 0 when the executable isn't executable): + AssertEqual + \ 0, + \ ale#fixers#golines#Fix(bufnr('')) + + +Execute(The golines callback should return the correct default values): + let g:ale_go_golines_executable = has('win32') ? 'cmd' : 'echo' + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_go_golines_executable), + \ }, + \ ale#fixers#golines#Fix(bufnr('')) + +Execute(The golines callback should include custom golines options): + let g:ale_go_golines_executable = has('win32') ? 'cmd' : 'echo' + let g:ale_go_golines_options = "--max-len --shorten-comments" + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_go_golines_executable) + \ . ' ' . g:ale_go_golines_options, + \ }, + \ ale#fixers#golines#Fix(bufnr('')) + +Execute(The golines callback should support Go environment variables): + let g:ale_go_golines_executable = has('win32') ? 'cmd' : 'echo' + let g:ale_go_go111module = 'off' + + AssertEqual + \ { + \ 'command': ale#Env('GO111MODULE', 'off') + \ . ale#Escape(g:ale_go_golines_executable) + \ }, + \ ale#fixers#golines#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_gomod_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_gomod_fixer_callback.vader new file mode 100644 index 00000000..56fb9854 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_gomod_fixer_callback.vader @@ -0,0 +1,41 @@ +Before: + Save g:ale_go_go_executable + Save g:ale_go_go111module + + " Use an invalid global executable, so we don't match it. + let g:ale_go_go_executable = 'xxxinvalid' + let g:ale_go_go111module = '' + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#test#RestoreDirectory() + +Execute(The gomod callback should return the correct default values): + call ale#test#SetFilename('../test-files/go/go.mod') + setl filetype=gomod + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' mod edit -fmt' + \ . ' %t', + \ }, + \ ale#fixers#gomod#Fix(bufnr('')) + +Execute(The gomod callback should support Go environment variables): + call ale#test#SetFilename('../test-files/go/go.mod') + setl filetype=gomod + let g:ale_go_go111module = 'on' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Env('GO111MODULE', 'on') + \ . ale#Escape('xxxinvalid') . ' mod edit -fmt %t' + \ }, + \ ale#fixers#gomod#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_goofle_java_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_goofle_java_format_fixer_callback.vader new file mode 100644 index 00000000..4c28b330 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_goofle_java_format_fixer_callback.vader @@ -0,0 +1,27 @@ +Before: + Save g:ale_java_google_java_format_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_java_google_java_format_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The google-java-format callback should return 0 when the executable isn't executable): + AssertEqual + \ 0, + \ ale#fixers#google_java_format#Fix(bufnr('')) + +Execute(The google-java-format callback should run the command when the executable test passes): + let g:ale_java_google_java_format_executable = has('win32') ? 'cmd' : 'echo' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(ale_java_google_java_format_executable) . ' --replace %t' + \ }, + \ ale#fixers#google_java_format#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_hackfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_hackfmt_fixer_callback.vader new file mode 100644 index 00000000..d294c15e --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_hackfmt_fixer_callback.vader @@ -0,0 +1,37 @@ +Before: + Save g:ale_hack_hackfmt_executable + Save g:ale_hack_hackfmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_hack_hackfmt_executable = 'xxxinvalid' + let g:ale_hack_hackfmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The hackfmt callback should return the correct default values): + call ale#test#SetFilename('../hack_files/testfile.hack') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -i %t', + \ }, + \ ale#fixers#hackfmt#Fix(bufnr('')) + +Execute(The hackfmt callback should include custom hackfmt options): + let g:ale_hack_hackfmt_options = "--some-option" + call ale#test#SetFilename('../hack_files/testfile.hack') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -i --some-option %t', + \ }, + \ ale#fixers#hackfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_hfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_hfmt_fixer_callback.vader new file mode 100644 index 00000000..69cd03f8 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_hfmt_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_haskell_hfmt_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_haskell_hfmt_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The hfmt callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -w' + \ . ' %t', + \ }, + \ ale#fixers#hfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_hindent_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_hindent_fixer_callback.vader new file mode 100644 index 00000000..2e5a8b9f --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_hindent_fixer_callback.vader @@ -0,0 +1,18 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The hindent callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('hindent') + \ . ' %t', + \ }, + \ ale#fixers#hindent#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_hlint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_hlint_fixer_callback.vader new file mode 100644 index 00000000..08f08fae --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_hlint_fixer_callback.vader @@ -0,0 +1,20 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The hlint callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('hlint') + \ . ' --refactor' + \ . ' --refactor-options="--inplace"' + \ . ' %t', + \ }, + \ ale#fixers#hlint#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_html_beautify_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_html_beautify_fixer_callback.vader new file mode 100644 index 00000000..3012c7f1 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_html_beautify_fixer_callback.vader @@ -0,0 +1,12 @@ +Before: + call ale#assert#SetUpFixerTest('html', 'html-beautify', 'beautify') + +After: + Restore + + call ale#assert#TearDownFixerTest() + +Execute(The html-beautify callback should return the correct default command): + AssertEqual + \ {'command': ale#Escape('html-beautify') . ' -'}, + \ ale#fixers#html_beautify#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_importjs_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_importjs_fixer_callback.vader new file mode 100644 index 00000000..727e6a16 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_importjs_fixer_callback.vader @@ -0,0 +1,35 @@ +Before: + Save g:ale_javascript_importjs_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_javascript_importjs_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + call ale#test#SetFilename('../test-files/javascript/test.js') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The importjs callback should return 0 when the executable isn't executable): + AssertEqual + \ 0, + \ ale#fixers#importjs#Fix(bufnr('')) + +Execute(The importjs callback should run the command when the executable test passes): + let g:ale_javascript_importjs_executable = has('win32') ? 'cmd' : 'echo' + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#importjs#ProcessOutput', + \ 'command': ale#Escape(g:ale_javascript_importjs_executable) . ' fix %s' + \ }, + \ ale#fixers#importjs#Fix(bufnr('')) + +Execute(The ProcessOutput callback should return the expected output): + let g:testOutput = '{"messages":[],"fileContent":"one\ntwo","unresolvedImports":{}}' + + AssertEqual + \ ['one', 'two'], + \ ale#fixers#importjs#ProcessOutput(bufnr(''), g:testOutput) diff --git a/sources_non_forked/ale/test/fixers/test_isort_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_isort_fixer_callback.vader new file mode 100644 index 00000000..8b665d6b --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_isort_fixer_callback.vader @@ -0,0 +1,70 @@ +Before: + call ale#assert#SetUpFixerTest('python', 'isort') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + call ale#assert#TearDownFixerTest() + + unlet! g:dir + unlet! b:bin_dir + +Execute(The isort callback should return the correct default values): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + + " --filename option exists only after 5.7.0 + GivenCommandOutput ['VERSION 5.7.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' --filename %s' . ' -', + \ } + +Execute(The isort callback should respect custom options): + let g:ale_python_isort_options = '--multi-line=3 --trailing-comma' + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + + " --filename option exists only after 5.7.0 + GivenCommandOutput ['VERSION 5.7.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) + \ . ' --filename %s' . ' --multi-line=3 --trailing-comma -', + \ } + +Execute(Pipenv is detected when python_isort_auto_pipenv is set): + let g:ale_python_isort_auto_pipenv = 1 + + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + GivenCommandOutput ['VERSION 5.7.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('pipenv') . ' run isort' . ' --filename %s' . ' -' + \ } + +Execute(Poetry is detected when python_isort_auto_poetry is set): + let g:ale_python_isort_auto_poetry = 1 + + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + GivenCommandOutput ['VERSION 5.7.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('poetry') . ' run isort' . ' --filename %s' . ' -' + \ } + +Execute(The isort callback should not use --filename for older versions): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + + " --filename option exists only after 5.7.0 + GivenCommandOutput ['VERSION 5.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -', + \ } diff --git a/sources_non_forked/ale/test/fixers/test_jq_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_jq_fixer_callback.vader new file mode 100644 index 00000000..74580d3b --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_jq_fixer_callback.vader @@ -0,0 +1,26 @@ +Before: + Save g:ale_json_jq_executable + Save g:ale_json_jq_options + Save g:ale_json_jq_filters + +After: + Restore + +Execute(The jq fixer should use the options you set): + let g:ale_json_jq_executable = 'foo' + let g:ale_json_jq_options = '--bar' + let g:ale_json_jq_filters = '.baz' + + AssertEqual + \ {'command': ale#Escape('foo') . ' .baz --bar'}, + \ ale#fixers#jq#Fix(bufnr('')) + +Execute(The jq fixer should return 0 when there are no filters): + let g:ale_json_jq_executable = 'jq' + let g:ale_json_jq_options = '' + + let g:ale_json_jq_filters = '' + + AssertEqual + \ 0, + \ ale#fixers#jq#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_jsonnetfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_jsonnetfmt_fixer_callback.vader new file mode 100644 index 00000000..204d6583 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_jsonnetfmt_fixer_callback.vader @@ -0,0 +1,38 @@ +Before: + Save g:ale_jsonnet_jsonnetfmt_executable + Save g:ale_jsonnet_jsonnetfmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_jsonnet_jsonnetfmt_executable = 'xxxinvalid' + let g:ale_jsonnet_jsonnetfmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + call ale#assert#SetUpFixerTest('jsonnet', 'jsonnetfmt') + +After: + call ale#test#RestoreDirectory() + call ale#assert#TearDownFixerTest() + +Execute(The jsonnetfmt callback should return the correct default values): + call ale#test#SetFilename('../jsonnet_files/testfile.jsonnet') + + AssertFixer { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_jsonnet_jsonnetfmt_executable) + \ . ' -i' + \ . ' %t', + \} + +Execute(The jsonnetfmt callback should include custom options): + let g:ale_jsonnet_jsonnetfmt_options = '--pad-arrays' + + call ale#test#SetFilename('../jsonnet_files/testfile.jsonnet') + + AssertFixer { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_jsonnet_jsonnetfmt_executable) + \ . ' -i' + \ . ' ' . g:ale_jsonnet_jsonnetfmt_options + \ . ' %t', + \} + diff --git a/sources_non_forked/ale/test/fixers/test_ktlint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_ktlint_fixer_callback.vader new file mode 100644 index 00000000..cfe39205 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_ktlint_fixer_callback.vader @@ -0,0 +1,42 @@ +Before: + Save g:ale_kotlin_ktlint_executable + Save g:ale_kotlin_ktlint_options + Save g:ale_kotlin_ktlint_rulesets + + " Use an invalid global executable, so we don't match it. + let g:ale_kotlin_ktlint_executable = 'xxxinvalid' + let g:ale_kotlin_ktlint_options = '' + let g:ale_kotlin_ktlint_rulesets = [] + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The ktlint callback should return the correct default values): + call ale#test#SetFilename('../test-files/kotlin/testfile.kt') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' --stdin' + \ . ' --format', + \ }, + \ ale#fixers#ktlint#Fix(bufnr('')) + +Execute(The ktlint callback should include custom ktlint options): + let g:ale_kotlin_ktlint_options = "--android" + let g:ale_kotlin_ktlint_rulesets = ['/path/to/custom/ruleset.jar'] + call ale#test#SetFilename('../test-files/kotlin/testfile.kt') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_kotlin_ktlint_options + \ . ' --ruleset /path/to/custom/ruleset.jar' + \ . ' --stdin' + \ . ' --format', + \ }, + \ ale#fixers#ktlint#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_latexindent_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_latexindent_fixer_callback.vader new file mode 100644 index 00000000..bd4ac69a --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_latexindent_fixer_callback.vader @@ -0,0 +1,36 @@ +Before: + Save g:ale_tex_latexindent_executable + Save g:ale_tex_latexindent_options + + " Use an invalid global executable, so we don't match it. + let g:ale_tex_latexindent_executable = 'xxxinvalid' + let g:ale_tex_latexindent_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The latexindent callback should return the correct default values): + call ale#test#SetFilename('../test-files/tex/testfile.tex') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' -l' + \ }, + \ ale#fixers#latexindent#Fix(bufnr('')) + +Execute(The latexindent callback should include custom gofmt options): + let g:ale_tex_latexindent_options = "-l '~/.indentconfig.yaml'" + call ale#test#SetFilename('../test-files/tex/testfile.tex') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' -l' + \ . ' ' . g:ale_tex_latexindent_options + \ }, + \ ale#fixers#latexindent#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_lua_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_lua_format_fixer_callback.vader new file mode 100644 index 00000000..29cafde6 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_lua_format_fixer_callback.vader @@ -0,0 +1,35 @@ +Before: + Save g:ale_lua_lua_format_executable + Save g:ale_lua_lua_format_options + + " Use an invalid global executable, so we don't match it. + let g:ale_lua_lua_format_executable = 'xxxinvalid' + let g:ale_lua_lua_format_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The lua_format callback should return the correct default values): + call ale#test#SetFilename('../test-files/lua/testfile.lua') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' -i', + \ }, + \ ale#fixers#lua_format#Fix(bufnr('')) + +Execute(The lua_format callback should include custom lua_format options): + let g:ale_lua_lua_format_options = "--no-chop-down-table" + call ale#test#SetFilename('../test-files/lua/testfile.lua') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_lua_lua_format_options + \ . ' -i', + \ }, + \ ale#fixers#lua_format#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_luafmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_luafmt_fixer_callback.vader new file mode 100644 index 00000000..ef69f297 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_luafmt_fixer_callback.vader @@ -0,0 +1,35 @@ +Before: + Save g:ale_lua_luafmt_executable + Save g:ale_lua_luafmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_lua_luafmt_executable = 'xxxinvalid' + let g:ale_lua_luafmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The luafmt callback should return the correct default values): + call ale#test#SetFilename('../test-files/lua/testfile.lua') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' --stdin', + \ }, + \ ale#fixers#luafmt#Fix(bufnr('')) + +Execute(The luafmt callback should include custom luafmt options): + let g:ale_lua_luafmt_options = "--skip-children" + call ale#test#SetFilename('../test-files/lua/testfile.lua') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_lua_luafmt_options + \ . ' --stdin', + \ }, + \ ale#fixers#luafmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_mix_format_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_mix_format_fixer_callback.vader new file mode 100644 index 00000000..cd492e81 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_mix_format_fixer_callback.vader @@ -0,0 +1,36 @@ +Before: + Save g:ale_elixir_mix_executable + Save g:ale_elixir_mix_format_options + + let g:ale_elixir_mix_executable = 'xxxinvalid' + let g:ale_elixir_mix_format_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The mix_format callback should return the correct default values): + call ale#test#SetFilename('../test-files/elixir/testfile.ex') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' format %t', + \ }, + \ ale#fixers#mix_format#Fix(bufnr('')) + +Execute(The mix_format callback should include the correct format options): + let g:ale_elixir_mix_format_options = 'invalid_options' + call ale#test#SetFilename('../test-files/elixir/testfile.ex') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' format invalid_options %t', + \ }, + \ ale#fixers#mix_format#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_nimpretty_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_nimpretty_fixer_callback.vader new file mode 100644 index 00000000..a26f649a --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_nimpretty_fixer_callback.vader @@ -0,0 +1,23 @@ +Before: + call ale#assert#SetUpFixerTest('nim', 'nimpretty') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The nimpretty callback should return the correct default values): + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('nimpretty') . ' %t --maxLineLen:80' + \ }, + \ ale#fixers#nimpretty#Fix(bufnr('')) + +Execute(The nimpretty callback should include any additional options): + let g:ale_nim_nimpretty_options = '--some-option' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('nimpretty') . ' %t --some-option' + \ }, + \ ale#fixers#nimpretty#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_nixfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_nixfmt_fixer_callback.vader new file mode 100644 index 00000000..880ac83e --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_nixfmt_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_nix_nixfmt_executable + Save g:ale_nix_nixfmt_options + +After: + Restore + +Execute(The nixfmt callback should return the correct default values): + AssertEqual + \ { + \ 'command': ale#Escape('nixfmt') + \ }, + \ ale#fixers#nixfmt#Fix(bufnr('')) + +Execute(The nixfmt executable and options should be configurable): + let g:ale_nix_nixfmt_executable = '/path/to/nixfmt' + let g:ale_nix_nixfmt_options = '--help' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/nixfmt') + \ . ' --help', + \ }, + \ ale#fixers#nixfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_nixpkgsfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_nixpkgsfmt_fixer_callback.vader new file mode 100644 index 00000000..0065f77b --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_nixpkgsfmt_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_nix_nixpkgsfmt_executable + Save g:ale_nix_nixpkgsfmt_options + +After: + Restore + +Execute(The nixpkgs-fmt callback should return the correct default values): + AssertEqual + \ { + \ 'command': ale#Escape('nixpkgs-fmt') + \ }, + \ ale#fixers#nixpkgsfmt#Fix(bufnr('')) + +Execute(The nixpkgs-fmt executable and options should be configurable): + let g:ale_nix_nixpkgsfmt_executable = '/path/to/nixpkgs-fmt' + let g:ale_nix_nixpkgsfmt_options = '-h' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/nixpkgs-fmt') + \ . ' -h', + \ }, + \ ale#fixers#nixpkgsfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_ocamlformat_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_ocamlformat_fixer_callback.vader new file mode 100644 index 00000000..587fcf56 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_ocamlformat_fixer_callback.vader @@ -0,0 +1,36 @@ +Before: + Save g:ale_ocaml_ocamlformat_executable + Save g:ale_ocaml_ocamlformat_options + + " Use an invalid global executable, so we don't match it. + let g:ale_ocaml_ocamlformat_executable = 'xxxinvalid' + let g:ale_ocaml_ocamlformat_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The ocamlformat callback should return the correct default values): + call ale#test#SetFilename('../test-files/ocaml/testfile.re') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' --name=%s -', + \ }, + \ ale#fixers#ocamlformat#Fix(bufnr('')) + +Execute(The ocamlformat callback should include custom ocamlformat options): + let g:ale_ocaml_ocamlformat_options = "-m 78" + call ale#test#SetFilename('../test-files/ocaml/testfile.re') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_ocaml_ocamlformat_options + \ . ' --name=%s -', + \ }, + \ ale#fixers#ocamlformat#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_ocp_indent_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_ocp_indent_fixer_callback.vader new file mode 100644 index 00000000..fc336b2d --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_ocp_indent_fixer_callback.vader @@ -0,0 +1,34 @@ +Before: + Save g:ale_ocaml_ocp_indent_executable + Save g:ale_ocaml_ocpindent_options + + " Use an invalid global executable + let g:ale_ocaml_ocp_indent_executable = 'xxxinvalid' + let g:ale_ocaml_ocp_indent_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The ocp_indent callback should return the correct default values): + call ale#test#SetFilename('../test-files/ocaml/ocp_inden_testfile.re') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ }, + \ ale#fixers#ocp_indent#Fix(bufnr('')) + +Execute(The ocp_indent callback should include custom ocp_indent options): + let g:ale_ocaml_ocp_indent_config = "base=4, type=4" + call ale#test#SetFilename('../test-files/ocaml/ocp_inden_testfile.re') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' --config=' . ale#Escape(g:ale_ocaml_ocp_indent_config) + \ }, + \ ale#fixers#ocp_indent#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_opa_fmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_opa_fmt_fixer_callback.vader new file mode 100644 index 00000000..3b112b2e --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_opa_fmt_fixer_callback.vader @@ -0,0 +1,33 @@ +Before: + Save g:ale_opa_fmt_executable + Save g:ale_opa_fmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_opa_fmt_executable = 'xxxinvalid' + let g:ale_opa_fmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The opa fmt callback should return the correct default values): + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' fmt', + \ }, + \ ale#fixers#opafmt#Fix(bufnr('')) + +Execute(The opa fmt callback should include custom options): + let g:ale_opa_fmt_options = "--list" + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' fmt' + \ . ' ' . g:ale_opa_fmt_options + \ }, + \ ale#fixers#opafmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_ormolu_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_ormolu_fixer_callback.vader new file mode 100644 index 00000000..8df3fca9 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_ormolu_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_haskell_ormolu_executable + Save g:ale_haskell_ormolu_options + +After: + Restore + +Execute(The ormolu callback should return the correct default values): + AssertEqual + \ { + \ 'command': ale#Escape('ormolu') + \ }, + \ ale#fixers#ormolu#Fix(bufnr('')) + +Execute(The ormolu executable and options should be configurable): + let g:ale_nix_nixpkgsfmt_executable = '/path/to/ormolu' + let g:ale_nix_nixpkgsfmt_options = '-h' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/ormolu') + \ . ' -h', + \ }, + \ ale#fixers#nixpkgsfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_packer_fmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_packer_fmt_fixer_callback.vader new file mode 100644 index 00000000..2eb07ed4 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_packer_fmt_fixer_callback.vader @@ -0,0 +1,34 @@ +Before: + Save g:ale_packer_fmt_executable + Save g:ale_packer_fmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_packer_fmt_executable = 'xxxinvalid' + let g:ale_packer_fmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The packer fmt callback should return the correct default values): + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' fmt -', + \ }, + \ ale#fixers#packer#Fix(bufnr('')) + +Execute(The packer fmt callback should include custom options): + let g:ale_packer_fmt_options = "-list=true" + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' fmt' + \ . ' ' . g:ale_packer_fmt_options + \ . ' -', + \ }, + \ ale#fixers#packer#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_pandoc_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_pandoc_fixer_callback.vader new file mode 100644 index 00000000..a364ee56 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_pandoc_fixer_callback.vader @@ -0,0 +1,23 @@ +Before: + Save g:ale_markdown_pandoc_executable + Save g:ale_markdown_pandoc_options + +After: + Restore + +Execute(The pandoc callback should return 'pandoc' as default command): + setlocal noexpandtab + Assert + \ ale#fixers#pandoc#Fix(bufnr('')).command =~# '^' . ale#Escape('pandoc'), + \ "Default command name is expected to be 'pandoc'" + +Execute(The pandoc executable and options should be configurable): + let g:ale_markdown_pandoc_executable = 'foobar' + let g:ale_markdown_pandoc_options = '--some-option' + + AssertEqual + \ { + \ 'command': ale#Escape('foobar') + \ . ' --some-option', + \ }, + \ ale#fixers#pandoc#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_perltidy_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_perltidy_fixer_callback.vader new file mode 100644 index 00000000..c7430bfa --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_perltidy_fixer_callback.vader @@ -0,0 +1,40 @@ +Before: + Save g:ale_perl_perltidy_executable + Save g:ale_perl_perltidy_options + + " Use an invalid global executable, so we don't match it. + let g:ale_perl_perltidy_executable = 'xxxinvalid' + let g:ale_perl_perltidy_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The perltidy callback should return the correct default values): + call ale#test#SetFilename('../pl_files/testfile.pl') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -b' + \ . ' %t', + \ }, + \ ale#fixers#perltidy#Fix(bufnr('')) + +Execute(The perltidy callback should include custom perltidy options): + let g:ale_perl_perltidy_options = "-r '(a) -> a'" + call ale#test#SetFilename('../pl_files/testfile.pl') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' -b' + \ . ' ' . g:ale_perl_perltidy_options + \ . ' %t', + \ }, + \ ale#fixers#perltidy#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_pgformatter_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_pgformatter_fixer_callback.vader new file mode 100644 index 00000000..5baa6f6f --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_pgformatter_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_sql_pgformatter_executable + Save g:ale_sql_pgformatter_options + +After: + Restore + +Execute(The pgFormatter callback should return the correct default values): + AssertEqual + \ { + \ 'command': ale#Escape('pg_format') + \ }, + \ ale#fixers#pgformatter#Fix(bufnr('')) + +Execute(The pgFormatter executable and options should be configurable): + let g:ale_sql_pgformatter_executable = '/path/to/pg_format' + let g:ale_sql_pgformatter_options = '-n' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/pg_format') + \ . ' -n', + \ }, + \ ale#fixers#pgformatter#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_php_cs_fixer.vader b/sources_non_forked/ale/test/fixers/test_php_cs_fixer.vader new file mode 100644 index 00000000..eb4d78f8 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_php_cs_fixer.vader @@ -0,0 +1,62 @@ +Before: + Save g:ale_php_cs_fixer_executable + Save g:ale_php_cs_fixer_options + let g:ale_php_cs_fixer_executable = 'php-cs-fixer' + let g:ale_php_cs_fixer_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + + +Execute(project with php-cs-fixer should use local by default): + call ale#test#SetFilename('../test-files/php/project-with-php-cs-fixer/test.php') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/php/project-with-php-cs-fixer/vendor/bin/php-cs-fixer'), + \ ale#fixers#php_cs_fixer#GetExecutable(bufnr('')) + +Execute(use-global should override local detection): + let g:ale_php_cs_fixer_use_global = 1 + call ale#test#SetFilename('../test-files/php/project-with-php-cs-fixer/test.php') + + AssertEqual + \ 'php-cs-fixer', + \ ale#fixers#php_cs_fixer#GetExecutable(bufnr('')) + +Execute(project without php-cs-fixer should use global): + call ale#test#SetFilename('../test-files/php/project-without-php-cs-fixer/test.php') + + AssertEqual + \ 'php-cs-fixer', + \ ale#fixers#php_cs_fixer#GetExecutable(bufnr('')) + + + + +Execute(The php-cs-fixer callback should return the correct default values): + call ale#test#SetFilename('../test-files/php/project-without-php-cs-fixer/foo/test.php') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('php-cs-fixer') + \ . ' ' . g:ale_php_cs_fixer_options + \ . ' fix %t' + \ }, + \ ale#fixers#php_cs_fixer#Fix(bufnr('')) + +Execute(The php-cs-fixer callback should include custom php-cs-fixer options): + let g:ale_php_cs_fixer_options = '--config="$HOME/.php_cs"' + call ale#test#SetFilename('../test-files/php/project-without-php-cs-fixer/test.php') + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_php_cs_fixer_executable) + \ . ' --config="$HOME/.php_cs" fix %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#php_cs_fixer#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_phpcbf_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_phpcbf_fixer_callback.vader new file mode 100644 index 00000000..45229a1b --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_phpcbf_fixer_callback.vader @@ -0,0 +1,117 @@ +Before: + Save g:ale_php_phpcbf_executable + Save g:ale_php_phpcbf_standard + Save g:ale_php_phpcbf_use_global + + let g:ale_php_phpcbf_executable = 'phpcbf_test' + let g:ale_php_phpcbf_standard = '' + let g:ale_php_phpcbf_options = '' + let g:ale_php_phpcbf_use_global = 0 + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(project with phpcbf should use local by default): + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf'), + \ ale#fixers#phpcbf#GetExecutable(bufnr('')) + +Execute(use-global should override local detection): + let g:ale_php_phpcbf_use_global = 1 + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ 'phpcbf_test', + \ ale#fixers#phpcbf#GetExecutable(bufnr('')) + +Execute(project without phpcbf should use global): + call ale#test#SetFilename('../test-files/php/project-without-phpcbf/foo/test.php') + + AssertEqual + \ 'phpcbf_test', + \ ale#fixers#phpcbf#GetExecutable(bufnr('')) + +Execute(The phpcbf callback should return the correct default values): + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s -' }, + \ ale#fixers#phpcbf#Fix(bufnr('')) + +Execute(The phpcbf callback should include the phpcbf_standard option): + let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml' + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml' . ' -'}, + \ ale#fixers#phpcbf#Fix(bufnr('')) + +Execute(User provided options should be used): + let g:ale_php_phpcbf_options = '--my-user-provided-option my-value' + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . ale#Pad('--my-user-provided-option my-value') . ' -'}, + \ ale#fixers#phpcbf#Fix(bufnr('')) + + +Before: + Save g:ale_php_phpcbf_executable + Save g:ale_php_phpcbf_standard + Save g:ale_php_phpcbf_use_global + + let g:ale_php_phpcbf_executable = 'phpcbf_test' + let g:ale_php_phpcbf_standard = '' + let g:ale_php_phpcbf_options = '' + let g:ale_php_phpcbf_use_global = 0 + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(project with phpcbf should use local by default): + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf'), + \ ale#fixers#phpcbf#GetExecutable(bufnr('')) + +Execute(use-global should override local detection): + let g:ale_php_phpcbf_use_global = 1 + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ 'phpcbf_test', + \ ale#fixers#phpcbf#GetExecutable(bufnr('')) + +Execute(project without phpcbf should use global): + call ale#test#SetFilename('../test-files/php/project-without-phpcbf/foo/test.php') + + AssertEqual + \ 'phpcbf_test', + \ ale#fixers#phpcbf#GetExecutable(bufnr('')) + +Execute(The phpcbf callback should return the correct default values): + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s -' }, + \ ale#fixers#phpcbf#Fix(bufnr('')) + +Execute(The phpcbf callback should include the phpcbf_standard option): + let g:ale_php_phpcbf_standard = 'phpcbf_ruleset.xml' + call ale#test#SetFilename('../test-files/php/project-with-phpcbf/foo/test.php') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/php/project-with-phpcbf/vendor/bin/phpcbf')) . ' --stdin-path=%s ' . '--standard=phpcbf_ruleset.xml' . ' -'}, + \ ale#fixers#phpcbf#Fix(bufnr('')) + diff --git a/sources_non_forked/ale/test/fixers/test_prettier_eslint_fixer.callback.vader b/sources_non_forked/ale/test/fixers/test_prettier_eslint_fixer.callback.vader new file mode 100644 index 00000000..cfdd1c78 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_prettier_eslint_fixer.callback.vader @@ -0,0 +1,97 @@ +Before: + call ale#assert#SetUpFixerTest('javascript', 'prettier_eslint') + Save g:ale_command_wrapper + + let g:ale_command_wrapper = '' + +After: + call ale#assert#TearDownFixerTest() + +Execute(The default command should be correct): + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape('prettier-eslint') + \ . ' %t' + \ . ' --write' + \ } + +Execute(Additional options should be used when set): + let b:ale_javascript_prettier_eslint_options = '--foobar' + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape('prettier-eslint') + \ . ' %t' + \ . ' --foobar --write' + \ } + +Execute(--eslint-config-path should be set for 4.2.0 and up): + call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js') + + GivenCommandOutput ['4.2.0'] + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape('prettier-eslint') + \ . ' %t' + \ . ' --eslint-config-path ' . ale#Escape(ale#test#GetFilename('../test-files/eslint/react-app/.eslintrc.js')) + \ . ' --write' + \ } + +Execute(--eslint-config-path shouldn't be used for older versions): + call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape('prettier-eslint') + \ . ' %t' + \ . ' --write' + \ } + +Execute(The version check should be correct): + AssertFixer [ + \ ale#Escape('prettier-eslint') . ' --version', + \ { + \ 'read_temporary_file': 1, + \ 'command': + \ ale#Escape('prettier-eslint') + \ . ' %t' + \ . ' --write' + \ } + \] + +Execute(The new --stdin-filepath option should be used when the version is new enough): + call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js') + + GivenCommandOutput ['4.4.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('prettier-eslint') + \ . ' --eslint-config-path ' . ale#Escape(ale#test#GetFilename('../test-files/eslint/react-app/.eslintrc.js')) + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(The version number should be cached): + GivenCommandOutput ['4.4.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('prettier-eslint') + \ . ' --stdin-filepath %s --stdin', + \ } + + GivenCommandOutput [] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape('prettier-eslint') + \ . ' --stdin-filepath %s --stdin', + \ } diff --git a/sources_non_forked/ale/test/fixers/test_prettier_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_prettier_fixer_callback.vader new file mode 100644 index 00000000..8da13fcd --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_prettier_fixer_callback.vader @@ -0,0 +1,337 @@ +Before: + call ale#assert#SetUpFixerTest('javascript', 'prettier') + Save g:ale_command_wrapper + + let g:ale_command_wrapper = '' + +After: + call ale#assert#TearDownFixerTest() + +Execute(The prettier callback should return the correct default values): + call ale#test#SetFilename('../test-files/prettier/testfile.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' %t' + \ . ' --write', + \ } + +Execute(The --config option should not be set automatically): + let g:ale_javascript_prettier_use_local_config = 1 + call ale#test#SetFilename('../test-files/prettier/with_config/testfile.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' %t' + \ . ' --write', + \ } + +Execute(The prettier callback should include custom prettier options): + let g:ale_javascript_prettier_options = '--no-semi' + call ale#test#SetFilename('../test-files/prettier/with_config/testfile.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' %t' + \ . ' --no-semi' + \ . ' --write', + \ } + +Execute(The version check should be correct): + call ale#test#SetFilename('../test-files/prettier/testfile.js') + + AssertFixer [ + \ ale#Escape('prettier') . ' --version', + \ {'read_temporary_file': 1, 'command': ale#Escape('prettier') . ' %t --write'} + \] + +Execute(--stdin-filepath should be used when prettier is new enough): + let g:ale_javascript_prettier_options = '--no-semi' + call ale#test#SetFilename('../test-files/prettier/with_config/testfile.js') + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --no-semi' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(The version number should be cached): + call ale#test#SetFilename('../test-files/prettier/with_config/testfile.js') + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --stdin-filepath %s --stdin', + \ } + + GivenCommandOutput [] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser to `babylon` by default, < 1.16.0): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=javascript + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser babylon' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser to `babel` by default, >= 1.16.0): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=javascript + + GivenCommandOutput ['1.16.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser babel' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, TypeScript): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=typescript + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser typescript' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, CSS): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=css + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser css' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, LESS): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=less + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser less' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, SCSS): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=scss + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser scss' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, JSON): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=json + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser json' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, JSON5): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=json5 + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser json5' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, GraphQL): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=graphql + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser graphql' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, Markdown): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=markdown + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser markdown' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, Vue): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=vue + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser vue' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, YAML): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=yaml + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser yaml' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, HTML): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=html + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser html' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on filetype, Ruby): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=ruby + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser ruby' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser based on first filetype of multiple filetypes): + call ale#test#SetFilename('../test-files/prettier/testfile') + + set filetype=css.scss + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser css' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Should set --parser for experimental language, Handlebars): + call ale#test#SetFilename('../test-files/prettier/testfile.hbs') + + set filetype=html.handlebars + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --parser glimmer' + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(Changes to directory where .prettierignore is found): + call ale#test#SetFilename('../test-files/prettier/with_prettierignore/src/testfile.js') + + GivenCommandOutput ['1.6.0'] + AssertFixer + \ { + \ 'cwd': expand('%:p:h:h'), + \ 'command': ale#Escape(g:ale_javascript_prettier_executable) + \ . ' --stdin-filepath %s --stdin', + \ } + +Execute(The prettier_d post-processor should permit regular JavaScript content): + AssertEqual + \ [ + \ 'const x = ''Error: foo''', + \ 'const y = 3', + \ ], + \ ale#fixers#prettier#ProcessPrettierDOutput(bufnr(''), [ + \ 'const x = ''Error: foo''', + \ 'const y = 3', + \ ]) + +Execute(The prettier_d post-processor should handle error messages correctly): + AssertEqual + \ [], + \ ale#fixers#prettier#ProcessPrettierDOutput(bufnr(''), [ + \ 'SyntaxError: Unexpected token, expected "," (36:28)', + \ ]) diff --git a/sources_non_forked/ale/test/fixers/test_prettier_standard_callback.vader b/sources_non_forked/ale/test/fixers/test_prettier_standard_callback.vader new file mode 100644 index 00000000..f5037ed6 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_prettier_standard_callback.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpFixerTest('javascript', 'prettier_standard') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The prettier callback should return the correct default values): + call ale#test#SetFilename('../test-files/prettier/testfile.js') + + AssertFixer + \ { + \ 'command': ale#Escape(g:ale_javascript_prettier_standard_executable) + \ . ' --stdin' + \ . ' --stdin-filepath=%s ', + \ } diff --git a/sources_non_forked/ale/test/fixers/test_protolint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_protolint_fixer_callback.vader new file mode 100644 index 00000000..5a6931d7 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_protolint_fixer_callback.vader @@ -0,0 +1,28 @@ +Before: + call ale#assert#SetUpFixerTest('proto', 'protolint') + call ale#test#SetFilename('test.proto') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The default command should be correct): + AssertFixer + \ { + \ 'command': ale#Escape('protolint') + \ . ' -fix' + \ . ' %t', + \ 'read_temporary_file': 1, + \ } + +Execute(The callback should include any additional options): + let b:ale_proto_protolint_executable = '/tmp/protolint' + let b:ale_proto_protolint_config = '/tmp/protolint.yaml' + + AssertFixer + \ { + \ 'command': ale#Escape('/tmp/protolint') + \ . ' -config_path=' . ale#Escape('/tmp/protolint.yaml') + \ . ' -fix' + \ . ' %t', + \ 'read_temporary_file': 1, + \ } diff --git a/sources_non_forked/ale/test/fixers/test_ptop_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_ptop_fixer_callback.vader new file mode 100644 index 00000000..7cf632e3 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_ptop_fixer_callback.vader @@ -0,0 +1,38 @@ +Before: + Save g:ale_pascal_ptop_executable + Save g:ale_pascal_ptop_options + + " Use an invalid global executable, so we don't match it. + let g:ale_pascal_ptop_executable = 'xxxinvalid' + let g:ale_pascal_ptop_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The ptop callback should return the correct default values): + call ale#test#SetFilename('../test-files/pascal/test.pas') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' %s %t', + \ }, + \ ale#fixers#ptop#Fix(bufnr('')) + +Execute(The ptop callback should include custom ptop options): + let g:ale_pascal_ptop_options = "-i 2" + call ale#test#SetFilename('../test-files/pascal/test.pas') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_pascal_ptop_options + \ . ' %s %t', + \ }, + \ ale#fixers#ptop#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_puppetlint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_puppetlint_fixer_callback.vader new file mode 100644 index 00000000..1a5a6cea --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_puppetlint_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_puppet_puppetlint_executable + Save g:ale_puppet_puppetlint_options + + " Use an invalid global executable, so we don't match it. + let g:ale_puppet_puppetlint_executable = 'xxxinvalid' + let g:ale_puppet_puppetlint_options = '--invalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The puppetlint callback should return the correct default values): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/puppet/dummy.pp') + + AssertEqual + \ {'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_puppet_puppetlint_executable) + \ . ' ' . g:ale_puppet_puppetlint_options + \ . ' --fix %t' }, + \ ale#fixers#puppetlint#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_purs_tidy_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_purs_tidy_fixer_callback.vader new file mode 100644 index 00000000..fdeb3f21 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_purs_tidy_fixer_callback.vader @@ -0,0 +1,20 @@ +Before: + Save g:ale_purescript_tidy_executable + Save g:ale_purescript_tidy_options + + " Use an invalid global executable, so we don’t match it. + let g:ale_purescript_tidy_executable = 'odd-purs-tidy' + let g:ale_purescript_tidy_options = '--indent 3' + + call ale#assert#SetUpFixerTest('purescript', 'purs-tidy') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The purs-tidy callback should return the correct custom options): + AssertFixer + \ { + \ 'command': ale#Escape('odd-purs-tidy') + \ . ' format' + \ . ' --indent 3' + \ } diff --git a/sources_non_forked/ale/test/fixers/test_purty_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_purty_fixer_callback.vader new file mode 100644 index 00000000..e83b8c18 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_purty_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_purescript_purty_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_purescript_purty_executable = 'my-special-purty' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The purty callback should return the correct options): + call ale#test#SetFilename('../purescript_files/testfile.purs') + + AssertEqual + \ { + \ 'command': ale#Escape('my-special-purty') + \ . ' --write' + \ . ' %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#purty#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_python_add_blank_lines_fixer.vader b/sources_non_forked/ale/test/fixers/test_python_add_blank_lines_fixer.vader new file mode 100644 index 00000000..7d042c8a --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_python_add_blank_lines_fixer.vader @@ -0,0 +1,167 @@ +Before: + Save g:ale_fixers + +After: + Restore + +Given python(Some Python without blank lines): + def foo(): + """ This is a simple test docstring """ + return 1 + + + def bar(): + '''This is another simple test docstring''' + return 1 + return 4 + + + def bar(): + """ + This is a multi-line + docstring + """ + + if x: + pass + for l in x: + pass + for l in x: + pass + break + continue + elif x: + pass + while x: + pass + while x: + pass + else: + pass + if x: + pass + elif x: + pass + else: + pass + +Execute(Blank lines should be added appropriately): + let g:ale_fixers = {'python': ['add_blank_lines_for_python_control_statements']} + ALEFix + +Expect python(Newlines should be added): + def foo(): + """ This is a simple test docstring """ + + return 1 + + + def bar(): + '''This is another simple test docstring''' + + return 1 + + return 4 + + + def bar(): + """ + This is a multi-line + docstring + """ + + if x: + pass + + for l in x: + pass + + for l in x: + pass + + break + + continue + elif x: + pass + + while x: + pass + + while x: + pass + else: + pass + + if x: + pass + elif x: + pass + else: + pass + +Given python(A file with a main block): + import os + + + def main(): + print('hello') + + + if __name__ == '__main__': + main() + +Execute(Fix the file): + let g:ale_fixers = {'python': ['add_blank_lines_for_python_control_statements']} + ALEFix + +Expect python(extra newlines shouldn't be added to the main block): + import os + + + def main(): + print('hello') + + + if __name__ == '__main__': + main() + + +Given python(A file with variables/docstring that start with a control statement): + def some(): + """ + This is a docstring that contains an + break control statement and also contains a + return something funny. + """ + + continue_some_var = True + forward_something = False + + if ( + continue_some_var and + forwarded_something + ): + return True + + +Execute(Fix the file): + let g:ale_fixers = {'python': ['add_blank_lines_for_python_control_statements']} + ALEFix + +Expect python(Extra new lines are not added to the file): + def some(): + """ + This is a docstring that contains an + break control statement and also contains a + return something funny. + """ + + continue_some_var = True + forward_something = False + + if ( + continue_some_var and + forwarded_something + ): + return True diff --git a/sources_non_forked/ale/test/fixers/test_qmlfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_qmlfmt_fixer_callback.vader new file mode 100644 index 00000000..e216f2e1 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_qmlfmt_fixer_callback.vader @@ -0,0 +1,12 @@ +Before: + Save g:ale_qml_qmlfmt_executable + +After: + Restore + +Execute(The qmlfmt fixer should use the options you set): + let g:ale_qml_qmlfmt_executable = 'foo-exe' + + AssertEqual + \ {'command': ale#Escape('foo-exe')}, + \ ale#fixers#qmlfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_refmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_refmt_fixer_callback.vader new file mode 100644 index 00000000..01b56bee --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_refmt_fixer_callback.vader @@ -0,0 +1,41 @@ +Before: + Save g:ale_reasonml_refmt_executable + Save g:ale_reasonml_refmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_reasonml_refmt_executable = 'xxxinvalid' + let g:ale_reasonml_refmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The refmt callback should return the correct default values): + call ale#test#SetFilename('../test-files/reasonml/testfile.re') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' --in-place' + \ . ' %t', + \ }, + \ ale#fixers#refmt#Fix(bufnr('')) + +Execute(The refmt callback should include custom refmt options): + let g:ale_reasonml_refmt_options = "-w 80" + call ale#test#SetFilename('../test-files/reasonml/testfile.re') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_reasonml_refmt_options + \ . ' --in-place' + \ . ' %t', + \ }, + \ ale#fixers#refmt#Fix(bufnr('')) + diff --git a/sources_non_forked/ale/test/fixers/test_remark_lint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_remark_lint_fixer_callback.vader new file mode 100644 index 00000000..5e2e342d --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_remark_lint_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_markdown_remark_lint_executable + Save g:ale_markdown_remark_lint_options + +After: + Restore + +Execute(The remark callback should return the correct default values): + AssertEqual + \ { + \ 'command': ale#Escape('remark') + \ }, + \ ale#fixers#remark_lint#Fix(bufnr('')) + +Execute(The remark executable and options should be configurable): + let g:ale_markdown_remark_lint_executable = '/path/to/remark' + let g:ale_markdown_remark_lint_options = '-h' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/remark') + \ . ' -h', + \ }, + \ ale#fixers#remark_lint#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_reorder_python_imports_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_reorder_python_imports_fixer_callback.vader new file mode 100644 index 00000000..ead2da77 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_reorder_python_imports_fixer_callback.vader @@ -0,0 +1,46 @@ +Before: + Save g:ale_python_reorder_python_imports_executable + Save g:ale_python_reorder_python_imports_options + + " Use an invalid global executable, so we don't match it. + let g:ale_python_reorder_python_imports_executable = 'xxxinvalid' + let g:ale_python_reorder_python_imports_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + Restore + + unlet! b:bin_dir + + call ale#test#RestoreDirectory() + +Execute(The reorder_python_imports callback should return the correct default values): + AssertEqual + \ 0, + \ ale#fixers#reorder_python_imports#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' + \ . b:bin_dir . '/reorder-python-imports')) . ' -', + \ }, + \ ale#fixers#reorder_python_imports#Fix(bufnr('')) + +Execute(The reorder_python_imports callback should respect custom options): + let g:ale_python_reorder_python_imports_options = '--py3-plus' + + AssertEqual + \ 0, + \ ale#fixers#reorder_python_imports#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' + \ . b:bin_dir . '/reorder-python-imports')) . ' --py3-plus -', + \ }, + \ ale#fixers#reorder_python_imports#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_rubocop_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_rubocop_fixer_callback.vader new file mode 100644 index 00000000..f7b0eb60 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_rubocop_fixer_callback.vader @@ -0,0 +1,89 @@ +Before: + Save g:ale_ruby_rubocop_executable + Save g:ale_ruby_rubocop_options + + " Use an invalid global executable, so we don't match it. + let g:ale_ruby_rubocop_executable = 'xxxinvalid' + let g:ale_ruby_rubocop_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The rubocop callback should return the correct default values): + call ale#test#SetFilename('../test-files/ruby/dummy.rb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#rubocop#PostProcess', + \ 'command': ale#Escape(g:ale_ruby_rubocop_executable) + \ . ' --auto-correct --force-exclusion --stdin %s', + \ }, + \ ale#fixers#rubocop#Fix(bufnr('')) + +Execute(The rubocop callback should include custom rubocop options): + let g:ale_ruby_rubocop_options = '--except Lint/Debugger' + call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#rubocop#PostProcess', + \ 'command': ale#Escape(g:ale_ruby_rubocop_executable) + \ . ' --except Lint/Debugger' + \ . ' --auto-correct --force-exclusion --stdin %s', + \ }, + \ ale#fixers#rubocop#Fix(bufnr('')) + +Execute(The rubocop callback should use auto-correct-all option when set): + let g:ale_ruby_rubocop_auto_correct_all = 1 + call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#rubocop#PostProcess', + \ 'command': ale#Escape(g:ale_ruby_rubocop_executable) + \ . ' --auto-correct-all --force-exclusion --stdin %s' + \ }, + \ ale#fixers#rubocop#Fix(bufnr('')) + +Execute(The rubocop post-processor should remove diagnostics content): + AssertEqual + \ [ + \ 'class MyModel < ApplicationRecord', + \ ' # rubocop:disable Rails/InverseOf', + \ ' has_one :something', + \ ' # rubocop:enable Rails/InverseOf', + \ 'end', + \ '', + \ 'array = [1, 2, 3,', + \ ' 4, 5, 6]', + \ 'array = [''run'',', + \ ' ''forrest'',', + \ ' ''run'']', + \ ], + \ ale#fixers#rubocop#PostProcess(bufnr(''), [ + \ 'Inspecting 1 file', + \ 'C', + \ '', + \ 'Offenses:', + \ 'app/models/my_model.rb:8:3: C: [Corrected] Layout/ArrayAlignment: ', + \ '4, 5, 6]', + \ '^', + \ '', + \ '1 file inspected, 3 offenses detected, 3 offenses corrected', + \ '====================', + \ 'class MyModel < ApplicationRecord', + \ ' # rubocop:disable Rails/InverseOf', + \ ' has_one :something', + \ ' # rubocop:enable Rails/InverseOf', + \ 'end', + \ '', + \ 'array = [1, 2, 3,', + \ ' 4, 5, 6]', + \ 'array = [''run'',', + \ ' ''forrest'',', + \ ' ''run'']', + \ ]) diff --git a/sources_non_forked/ale/test/fixers/test_rufo_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_rufo_fixer_callback.vader new file mode 100644 index 00000000..3d539f7a --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_rufo_fixer_callback.vader @@ -0,0 +1,30 @@ +Before: + Save g:ale_ruby_rufo_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_ruby_rufo_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The rufo command should contain `bundle exec` when executable is `bundle`): + let g:ale_ruby_rufo_executable = 'bundle' + call ale#test#SetFilename('../test-files/ruby/dummy.rb') + + AssertEqual + \ ale#Escape('bundle') . ' exec rufo %t', + \ ale#fixers#rufo#GetCommand(bufnr('')) + +Execute(The rufo callback should return the correct default values): + call ale#test#SetFilename('../test-files/ruby/dummy.rb') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') . ' %t' + \ }, + \ ale#fixers#rufo#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_rustfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_rustfmt_fixer_callback.vader new file mode 100644 index 00000000..98761c94 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_rustfmt_fixer_callback.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpFixerTest('rust', 'rustfmt') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The rustfmt callback should return the correct default values): + call ale#test#SetFilename('../test-files/rust/testfile.rs') + + AssertFixer {'command': ale#Escape('rustfmt')} + +Execute(The rustfmt callback should include custom rustfmt options): + let g:ale_rust_rustfmt_options = "--skip-children" + call ale#test#SetFilename('../test-files/rust/testfile.rs') + + AssertFixer {'command': ale#Escape('rustfmt') . ' ' . g:ale_rust_rustfmt_options} diff --git a/sources_non_forked/ale/test/fixers/test_scalafmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_scalafmt_fixer_callback.vader new file mode 100644 index 00000000..2b8dc3eb --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_scalafmt_fixer_callback.vader @@ -0,0 +1,66 @@ +Before: + Save g:ale_scala_scalafmt_executable + Save g:ale_scala_scalafmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_scala_scalafmt_executable = 'xxxinvalid' + let g:ale_scala_scalafmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The scalafmt callback should return the correct default values): + call ale#test#SetFilename('../test-files/scala/dummy.scala') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_scala_scalafmt_executable) + \ . ' %t', + \ }, + \ ale#fixers#scalafmt#Fix(bufnr('')) + +Execute(The scalafmt callback should use ng with scalafmt automatically): + let g:ale_scala_scalafmt_executable = 'ng' + call ale#test#SetFilename('../test-files/scala/dummy.scala') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('ng') + \ . ' scalafmt' + \ . ' %t', + \ }, + \ ale#fixers#scalafmt#Fix(bufnr('')) + +Execute(The scalafmt callback should include custom scalafmt options): + let g:ale_scala_scalafmt_options = '--diff' + call ale#test#SetFilename('../test-files/scala/dummy.scala') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_scala_scalafmt_executable) + \ . ' --diff' + \ . ' %t', + \ }, + \ ale#fixers#scalafmt#Fix(bufnr('')) + +Execute(The scalafmt callback should include custom scalafmt options and use ng with scalafmt): + let g:ale_scala_scalafmt_options = '--diff' + let g:ale_scala_scalafmt_executable = 'ng' + call ale#test#SetFilename('../test-files/scala/dummy.scala') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('ng') + \ . ' scalafmt' + \ . ' --diff' + \ . ' %t', + \ }, + \ ale#fixers#scalafmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_shfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_shfmt_fixer_callback.vader new file mode 100644 index 00000000..99cb0987 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_shfmt_fixer_callback.vader @@ -0,0 +1,59 @@ +Before: + Save g:ale_sh_shfmt_executable + Save g:ale_sh_shfmt_options + Save &l:expandtab + Save &l:shiftwidth + Save &l:tabstop + +After: + Restore + +Execute(The shfmt callback should return 'shfmt' as default command): + setlocal noexpandtab + Assert + \ ale#fixers#shfmt#Fix(bufnr('')).command =~# '^' . ale#Escape('shfmt'), + \ "Default command name is expected to be 'shfmt'" + +Execute(The shfmt callback should return the command with no option as default when noexpandtab is set): + let g:ale_sh_shfmt_executable = 'shfmt' + let g:ale_sh_shfmt_options = '' + setlocal noexpandtab + AssertEqual + \ { + \ 'command': ale#Escape('shfmt'), + \ }, + \ ale#fixers#shfmt#Fix(bufnr('')) + +Execute(The shfmt callback should return the command specifying indent width by looking shiftwidth as default): + let g:ale_sh_shfmt_executable = 'shfmt' + let g:ale_sh_shfmt_options = '' + setlocal expandtab + setlocal shiftwidth=4 + AssertEqual + \ { + \ 'command': ale#Escape('shfmt') . ' -i 4', + \ }, + \ ale#fixers#shfmt#Fix(bufnr('')) + +Execute(The shfmt callback should return the command specifying indent width by looking tabstop when shiftwidth is 0 as default): + let g:ale_sh_shfmt_executable = 'shfmt' + let g:ale_sh_shfmt_options = '' + setlocal expandtab + setlocal shiftwidth=0 + setlocal tabstop=8 + AssertEqual + \ { + \ 'command': ale#Escape('shfmt') . ' -i 8', + \ }, + \ ale#fixers#shfmt#Fix(bufnr('')) + +Execute(The shfmt executable and options should be configurable): + let g:ale_sh_shfmt_executable = 'foobar' + let g:ale_sh_shfmt_options = '--some-option' + + AssertEqual + \ { + \ 'command': ale#Escape('foobar') + \ . ' --some-option', + \ }, + \ ale#fixers#shfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_sorbet_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_sorbet_fixer_callback.vader new file mode 100644 index 00000000..2694a3dc --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_sorbet_fixer_callback.vader @@ -0,0 +1,38 @@ +Before: + Save g:ale_ruby_sorbet_executable + Save g:ale_ruby_sorbet_options + + " Use an invalid global executable, so we don't match it. + let g:ale_ruby_sorbet_executable = 'xxxinvalid' + let g:ale_ruby_sorbet_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The sorbet callback should return the correct default values): + call ale#test#SetFilename('../test-files/ruby/dummy.rb') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_ruby_sorbet_executable) + \ . ' tc --autocorrect --file %t', + \ }, + \ ale#fixers#sorbet#Fix(bufnr('')) + +Execute(The sorbet callback should include custom sorbet options): + let g:ale_ruby_sorbet_options = '--enable-experimental-lsp-hover' + call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_ruby_sorbet_executable) + \ . ' tc --enable-experimental-lsp-hover' + \ . ' --autocorrect --file %t', + \ }, + \ ale#fixers#sorbet#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_sqlfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_sqlfmt_fixer_callback.vader new file mode 100644 index 00000000..3046edb3 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_sqlfmt_fixer_callback.vader @@ -0,0 +1,26 @@ +Before: + Save g:ale_sql_sqlfmt_executable + Save g:ale_sql_sqlfmt_options + +After: + Restore + +Execute(The sqlfmt callback should return the correct default values): + AssertEqual + \ { + \ 'command': ale#Escape('sqlfmt') + \ . ' -w', + \ }, + \ ale#fixers#sqlfmt#Fix(bufnr('')) + +Execute(The sqlfmt executable and options should be configurable): + let g:ale_sql_sqlfmt_executable = '/path/to/sqlfmt' + let g:ale_sql_sqlfmt_options = '-u' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/sqlfmt') + \ . ' -w' + \ . ' -u', + \ }, + \ ale#fixers#sqlfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_sqlformat_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_sqlformat_fixer_callback.vader new file mode 100644 index 00000000..4bace089 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_sqlformat_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_sql_sqlformat_executable + Save g:ale_sql_sqlformat_options + +After: + Restore + +Execute(The sqlformat callback should return the correct default values): + AssertEqual + \ { + \ 'command': ale#Escape('sqlformat') . ' -' + \ }, + \ ale#fixers#sqlformat#Fix(bufnr('')) + +Execute(The sqlformat executable and options should be configurable): + let g:ale_sql_sqlformat_executable = '/path/to/sqlformat' + let g:ale_sql_sqlformat_options = '-a' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/sqlformat') + \ . ' -a -' + \ }, + \ ale#fixers#sqlformat#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_standard_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_standard_fixer_callback.vader new file mode 100644 index 00000000..9f5eb0e9 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_standard_fixer_callback.vader @@ -0,0 +1,31 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + + unlet! b:ale_javascript_standard_executable + unlet! b:ale_javascript_standard_options + +After: + call ale#test#RestoreDirectory() + +Execute(The executable path should be correct): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/standard/bin/cmd.js')) + \ . ' --fix --stdin < %s > %t', + \ }, + \ ale#fixers#standard#Fix(bufnr('')) + +Execute(Custom options should be supported): + let b:ale_javascript_standard_use_global = 1 + let b:ale_javascript_standard_options = '--foo-bar' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('standard') . ' --foo-bar --fix --stdin < %s > %t', + \ }, + \ ale#fixers#standard#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_standardrb_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_standardrb_fixer_callback.vader new file mode 100644 index 00000000..ff82b8f1 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_standardrb_fixer_callback.vader @@ -0,0 +1,51 @@ +Before: + Save g:ale_ruby_standardrb_executable + Save g:ale_ruby_standardrb_options + + " Use an invalid global executable, so we don't match it. + let g:ale_ruby_standardrb_executable = 'xxxinvalid' + let g:ale_ruby_standardrb_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The standardrb callback should return the correct default values): + call ale#test#SetFilename('../test-files/ruby/dummy.rb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#rubocop#PostProcess', + \ 'command': ale#Escape(g:ale_ruby_standardrb_executable) + \ . ' --fix --force-exclusion --stdin %s', + \ }, + \ ale#fixers#standardrb#Fix(bufnr('')) + +Execute(The standardrb callback should include configuration files): + call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#rubocop#PostProcess', + \ 'command': ale#Escape(g:ale_ruby_standardrb_executable) + \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.standard.yml')) + \ . ' --fix --force-exclusion --stdin %s', + \ }, + \ ale#fixers#standardrb#Fix(bufnr('')) + +Execute(The standardrb callback should include custom rubocop options): + let g:ale_ruby_standardrb_options = '--except Lint/Debugger' + call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#rubocop#PostProcess', + \ 'command': ale#Escape(g:ale_ruby_standardrb_executable) + \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.standard.yml')) + \ . ' --except Lint/Debugger' + \ . ' --fix --force-exclusion --stdin %s', + \ }, + \ ale#fixers#standardrb#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_statix_fixer.vader b/sources_non_forked/ale/test/fixers/test_statix_fixer.vader new file mode 100644 index 00000000..c55365a6 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_statix_fixer.vader @@ -0,0 +1,18 @@ +Before: + call ale#assert#SetUpFixerTest('nix', 'statix') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The callback should return the correct default values): + AssertFixer { 'command': ale#Escape('statix') . ' fix --stdin' } + +Execute(The callback should include a custom runtime): + let g:ale_nix_statix_fix_executable = 'foo/bar' + + AssertFixer { 'command': ale#Escape('foo/bar') . ' fix --stdin' } + +Execute(The callback should include custom options): + let g:ale_nix_statix_fix_options = '--foobar' + + AssertFixer { 'command': ale#Escape('statix') . ' fix --stdin --foobar' } diff --git a/sources_non_forked/ale/test/fixers/test_stylelint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_stylelint_fixer_callback.vader new file mode 100644 index 00000000..ee7cfdd4 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_stylelint_fixer_callback.vader @@ -0,0 +1,34 @@ +Before: + Save g:ale_stylelint_options + + let g:ale_stylelint_options = '' + + call ale#assert#SetUpFixerTest('css', 'stylelint') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The stylelint callback should return the correct default values): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.css') + + AssertFixer + \ { + \ 'read_temporary_file': 0, + \ 'cwd': '%s:h', + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js')) + \ . ' --fix --stdin --stdin-filename %s', + \ } + +Execute(The stylelint callback should include custom stylelint options): + let g:ale_stylelint_options = '--cache' + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.css') + + AssertFixer + \ { + \ 'read_temporary_file': 0, + \ 'cwd': '%s:h', + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js')) + \ . ' --cache --fix --stdin --stdin-filename %s', + \ } diff --git a/sources_non_forked/ale/test/fixers/test_styler_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_styler_fixer_callback.vader new file mode 100644 index 00000000..79f71ba9 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_styler_fixer_callback.vader @@ -0,0 +1,21 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The styler callback should include custom styler options): + let g:ale_r_styler_options = "a_custom_option" + + AssertEqual + \ { + \ 'command': 'Rscript --vanilla -e ' + \ . '"suppressPackageStartupMessages(library(styler));' + \ . 'style_file(commandArgs(TRUE), transformers = ' + \ . 'a_custom_option)"' + \ . ' %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#styler#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_stylish_haskell_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_stylish_haskell_fixer_callback.vader new file mode 100644 index 00000000..755d3430 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_stylish_haskell_fixer_callback.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_haskell_stylish_haskell_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_haskell_stylish_haskell_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The stylish-haskell callback should return the correct default values): + call ale#test#SetFilename('../haskell_files/testfile.hs') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' --inplace' + \ . ' %t', + \ }, + \ ale#fixers#stylish_haskell#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_stylua_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_stylua_fixer_callback.vader new file mode 100644 index 00000000..8621c498 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_stylua_fixer_callback.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpFixerTest('lua', 'stylua') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The default command should be correct): + AssertFixer {'command': ale#Escape('stylua') . ' -'} + +Execute(The stylua callback should include custom stylua options): + let g:ale_lua_stylua_executable = 'xxxinvalid' + let g:ale_lua_stylua_options = '--search-parent-directories' + + AssertFixer + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_lua_stylua_options + \ . ' -', + \ } diff --git a/sources_non_forked/ale/test/fixers/test_swiftformat_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_swiftformat_fixer_callback.vader new file mode 100644 index 00000000..755c30f6 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_swiftformat_fixer_callback.vader @@ -0,0 +1,35 @@ +Before: + Save g:ale_swift_swiftformat_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_swift_swiftformat_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The swiftformat callback should return the correct default values): + call ale#test#SetFilename('../test-files/swift/dummy.swift') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_swift_swiftformat_executable) + \ . ' %t ', + \ }, + \ ale#fixers#swiftformat#Fix(bufnr('')) + +Execute(The swiftformat callback should include any additional options): + call ale#test#SetFilename('../test-files/swift/dummy.swift') + let g:ale_swift_swiftformat_options = '--some-option' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_swift_swiftformat_executable) + \ . ' %t --some-option', + \ }, + \ ale#fixers#swiftformat#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_terraform_fmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_terraform_fmt_fixer_callback.vader new file mode 100644 index 00000000..15377a7e --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_terraform_fmt_fixer_callback.vader @@ -0,0 +1,34 @@ +Before: + Save g:ale_terraform_fmt_executable + Save g:ale_terraform_fmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_terraform_fmt_executable = 'xxxinvalid' + let g:ale_terraform_fmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The terraform fmt callback should return the correct default values): + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' fmt -', + \ }, + \ ale#fixers#terraform#Fix(bufnr('')) + +Execute(The terraform fmt callback should include custom options): + let g:ale_terraform_fmt_options = "-list=true" + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' fmt' + \ . ' ' . g:ale_terraform_fmt_options + \ . ' -', + \ }, + \ ale#fixers#terraform#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_textlint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_textlint_fixer_callback.vader new file mode 100644 index 00000000..5b6c5b7a --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_textlint_fixer_callback.vader @@ -0,0 +1,42 @@ +Before: + Save g:ale_textlint_executable + Save g:ale_textlint_options + Save g:ale_textlint_use_global + + " Use an invalid global executable, so we don't match it. + let g:ale_textlint_executable = 'xxxinvalid' + let g:ale_textlint_options = '' + let g:ale_textlint_use_global = 0 + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The textlint callback should return the correct default values): + call ale#test#SetFilename('../test-files/markdown/testfile.md') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' --fix' + \ . ' %t', + \ }, + \ ale#fixers#textlint#Fix(bufnr('')) + +Execute(The textlint callback should include custom textlint options): + let g:ale_textlint_options = "--quiet" + call ale#test#SetFilename('../test-files/markdown/testfile.md') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' --fix' + \ . ' ' . g:ale_textlint_options + \ . ' %t', + \ }, + \ ale#fixers#textlint#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_tidy_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_tidy_fixer_callback.vader new file mode 100644 index 00000000..25d3d6c3 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_tidy_fixer_callback.vader @@ -0,0 +1,25 @@ +Before: + Save g:ale_html_tidy_executable + + let g:ale_html_tidy_executable = '../test-files/tidy/tidy' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The tidy callback should return 0 if tidy not found): + let g:ale_html_tidy_executable = 'xxxinvalidpath' + AssertEqual + \ 0, + \ ale#fixers#tidy#Fix(bufnr('')) + +Execute(The tidy callback should return the correct default command): + AssertEqual + \ { + \ 'command': ale#Escape('../test-files/tidy/tidy') + \ . ' -q --tidy-mark no --show-errors 0 --show-warnings 0' + \ }, + \ ale#fixers#tidy#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_trim_whitespace.vader b/sources_non_forked/ale/test/fixers/test_trim_whitespace.vader new file mode 100644 index 00000000..2ffbcb04 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_trim_whitespace.vader @@ -0,0 +1,28 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + call ale#test#RestoreDirectory() + +Execute(Should delete all whitespace at the end of different lines): + AssertEqual + \ [ + \ 'def foo():', + \ ' some_variable = this_is_a_longer_function(', + \ 'first_argument,', + \ ' second_argument,', + \ ' third_with_function_call(', + \ 'foo,', + \ ' bar,', + \ '))', + \ ], + \ ale#fixers#generic#TrimWhitespace(bufnr(''), [ + \ 'def foo():', + \ ' some_variable = this_is_a_longer_function(', + \ 'first_argument,', + \ ' second_argument,', + \ ' third_with_function_call(', + \ 'foo,', + \ ' bar,', + \ '))', + \ ]) diff --git a/sources_non_forked/ale/test/fixers/test_tslint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_tslint_fixer_callback.vader new file mode 100644 index 00000000..43fcc5a4 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_tslint_fixer_callback.vader @@ -0,0 +1,42 @@ +Before: + Save g:ale_typescript_tslint_executable + Save g:ale_typescript_tslint_config_path + + unlet! g:ale_typescript_tslint_executable + unlet! g:ale_typescript_tslint_config_path + unlet! b:ale_typescript_tslint_executable + unlet! b:ale_typescript_tslint_config_path + + call ale#handlers#tslint#InitVariables() + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The tslint callback should return the correct default values): + let g:ale_typescript_tslint_config_path = 'tslint.json' + call ale#test#SetFilename('../test-files/prettier/testfile.ts') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('tslint') + \ . ' -c ' . ale#Escape('tslint.json') + \ . ' --outputAbsolutePaths --fix %t', + \ }, + \ ale#fixers#tslint#Fix(bufnr('')) + +Execute(The tslint callback should include custom tslint config option): + let g:ale_typescript_tslint_config_path = '.tslintrc' + call ale#test#SetFilename('../test-files/prettier/testfile.ts') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('tslint') + \ . ' -c ' . ale#Escape('.tslintrc') + \ . ' --outputAbsolutePaths --fix %t', + \ }, + \ ale#fixers#tslint#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_uncrustify_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_uncrustify_fixer_callback.vader new file mode 100644 index 00000000..c101a31a --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_uncrustify_fixer_callback.vader @@ -0,0 +1,108 @@ +Before: + Save g:ale_c_uncrustify_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_c_uncrustify_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The clang-format callback should return the correct default values): + call ale#test#SetFilename('../test-files/c/dummy.c') + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l C' + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + +Execute(The uncrustify callback should include any additional options): + call ale#test#SetFilename('../test-files/c/dummy.c') + let b:ale_c_uncrustify_options = '--some-option' + + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l C --some-option', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + +Execute(The uncrustify callback should set proper language): + unlet b:ale_c_uncrustify_options + + set filetype=c + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l C', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=cpp + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l CPP', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=cs + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l CS', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=objc + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l OC', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=objcpp + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l OC+', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=d + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l D', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=java + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l JAVA', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=vala + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l VALA', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) + + set filetype=p + AssertEqual + \ { + \ 'command': ale#Escape(g:ale_c_uncrustify_executable) + \ . ' --no-backup -l PAWN', + \ }, + \ ale#fixers#uncrustify#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_vfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_vfmt_fixer_callback.vader new file mode 100644 index 00000000..cbab1189 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_vfmt_fixer_callback.vader @@ -0,0 +1,44 @@ +Before: + Save g:ale_v_v_executable + Save g:ale_v_vfmt_options + + " Use an invalid global executable, so we don't match it. + let g:ale_v_v_executable = 'xxxinvalid' + let g:ale_v_vfmt_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The vfmt callback should return the correct default values): + call ale#test#SetFilename('../v_files/testfile.v') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' fmt', + \ }, + \ ale#fixers#vfmt#Fix(bufnr('')) + +Execute(The vfmt callback should include custom vfmt options): + let g:ale_v_vfmt_options = "-r '(a) -> a'" + + call ale#test#SetFilename('../v_files/testfile.v') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' fmt ' . g:ale_v_vfmt_options, + \ }, + \ ale#fixers#vfmt#Fix(bufnr('')) + +Execute(The vfmt callback should support Go environment variables): + call ale#test#SetFilename('../v_files/testfile.v') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' fmt', + \ }, + \ ale#fixers#vfmt#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_vim_help_tags_alignment_fixer.vader b/sources_non_forked/ale/test/fixers/test_vim_help_tags_alignment_fixer.vader new file mode 100644 index 00000000..7e18a771 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_vim_help_tags_alignment_fixer.vader @@ -0,0 +1,19 @@ +Before: + Save g:ale_fixers + +After: + Restore + +Given help(A vim help file with badly aligned tags): + foo *foo* + bar *bar* + baz *bar* + +Execute(Tags should be aligned at the right margin): + let g:ale_fixers = {'help': ['align_help_tags']} + ALEFix + +Expect help(Tags should be aligned): + foo *foo* + bar *bar* + baz *bar* diff --git a/sources_non_forked/ale/test/fixers/test_xmllint_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_xmllint_fixer_callback.vader new file mode 100644 index 00000000..54fe05bd --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_xmllint_fixer_callback.vader @@ -0,0 +1,46 @@ +Before: + Save g:ale_xml_xmllint_executable + Save g:ale_xml_xmllint_indentsize + Save g:ale_xml_xmllint_options + + let g:ale_xml_xmllint_executable = '/path/to/xmllint' + let g:ale_xml_xmllint_indentsize = '' + let g:ale_xml_xmllint_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + +Execute(The xmllint callback should return the correct default command): + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/xmllint') + \ . ' --format ' + \ . ale#Escape(bufname(bufnr(''))) + \ }, + \ ale#fixers#xmllint#Fix(bufnr('')) + +Execute(The xmllint callback should include the XMLLINT_INDENT variable): + let g:ale_xml_xmllint_indentsize = 2 + + AssertEqual + \ { + \ 'command': ale#Env('XMLLINT_INDENT', ' ') + \ . ale#Escape('/path/to/xmllint') + \ . ' --format ' + \ . ale#Escape(bufname(bufnr(''))) + \ }, + \ ale#fixers#xmllint#Fix(bufnr('')) + +Execute(The xmllint callback should include additional options): + let g:ale_xml_xmllint_options = '--nonet' + + AssertEqual + \ { + \ 'command': ale#Escape('/path/to/xmllint') + \ . ' --format ' + \ . ale#Escape(bufname(bufnr(''))) + \ . ' --nonet' + \ }, + \ ale#fixers#xmllint#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_xo_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_xo_fixer_callback.vader new file mode 100644 index 00000000..fe2da8cc --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_xo_fixer_callback.vader @@ -0,0 +1,45 @@ +Before: + call ale#assert#SetUpFixerTest('javascript', 'xo') + runtime autoload/ale/handlers/xo.vim + set filetype=javascript + +After: + call ale#assert#TearDownFixerTest() + +Execute(The xo callback should return the correct default values): + call ale#test#SetFilename('../test-files/xo/monorepo/packages/a/index.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/xo/monorepo/node_modules/xo/cli.js')) + \ . ' --fix %t', + \ } + +Execute(The xo callback should include custom xo options): + let g:ale_javascript_xo_options = '--space' + call ale#test#SetFilename('../test-files/xo/monorepo/packages/a/index.js') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/xo/monorepo/node_modules/xo/cli.js')) + \ . ' --fix %t' + \ . ' --space', + \ } + +Execute(--stdin should be used when xo is new enough): + let g:ale_javascript_xo_options = '--space' + call ale#test#SetFilename('../test-files/xo/monorepo/packages/a/index.js') + + GivenCommandOutput ['0.30.0'] + AssertFixer + \ { + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/xo/monorepo/node_modules/xo/cli.js')) + \ . ' --stdin --stdin-filename %s' + \ . ' --fix' + \ . ' --space', + \ } diff --git a/sources_non_forked/ale/test/fixers/test_xots_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_xots_fixer_callback.vader new file mode 100644 index 00000000..61a22e62 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_xots_fixer_callback.vader @@ -0,0 +1,45 @@ +Before: + call ale#assert#SetUpFixerTest('typescript', 'xo') + runtime autoload/ale/handlers/xo.vim + set filetype=typescript + +After: + call ale#assert#TearDownFixerTest() + +Execute(The xo callback should return the correct default values): + call ale#test#SetFilename('../test-files/xo/monorepo/packages/a/index.ts') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/xo/monorepo/node_modules/xo/cli.js')) + \ . ' --fix %t', + \ } + +Execute(The xo callback should include custom xo options): + let g:ale_typescript_xo_options = '--space' + call ale#test#SetFilename('../test-files/xo/monorepo/packages/a/index.ts') + + AssertFixer + \ { + \ 'read_temporary_file': 1, + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/xo/monorepo/node_modules/xo/cli.js')) + \ . ' --fix %t' + \ . ' --space', + \ } + +Execute(--stdin should be used when xo is new enough): + let g:ale_typescript_xo_options = '--space' + call ale#test#SetFilename('../test-files/xo/monorepo/packages/a/index.ts') + + GivenCommandOutput ['0.30.0'] + AssertFixer + \ { + \ 'command': (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/xo/monorepo/node_modules/xo/cli.js')) + \ . ' --stdin --stdin-filename %s' + \ . ' --fix' + \ . ' --space', + \ } diff --git a/sources_non_forked/ale/test/fixers/test_yamlfix_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_yamlfix_fixer_callback.vader new file mode 100644 index 00000000..1ae5e335 --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_yamlfix_fixer_callback.vader @@ -0,0 +1,33 @@ +Before: + call ale#assert#SetUpFixerTest('yaml', 'yamlfix') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + call ale#assert#TearDownFixerTest() + +Execute(The yamlfix callback should return the correct default values): + AssertEqual + \ 0, + \ ale#fixers#yamlfix#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.yaml') + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yamlfix')) . ' -', + \ }, + \ ale#fixers#yamlfix#Fix(bufnr('')) + +Execute(The yamlfix callback should respect custom options): + let g:ale_yaml_yamlfix_options = '--multi-line=3 --trailing-comma' + + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.yaml') + AssertEqual + \ { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yamlfix')) + \ . ' --multi-line=3 --trailing-comma -', + \ }, + \ ale#fixers#yamlfix#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_yapf_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_yapf_fixer_callback.vader new file mode 100644 index 00000000..a7fcc07b --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_yapf_fixer_callback.vader @@ -0,0 +1,39 @@ +Before: + Save g:ale_python_yapf_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_python_yapf_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + Restore + + unlet! b:bin_dir + + call ale#test#RestoreDirectory() + +Execute(The yapf callback should return the correct default values): + AssertEqual + \ 0, + \ ale#fixers#yapf#Fix(bufnr('')) + + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + AssertEqual + \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yapf'))}, + \ ale#fixers#yapf#Fix(bufnr('')) + \ +Execute(The yapf should include the .style.yapf file if present): + call ale#test#SetFilename('../test-files/python/with_virtualenv/dir_with_yapf_config/foo/bar.py') + + AssertEqual + \ { + \ 'command': + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yapf')) + \ . ' --no-local-style' + \ . ' --style ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/dir_with_yapf_config/.style.yapf')), + \ }, + \ ale#fixers#yapf#Fix(bufnr('')) diff --git a/sources_non_forked/ale/test/fixers/test_zigfmt_fixer_callback.vader b/sources_non_forked/ale/test/fixers/test_zigfmt_fixer_callback.vader new file mode 100644 index 00000000..47e3ddee --- /dev/null +++ b/sources_non_forked/ale/test/fixers/test_zigfmt_fixer_callback.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpFixerTest('zig', 'zigfmt') + +After: + call ale#assert#TearDownFixerTest() + +Execute(The zig callback should return the correct default values): + AssertFixer { + \ 'command': ale#Escape('zig') . ' fmt %t', + \ 'read_temporary_file': 1, + \} + +Execute(The zig callback should allow custom zig executables): + let g:ale_zig_zigfmt_executable = 'foo/bar' + + AssertFixer { + \ 'command': ale#Escape('foo/bar') . ' fmt %t', + \ 'read_temporary_file': 1, + \} + diff --git a/sources_non_forked/ale/test/handler/test_actionlint_handler.vader b/sources_non_forked/ale/test/handler/test_actionlint_handler.vader new file mode 100644 index 00000000..557cff02 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_actionlint_handler.vader @@ -0,0 +1,28 @@ +Before: + runtime! ale/handlers/actionlint.vim + +After: + call ale#linter#Reset() + +Execute(Problems should be parsed correctly for actionlint): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': '"jobs" section is missing in workflow', + \ 'code': 'syntax-check', + \ }, + \ { + \ 'lnum': 56, + \ 'col': 23, + \ 'type': 'E', + \ 'text': 'property "unknown_input" is not defined in object type {input7: bool; input0: any; input1: any; input2: string; input3: any; input4: any; input5: number; input6: number}', + \ 'code': 'expression', + \ }, + \ ], + \ ale#handlers#actionlint#Handle(bufnr(''), [ + \ '.codecov.yaml:2:1: "jobs" section is missing in workflow [syntax-check]', + \ 'workflow_call_event.yaml:56:23: property "unknown_input" is not defined in object type {input7: bool; input0: any; input1: any; input2: string; input3: any; input4: any; input5: number; input6: number} [expression]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_ada_gcc_handler.vader b/sources_non_forked/ale/test/handler/test_ada_gcc_handler.vader new file mode 100644 index 00000000..06ddfe1f --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ada_gcc_handler.vader @@ -0,0 +1,36 @@ +Before: + runtime ale_linters/ada/gcc.vim + +After: + call ale#linter#Reset() + +Execute(The gcc handler for Ada should parse input correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 0, + \ 'lnum': 8, + \ 'col': 5, + \ 'type': 'W', + \ 'text': 'variable "X" is assigned but never read', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 6, + \ 'col': 22, + \ 'type': 'E', + \ 'text': 'type definition expected', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 8, + \ 'col': 9, + \ 'type': 'E', + \ 'text': 'aspect specifications not allowed here', + \ }, + \ ], + \ ale_linters#ada#gcc#Handle(0, [ + \ 'foobar.adb:8:05: warning: variable "X" is assigned but never read', + \ 'foobar.ads:6:22: type definition expected', + \ 'foobar.ads:8:09: aspect specifications not allowed here', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_alex_handler.vader b/sources_non_forked/ale/test/handler/test_alex_handler.vader new file mode 100644 index 00000000..eb241f80 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_alex_handler.vader @@ -0,0 +1,54 @@ +Execute(The alex handler should handle the example from the alex README): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 5, + \ 'end_lnum': 1, + \ 'end_col': 13, + \ 'type': 'W', + \ 'text': '`boogeyman` may be insensitive, use `boogey` instead (retext-equality)', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 42, + \ 'end_lnum': 1, + \ 'end_col': 47, + \ 'type': 'W', + \ 'text': '`master` / `slaves` may be insensitive, use `primary` / `replica` instead (retext-equality)', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 69, + \ 'end_lnum': 1, + \ 'end_col': 74, + \ 'type': 'W', + \ 'text': 'Don’t use “slaves”, it’s profane (retext-profanities)', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 52, + \ 'end_lnum': 2, + \ 'end_col': 53, + \ 'type': 'W', + \ 'text': '`he` may be insensitive, use `they`, `it` instead (retext-equality)', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 61, + \ 'end_lnum': 2, + \ 'end_col': 67, + \ 'type': 'W', + \ 'text': '`cripple` may be insensitive, use `person with a limp` instead (retext-equality)', + \ }, + \ ], + \ ale#handlers#alex#Handle(bufnr(''), [ + \ 'example.md', + \ ' 1:5-1:14 warning `boogeyman` may be insensitive, use `boogey` instead boogeyman-boogeywoman retext-equality', + \ ' 1:42-1:48 warning `master` / `slaves` may be insensitive, use `primary` / `replica` instead master-slave retext-equality', + \ ' 1:69-1:75 warning Don’t use “slaves”, it’s profane slaves retext-profanities', + \ ' 2:52-2:54 warning `he` may be insensitive, use `they`, `it` instead he-she retext-equality', + \ ' 2:61-2:68 warning `cripple` may be insensitive, use `person with a limp` instead cripple retext-equality', + \ '', + \ '⚠ 5 warnings', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_ameba_handler.vader b/sources_non_forked/ale/test/handler/test_ameba_handler.vader new file mode 100644 index 00000000..a6f43170 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ameba_handler.vader @@ -0,0 +1,44 @@ +Before: + runtime ale_linters/crystal/ameba.vim + +After: + unlet! g:lines + call ale#linter#Reset() + +Execute(The ameba handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 24, + \ 'col': 28, + \ 'end_col': 29, + \ 'text': 'Trailing whitespace detected', + \ 'code': 'Layout/TrailingWhitespace', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, [ + \ '{"sources":[{"path":"my_file_with_issues.cr","issues":[{"rule_name":"Layout/TrailingWhitespace","message":"Trailing whitespace detected","location":{"line":24,"column":28},"end_location":{"line":null,"column":null}}]},{"path":"my_file_without_issues.cr","issues":[]}],"metadata":{"ameba_version":"0.8.1","crystal_version":"0.26.1"},"summary":{"target_sources_count":2,"issues_count":1}}' + \ ]) + +Execute(The ameba handler should handle when files are checked and no offenses are found): + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, [ + \ '{"sources":[{"path":"my_file_with_issues.cr",issues":[]},{"path":"my_file_without_issues.cr",issues":[]}],"metadata":{ameba_version":"0.8.1",crystal_version":"0.26.1"},"summary":{target_sources_count":2,issues_count":0}}' + \ ]) + +Execute(The ameba handler should handle when no files are checked): + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, [ + \ '{"sources":[],"metadata":{ameba_version":"0.8.1",crystal_version":"0.26.1"},"summary":{target_sources_count":0,issues_count":0}}' + \ ]) + +Execute(The ameba handler should handle blank output without any errors): + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, ['{}']) + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, []) diff --git a/sources_non_forked/ale/test/handler/test_ansible_lint_handler.vader b/sources_non_forked/ale/test/handler/test_ansible_lint_handler.vader new file mode 100644 index 00000000..28dbba30 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ansible_lint_handler.vader @@ -0,0 +1,95 @@ +Before: + runtime ale_linters/ansible/ansible_lint.vim + call ale#test#SetFilename('test_playbook.yml') + + let b:ale_warn_about_trailing_whitespace = 1 + +After: + unlet! b:ale_warn_about_trailing_whitespace + call ale#linter#Reset() + +Execute(The ansible-lint handler for version group <5 should handle basic errors): + AssertEqual + \ [ + \ { + \ 'lnum': 35, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'Trailing whitespace', + \ 'code': 'EANSIBLE0002', + \ }, + \ ], + \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [4, 1, 2], [ + \ fnamemodify(tempname(), ':h') . '/test_playbook.yml:35: [EANSIBLE0002] Trailing whitespace', + \ ]) + +Execute(The ansible-lint handler for version group <5 should supress trailing whitespace output when the option is used): + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [4, 1, 2], [ + \ fnamemodify(tempname(), ':h') . '/test_playbook.yml:35: [EANSIBLE0002] Trailing whitespace', + \ ]) + + +Execute(The ansible-lint handler for version group >=5 should handle basic errors): + AssertEqual + \ [ + \ { + \ 'lnum': 35, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'File permissions unset or incorrect', + \ 'code': 'risky-file-permissions', + \ }, + \ ], + \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [5, 1, 2], [ + \ fnamemodify(tempname(), ':h') . '/test_playbook.yml:35: [risky-file-permissions] [VERY_HIGH] File permissions unset or incorrect', + \ ]) + +Before: + runtime ale_linters/ansible/ansible_lint.vim + call ale#test#SetFilename('test playbook.yml') + +After: + call ale#linter#Reset() + +Execute (The ansible-lint handler for version group <5 should handle names with spaces): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 6, + \ 'type': 'E', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', + \ }, + \ ], + \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [4, 1, 2], [ + \ fnamemodify(tempname(), ':h') . '/test playbook.yml:6:6: E111 indentation is not a multiple of four', + \ ]) + +Execute (The ansible-lint handler for version group >=5 should handle names with spaces): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col': 148, + \ 'type': 'E', + \ 'text': "'var' is not a valid attribute for a Play", + \ 'code': 'syntax-check', + \ }, + \ ], + \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [5, 1, 2], [ + \ fnamemodify(tempname(), ':h') . "/test playbook.yml:3:148: [syntax-check] [VERY_HIGH] 'var' is not a valid attribute for a Play", + \ ]) + +Execute (The ansible-lint handler should ignore errors from other files): + AssertEqual + \ [ + \ ], + \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [5, 1, 2], [ + \ '/foo/bar/roles/test_playbook.yml:6: [command-instead-of-module] [VERY_LOW] curl used in place of get_url or uri module', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_appleswiftformat_handler.vader b/sources_non_forked/ale/test/handler/test_appleswiftformat_handler.vader new file mode 100644 index 00000000..818bd9c5 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_appleswiftformat_handler.vader @@ -0,0 +1,28 @@ +Before: + runtime ale_linters/swift/appleswiftformat.vim + +After: + call ale#linter#Reset() + +Execute(The appleswiftformat handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 21, + \ 'type': 'W', + \ 'code': 'DoNotUseSemicolons', + \ 'text': 'remove '';'' and move the next statement to the new line', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 12, + \ 'type': 'W', + \ 'code': 'Spacing', + \ 'text': 'remove 1 space' + \ }, + \ ], + \ ale_linters#swift#appleswiftformat#Handle(bufnr(''), [ + \ 'Sources/main.swift:4:21: warning: [DoNotUseSemicolons] remove '';'' and move the next statement to the new line', + \ 'Sources/main.swift:3:12: warning: [Spacing] remove 1 space', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_asm_handler.vader b/sources_non_forked/ale/test/handler/test_asm_handler.vader new file mode 100644 index 00000000..4ab99992 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_asm_handler.vader @@ -0,0 +1,26 @@ +Before: + runtime ale_linters/asm/gcc.vim + +After: + call ale#linter#Reset() + +Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly): + + AssertEqual + \ [ + \ { + \ 'lnum': 38, + \ 'text': "too many memory references for `mov'", + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 42, + \ 'text': "incorrect register `%ax' used with `l' suffix", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#asm#gcc#Handle(357, [ + \ "{standard input}: Assembler messages:", + \ "{standard_input}:38: Error: too many memory references for `mov'", + \ "{standard input}:42: Error: incorrect register `%ax' used with `l' suffix", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_atools_handler.vader b/sources_non_forked/ale/test/handler/test_atools_handler.vader new file mode 100644 index 00000000..1bb9ca00 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_atools_handler.vader @@ -0,0 +1,85 @@ +Before: + runtime autoload/ale/handlers/atools.vim + +After: + call ale#linter#Reset() + +Execute(The atools handler should handle basic errors or warings): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'text': 'trailing whitespace', + \ 'type': 'E', + \ 'code': 'AL8', + \ }, + \ { + \ 'lnum': 15, + \ 'text': '$pkgname should not be used in the source url', + \ 'type': 'W', + \ 'code': 'AL29', + \ }, + \ ], + \ ale#handlers#atools#Handle(bufnr(''), [ + \ 'IC:[AL8]:APKBUILD:2:trailing whitespace', + \ 'MC:[AL29]:APKBUILD:15:$pkgname should not be used in the source url', + \ ]) + +" Regardless of the severity, if the certainty is [P]ossible and not [C]ertain +" or if regardless of the Certainity the Severity is not [I]mportant or [S]erious +" then it must be a [W]arning +Execute(If we are not Certain or Importantly Serious, be a Warning): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'text': 'This violation is Serious but Possible false positive, I am a Warning!', + \ 'type': 'W', + \ 'code': 'AL', + \ }, + \ { + \ 'lnum': 4, + \ 'text': 'This violation is Important but Possible false positive, I am a Warning!', + \ 'type': 'W', + \ 'code': 'AL', + \ }, + \ { + \ 'lnum': 5, + \ 'text': 'This violation is Minor, I am a Warning!', + \ 'type': 'W', + \ 'code': 'AL', + \ }, + \ { + \ 'lnum': 6, + \ 'text': 'This violation is Style, I am a Warning!', + \ 'type': 'W', + \ 'code': 'AL', + \ }, + \ ], + \ ale#handlers#atools#Handle(bufnr(''), [ + \ 'SP:[AL]:APKBUILD:3:This violation is Serious but Possible false positive, I am a Warning!', + \ 'IP:[AL]:APKBUILD:4:This violation is Important but Possible false positive, I am a Warning!', + \ 'MC:[AL]:APKBUILD:5:This violation is Minor, I am a Warning!', + \ 'TC:[AL]:APKBUILD:6:This violation is Style, I am a Warning!', + \ ]) + +Execute(We should be error if we are Certain it is Serious or Important): + AssertEqual + \ [ + \ { + \ 'lnum': 7, + \ 'text': 'This is Certainly Serious, I am an Error!', + \ 'type': 'E', + \ 'code': 'AL', + \ }, + \ { + \ 'lnum': 8, + \ 'text': 'This is Certainly Important, I am an Error!', + \ 'type': 'E', + \ 'code': 'AL', + \ }, + \ ], + \ ale#handlers#atools#Handle(bufnr(''), [ + \ 'SC:[AL]:APKBUILD:7:This is Certainly Serious, I am an Error!', + \ 'IC:[AL]:APKBUILD:8:This is Certainly Important, I am an Error!', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_avra_handler.vader b/sources_non_forked/ale/test/handler/test_avra_handler.vader new file mode 100644 index 00000000..0de83fb8 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_avra_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/avra/avra.vim + +After: + call ale#linter#Reset() + +Execute(The avra handler should parse errors correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'text': "Unknown device: atmega3228p", + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 12, + \ 'text': "Unknown directive: .EQ", + \ 'type': 'E' + \ } + \ ], + \ ale_linters#avra#avra#Handle(bufnr(''), [ + \ "main.asm(3) : Error : Unknown device: atmega3228p", + \ "main.asm(12) : Error : Unknown directive: .EQ" + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_bandit_handler.vader b/sources_non_forked/ale/test/handler/test_bandit_handler.vader new file mode 100644 index 00000000..a2793a46 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_bandit_handler.vader @@ -0,0 +1,42 @@ +Before: + runtime ale_linters/python/bandit.vim + +After: + call ale#linter#Reset() + +Execute(The bandit handler for Python should parse input correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 0, + \ 'lnum': 2, + \ 'code': 'B404', + \ 'type': 'I', + \ 'text': 'Consider possible security implications associated with subprocess module.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 4, + \ 'code': 'B305', + \ 'type': 'W', + \ 'text': 'Use of insecure cipher mode cryptography.hazmat.primitives.ciphers.modes.ECB.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 6, + \ 'code': 'B609', + \ 'type': 'E', + \ 'text': 'Possible wildcard injection in call: subprocess.Popen', + \ }, + \ ], + \ ale_linters#python#bandit#Handle(0, [ + \ '[main] INFO profile include tests: None', + \ '[main] INFO profile exclude tests: None', + \ '[main] INFO cli include tests: None', + \ '[main] INFO cli exclude tests: None', + \ '[main] INFO running on Python 3.7.2', + \ '[node_visitor] INFO Unable to find qualified name for module: ', + \ '2:B404:LOW:Consider possible security implications associated with subprocess module.', + \ '4:B305:MEDIUM:Use of insecure cipher mode cryptography.hazmat.primitives.ciphers.modes.ECB.', + \ '6:B609:HIGH:Possible wildcard injection in call: subprocess.Popen', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_bashate_handler.vader b/sources_non_forked/ale/test/handler/test_bashate_handler.vader new file mode 100644 index 00000000..b61bb956 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_bashate_handler.vader @@ -0,0 +1,36 @@ +Before: + runtime ale_linters/sh/bashate.vim + +After: + call ale#linter#Reset() + +Execute(The bashate handler should handle basic errors): + AssertEqual + \ [ + \ { + \ 'lnum': 777, + \ 'col': 1, + \ 'text': 'E003 Indent not multiple of 4', + \ }, + \ { + \ 'lnum': 783, + \ 'col': 1, + \ 'text': 'E020 Function declaration not in format ^function name {$', + \ }, + \ { + \ 'lnum': 786, + \ 'col': 1, + \ 'text': 'E010 The "do" should be on same line as for', + \ }, + \ { + \ 'lnum': 791, + \ 'col': 1, + \ 'text': 'E006 Line too long', + \ }, + \ ], + \ ale_linters#sh#bashate#Handle(bufnr(''), [ + \ 'run:777:1: E003 Indent not multiple of 4', + \ 'run:783:1: E020 Function declaration not in format ^function name {$', + \ 'run:786:1: E010 The "do" should be on same line as for', + \ 'run:791:1: E006 Line too long', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_bibclean_handler.vader b/sources_non_forked/ale/test/handler/test_bibclean_handler.vader new file mode 100644 index 00000000..9da52a92 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_bibclean_handler.vader @@ -0,0 +1,88 @@ +Before: + runtime ale_linters/bib/bibclean.vim + +After: + call ale#linter#Reset() + +Execute(The bibclean handler should parse lines from bibclean <= v2.11.4 correctly): + + AssertEqual + \ [ + \ { + \ 'lnum': '60', + \ 'type': 'W', + \ 'text': 'Unexpected value in ``month = "09"''''.', + \ 'col': '17' + \ }, + \ { + \ 'lnum': '63', + \ 'type': 'E', + \ 'text': 'Expected comma after last field ``keywords''''.', + \ 'col': ' 1' + \ }, + \ { + \ 'lnum': '176', + \ 'type': 'W', + \ 'text': 'Unexpected DOI in URL value ``"https://doi.org/DOI"'''': move to separate DOI = "..." key/value in this entry.', + \ 'col': '14' + \ } + \ ], + \ ale_linters#bib#bibclean#Handle(255, [ + \ "%% \"stdin\", line 60: Unexpected value in ``month = \"09\"''.", + \ "%% File positions: input [main.bib] output [stdout]", + \ "%% Entry input byte=1681 line=50 column= 1 output byte=1680 line=50 column= 0", + \ "%% Value input byte=2137 line=60 column=17 output byte=2137 line=60 column=17", + \ "%% Current input byte=2139 line=60 column=19 output byte=2137 line=60 column=17", + \ "?? \"stdin\", line 71: Expected comma after last field ``keywords''.", + \ "?? File positions: input [main.bib] output [stdout]", + \ "?? Entry input byte=2145 line=63 column= 1 output byte=2146 line=63 column= 0", + \ "?? Value input byte=2528 line=71 column= 2 output byte=2527 line=70 column=49", + \ "?? Current input byte=2529 line=71 column= 3 output byte=2528 line=70 column=50", + \ "%% \"stdin\", line 176: Unexpected DOI in URL value ``\"https://doi.org/DOI\"'': move to separate DOI = \"...\" key/value in this entry.", + \ "%% File positions: input [stdin] output [stdout]", + \ "%% Entry input byte=6813 line=174 column= 1 output byte=8543 line=227 column= 0", + \ "%% Value input byte=6890 line=176 column=14 output byte=8641 line=229 column=17", + \ "%% Current input byte=6938 line=176 column=62 output byte=8641 line=229 column=17" + \ ]) + +Execute(The bibclean handler should parse lines of bibclean > v2.11.4 correctly): + + AssertEqual + \ [ + \ { + \ 'lnum': '60', + \ 'type': 'W', + \ 'text': 'Unexpected value in ``month = "09"''''.', + \ 'col': '17' + \ }, + \ { + \ 'lnum': '63', + \ 'type': 'E', + \ 'text': 'Expected comma after last field ``keywords''''.', + \ 'col': ' 1' + \ }, + \ { + \ 'lnum': '176', + \ 'type': 'W', + \ 'text': 'Unexpected DOI in URL value ``"https://doi.org/DOI"'''': move to separate DOI = "..." key/value in this entry.', + \ 'col': '14' + \ } + \ ], + \ ale_linters#bib#bibclean#Handle(255, [ + \ "%% stdin:60:Unexpected value in ``month = \"09\"''.", + \ "%% File positions: input [main.bib] output [stdout]", + \ "%% Entry input byte=1681 line=50 column= 1 output byte=1680 line=50 column= 0", + \ "%% Value input byte=2137 line=60 column=17 output byte=2137 line=60 column=17", + \ "%% Current input byte=2139 line=60 column=19 output byte=2137 line=60 column=17", + \ "?? stdin:71:Expected comma after last field ``keywords''.", + \ "?? File positions: input [main.bib] output [stdout]", + \ "?? Entry input byte=2145 line=63 column= 1 output byte=2146 line=63 column= 0", + \ "?? Value input byte=2528 line=71 column= 2 output byte=2527 line=70 column=49", + \ "?? Current input byte=2529 line=71 column= 3 output byte=2528 line=70 column=50", + \ "%% stdin:176:Unexpected DOI in URL value ``\"https://doi.org/DOI\"'': move to separate DOI = \"...\" key/value in this entry.", + \ "%% File positions: input [stdin] output [stdout]", + \ "%% Entry input byte=6813 line=174 column= 1 output byte=8543 line=227 column= 0", + \ "%% Value input byte=6890 line=176 column=14 output byte=8641 line=229 column=17", + \ "%% Current input byte=6938 line=176 column=62 output byte=8641 line=229 column=17" + \ ]) + diff --git a/sources_non_forked/ale/test/handler/test_bitbake_oelint_adv_handler.vader b/sources_non_forked/ale/test/handler/test_bitbake_oelint_adv_handler.vader new file mode 100644 index 00000000..a52e8810 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_bitbake_oelint_adv_handler.vader @@ -0,0 +1,28 @@ +Before: + runtime ale_linters/bitbake/oelint_adv.vim + +After: + Restore + + call ale#linter#Reset() + +Execute(The oelint_adv handler should handle warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 1234, + \ 'type': 'I', + \ 'code': 'oelint.var.suggestedvar.BUGTRACKER', + \ 'text': 'Variable ''BUGTRACKER'' should be set', + \ }, + \ { + \ 'lnum': 17, + \ 'type': 'E', + \ 'code': 'oelint.var.mandatoryvar.DESCRIPTION', + \ 'text': 'Variable ''DESCRIPTION'' should be set', + \ }, + \ ], + \ ale_linters#bitbake#oelint_adv#Handle(1, [ + \ '/meta-x/recipes-y/example/example_1.0.bb:1234:info:oelint.var.suggestedvar.BUGTRACKER:Variable ''BUGTRACKER'' should be set', + \ 'example2_1.1.bb:17:error:oelint.var.mandatoryvar.DESCRIPTION:Variable ''DESCRIPTION'' should be set', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_brakeman_handler.vader b/sources_non_forked/ale/test/handler/test_brakeman_handler.vader new file mode 100644 index 00000000..ad5376f7 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_brakeman_handler.vader @@ -0,0 +1,83 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/handler') + + runtime ale_linters/ruby/brakeman.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The brakeman handler should parse JSON correctly): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/models/thing.rb') + + AssertEqual + \ [ + \ { + \ 'filename': expand('%:p'), + \ 'lnum': 84, + \ 'text': 'SQL Injection Possible SQL injection (Medium)', + \ 'type': 'W', + \ }, + \ { + \ 'filename': expand('%:p'), + \ 'lnum': 1, + \ 'text': 'Mass Assignment Potentially dangerous attribute available for mass assignment (Weak)', + \ 'type': 'W', + \ } + \ ], + \ ale_linters#ruby#brakeman#Handle(bufnr(''), [ + \ '{', + \ '"warnings": [', + \ '{', + \ '"warning_type": "SQL Injection",', + \ '"warning_code": 0,', + \ '"fingerprint": "1234",', + \ '"check_name": "SQL",', + \ '"message": "Possible SQL injection",', + \ '"file": "' . substitute(ale#path#Simplify('app/models/thing.rb'), '\\', '\\\\', 'g') . '",', + \ '"line": 84,', + \ '"link": "http://brakemanscanner.org/docs/warning_types/sql_injection/",', + \ '"code": "Thing.connection.execute(params[:data])",', + \ '"render_path": null,', + \ '"location": {', + \ '"type": "method",', + \ '"class": "Thing",', + \ '"method": "run_raw_sql_from_internet"', + \ '},', + \ '"user_input": "whatever",', + \ '"confidence": "Medium"', + \ '},', + \ '{', + \ '"warning_type": "Mass Assignment",', + \ '"warning_code": 60,', + \ '"fingerprint": "1235",', + \ '"check_name": "ModelAttrAccessible",', + \ '"message": "Potentially dangerous attribute available for mass assignment",', + \ '"file": "' . substitute(ale#path#Simplify('app/models/thing.rb'), '\\', '\\\\', 'g') . '",', + \ '"line": null,', + \ '"link": "http://brakemanscanner.org/docs/warning_types/mass_assignment/",', + \ '"code": ":name",', + \ '"render_path": null,', + \ '"location": {', + \ '"type": "model",', + \ '"model": "Thing"', + \ '},', + \ '"user_input": null,', + \ '"confidence": "Weak"', + \ '}', + \ ']', + \ '}' + \ ]) + +Execute(The brakeman handler should parse JSON correctly when there is no output from brakeman): + AssertEqual + \ [], + \ ale_linters#ruby#brakeman#Handle(347, [ + \ ]) + \ +Execute(The brakeman handler should handle garbage output): + AssertEqual + \ [], + \ ale_linters#ruby#brakeman#Handle(347, [ + \ 'No such command in 2.4.1 of ruby', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_cfn_python_lint_handler.vader b/sources_non_forked/ale/test/handler/test_cfn_python_lint_handler.vader new file mode 100644 index 00000000..2c7ddc62 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cfn_python_lint_handler.vader @@ -0,0 +1,33 @@ +Before: + runtime! ale_linters/cloudformation/cfn_python_lint.vim + call ale#test#SetFilename('sample.template.yaml') + +After: + call ale#linter#Reset() + +Execute(The cfn_python_lint handler should parse items correctly): + AssertEqual + \ [ + \ { + \ 'lnum': '96', + \ 'col': '7', + \ 'end_lnum': '96', + \ 'end_col': '15', + \ 'text': 'Property Resources/Sample/Properties/FromPort should be of type Integer', + \ 'code': 'E3012', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': '97', + \ 'col': '7', + \ 'end_lnum': '97', + \ 'end_col': '15', + \ 'text': 'AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"', + \ 'code': 'W2509', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#cloudformation#cfn_python_lint#Handle(bufnr(''), [ + \ fnamemodify(tempname(), ':h') . '/sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer', + \ fnamemodify(tempname(), ':h') . '/sample.template.yaml:97:7:97:15:W2509:AllowedPattern and/or AllowedValues for Parameter should be specified at Parameters/SampleIpAddress. Example for AllowedPattern "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$"', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_checkmake_handler.vader b/sources_non_forked/ale/test/handler/test_checkmake_handler.vader new file mode 100644 index 00000000..e2e18425 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_checkmake_handler.vader @@ -0,0 +1,23 @@ +Before: + runtime ale_linters/make/checkmake.vim + +After: + call ale#linter#Reset() + +Execute(Parsing checkmake errors should work): + silent file Makefile + + AssertEqual + \ [ + \ { + \ 'bufnr': 42, + \ 'lnum': 1, + \ 'type': 'E', + \ 'code': 'woops', + \ 'text': 'an error has occurred', + \ } + \ ], + \ ale_linters#make#checkmake#Handle(42, [ + \ 'This shouldnt match', + \ '1:woops:an error has occurred', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_checkov_handler.vader b/sources_non_forked/ale/test/handler/test_checkov_handler.vader new file mode 100644 index 00000000..9884113c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_checkov_handler.vader @@ -0,0 +1,66 @@ +Before: + runtime ale_linters/terraform/checkov.vim + call ale#test#SetFilename('main.tf') + +After: + call ale#linter#Reset() + +Execute(The JSON output of checkov should be handled correctly): + AssertEqual + \ [ + \ { + \ 'filename': '/main.tf', + \ 'lnum': 22, + \ 'end_lnum': 27, + \ 'text': 'Enable VPC Flow Logs and Intranode Visibility [CKV_GCP_61]', + \ 'detail': "CKV_GCP_61: Enable VPC Flow Logs and Intranode Visibility\n" . + \ 'For more information, see: https://docs.bridgecrew.io/docs/enable-vpc-flow-logs-and-intranode-visibility', + \ 'type': 'W', + \ } + \ ], + \ ale_linters#terraform#checkov#Handle(bufnr(''), [ + \'{', + \' "check_type": "terraform",', + \' "results": {', + \' "failed_checks": [', + \' {', + \' "check_id": "CKV_GCP_61",', + \' "bc_check_id": "BC_GCP_KUBERNETES_18",', + \' "check_name": "Enable VPC Flow Logs and Intranode Visibility",', + \' "check_result": {', + \' "result": "FAILED",', + \' "evaluated_keys": [', + \' "enable_intranode_visibility"', + \' ]', + \' },', + \' "file_path": "/main.tf",', + \' "repo_file_path": "/main.tf",', + \' "file_line_range": [', + \' 22,', + \' 27', + \' ],', + \' "resource": "google_container_cluster.cluster-name",', + \' "evaluations": null,', + \' "check_class": "checkov.terraform.checks.resource.gcp.GKEEnableVPCFlowLogs",', + \' "entity_tags": null,', + \' "resource_address": null,', + \' "guideline": "https://docs.bridgecrew.io/docs/enable-vpc-flow-logs-and-intranode-visibility"', + \' }', + \' ]', + \' }', + \'}' + \ ]) + +Execute(Handle output for no findings correctly): + AssertEqual + \ [], + \ ale_linters#terraform#checkov#Handle(bufnr(''), [ + \'{', + \' "passed": 0,', + \' "failed": 0,', + \' "skipped": 0,', + \' "parsing_errors": 0,', + \' "resource_count": 0,', + \' "checkov_version": "2.0.632"', + \'}' + \]) diff --git a/sources_non_forked/ale/test/handler/test_checkstyle_handler.vader b/sources_non_forked/ale/test/handler/test_checkstyle_handler.vader new file mode 100644 index 00000000..ea90db3f --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_checkstyle_handler.vader @@ -0,0 +1,53 @@ +Before: + runtime ale_linters/java/checkstyle.vim + +After: + call ale#linter#Reset() + +Execute(The checkstyle handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 101, + \ 'col': 0, + \ 'text': '''method def rcurly'' has incorrect indentation level 4, expected level should be 2.', + \ 'code': 'Indentation', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 63, + \ 'col': 3, + \ 'text': 'Missing a Javadoc comment.', + \ 'code': 'JavadocMethod', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 11, + \ 'col': 7, + \ 'text': 'WhitespaceAround: ''if'' is not followed by whitespace.', + \ 'code': 'WhitespaceAround', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ ], + \ ale_linters#java#checkstyle#Handle(666, [ + \ '[WARN] whatever:101: ''method def rcurly'' has incorrect indentation level 4, expected level should be 2. [Indentation]', + \ '[WARN] whatever:63:3: Missing a Javadoc comment. [JavadocMethod]', + \ '[WARN] whatever:11:7: WhitespaceAround: ''if'' is not followed by whitespace. [WhitespaceAround]', + \ ]) + +Execute(The checkstyle handler should parse lines from older checkstyle versions correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 289, + \ 'text': '''method def modifier'' have incorrect indentation level 4, expected level should be 2.', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ ], + \ ale_linters#java#checkstyle#Handle(666, [ + \ '/home/languitar/src/rsb-java/rsb-java/src/main/java/rsb/Listener.java:289: warning: ''method def modifier'' have incorrect indentation level 4, expected level should be 2.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_circleci_handler.vader b/sources_non_forked/ale/test/handler/test_circleci_handler.vader new file mode 100644 index 00000000..8ffba360 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_circleci_handler.vader @@ -0,0 +1,39 @@ +Before: + runtime ale_linters/yaml/circleci.vim + +After: + call ale#linter#Reset() + +Execute(The circlei handler should return nothing when configs are valid): + AssertEqual + \ [], + \ ale_linters#yaml#circleci#Handle(0, [ + \ 'Config input is valid.', + \ ]) + +Execute(The circlei handler put errors at the top when something is wrong): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': '[#/jobs] expected type: Mapping, found: Integer', + \ 'detail': join([ + \ '[#/jobs] expected type: Mapping, found: Integer', + \ 'Jobs is a map', + \ 'SCHEMA:', + \ ' type: object', + \ 'INPUT:', + \ ' 4', + \ ], "\n"), + \ }, + \ ], + \ ale_linters#yaml#circleci#Handle(0, [ + \ 'Error: ERROR IN CONFIG FILE:', + \ '[#/jobs] expected type: Mapping, found: Integer', + \ 'Jobs is a map', + \ 'SCHEMA:', + \ ' type: object', + \ 'INPUT:', + \ ' 4', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_clang_handler.vader b/sources_non_forked/ale/test/handler/test_clang_handler.vader new file mode 100644 index 00000000..cc8eabd0 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_clang_handler.vader @@ -0,0 +1,30 @@ +Execute(clang errors from included files should be parsed correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'filename': './b.h', + \ 'type': 'E', + \ 'text': 'expected identifier or ''(''', + \ }, + \ { + \ 'lnum': 3, + \ 'text': 'Error found in header. See :ALEDetail', + \ 'detail': join([ + \ 'In file included from :3:', + \ 'In file included from ./a.h:1:', + \ './b.h:1:1: error: expected identifier or ''(''', + \ '{{{', + \ '^', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ 'In file included from :3:', + \ 'In file included from ./a.h:1:', + \ './b.h:1:1: error: expected identifier or ''(''', + \ '{{{', + \ '^', + \ '1 error generated.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_clojure_clj_kondo_handler.vader b/sources_non_forked/ale/test/handler/test_clojure_clj_kondo_handler.vader new file mode 100644 index 00000000..9ae70668 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_clojure_clj_kondo_handler.vader @@ -0,0 +1,89 @@ +Before: + runtime ale_linters/clojure/clj_kondo.vim + +After: + call ale#linter#Reset() + +Execute(the clojure clj-kondo handler should be able to handle errors): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 44, + \ 'type': 'E', + \ 'text': 'error: Unexpected )', + \ }, + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'test.clj:123:44: error: Unexpected )', + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 654, + \ 'col': 321, + \ 'type': 'W', + \ 'text': 'warning: inline def', + \ } + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'test.clj:654:321: warning: inline def' + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle exceptions): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 321, + \ 'type': 'E', + \ 'text': 'Exception: something horrible happen', + \ } + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'test.clj:123:321: Exception: something horrible happen' + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle errors from stdin): + AssertEqual + \ [ + \ { + \ 'lnum': 16, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'error: Unexpected )', + \ }, + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ ':16:1: error: Unexpected )', + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle windows files): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 44, + \ 'type': 'E', + \ 'text': 'error: Unexpected )', + \ } + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'C:\my\operating\system\is\silly\core.clj:123:44: error: Unexpected )', + \ ]) + +Execute(the clojure clj-kondo handler should be able to lines without row/col): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'error: Unexpected )', + \ }, + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'test.clj::: error: Unexpected )', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_clojure_joker_handler.vader b/sources_non_forked/ale/test/handler/test_clojure_joker_handler.vader new file mode 100644 index 00000000..460c62e8 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_clojure_joker_handler.vader @@ -0,0 +1,75 @@ +Before: + runtime ale_linters/clojure/joker.vim + +After: + call ale#linter#Reset() + +Execute(the clojure joker handler should be able to handle errors): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 44, + \ 'type': 'E', + \ 'text': 'Read error: Unexpected )', + \ }, + \ ], + \ ale_linters#clojure#joker#HandleJokerFormat(0, [ + \ 'test.clj:123:44: Read error: Unexpected )', + \ ]) + +Execute(the clojure joker handler should be able to handle warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 654, + \ 'col': 321, + \ 'type': 'W', + \ 'text': 'Parse warning: let form with empty body', + \ } + \ ], + \ ale_linters#clojure#joker#HandleJokerFormat(0, [ + \ 'test.clj:654:321: Parse warning: let form with empty body' + \ ]) + +Execute(the clojure joker handler should be able to handle exceptions): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 321, + \ 'type': 'E', + \ 'text': 'Exception: something horrible happen', + \ } + \ ], + \ ale_linters#clojure#joker#HandleJokerFormat(0, [ + \ 'test.clj:123:321: Exception: something horrible happen' + \ ]) + +Execute(the clojure joker handler should be able to handle errors from stdin): + AssertEqual + \ [ + \ { + \ 'lnum': 16, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Read error: Unexpected )', + \ }, + \ ], + \ ale_linters#clojure#joker#HandleJokerFormat(0, [ + \ ':16:1: Read error: Unexpected )', + \ ]) + +Execute(the clojure joker handler should be able to handle windows files): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 44, + \ 'type': 'E', + \ 'text': 'Read error: Unexpected )', + \ } + \ ], + \ ale_linters#clojure#joker#HandleJokerFormat(0, [ + \ 'C:\my\operating\system\is\silly\core.clj:123:44: Read error: Unexpected )', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_cmake_lint_handler.vader b/sources_non_forked/ale/test/handler/test_cmake_lint_handler.vader new file mode 100644 index 00000000..26fb8c1d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cmake_lint_handler.vader @@ -0,0 +1,30 @@ +Before: + runtime ale_linters/cmake/cmake_lint.vim + +After: + Restore + + call ale#linter#Reset() + +Execute(The cmake_lint handler should handle basic warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 126, + \ 'col': 0, + \ 'type': 'W', + \ 'code': 'C0301', + \ 'text': 'Line too long (136/80)', + \ }, + \ { + \ 'lnum': 139, + \ 'col': 4, + \ 'type': 'W', + \ 'code': 'C0113', + \ 'text': 'Missing COMMENT in statement which allows it', + \ }, + \ ], + \ ale_linters#cmake#cmake_lint#Handle(1, [ + \ 'CMakeLists.txt:126: [C0301] Line too long (136/80)', + \ 'CMakeLists.txt:139,04: [C0113] Missing COMMENT in statement which allows it', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_coffeelint_handler.vader b/sources_non_forked/ale/test/handler/test_coffeelint_handler.vader new file mode 100644 index 00000000..a061f3a9 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_coffeelint_handler.vader @@ -0,0 +1,20 @@ +Before: + runtime ale_linters/coffee/coffeelint.vim + +After: + call ale#linter#Reset() + +Execute(The coffeelint handler should parse lines correctly): + + AssertEqual + \ [ + \ { + \ 'lnum': 125, + \ 'text': "Line exceeds maximum allowed length Length is 122, max is 120.", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#coffee#coffeelint#Handle(347, [ + \ "path,lineNumber,lineNumberEnd,level,message", + \ "stdin,125,,error,Line exceeds maximum allowed length Length is 122, max is 120.", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_common_handlers.vader b/sources_non_forked/ale/test/handler/test_common_handlers.vader new file mode 100644 index 00000000..ee29da36 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_common_handlers.vader @@ -0,0 +1,181 @@ +Execute(HandleCSSLintFormat should handle CSS errors): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Expected RBRACE at line 2, col 1.', + \ 'code': 'errors', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 5, + \ 'type': 'W', + \ 'text': 'Expected ... but found ''wat''.', + \ 'code': 'known-properties', + \ }, + \ ], + \ ale#handlers#css#HandleCSSLintFormat(42, [ + \ 'something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors)', + \ 'something.css: line 2, col 5, Warning - Expected ... but found ''wat''. (known-properties)', + \ ]) + +Execute(HandleCSSLintFormat should handle CSS errors without groups): + AssertEqual + \ [ + \ { + \ 'lnum': 7, + \ 'col': 3, + \ 'type': 'W', + \ 'text': 'Unknown property ''fill''.', + \ }, + \ { + \ 'lnum': 8, + \ 'col': 3, + \ 'type': 'W', + \ 'text': 'Unknown property ''fill-opacity''.', + \ }, + \ ], + \ ale#handlers#css#HandleCSSLintFormat(42, [ + \ 'something.css: line 7, col 3, Warning - Unknown property ''fill''.', + \ 'something.css: line 8, col 3, Warning - Unknown property ''fill-opacity''.', + \ ]) + +Execute (HandleGCCFormat should handle the correct lines of output): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 5, + \ 'type': 'W', + \ 'text': 'conversion lacks type at end of format [-Wformat=]', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 27, + \ 'type': 'E', + \ 'text': 'invalid operands to binary - (have ''int'' and ''char *'')', + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormat(42, [ + \ ':8:5: warning: conversion lacks type at end of format [-Wformat=]', + \ ':10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’)', + \ ]) + +Execute (HandleGCCFormat should replace Unicode quotes): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 5, + \ 'type': 'W', + \ 'text': "'''' \"\"", + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormat(42, [':8:5: warning: `´‘’ “”']) + +Execute (HandleUnixFormatAsError should handle some example lines of output): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ }, + \ { + \ 'lnum': 53, + \ 'col': 10, + \ 'type': 'E', + \ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': '".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.', + \ }, + \ ], + \ ale#handlers#unix#HandleAsError(42, [ + \ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)', + \ 'test.pug:1:1 ".b" is not a valid class name. Class names must begin with "-", "_" or a letter and can only contain "_", "-", a-z and 0-9.', + \ ]) + +Execute (HandleUnixFormatAsError should handle lines with no space after the colon): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'foo', + \ }, + \ { + \ 'lnum': 53, + \ 'col': 10, + \ 'type': 'E', + \ 'text': 'bar', + \ }, + \ ], + \ ale#handlers#unix#HandleAsError(42, [ + \ 'some_file.xyz:27:foo', + \ 'some_file.xyz:53:10:bar', + \ ]) + +Execute (HandleUnixFormatAsError should handle names with spaces): + AssertEqual + \ [ + \ { + \ 'lnum': 13, + \ 'col': 90, + \ 'type': 'E', + \ 'text': 'leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.', + \ }, + \ ], + \ ale#handlers#unix#HandleAsError(42, [ + \ '/Users/rrj/Notes/Astro/Taurus December SM.txt:13:90: leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.', + \ ]) + +Execute (HandleUnixFormatAsWarning should handle some example lines of output): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ }, + \ { + \ 'lnum': 53, + \ 'col': 10, + \ 'type': 'W', + \ 'text': 'if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)', + \ }, + \ ], + \ ale#handlers#unix#HandleAsWarning(42, [ + \ 'file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ 'file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)', + \ ]) + +Execute (Unix format functions should handle Windows paths): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'foo', + \ }, + \ { + \ 'lnum': 53, + \ 'col': 10, + \ 'type': 'E', + \ 'text': 'foo', + \ }, + \ ], + \ ale#handlers#unix#HandleAsError(42, [ + \ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:27: foo', + \ 'C:\Users\w0rp\AppData\Local\Temp\Xyz123.go:53:10: foo', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_cookstyle_handler.vader b/sources_non_forked/ale/test/handler/test_cookstyle_handler.vader new file mode 100644 index 00000000..7d705a19 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cookstyle_handler.vader @@ -0,0 +1,22 @@ +Before: + runtime ale_linters/chef/cookstyle.vim + +After: + call ale#linter#Reset() + +Execute(Basic warnings should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 58, + \ 'col': 24, + \ 'code': 'Style/UnneededInterpolation', + \ 'type': 'W', + \ 'end_col': 40, + \ 'text': 'Style/UnneededInterpolation: Prefer `to_s` over string interpolation.', + \ } + \ ], + \ ale_linters#chef#cookstyle#Handle(bufnr(''), [ + \ '{"metadata":{"rubocop_version":"0.62.0","ruby_engine":"ruby","ruby_version":"2.6.0","ruby_patchlevel":"0","ruby_platform":"x86_64-linux"},"files":[{"path":"recipes/default.rb","offenses":[{"severity":"convention","message":"Style/UnneededInterpolation: Prefer `to_s` over string interpolation.","cop_name":"Style/UnneededInterpolation","corrected":false,"location":{"start_line":58,"start_column":24,"last_line":58,"last_column":40,"length":17,"line":58,"column":24}}]}],"summary":{"offense_count":1,"target_file_count":1,"inspected_file_count":1}}' + \ ]) + diff --git a/sources_non_forked/ale/test/handler/test_cppcheck_handler.vader b/sources_non_forked/ale/test/handler/test_cppcheck_handler.vader new file mode 100644 index 00000000..ef161f44 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cppcheck_handler.vader @@ -0,0 +1,93 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/handler') + +After: + call ale#test#RestoreDirectory() + +Execute(Basic errors should be handled by cppcheck): + call ale#test#SetFilename('test.cpp') + + AssertEqual + \ [ + \ { + \ 'lnum': 974, + \ 'col' : 6, + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'Array ''n[3]'' accessed at index 3, which is out of bounds.', + \ 'code': 'arrayIndexOutOfBounds' + \ }, + \ { + \ 'lnum': 1185, + \ 'col' : 10, + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'The scope of the variable ''indxStr'' can be reduced.', + \ 'code': 'variableScope' + \ }, + \ ], + \ ale#handlers#cppcheck#HandleCppCheckFormat(bufnr(''), [ + \ 'test.cpp:974:6: error: Array ''n[3]'' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\', + \ ' n[3]=3;', + \ ' ^', + \ 'test.cpp:1185:10: style: The scope of the variable ''indxStr'' can be reduced. [variableScope]\', + \ ' char indxStr[16];', + \ ' ^', + \ ]) + + AssertEqual + \ [ + \ { + \ 'lnum': 974, + \ 'col' : 1, + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'inconclusive Array ''n[3]'' accessed at index 3, which is out of bounds.', + \ 'code': 'arrayIndexOutOfBounds' + \ }, + \ { + \ 'lnum': 1185, + \ 'col' : 1, + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'The scope of the variable ''indxStr'' can be reduced.', + \ 'code': 'variableScope' + \ }, + \ ], + \ ale#handlers#cppcheck#HandleCppCheckFormat(bufnr(''), [ + \ 'test.cpp:974:{column}: error:inconclusive Array ''n[3]'' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\', + \ ' n[3]=3;', + \ ' ^', + \ 'test.cpp:1185:{column}: style:{inconclusive:inconclusive} The scope of the variable ''indxStr'' can be reduced. [variableScope]\', + \ ' char indxStr[16];', + \ ' ^', + \ ]) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col' : 16, + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'misra violation (use --rule-texts= to get proper output)', + \ 'code': 'misra-c2012-2.7' + \ }, + \ ], + \ ale#handlers#cppcheck#HandleCppCheckFormat(bufnr(''), [ + \ 'test.cpp:1:16: style: misra violation (use --rule-texts= to get proper output) [misra-c2012-2.7]\', + \ 'void test( int parm ) {}', + \ ' ^', + \ ]) + +Execute(Problems from other files should be ignored by cppcheck): + call ale#test#SetFilename('test.cpp') + + AssertEqual + \ [ + \ ], + \ ale#handlers#cppcheck#HandleCppCheckFormat(bufnr(''), [ + \ 'bar.cpp:974:6: error: Array ''n[3]'' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\', + \ ' n[3]=3;', + \ ' ^', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_cpplint_handler.vader b/sources_non_forked/ale/test/handler/test_cpplint_handler.vader new file mode 100644 index 00000000..d8d7b8b7 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cpplint_handler.vader @@ -0,0 +1,29 @@ +Before: + runtime ale_linters/cpp/cpplint.vim + +After: + call ale#linter#Reset() + +Execute(cpplint warnings from included files should be parsed correctly): + + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 0, + \ 'text': 'Extra space after ( in function call', + \ 'code': 'whitespace/parents', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 120, + \ 'col': 0, + \ 'text': 'At least two spaces is best between code and comments', + \ 'code': 'whitespace/comments', + \ 'type': 'W', + \ }, + \ ], + \ ale#handlers#cpplint#HandleCppLintFormat(347, [ + \ 'test.cpp:5: Extra space after ( in function call [whitespace/parents] [4]', + \ 'keymap_keys.hpp:120: At least two spaces is best between code and comments [whitespace/comments] [2]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_credo_handler.vader b/sources_non_forked/ale/test/handler/test_credo_handler.vader new file mode 100644 index 00000000..1fd54bb5 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_credo_handler.vader @@ -0,0 +1,53 @@ +Before: + runtime ale_linters/elixir/credo.vim + +After: + call ale#linter#Reset() + +Execute(The credo handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 347, + \ 'lnum': 1, + \ 'col': 24, + \ 'text': 'This code can be refactored', + \ 'type': 'W', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 1, + \ 'col': 4, + \ 'text': 'There is no whitespace around parentheses/brackets most of the time, but here there is.', + \ 'type': 'W', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 5, + \ 'col': 21, + \ 'text': 'TODO comment', + \ 'type': 'I', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 26, + \ 'col': 0, + \ 'text': 'If/else blocks should not have a negated condition in `if`.', + \ 'type': 'I', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 15, + \ 'col': 1, + \ 'text': 'Warning in the code', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#elixir#credo#Handle(347, [ + \ 'This line should be ignored completely', + \ 'lib/my_code/test.ex:1:24: F: This code can be refactored', + \ 'lib/filename.ex:1:4: C: There is no whitespace around parentheses/brackets most of the time, but here there is.', + \ 'lib/my_code/test.ex:5:21: D: TODO comment', + \ 'lib/phoenix/channel.ex:26: R: If/else blocks should not have a negated condition in `if`.', + \ 'lib/my_code/test.ex:15:1: W: Warning in the code', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_crystal_handler.vader b/sources_non_forked/ale/test/handler/test_crystal_handler.vader new file mode 100644 index 00000000..209632e9 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_crystal_handler.vader @@ -0,0 +1,28 @@ +Before: + runtime ale_linters/crystal/crystal.vim + +After: + call ale#linter#Reset() + +Execute(The crystal handler should parse lines correctly and add the column if it can): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'unexpected token: EOF' + \ } + \ ], + \ ale_linters#crystal#crystal#Handle(255, [ + \ '[{"file":"/tmp/test.cr","line":2,"column":1,"size":null,"message":"unexpected token: EOF"}]' + \ ]) + +Execute(The crystal handler should not fail when a missing file is required): + AssertEqual + \ [ { 'lnum':1, 'col': 1, 'text': 'while requiring "./nonexistent.cr"' } ], + \ ale_linters#crystal#crystal#Handle(255, + \ json_encode([ + \ { "file":"/tmp/file.cr","line":1,"column":1,"size":0,"message":"while requiring \"./nonexistent.cr\"" }, + \ { "message": "can't find file './nonexistent.cr' relative to '/tmp'" }, + \ ]) + \ ) diff --git a/sources_non_forked/ale/test/handler/test_csc_handler.vader b/sources_non_forked/ale/test/handler/test_csc_handler.vader new file mode 100644 index 00000000..3db5b6fd --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_csc_handler.vader @@ -0,0 +1,98 @@ +Before: + Save g:ale_cs_csc_source + + unlet! g:ale_cs_csc_source + + call ale#test#SetDirectory('/testplugin/test/handler') + call ale#test#SetFilename('Test.cs') + + runtime ale_linters/cs/csc.vim + +After: + unlet! g:ale_cs_csc_source + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The csc handler should work with the default of the buffer's directory): + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col' : 29, + \ 'text': '; expected', + \ 'code': 'CS1001', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(g:dir . '/Test.cs'), + \ }, + \ ], + \ ale_linters#cs#csc#Handle(bufnr(''), [ + \ 'Test.cs(12,29): error CS1001: ; expected', + \ 'Compilation failed: 2 error(s), 1 warnings', + \ ]) + +Execute(The csc handler should handle cannot find symbol errors): + let g:ale_cs_csc_source = '/home/foo/project/bar' + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col' : 29, + \ 'text': '; expected', + \ 'code': 'CS1001', + \ 'type': 'E', + \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), + \ }, + \ { + \ 'lnum': 101, + \ 'col': 0, + \ 'text': 'Unexpected processor directive (no #if for this #endif)', + \ 'code': 'CS1028', + \ 'type': 'E', + \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), + \ }, + \ { + \ 'lnum': 10, + \ 'col': 12, + \ 'text': 'some warning', + \ 'code': 'CS0123', + \ 'type': 'W', + \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), + \ }, + \ ], + \ ale_linters#cs#csc#Handle(bufnr(''), [ + \ 'Test.cs(12,29): error CS1001: ; expected', + \ 'Test.cs(101,0): error CS1028: Unexpected processor directive (no #if for this #endif)', + \ 'Test.cs(10,12): warning CS0123: some warning', + \ 'Compilation failed: 2 error(s), 1 warnings', + \ ]) + +Execute(The csc handler should handle non file specific compiler errors without reporting overal status report as error): + let g:ale_cs_csc_source = '/home/foo/project/bar' + + AssertEqual + \ [ + \ { + \ 'lnum': -1, + \ 'col' : -1, + \ 'text': 'No source files specified.', + \ 'code': 'CS2008', + \ 'type': 'W', + \ 'filename': '', + \ }, + \ { + \ 'lnum': -1, + \ 'col': -1, + \ 'text': 'Outputs without source must have the /out option specified', + \ 'code': 'CS1562', + \ 'type': 'E', + \ 'filename': '', + \ }, + \ ], + \ ale_linters#cs#csc#Handle(bufnr(''), [ + \ 'Microsoft (R) Visual C# Compiler version 2.8.2.62916 (2ad4aabc)', + \ 'Copyright (C) Microsoft Corporation. All rights reserved.', + \ 'warning CS2008: No source files specified.', + \ 'error CS1562: Outputs without source must have the /out option specified', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_cspell_handler.vader b/sources_non_forked/ale/test/handler/test_cspell_handler.vader new file mode 100644 index 00000000..b74b8d22 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cspell_handler.vader @@ -0,0 +1,13 @@ +Execute(The cspell handler should handle cspell output): + AssertEqual + \ [ + \ { + \ 'lnum': 721, + \ 'col': 18, + \ 'type': 'W', + \ 'text': 'Unknown word (stylelint)', + \ }, + \ ], + \ ale#handlers#cspell#Handle(bufnr(''), + \ '/:721:18 - Unknown word (stylelint)' + \) diff --git a/sources_non_forked/ale/test/handler/test_cucumber_handler.vader b/sources_non_forked/ale/test/handler/test_cucumber_handler.vader new file mode 100644 index 00000000..2b69a784 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cucumber_handler.vader @@ -0,0 +1,18 @@ +Before: + runtime ale_linters/cucumber/cucumber.vim + +After: + call ale#linter#Reset() + +Execute(The cucumber handler parses JSON correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 13, + \ 'code': 'E', + \ 'text': 'Undefined step' + \ } + \ ], + \ ale_linters#cucumber#cucumber#Handle(bufnr(''), [ + \ '[{"elements": [{"steps": [{"result": {"status": "undefined"},"match": {"location": "features/cuke.feature:13"},"line": 13,"name": "Something undefined","keyword": "Given "},{"result": {"status": "skipped"},"match": {"location": "/var/lib/gems/2.3.0/gems/cucumber-3.1.0/lib/cucumber/step_match.rb:103"},"line": 14,"name": "I visit the profile page for Alice","keyword": "When "}],"type": "scenario","line": 12,"description": "","name": "Another scenario","keyword": "Scenario","id": "a-user-can-view-another-users-profile;another-scenario"}],"line": 1,"description": "","name": "A user can view another users profile","keyword": "Feature","id": "a-user-can-view-another-users-profile","uri": "features/cuke.feature"}]' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_cuda_nvcc_handler.vader b/sources_non_forked/ale/test/handler/test_cuda_nvcc_handler.vader new file mode 100644 index 00000000..40e31922 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cuda_nvcc_handler.vader @@ -0,0 +1,41 @@ +Before: + runtime ale_linters/cuda/nvcc.vim + +After: + call ale#linter#Reset() + +Execute(The cuda nvcc handler should parse errors from multiple files for NVCC 8.0): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': 'this declaration has no storage class or type specifier', + \ 'filename': has('win32') + \ ? 'C:\tmp\cudatest\test.cu' + \ : '/tmp/cudatest/test.cu', + \ }, + \ { + \ 'lnum': 2, + \ 'type': 'E', + \ 'text': 'attribute "global" does not apply here', + \ 'filename': has('win32') + \ ? 'C:\tmp\cudatest\common.h' + \ : '/tmp/cudatest/common.h', + \ }, + \ { + \ 'lnum': 2, + \ 'type': 'E', + \ 'text': 'expected a ";"', + \ 'filename': has('win32') + \ ? 'C:\tmp\cudatest\common.h' + \ : '/tmp/cudatest/common.h', + \ }, + \ ], + \ ale_linters#cuda#nvcc#HandleNVCCFormat(0, [ + \ '/tmp/cudatest/test.cu(1): error: this declaration has no storage class or type specifier', + \ '/tmp/cudatest/common.h(2): error: attribute "global" does not apply here', + \ '/tmp/cudatest/common.h(2): error: expected a ";"', + \ 'At end of source: warning: parsing restarts here after previous syntax error', + \ '3 errors detected in the compilation of "/tmp/tmpxft_00003a9f_00000000-7_test.cpp1.ii".', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_cypher_lint_handler.vader b/sources_non_forked/ale/test/handler/test_cypher_lint_handler.vader new file mode 100644 index 00000000..066adae4 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_cypher_lint_handler.vader @@ -0,0 +1,21 @@ +Before: + runtime ale_linters/cypher/cypher_lint.vim + +After: + call ale#linter#Reset() + +Execute(The cypher-lint handler should handle errors for the current file correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 75, + \ 'type': 'E', + \ 'text': "Invalid input ',': expected an identifier, shortestPath, allShortestPaths or '('", + \ }, + \ ], + \ ale_linters#cypher#cypher_lint#Handle(bufnr(''), [ + \ "shakespeare.cql:1:75: Invalid input ',': expected an identifier, shortestPath, allShortestPaths or '('", + \ "CREATE (shakespeare:Author {firstname:'William', lastname:'Shakespeare'}),,", + \ " ^", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_dafny_handler.vader b/sources_non_forked/ale/test/handler/test_dafny_handler.vader new file mode 100644 index 00000000..4ca288d2 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_dafny_handler.vader @@ -0,0 +1,36 @@ +Before: + runtime ale_linters/dafny/dafny.vim + +After: + call ale#linter#Reset() + +Execute(The Dafny handler should parse output correctly): + AssertEqual + \ [ + \ { + \ 'filename': 'File.dfy', + \ 'col': 45, + \ 'lnum': 123, + \ 'text': 'A precondition for this call might not hold.', + \ 'type': 'E' + \ }, + \ { + \ 'filename': 'File.dfy', + \ 'col': 90, + \ 'lnum': 678, + \ 'text': 'This is the precondition that might not hold.', + \ 'type': 'W' + \ }, + \ { + \ 'filename': 'File.dfy', + \ 'col': 45, + \ 'lnum': 123, + \ 'text': "Verification of 'Impl$$_22_Proof.__default.PutKeepsMapsFull' timed out after 2 seconds", + \ 'type': 'E' + \ }, + \ ], + \ ale_linters#dafny#dafny#Handle(0, [ + \ 'File.dfy(123,45): Error BP5002: A precondition for this call might not hold.', + \ 'File.dfy(678,90): Related location: This is the precondition that might not hold.', + \ "File.dfy(123,45): Verification of 'Impl$$_22_Proof.__default.PutKeepsMapsFull' timed out after 2 seconds", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_dart_analyze_handler.vader b/sources_non_forked/ale/test/handler/test_dart_analyze_handler.vader new file mode 100644 index 00000000..b3f20fb8 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_dart_analyze_handler.vader @@ -0,0 +1,28 @@ +Before: + runtime ale_linters/dart/dart_analyze.vim + +After: + call ale#linter#Reset() + +Execute(Basic problems should be parsed correctly): + AssertEqual + \ [ + \ { + \ 'type': 'E', + \ 'text': 'expected_token: Expected to find ''}''', + \ 'lnum': 5, + \ 'col': 1, + \ }, + \ { + \ 'type': 'W', + \ 'text': 'invalid_assignment: A value of type ''String'' can''t be assigned to a variable of type ''int''', + \ 'lnum': 2, + \ 'col': 16, + \ }, + \ ], + \ ale_linters#dart#dart_analyze#Handle(bufnr(''), [ + \ 'Analyzing main.dart...', + \ ' error - main.dart:5:1 - Expected to find ''}'' - expected_token', + \ ' warning - main.dart:2:16 - A value of type ''String'' can''t be assigned to a variable of type ''int'' - invalid_assignment', + \ '1 error and 1 warning found.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_debride_handler.vader b/sources_non_forked/ale/test/handler/test_debride_handler.vader new file mode 100644 index 00000000..62851468 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_debride_handler.vader @@ -0,0 +1,27 @@ +Before: + runtime ale_linters/ruby/debride.vim + +After: + call ale#linter#Reset() + +Execute(The debride linter parses output correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'text': 'Possible unused method: image_tags', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 7, + \ 'text': 'Possible unused method: not_deleted', + \ 'type': 'W', + \ } + \ ], + \ ale_linters#ruby#debride#HandleOutput(0, [ + \ 'These methods MIGHT not be called:', + \ '', + \ 'Image', + \ ' image_tags app/models/image.rb:2', + \ ' not_deleted app/models/image.rb:7' + \]) diff --git a/sources_non_forked/ale/test/handler/test_desktop_file_validate_handler.vader b/sources_non_forked/ale/test/handler/test_desktop_file_validate_handler.vader new file mode 100644 index 00000000..88163433 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_desktop_file_validate_handler.vader @@ -0,0 +1,26 @@ +Before: + runtime ale_linters/desktop/desktop_file_validate.vim + +After: + call ale#linter#Reset() + +Execute(The desktop-file-validate handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'key "TerminalOptions" in group "Desktop Entry" is deprecated', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'action "new-private-window" is defined, but there is no matching "Desktop Action new-private-window" group', + \ }, + \ ], + \ ale_linters#desktop#desktop_file_validate#Handle(bufnr(''), [ + \ 'foo.desktop: warning: key "TerminalOptions" in group "Desktop Entry" is deprecated', + \ 'foo.desktop: error: action "new-private-window" is defined, but there is no matching "Desktop Action new-private-window" group', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_dmd_handler.vader b/sources_non_forked/ale/test/handler/test_dmd_handler.vader new file mode 100644 index 00000000..32a04982 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_dmd_handler.vader @@ -0,0 +1,41 @@ +Before: + runtime ale_linters/d/dmd.vim + call ale#test#SetDirectory('/testplugin/test/dmd') + call ale#test#SetFilename('test.d') + +After: + call ale#linter#Reset() + call ale#test#RestoreDirectory() + +Execute(Basic errors should be handled by dmd): + AssertEqual + \ [ + \ { + \ 'filename': ale#path#Simplify(g:dir . '/test.d'), + \ 'lnum': '5', + \ 'col' : '8', + \ 'type': 'E', + \ 'text': 'module weak_reference is in file ''dstruct/weak_reference.d'' which cannot be read' + \ }, + \ { + \ 'filename': ale#path#Simplify(g:dir . '/test.d'), + \ 'lnum': '20', + \ 'col' : '10', + \ 'type': 'W', + \ 'text': 'function test.thisoldfunc is deprecated' + \ }, + \ { + \ 'filename': ale#path#Simplify(g:dir . '/foo.d'), + \ 'lnum': '230', + \ 'col' : '9', + \ 'type': 'W', + \ 'text': 'statement is not reachable' + \ } + \ ], + \ ale_linters#d#dmd#Handle(bufnr(''), [ + \ 'test.d(5,8): Error: module weak_reference is in file ''dstruct/weak_reference.d'' which cannot be read', + \ 'import path[0] = source', + \ 'import path[1] = /usr/include/dlang/dmd', + \ ale#path#Simplify(g:dir . '/test.d') . '(20,10): Deprecation: function test.thisoldfunc is deprecated', + \ 'foo.d(230,9): Warning: statement is not reachable', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_dockerfile_lint_handler.vader b/sources_non_forked/ale/test/handler/test_dockerfile_lint_handler.vader new file mode 100644 index 00000000..a73db8cd --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_dockerfile_lint_handler.vader @@ -0,0 +1,112 @@ +Before: + runtime ale_linters/dockerfile/dockerfile_lint.vim + +After: + call ale#linter#Reset() + +Execute(The dockerfile_lint handler should handle broken JSON): + AssertEqual + \ [], + \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{asdf"]) + +Execute(The dockerfile_lint handler should handle an empty string response): + AssertEqual + \ [], + \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), []) + +Execute(The dockerfile_lint handler should handle an empty result, even if it shouldn't happen): + AssertEqual + \ [], + \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{}"]) + +Execute(The dockerfile_lint handler should handle a normal example): + AssertEqual + \ [ + \ { + \ 'lnum': -1, + \ 'type': 'E', + \ 'text': "Required LABEL name/key 'Name' is not defined", + \ 'detail': "Required LABEL name/key 'Name' is not defined\n\nhttp://docs.projectatomic.io/container-best-practices/#_recommended_labels_for_your_project", + \ }, + \ { + \ 'lnum': -1, + \ 'type': 'E', + \ 'text': "Required LABEL name/key 'Version' is not defined", + \ 'detail': "Required LABEL name/key 'Version' is not defined\n\nhttp://docs.projectatomic.io/container-best-practices/#_recommended_labels_for_your_project", + \ }, + \ { + \ 'lnum': 3, + \ 'type': 'I', + \ 'text': "the MAINTAINER command is deprecated", + \ 'detail': "the MAINTAINER command is deprecated\n\nMAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0\n\nhttps://github.com/docker/cli/blob/master/docs/deprecated.md#maintainer-in-dockerfile", + \ }, + \ { + \ 'lnum': -1, + \ 'type': 'I', + \ 'text': "There is no 'CMD' instruction", + \ 'detail': "There is no 'CMD' instruction\n\nhttps://docs.docker.com/engine/reference/builder/#cmd", + \ }, + \ ], + \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [ + \ '{', + \ ' "error": {', + \ ' "count": 2,', + \ ' "data": [', + \ ' {', + \ " \"message\": \"Required LABEL name/key 'Name' is not defined\",", + \ ' "line": -1,', + \ ' "level": "error",', + \ ' "lineContent": "",', + \ ' "reference_url": [', + \ ' "http://docs.projectatomic.io/container-best-practices/#",', + \ ' "_recommended_labels_for_your_project"', + \ ' ]', + \ ' },', + \ ' {', + \ " \"message\": \"Required LABEL name/key 'Version' is not defined\",", + \ ' "line": -1,', + \ ' "level": "error",', + \ ' "lineContent": "",', + \ ' "reference_url": [', + \ ' "http://docs.projectatomic.io/container-best-practices/#",', + \ ' "_recommended_labels_for_your_project"', + \ ' ]', + \ ' }', + \ ' ]', + \ ' },', + \ ' "warn": {', + \ ' "count": 0,', + \ ' "data": []', + \ ' },', + \ ' "info": {', + \ ' "count": 2,', + \ ' "data": [', + \ ' {', + \ ' "label": "maintainer_deprecated",', + \ ' "regex": {},', + \ ' "level": "info",', + \ ' "message": "the MAINTAINER command is deprecated",', + \ ' "description": "MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",', + \ ' "reference_url": [', + \ ' "https://github.com/docker/cli/blob/master/docs/deprecated.md",', + \ ' "#maintainer-in-dockerfile"', + \ ' ],', + \ ' "lineContent": "MAINTAINER Alexander Olofsson ",', + \ ' "line": 3', + \ ' },', + \ ' {', + \ ' "instruction": "CMD",', + \ ' "count": 1,', + \ ' "level": "info",', + \ " \"message\": \"There is no 'CMD' instruction\",", + \ ' "description": "None",', + \ ' "reference_url": [', + \ ' "https://docs.docker.com/engine/reference/builder/",', + \ ' "#cmd"', + \ ' ]', + \ ' }', + \ ' ]', + \ ' },', + \ ' "summary": []', + \ '}', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_dogma_handler.vader b/sources_non_forked/ale/test/handler/test_dogma_handler.vader new file mode 100644 index 00000000..ead6d09f --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_dogma_handler.vader @@ -0,0 +1,30 @@ +Before: + runtime ale_linters/elixir/dogma.vim + +After: + call ale#linter#Reset() + +Execute(The dogma handler should parse lines correctly): + + AssertEqual + \ [ + \ { + \ 'bufnr': 347, + \ 'lnum': 18, + \ 'col': 5, + \ 'text': 'Some error', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 19, + \ 'col': 7, + \ 'text': 'Some warning', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#elixir#dogma#Handle(347, [ + \ 'This line should be ignored completely', + \ 'lib/filename.ex:18:5: C: Some error', + \ 'lib/filename.ex:19:7: R: Some warning', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_drafter_handler.vader b/sources_non_forked/ale/test/handler/test_drafter_handler.vader new file mode 100644 index 00000000..1524dde1 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_drafter_handler.vader @@ -0,0 +1,37 @@ +Before: + runtime! ale_linters/apiblueprint/drafter.vim + +After: + call ale#linter#Reset() + +Execute(drafter handler should handle errors output): + AssertEqual + \ [ + \ { + \ 'lnum': 25, + \ 'col': 3, + \ 'text': "unable to parse response signature, expected 'response [] [()]'", + \ 'type': "W", + \ }, + \ { + \ 'lnum': 25, + \ 'col': 3, + \ 'text': "missing response HTTP status code, assuming 'Response 200'", + \ 'type': "W", + \ }, + \ { + \ 'lnum': 30, + \ 'col': 7, + \ 'end_lnum': 32, + \ 'end_col': 7, + \ 'text': "message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs", + \ 'type': "W", + \ }, + \ ], + \ ale_linters#apiblueprint#drafter#HandleErrors(bufnr(''), [ + \ "", + \ "OK.", + \ "warning: (3) unable to parse response signature, expected 'response [] [()]'; line 25, column 3 - line 25, column 29", + \ "warning: (6) missing response HTTP status code, assuming 'Response 200'; line 25, column 3 - line 25, column 29", + \ "warning: (10) message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs; line 30, column 7 - line 30, column 11; line 31, column 6 - line 31, column 7; line 32, column 6 - line 32, column 7" + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_elmmake_handler.vader b/sources_non_forked/ale/test/handler/test_elmmake_handler.vader new file mode 100644 index 00000000..f5906a8b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_elmmake_handler.vader @@ -0,0 +1,299 @@ +Before: + runtime ale_linters/elm/make.vim + +After: + unlet! g:config_error_lines + + call ale#linter#Reset() + + +" Elm 0.19 + +Execute(The elm-make handler should parse Elm 0.19 general problems correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': "error details\n\nstyled details" + \ } + \ ], + \ ale_linters#elm#make#Handle(347, [ + \ json_encode({ + \ 'type': 'error', + \ 'path': ale#util#Tempname() . '/Module.elm', + \ 'title': 'UNKNOWN IMPORT', + \ 'message': ["error details\n\n", { 'string': 'styled details' }] + \ }), + \ ]) + +Execute(The elm-make handler should parse Elm 0.19 compilation errors correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 404, + \ 'col': 1, + \ 'end_lnum': 408, + \ 'end_col': 18, + \ 'type': 'E', + \ 'text': "error details 1\n\nstyled details" + \ }, + \ { + \ 'lnum': 406, + \ 'col': 5, + \ 'end_lnum': 407, + \ 'end_col': 17, + \ 'type': 'E', + \ 'text': 'error details 2', + \ }, + \ { + \ 'lnum': 406, + \ 'col': 5, + \ 'end_lnum': 406, + \ 'end_col': 93, + \ 'type': 'E', + \ 'text': 'error details 3', + \ }, + \ ], + \ ale_linters#elm#make#Handle(347, [ + \ json_encode({ + \ 'type': 'compile-errors', + \ 'errors': [ + \ { + \ 'path': ale#util#Tempname() . '/Module.elm', + \ 'problems': [ + \ { + \ 'title': 'TYPE MISMATCH', + \ 'message': ["error details 1\n\n", { 'string': 'styled details' }], + \ 'region': { 'start': { 'line': 404, 'column': 1 }, 'end': { 'line': 408, 'column': 18 } } + \ }, + \ { + \ 'title': 'TYPE MISMATCH', + \ 'message': ['error details 2'], + \ 'region': { 'start': {'line': 406, 'column': 5}, 'end': {'line': 407, 'column': 17 } } + \ }, + \ { + \ 'title': 'TYPE MISMATCH', + \ 'message': ['error details 3'], + \ 'region': { 'start': { 'line': 406, 'column': 5}, 'end': {'line': 406, 'column': 93 } } + \ } + \ ] + \ } + \ ] + \ }), + \ ]) + +Execute(The elm-make handler should handle errors in Elm 0.19 imported modules): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': "src/Module.elm - error details\n\nstyled details", + \ 'detail': "src/Module.elm ----------\n\nerror details\n\nstyled details" + \ }, + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': "Elm - error details\n\nstyled details", + \ 'detail': "Elm ----------\n\nerror details\n\nstyled details" + \ }, + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': "src/Module.elm:404 - error details\n\nstyled details", + \ 'detail': "src/Module.elm:404 ----------\n\nerror details\n\nstyled details" + \ }, + \ ], + \ ale_linters#elm#make#Handle(347, [ + \ json_encode({ + \ 'type': 'error', + \ 'path': 'src/Module.elm', + \ 'title': 'UNKNOWN IMPORT', + \ 'message': ["error details\n\n", { 'string': 'styled details' }] + \ }), + \ json_encode({ + \ 'type': 'error', + \ 'path': v:null, + \ 'title': 'UNKNOWN IMPORT', + \ 'message': ["error details\n\n", { 'string': 'styled details' }] + \ }), + \ json_encode({ + \ 'type': 'compile-errors', + \ 'errors': [ + \ { + \ 'path': 'src/Module.elm', + \ 'problems': [ + \ { + \ 'title': 'TYPE MISMATCH', + \ 'message': ["error details\n\n", { 'string': 'styled details' }], + \ 'region': { 'start': { 'line': 404, 'column': 1 }, 'end': { 'line': 408, 'column': 18 } } + \ } + \ ] + \ } + \ ] + \ }), + \ ]) + + +" Elm 0.18 + +Execute(The elm-make handler should parse Elm 0.18 compilation errors correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 33, + \ 'col': 1, + \ 'end_lnum': 33, + \ 'end_col': 19, + \ 'type': 'W', + \ 'text': 'warning overview', + \ 'detail': "warning overview\n\nwarning details", + \ }, + \ { + \ 'lnum': 404, + \ 'col': 1, + \ 'end_lnum': 408, + \ 'end_col': 18, + \ 'type': 'E', + \ 'text': 'error overview 1', + \ 'detail': "error overview 1\n\nerror details 1", + \ }, + \ { + \ 'lnum': 406, + \ 'col': 5, + \ 'end_lnum': 407, + \ 'end_col': 17, + \ 'type': 'E', + \ 'text': 'error overview 2', + \ 'detail': "error overview 2\n\nerror details 2", + \ }, + \ { + \ 'lnum': 406, + \ 'col': 5, + \ 'end_lnum': 406, + \ 'end_col': 93, + \ 'type': 'E', + \ 'text': 'error overview 3', + \ 'detail': "error overview 3\n\nerror details 3", + \ }, + \ ], + \ ale_linters#elm#make#Handle(347, [ + \ json_encode([ + \ { + \ 'tag': 'unused import', + \ 'overview': 'warning overview', + \ 'details': 'warning details', + \ 'region': {'start': { 'line': 33, 'column': 1 }, 'end': { 'line': 33, 'column': 19 } }, + \ 'type': 'warning', + \ 'file': ale#util#Tempname() . '/Module.elm', + \ } + \ ]), + \ json_encode([ + \ { + \ 'tag': 'TYPE MISMATCH', + \ 'overview': 'error overview 1', + \ 'subregion': { 'start': { 'line': 406, 'column': 5 }, 'end': { 'line': 408, 'column': 18 } }, + \ 'details': 'error details 1', + \ 'region': { 'start': { 'line': 404, 'column': 1 }, 'end': { 'line': 408, 'column': 18 } }, + \ 'type': 'error', + \ 'file': ale#util#Tempname() . '/Module.elm', + \ }, + \ { + \ 'tag': 'TYPE MISMATCH', + \ 'overview': 'error overview 2', + \ 'subregion': { 'start': { 'line': 407, 'column': 12 }, 'end': { 'line': 407, 'column': 17 } }, + \ 'details': 'error details 2', + \ 'region': { 'start': { 'line': 406, 'column': 5}, 'end': { 'line': 407, 'column': 17 } }, + \ 'type':'error', + \ 'file': ale#util#Tempname() . '/Module.elm', + \ }, + \ { + \ 'tag': 'TYPE MISMATCH', + \ 'overview': 'error overview 3', + \ 'subregion': { 'start': { 'line': 406, 'column': 88 }, 'end': { 'line': 406, 'column': 93 } }, + \ 'details': 'error details 3', + \ 'region': { 'start': { 'line': 406, 'column': 5 }, 'end': { 'line': 406, 'column': 93 } }, + \ 'type':'error', + \ 'file': ale#util#Tempname() . '/Module.elm', + \ } + \ ]), + \ ]) + +Execute(The elm-make handler should handle errors in Elm 0.18 imported modules): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': 'src/Module.elm:33 - error overview', + \ 'detail': "src/Module.elm:33 ----------\n\nerror overview\n\nerror details" + \ } + \ ], + \ ale_linters#elm#make#Handle(347, [ + \ json_encode([ + \ { + \ 'tag': 'unused import', + \ 'overview': 'warning overview', + \ 'details': 'warning details', + \ 'region': {'start': { 'line': 33, 'column': 1 }, 'end': { 'line': 33, 'column': 19 } }, + \ 'type': 'warning', + \ 'file': 'src/Module.elm', + \ }, + \ { + \ 'tag': 'type error', + \ 'overview': 'error overview', + \ 'details': 'error details', + \ 'region': {'start': { 'line': 33, 'column': 1 }, 'end': { 'line': 33, 'column': 19 } }, + \ 'type': 'error', + \ 'file': 'src/Module.elm', + \ } + \ ]), + \ ]) + +" Generic + +Execute(The elm-make handler should put an error on the first line if a line cannot be parsed): + AssertEqual + \ [ + \ { + \ 'lnum': 404, + \ 'col': 1, + \ 'end_lnum': 408, + \ 'end_col': 18, + \ 'type': 'E', + \ 'text': "error details 1\n\nstyled details" + \ }, + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': 'Not JSON', + \ 'detail': "Not JSON\nAlso not JSON", + \ }, + \ ], + \ ale_linters#elm#make#Handle(347, [ + \ json_encode({ + \ 'type': 'compile-errors', + \ 'errors': [ + \ { + \ 'path': ale#util#Tempname() . '/Module.elm', + \ 'problems': [ + \ { + \ 'title': 'TYPE MISMATCH', + \ 'message': ["error details 1\n\n", { 'string': 'styled details' }], + \ 'region': { 'start': { 'line': 404, 'column': 1 }, 'end': { 'line': 408, 'column': 18 } } + \ } + \ ] + \ } + \ ] + \ }), + \ 'Not JSON', + \ 'Also not JSON', + \ ]) + +Execute(The elm-make handler should ignore success lines): + AssertEqual + \ [], + \ ale_linters#elm#make#Handle(347, [ + \ 'Successfully generated /dev/null', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_embertemplatelint_handler.vader b/sources_non_forked/ale/test/handler/test_embertemplatelint_handler.vader new file mode 100644 index 00000000..97ca4390 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_embertemplatelint_handler.vader @@ -0,0 +1,81 @@ +" Author: Adrian Zalewski +Before: + runtime ale_linters/handlebars/embertemplatelint.vim + +After: + call ale#linter#Reset() + +Execute(The ember-template-lint handler should parse lines correctly): + let input_lines = split('{ + \ "/ember-project/app/templates/application.hbs": [ + \ { + \ "moduleId": "app/templates/application", + \ "rule": "bare-strings", + \ "severity": 2, + \ "message": "Non-translated string used", + \ "line": 1, + \ "column": 10, + \ "source": " Bare String\n" + \ }, + \ { + \ "moduleId": "app/templates/application", + \ "rule": "invalid-interactive", + \ "severity": 1, + \ "message": "Interaction added to non-interactive element", + \ "line": 3, + \ "column": 6, + \ "source": "" + \ } + \ ] + \ }', '\n') + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'text': 'bare-strings: Non-translated string used', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 6, + \ 'text': 'invalid-interactive: Interaction added to non-interactive element', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#handlebars#embertemplatelint#Handle(347, input_lines) + +Execute(The ember-template-lint handler should handle template parsing error correctly): + let input_lines = split('{ + \ "/ember-project/app/templates/application.hbs": [ + \ { + \ "fatal": true, + \ "moduleId": "app/templates/application", + \ "message": "Parse error on line 5 ...", + \ "line": 5, + \ "column": 3, + \ "source": "Error: Parse error on line 5 ...", + \ "severity": 2 + \ } + \ ] + \ }', '\n') + + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 3, + \ 'text': 'Parse error on line 5 ...', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#handlebars#embertemplatelint#Handle(347, input_lines) + +Execute(The ember-template-lint handler should handle no lint errors/warnings): + AssertEqual + \ [], + \ ale_linters#handlebars#embertemplatelint#Handle(347, []) + AssertEqual + \ [], + \ ale_linters#handlebars#embertemplatelint#Handle(347, ['{}']) diff --git a/sources_non_forked/ale/test/handler/test_erblint_handler.vader b/sources_non_forked/ale/test/handler/test_erblint_handler.vader new file mode 100644 index 00000000..01d4c0ab --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_erblint_handler.vader @@ -0,0 +1,70 @@ +Before: + runtime ale_linters/eruby/erblint.vim + +After: + unlet! g:lines + call ale#linter#Reset() + +Execute(The erblint handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col': 0, + \ 'end_col': 0, + \ 'text': 'Extra blank line detected.', + \ 'code': 'ExtraNewline', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 0, + \ 'end_col': 0, + \ 'text': 'Remove multiple trailing newline at the end of the file.', + \ 'code': 'FinalNewline', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 9, + \ 'end_col': 11, + \ 'text': 'Use 1 space after `<%=` instead of 2 spaces.', + \ 'code': 'SpaceAroundErbTag', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 9, + \ 'end_col': 11, + \ 'text': 'Use 1 space before `%>` instead of 2 spaces.', + \ 'code': 'SpaceAroundErbTag', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 6, + \ 'end_col': 10, + \ 'text': 'Extra whitespace detected at end of line.', + \ 'code': 'TrailingWhitespace', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#eruby#erblint#Handle(347, [ + \ '{"metadata":{"erb_lint_version":"0.1.1","ruby_engine":"ruby","ruby_version":"3.0.2","ruby_patchlevel":"107","ruby_platform":"arm64-darwin20"},"files":[{"path":"demo.html.erb","offenses":[{"linter":"ExtraNewline","message":"Extra blank line detected.","location":{"start_line":3,"start_column":0,"last_line":4,"last_column":0,"length":1}},{"linter":"FinalNewline","message":"Remove multiple trailing newline at the end of the file.","location":{"start_line":6,"start_column":0,"last_line":8,"last_column":0,"length":2}},{"linter":"SpaceAroundErbTag","message":"Use 1 space after `<%=` instead of 2 spaces.","location":{"start_line":4,"start_column":9,"last_line":4,"last_column":11,"length":2}},{"linter":"SpaceAroundErbTag","message":"Use 1 space before `%>` instead of 2 spaces.","location":{"start_line":4,"start_column":9,"last_line":4,"last_column":11,"length":2}},{"linter":"TrailingWhitespace","message":"Extra whitespace detected at end of line.","location":{"start_line":5,"start_column":6,"last_line":5,"last_column":10,"length":4}}]}],"summary":{"offenses":5,"inspected_files":1,"corrected":0}}' + \ ]) + +Execute(The erblint handler should handle when files are checked and no offenses are found): + AssertEqual + \ [], + \ ale_linters#eruby#erblint#Handle(347, [ + \ '{"metadata":{"erb_lint_version":"0.1.1","ruby_engine":"ruby","ruby_version":"3.0.2","ruby_patchlevel":"107","ruby_platform":"arm64-darwin20"},"files":[{"path":"demo.html.erb","offenses":[]}],"summary":{"offenses":0,"inspected_files":1,"corrected":0}}' + \ ]) + +Execute(The erblint handler should handle output without any errors): + AssertEqual + \ [], + \ ale_linters#eruby#erblint#Handle(347, ['{}']) + + AssertEqual + \ [], + \ ale_linters#eruby#erblint#Handle(347, []) diff --git a/sources_non_forked/ale/test/handler/test_erlang_dialyzer_handler.vader b/sources_non_forked/ale/test/handler/test_erlang_dialyzer_handler.vader new file mode 100644 index 00000000..afd5c597 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_erlang_dialyzer_handler.vader @@ -0,0 +1,27 @@ +Before: + runtime ale_linters/erlang/dialyzer.vim + +After: + call ale#linter#Reset() + +Execute(The dialyzer handler should handle error messages.): + AssertEqual + \[ + \ { + \ 'lnum': 3, + \ 'lcol': 0, + \ 'text': 'Callback info about the provider behaviour is not available', + \ 'type': 'W' + \ } + \], + \ ale_linters#erlang#dialyzer#Handle(bufnr(''), ['erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available']) + +Execute(The dialyzer handler should handle empty file.): + AssertEqual + \[], + \ ale_linters#erlang#dialyzer#Handle(bufnr(''), []) + +Execute(The dialyzer handler should handle empty lines.): + AssertEqual + \[], + \ ale_linters#erlang#dialyzer#Handle(bufnr(''), ['']) diff --git a/sources_non_forked/ale/test/handler/test_erlang_elvis_handler.vader b/sources_non_forked/ale/test/handler/test_erlang_elvis_handler.vader new file mode 100644 index 00000000..0a6d756d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_erlang_elvis_handler.vader @@ -0,0 +1,40 @@ +Before: + runtime ale_linters/erlang/elvis.vim + +After: + call ale#linter#Reset() + +Execute(Warning messages should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 11, + \ 'text': "Replace the 'if' expression on line 11 with a 'case' expression or function clauses.", + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 20, + \ 'text': 'Remove the debug call to io:format/1 on line 20.', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ ], + \ ale_linters#erlang#elvis#Handle(bufnr(''), [ + \ "src/foo.erl:11:no_if_expression:Replace the 'if' expression on line 11 with a 'case' expression or function clauses.", + \ 'src/foo.erl:20:no_debug_call:Remove the debug call to io:format/1 on line 20.', + \ ]) + +Execute(Line length message shouldn't contain the line itself): + AssertEqual + \ [ + \ { + \ 'lnum': 24, + \ 'text': 'Line 24 is too long.', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ ], + \ ale_linters#erlang#elvis#Handle(bufnr(''), [ + \ 'src/foo.erl:24:line_length:Line 24 is too long: io:format("Look ma, too long!"),.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_eslint_handler.vader b/sources_non_forked/ale/test/handler/test_eslint_handler.vader new file mode 100644 index 00000000..01dd2c8f --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_eslint_handler.vader @@ -0,0 +1,438 @@ +Before: + Save g:ale_javascript_eslint_suppress_eslintignore + Save g:ale_javascript_eslint_suppress_missing_config + Save g:ale_warn_about_trailing_whitespace + Save g:ale_warn_about_trailing_blank_lines + + let g:ale_javascript_eslint_suppress_eslintignore = 0 + let g:ale_javascript_eslint_suppress_missing_config = 0 + let g:ale_warn_about_trailing_whitespace = 1 + let g:ale_warn_about_trailing_blank_lines = 1 + unlet! b:ale_warn_about_trailing_whitespace + unlet! b:ale_warn_about_trailing_blank_lines + +After: + Restore + + unlet! b:ale_javascript_eslint_suppress_eslintignore + unlet! b:ale_javascript_eslint_suppress_missing_config + unlet! b:ale_warn_about_trailing_whitespace + unlet! b:ale_warn_about_trailing_blank_lines + unlet! g:config_error_lines + +Execute(The eslint handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 47, + \ 'col': 14, + \ 'text': 'Missing trailing comma.', + \ 'code': 'comma-dangle', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 56, + \ 'col': 41, + \ 'text': 'Missing semicolon.', + \ 'code': 'semi', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 13, + \ 'col': 3, + \ 'text': 'Parsing error: Unexpected token', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ 'This line should be ignored completely', + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ 'This line should be ignored completely', + \ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token', + \ ]) + +Execute(The eslint handler should print a message about a missing configuration file): + let g:config_error_lines = [ + \ '', + \ 'Oops! Something went wrong! :(', + \ '', + \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:', + \ ' eslint --init', + \ '', + \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.', + \ '', + \ 'If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://gitter.im/eslint/eslint', + \ '', + \ ] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should allow the missing config error to be suppressed): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ '', + \ 'Oops! Something went wrong! :(', + \ '', + \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:', + \ ' eslint --init', + \ '', + \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.', + \ '', + \ 'If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://gitter.im/eslint/eslint', + \ '', + \ ] + + AssertEqual + \ [], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should print a message for config parsing errors): + let g:config_error_lines = [ + \ 'Cannot read config file: /some/path/or/other/.eslintrc.js', + \ 'Error: Unexpected token <<', + \ '/some/path/or/other/.eslintrc.js:1', + \ '(function (exports, require, module, __filename, __dirname) { <<<>>>', + \ ' ^^', + \ 'SyntaxError: Unexpected token <<', + \ ' at Object.exports.runInThisContext (vm.js:76:16)', + \ ' at Module._compile (module.js:528:28)', + \ ' at Object.Module._extensions..js (module.js:565:10)', + \ ' at Module.load (module.js:473:32)', + \ ' at tryModuleLoad (module.js:432:12)', + \ ' at Function.Module._load (module.js:424:3)', + \ ' at Module.require (module.js:483:17)', + \ ' at require (internal/module.js:20:19)', + \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)', + \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + +Execute(Suppressing missing configs shouldn't suppress parsing errors): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ 'Cannot read config file: /some/path/or/other/.eslintrc.js', + \ 'Error: Unexpected token <<', + \ '/some/path/or/other/.eslintrc.js:1', + \ '(function (exports, require, module, __filename, __dirname) { <<<>>>', + \ ' ^^', + \ 'SyntaxError: Unexpected token <<', + \ ' at Object.exports.runInThisContext (vm.js:76:16)', + \ ' at Module._compile (module.js:528:28)', + \ ' at Object.Module._extensions..js (module.js:565:10)', + \ ' at Module.load (module.js:473:32)', + \ ' at tryModuleLoad (module.js:432:12)', + \ ' at Function.Module._load (module.js:424:3)', + \ ' at Module.require (module.js:483:17)', + \ ' at require (internal/module.js:20:19)', + \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)', + \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should print a message for invalid configuration settings): + let g:config_error_lines = [ + \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)', + \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13', + \ ' at Array.forEach (native)', + \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)', + \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)', + \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)', + \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)', + \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)', + \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)', + \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + +Execute(Suppressing missing configs shouldn't suppress invalid config errors): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)', + \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13', + \ ' at Array.forEach (native)', + \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)', + \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)', + \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)', + \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)', + \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)', + \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)', + \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should print a message when import is not used in a module): + let g:config_error_lines = [ + \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)', + \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)', + \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)', + \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)', + \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)', + \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + +Execute(Suppressing missing configs shouldn't suppress module import errors): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)', + \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)', + \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)', + \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)', + \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)', + \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:]) + + +Execute(The eslint handler should output end_col values where appropriate): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 3, + \ 'end_col': 15, + \ 'text': 'Parsing error: Unexpected token ''some string''', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 70, + \ 'col': 3, + \ 'end_col': 5, + \ 'text': '''foo'' is not defined.', + \ 'code': 'no-undef', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 71, + \ 'col': 2, + \ 'end_col': 6, + \ 'text': 'Unexpected `await` inside a loop.', + \ 'code': 'no-await-in-loop', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 72, + \ 'col': 6, + \ 'end_col': 10, + \ 'text': 'Redundant use of `await` on a return value.', + \ 'code': 'no-return-await', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 73, + \ 'col': 4, + \ 'end_col': 10, + \ 'text': 'Unexpected console statement', + \ 'code': 'no-console', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 74, + \ 'col': 4, + \ 'end_col': 11, + \ 'text': 'Unexpected ''debugger'' statement.', + \ 'code': 'no-debugger', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ 'app.js:4:3: Parsing error: Unexpected token ''some string'' [Error]', + \ 'app.js:70:3: ''foo'' is not defined. [Error/no-undef]', + \ 'app.js:71:2: Unexpected `await` inside a loop. [Error/no-await-in-loop]', + \ 'app.js:72:6: Redundant use of `await` on a return value. [Error/no-return-await]', + \ 'app.js:73:4: Unexpected console statement [Error/no-console]', + \ 'app.js:74:4: Unexpected ''debugger'' statement. [Error/no-debugger]', + \ ]) + +Execute(The eslint hint about using typescript-eslint-parser): + silent! noautocmd file foo.ts + + AssertEqual + \ [ + \ { + \ 'lnum': 451, + \ 'col': 2, + \ 'end_col': 2, + \ 'text': 'Parsing error (You may need configure typescript-eslint-parser): Unexpected token )', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ 'foo.ts:451:2: Parsing error: Unexpected token ) [Error]', + \ ]) + +Execute(eslint should warn about ignored files by default): + AssertEqual + \ [{ + \ 'lnum': 0, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.' + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]', + \ ]) + + AssertEqual + \ [{ + \ 'lnum': 0, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override.', + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]', + \ ]) + +Execute(eslint should not warn about ignored files when explicitly disabled): + let g:ale_javascript_eslint_suppress_eslintignore = 1 + + AssertEqual + \ [], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]', + \ ]) + + AssertEqual + \ [], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]', + \ ]) + +Execute(eslint should handle react errors correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 59, + \ 'col': 9, + \ 'type': 'E', + \ 'text': 'Property should be placed on the same line as the component declaration', + \ 'code': 'react/jsx-first-prop-new-line', + \ }, + \ ], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ '/path/editor-help.jsx:59:9: Property should be placed on the same line as the component declaration [Error/react/jsx-first-prop-new-line]', + \ ]) + +Execute(Failing to connect to eslint_d should be handled correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', + \ }, + \ ], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ 'Could not connect', + \ ]) + +Execute(Disabling warnings about trailing spaces should work): + silent! noautocmd file foo.ts + + AssertEqual + \ [ + \ { + \ 'lnum': 182, + \ 'col': 22, + \ 'code': 'no-trailing-spaces', + \ 'type': 'E', + \ 'text': 'Trailing spaces not allowed.', + \ }, + \ ], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]', + \ ]) + + let g:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]', + \ ]) + + let g:ale_warn_about_trailing_whitespace = 1 + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_eslint_json_handler.vader b/sources_non_forked/ale/test/handler/test_eslint_json_handler.vader new file mode 100644 index 00000000..6235794a --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_eslint_json_handler.vader @@ -0,0 +1,376 @@ +Before: + Save g:ale_javascript_eslint_suppress_eslintignore + Save g:ale_javascript_eslint_suppress_missing_config + Save g:ale_warn_about_trailing_whitespace + Save g:ale_warn_about_trailing_blank_lines + + let g:ale_javascript_eslint_suppress_eslintignore = 0 + let g:ale_javascript_eslint_suppress_missing_config = 0 + let g:ale_warn_about_trailing_whitespace = 1 + let g:ale_warn_about_trailing_blank_lines = 1 + unlet! b:ale_warn_about_trailing_whitespace + unlet! b:ale_warn_about_trailing_blank_lines + +After: + Restore + + unlet! b:ale_javascript_eslint_suppress_eslintignore + unlet! b:ale_javascript_eslint_suppress_missing_config + unlet! b:ale_warn_about_trailing_whitespace + unlet! b:ale_warn_about_trailing_blank_lines + unlet! g:config_error_lines + +Execute(The eslint handler should parse json correctly): + call ale#test#SetFilename('foo.js') + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'end_lnum': 1, + \ 'col': 7, + \ 'end_col': 14, + \ 'text': '''variable'' is assigned a value but never used.', + \ 'code': 'no-unused-vars', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 15, + \ 'text': 'Missing semicolon.', + \ 'code': 'semi', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 7, + \ 'end_lnum': 7, + \ 'col': 7, + \ 'end_col': 14, + \ 'text': '''variable'' is already defined.', + \ 'code': 'no-redeclare', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-unused-vars","severity":1,"message":"''variable'' is assigned a value but never used.","line":1,"column":7,"nodeType":"Identifier","endLine":1,"endColumn":15},{"ruleId":"semi","severity":1,"message":"Missing semicolon.","line":5,"column":15,"nodeType":"ExpressionStatement","fix":{"range":[46,46],"text":";"}},{"ruleId":"no-redeclare","severity":2,"message":"''variable'' is already defined.","line":7,"column":7,"nodeType":"Identifier","endLine":7,"endColumn":15}],"errorCount":1,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":1,"source":"const variable = {\n a: 3\n};\n\nconsole.log(1)\n\nclass variable {\n}\n"}]' + \ ]) + +Execute(The eslint handler should suppress deprecation warnings): + call ale#test#SetFilename('foo.js') + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 9, + \ 'text': 'Parsing error: Unexpected token Controller', + \ 'type': 'E', + \ } + \ ], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"foo.js","messages":[{"ruleId":null,"fatal":true,"severity":2 ,"message":"Parsing error: Unexpected token Controller","line":1,"column":9}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount": 0,"source":"i:mport Controller from \"@ember/controller\";\nimport listViewControllerMixin from \"elearning/mixins/list-view-controller\";\nimport { inject as service } from \"@ember/service\";\n\nexport default Controller.extend(listViewControllerMixin(), {\n modelName: \"notification\",\n intl: service(),\n\n flatpickrLocale: computed(\"intl.locale\", function() {\n return this.intl.locale.firstObject.split(\"-\")[0];\n })\n});\n"}]', '(node:616989) [ESLINT_LEGACY_OBJECT_REST_SPREAD] DeprecationWarning: The ''parserOptions.ecmaFeatures.experimentalObjectRestSpread'' option is deprecated. Use ''parser Options.ecmaVersion'' instead. (found in "node_modules/eslint-plugin-ember/lib/config/base.js")]' + \ ]) + +Execute(The eslint handler should print a message about a missing configuration file): + let g:config_error_lines = [ + \ '', + \ 'Oops! Something went wrong! :(', + \ '', + \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:', + \ ' eslint --init', + \ '', + \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.', + \ '', + \ 'If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://gitter.im/eslint/eslint', + \ '', + \ ] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should allow the missing config error to be suppressed): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ '', + \ 'Oops! Something went wrong! :(', + \ '', + \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:', + \ ' eslint --init', + \ '', + \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.', + \ '', + \ 'If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://gitter.im/eslint/eslint', + \ '', + \ ] + + AssertEqual + \ [], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should print a message for config parsing errors): + let g:config_error_lines = [ + \ 'Cannot read config file: /some/path/or/other/.eslintrc.js', + \ 'Error: Unexpected token <<', + \ '/some/path/or/other/.eslintrc.js:1', + \ '(function (exports, require, module, __filename, __dirname) { <<<>>>', + \ ' ^^', + \ 'SyntaxError: Unexpected token <<', + \ ' at Object.exports.runInThisContext (vm.js:76:16)', + \ ' at Module._compile (module.js:528:28)', + \ ' at Object.Module._extensions..js (module.js:565:10)', + \ ' at Module.load (module.js:473:32)', + \ ' at tryModuleLoad (module.js:432:12)', + \ ' at Function.Module._load (module.js:424:3)', + \ ' at Module.require (module.js:483:17)', + \ ' at require (internal/module.js:20:19)', + \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)', + \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(Suppressing missing configs shouldn't suppress parsing errors): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ 'Cannot read config file: /some/path/or/other/.eslintrc.js', + \ 'Error: Unexpected token <<', + \ '/some/path/or/other/.eslintrc.js:1', + \ '(function (exports, require, module, __filename, __dirname) { <<<>>>', + \ ' ^^', + \ 'SyntaxError: Unexpected token <<', + \ ' at Object.exports.runInThisContext (vm.js:76:16)', + \ ' at Module._compile (module.js:528:28)', + \ ' at Object.Module._extensions..js (module.js:565:10)', + \ ' at Module.load (module.js:473:32)', + \ ' at tryModuleLoad (module.js:432:12)', + \ ' at Function.Module._load (module.js:424:3)', + \ ' at Module.require (module.js:483:17)', + \ ' at require (internal/module.js:20:19)', + \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)', + \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should print a message for invalid configuration settings): + let g:config_error_lines = [ + \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)', + \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13', + \ ' at Array.forEach (native)', + \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)', + \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)', + \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)', + \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)', + \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)', + \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)', + \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(Suppressing missing configs shouldn't suppress invalid config errors): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:', + \ ' Configuration for rule "indent" is invalid:', + \ ' Value "off" is the wrong type.', + \ '', + \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)', + \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13', + \ ' at Array.forEach (native)', + \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)', + \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)', + \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)', + \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)', + \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)', + \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)', + \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should print a message when import is not used in a module): + let g:config_error_lines = [ + \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)', + \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)', + \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)', + \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)', + \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)', + \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(Suppressing missing configs shouldn't suppress module import errors): + let b:ale_javascript_eslint_suppress_missing_config = 1 + let g:config_error_lines = [ + \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.', + \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)', + \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)', + \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)', + \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)', + \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)', + \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)', + \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)', + \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(g:config_error_lines, "\n"), + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:]) + +Execute(The eslint handler should hint about using typescript-eslint-parser): + call ale#test#SetFilename('foo.ts') + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'Parsing error (You may need configure typescript-eslint-parser): The keyword ''interface'' is reserved', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"foo.ts","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: The keyword ''interface'' is reserved","line":2,"column":1}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":"\ninterface test {}\n"}]', + \ ]) + +Execute(eslint should warn about ignored files by default): + AssertEqual + \ [{ + \ 'lnum': 0, + \ 'type': 'W', + \ 'text': 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.' + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]', + \ ]) + + AssertEqual + \ [{ + \ 'lnum': 0, + \ 'type': 'W', + \ 'text': 'File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override.', + \ }], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored by default. Use \"--ignore-pattern ''!node_modules/*''\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]', + \ ]) + +Execute(eslint should not warn about ignored files when explicitly disabled): + let g:ale_javascript_eslint_suppress_eslintignore = 1 + + AssertEqual + \ [], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]', + \ ]) + + AssertEqual + \ [], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored by default. Use \"--ignore-pattern ''!node_modules/*''\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]', + \ ]) + +Execute(Failing to connect to eslint_d should be handled correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', + \ }, + \ ], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ 'Could not connect', + \ ]) + +Execute(Disabling warnings about trailing spaces should work): + call ale#test#SetFilename('foo.js') + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 16, + \ 'code': 'no-trailing-spaces', + \ 'type': 'W', + \ 'text': 'Trailing spaces not allowed.', + \ }, + \ ], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-trailing-spaces","severity":1,"message":"Trailing spaces not allowed.","line":2,"column":16,"nodeType":"Program","fix":{"range":[16,17],"text":""}}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"\nconsole.log(1); \n"}]' + \ ]) + + let g:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-trailing-spaces","severity":1,"message":"Trailing spaces not allowed.","line":2,"column":16,"nodeType":"Program","fix":{"range":[16,17],"text":""}}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"\nconsole.log(1); \n"}]' + \ ]) + + let g:ale_warn_about_trailing_whitespace = 1 + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [], + \ ale#handlers#eslint#HandleJSON(bufnr(''), [ + \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-trailing-spaces","severity":1,"message":"Trailing spaces not allowed.","line":2,"column":16,"nodeType":"Program","fix":{"range":[16,17],"text":""}}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"\nconsole.log(1); \n"}]' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_fecs_handler.vader b/sources_non_forked/ale/test/handler/test_fecs_handler.vader new file mode 100644 index 00000000..7c216b8d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_fecs_handler.vader @@ -0,0 +1,35 @@ +Before: + runtime autoload/ale/handlers/fecs.vim + +After: + call ale#linter#Reset() + +Execute(fecs should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 20, + \ 'col': 25, + \ 'text': 'Unexpected console statement.', + \ 'code': 'no-console', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 24, + \ 'col': 36, + \ 'text': 'Missing radix parameter.', + \ 'code': 'radix', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 25, + \ 'col': 6, + \ 'text': 'Missing static property value.', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#fecs#Handle(347, [ + \ 'fecs WARN → line 20, col 25: Unexpected console statement. (no-console)', + \ 'fecs ERROR → line 24, col 36: Missing radix parameter. (radix)', + \ 'fecs ERROR → line 25, col 6: Missing static property value.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_fish_handler.vader b/sources_non_forked/ale/test/handler/test_fish_handler.vader new file mode 100644 index 00000000..ad3a963c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_fish_handler.vader @@ -0,0 +1,61 @@ +Before: + runtime ale_linters/fish/fish.vim + +After: + call ale#linter#Reset() + +Execute(The fish handler should handle basic warnings and syntax errors): + AssertEqual + \ [ + \ { + \ 'lnum': 20, + \ 'col': 23, + \ 'text': "Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.", + \ }, + \ { + \ 'lnum': 26, + \ 'col': 7, + \ 'text': "Illegal command name '(prompt_pwd)'", + \ }, + \ { + \ 'lnum': 36, + \ 'col': 1, + \ 'text': "'end' outside of a block", + \ }, + \ ], + \ ale_linters#fish#fish#Handle(1, [ + \ "fish_prompt.fish (line 20): Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.", + \ 'if set -q SSH_CLIENT || set -q SSH_TTY', + \ ' ^', + \ "fish_prompt.fish (line 26): Illegal command name '(prompt_pwd)'", + \ ' (prompt_pwd) \', + \ ' ^', + \ "fish_prompt.fish (line 36): 'end' outside of a block", + \ 'end', + \ '^', + \ 'config.fish (line 45):', + \ "abbr --add p 'cd ~/Projects'", + \ '^', + \ ]) + +Execute(The fish handler should handle problems where the problem before before the line with the line number): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 23, + \ 'text': 'Unsupported use of ''||''. In fish, please use ''COMMAND; or COMMAND''.', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 1, + \ 'text': 'wat', + \ }, + \ ], + \ ale_linters#fish#fish#Handle(bufnr(''), [ + \ 'Unsupported use of ''||''. In fish, please use ''COMMAND; or COMMAND''.', + \ '/tmp/vLz620o/258/test.fish (line 2): if set -q SSH_CLIENT || set -q SSH_TTY', + \ ' ^', + \ '/tmp/vLz620o/258/test.fish (line 5): wat', + \ ' ^', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_flake8_handler.vader b/sources_non_forked/ale/test/handler/test_flake8_handler.vader new file mode 100644 index 00000000..1c9956fa --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_flake8_handler.vader @@ -0,0 +1,276 @@ +Before: + Save g:ale_warn_about_trailing_blank_lines + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_blank_lines = 1 + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/flake8.vim + +After: + Restore + + unlet! b:ale_warn_about_trailing_blank_lines + unlet! b:ale_warn_about_trailing_whitespace + + call ale#linter#Reset() + +Execute(The flake8 handler should handle basic warnings and syntax errors): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 6, + \ 'vcol': 1, + \ 'type': 'E', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 6, + \ 'vcol': 1, + \ 'type': 'W', + \ 'text': 'some warning', + \ 'code': 'W123', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 8, + \ 'col': 3, + \ 'vcol': 1, + \ 'type': 'E', + \ 'text': 'SyntaxError: invalid syntax', + \ 'code': 'E999', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(1, [ + \ 'stdin:6:6: E111 indentation is not a multiple of four', + \ 'stdin:7:6: W123 some warning', + \ 'stdin:8:3: E999 SyntaxError: invalid syntax', + \ ]) + +Execute(The flake8 handler should set end column indexes for certain errors): + AssertEqual + \ [ + \ { + \ 'lnum': 25, + \ 'col': 1, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 3, + \ 'text': 'undefined name ''foo''', + \ 'code': 'F821', + \ }, + \ { + \ 'lnum': 28, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 9, + \ 'text': 'hello may be undefined, or defined from star imports: x', + \ 'code': 'F405', + \ }, + \ { + \ 'lnum': 104, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 12, + \ 'text': '''continue'' not properly in loop', + \ 'code': 'F999', + \ }, + \ { + \ 'lnum': 106, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 9, + \ 'text': '''break'' outside loop', + \ 'code': 'F999', + \ }, + \ { + \ 'lnum': 109, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 8, + \ 'text': 'local variable ''test'' is assigned to but never used', + \ 'code': 'F841', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(1, [ + \ 'foo.py:25:1: F821 undefined name ''foo''', + \ 'foo.py:28:5: F405 hello may be undefined, or defined from star imports: x', + \ 'foo.py:104:5: F999 ''continue'' not properly in loop', + \ 'foo.py:106:5: F999 ''break'' outside loop', + \ 'foo.py:109:5: F841 local variable ''test'' is assigned to but never used', + \ ]) + +Execute(The flake8 handler should handle stack traces): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'ImportError: No module named parser (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/bin/flake8", line 7, in ', + \ ' from flake8.main.cli import main', + \ ' File "/usr/local/lib/python2.7/dist-packages/flake8/main/cli.py", line 2, in ', + \ ' from flake8.main import application', + \ ' File "/usr/local/lib/python2.7/dist-packages/flake8/main/application.py", line 17, in ', + \ ' from flake8.plugins import manager as plugin_manager', + \ ' File "/usr/local/lib/python2.7/dist-packages/flake8/plugins/manager.py", line 5, in ', + \ ' import pkg_resources', + \ ' File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in ', + \ ' import email.parser', + \ 'ImportError: No module named parser', + \ ], "\n"), + \ }, + \ ], + \ ale_linters#python#flake8#Handle(42, [ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/bin/flake8", line 7, in ', + \ ' from flake8.main.cli import main', + \ ' File "/usr/local/lib/python2.7/dist-packages/flake8/main/cli.py", line 2, in ', + \ ' from flake8.main import application', + \ ' File "/usr/local/lib/python2.7/dist-packages/flake8/main/application.py", line 17, in ', + \ ' from flake8.plugins import manager as plugin_manager', + \ ' File "/usr/local/lib/python2.7/dist-packages/flake8/plugins/manager.py", line 5, in ', + \ ' import pkg_resources', + \ ' File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in ', + \ ' import email.parser', + \ 'ImportError: No module named parser', + \ ]) + +Execute(The flake8 handler should handle names with spaces): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 6, + \ 'vcol': 1, + \ 'type': 'E', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', + \ 'sub_type': 'style', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(42, [ + \ 'C:\something\with spaces.py:6:6: E111 indentation is not a multiple of four', + \ ]) + +Execute(Warnings about trailing whitespace should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'W291', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'who cares', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'W293', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'who cares', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: W291 who cares', + \ 'foo.py:6:1: W293 who cares', + \ ]) + +Execute(Disabling trailing whitespace warnings should work): + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: W291 who cares', + \ 'foo.py:6:1: W293 who cares', + \ ]) + +Execute(Warnings about trailing blank lines should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'W391', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'blank line at end of file', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(Disabling trailing blank line warnings should work): + let b:ale_warn_about_trailing_blank_lines = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(F401 should be a warning): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'F401', + \ 'type': 'W', + \ 'text': 'module imported but unused', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: F401 module imported but unused', + \ ]) + +Execute(E112 should be a syntax error): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'E112', + \ 'type': 'E', + \ 'text': 'expected an indented block', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: E112 expected an indented block', + \ ]) + +Execute(Compatibility with hacking which uses older style flake8): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'H306', + \ 'type': 'W', + \ 'text': 'imports not in alphabetical order (smtplib, io)', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: H306: imports not in alphabetical order (smtplib, io)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_flakehell_handler.vader b/sources_non_forked/ale/test/handler/test_flakehell_handler.vader new file mode 100644 index 00000000..1f77bd96 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_flakehell_handler.vader @@ -0,0 +1,276 @@ +Before: + Save g:ale_warn_about_trailing_blank_lines + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_blank_lines = 1 + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/flakehell.vim + +After: + Restore + + unlet! b:ale_warn_about_trailing_blank_lines + unlet! b:ale_warn_about_trailing_whitespace + + call ale#linter#Reset() + +Execute(The flakehell handler should handle basic warnings and syntax errors): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 6, + \ 'vcol': 1, + \ 'type': 'E', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 6, + \ 'vcol': 1, + \ 'type': 'W', + \ 'text': 'some warning', + \ 'code': 'W123', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 8, + \ 'col': 3, + \ 'vcol': 1, + \ 'type': 'E', + \ 'text': 'SyntaxError: invalid syntax', + \ 'code': 'E999', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(1, [ + \ 'stdin:6:6: E111 indentation is not a multiple of four', + \ 'stdin:7:6: W123 some warning', + \ 'stdin:8:3: E999 SyntaxError: invalid syntax', + \ ]) + +Execute(The flakehell handler should set end column indexes for certain errors): + AssertEqual + \ [ + \ { + \ 'lnum': 25, + \ 'col': 1, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 3, + \ 'text': 'undefined name ''foo''', + \ 'code': 'F821', + \ }, + \ { + \ 'lnum': 28, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 9, + \ 'text': 'hello may be undefined, or defined from star imports: x', + \ 'code': 'F405', + \ }, + \ { + \ 'lnum': 104, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 12, + \ 'text': '''continue'' not properly in loop', + \ 'code': 'F999', + \ }, + \ { + \ 'lnum': 106, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 9, + \ 'text': '''break'' outside loop', + \ 'code': 'F999', + \ }, + \ { + \ 'lnum': 109, + \ 'col': 5, + \ 'vcol': 1, + \ 'type': 'E', + \ 'end_col': 8, + \ 'text': 'local variable ''test'' is assigned to but never used', + \ 'code': 'F841', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(1, [ + \ 'foo.py:25:1: F821 undefined name ''foo''', + \ 'foo.py:28:5: F405 hello may be undefined, or defined from star imports: x', + \ 'foo.py:104:5: F999 ''continue'' not properly in loop', + \ 'foo.py:106:5: F999 ''break'' outside loop', + \ 'foo.py:109:5: F841 local variable ''test'' is assigned to but never used', + \ ]) + +Execute(The flakehell handler should handle stack traces): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'ImportError: No module named parser (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/bin/flakehell", line 7, in ', + \ ' from flakehell.main.cli import main', + \ ' File "/usr/local/lib/python2.7/dist-packages/flakehell/main/cli.py", line 2, in ', + \ ' from flakehell.main import application', + \ ' File "/usr/local/lib/python2.7/dist-packages/flakehell/main/application.py", line 17, in ', + \ ' from flakehell.plugins import manager as plugin_manager', + \ ' File "/usr/local/lib/python2.7/dist-packages/flakehell/plugins/manager.py", line 5, in ', + \ ' import pkg_resources', + \ ' File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in ', + \ ' import email.parser', + \ 'ImportError: No module named parser', + \ ], "\n"), + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(42, [ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/bin/flakehell", line 7, in ', + \ ' from flakehell.main.cli import main', + \ ' File "/usr/local/lib/python2.7/dist-packages/flakehell/main/cli.py", line 2, in ', + \ ' from flakehell.main import application', + \ ' File "/usr/local/lib/python2.7/dist-packages/flakehell/main/application.py", line 17, in ', + \ ' from flakehell.plugins import manager as plugin_manager', + \ ' File "/usr/local/lib/python2.7/dist-packages/flakehell/plugins/manager.py", line 5, in ', + \ ' import pkg_resources', + \ ' File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 35, in ', + \ ' import email.parser', + \ 'ImportError: No module named parser', + \ ]) + +Execute(The flakehell handler should handle names with spaces): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 6, + \ 'vcol': 1, + \ 'type': 'E', + \ 'text': 'indentation is not a multiple of four', + \ 'code': 'E111', + \ 'sub_type': 'style', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(42, [ + \ 'C:\something\with spaces.py:6:6: E111 indentation is not a multiple of four', + \ ]) + +Execute(Warnings about trailing whitespace should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'W291', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'who cares', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'W293', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'who cares', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(bufnr(''), [ + \ 'foo.py:6:1: W291 who cares', + \ 'foo.py:6:1: W293 who cares', + \ ]) + +Execute(Disabling trailing whitespace warnings should work): + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#flakehell#Handle(bufnr(''), [ + \ 'foo.py:6:1: W291 who cares', + \ 'foo.py:6:1: W293 who cares', + \ ]) + +Execute(Warnings about trailing blank lines should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'W391', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'blank line at end of file', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(Disabling trailing blank line warnings should work): + let b:ale_warn_about_trailing_blank_lines = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#flakehell#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(F401 should be a warning): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'F401', + \ 'type': 'W', + \ 'text': 'module imported but unused', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(bufnr(''), [ + \ 'foo.py:6:1: F401 module imported but unused', + \ ]) + +Execute(E112 should be a syntax error): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'E112', + \ 'type': 'E', + \ 'text': 'expected an indented block', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(bufnr(''), [ + \ 'foo.py:6:1: E112 expected an indented block', + \ ]) + +Execute(Compatibility with hacking which uses older style flakehell): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'H306', + \ 'type': 'W', + \ 'text': 'imports not in alphabetical order (smtplib, io)', + \ }, + \ ], + \ ale_linters#python#flakehell#Handle(bufnr(''), [ + \ 'foo.py:6:1: H306: imports not in alphabetical order (smtplib, io)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_flawfinder_handler.vader b/sources_non_forked/ale/test/handler/test_flawfinder_handler.vader new file mode 100644 index 00000000..708bac2a --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_flawfinder_handler.vader @@ -0,0 +1,57 @@ +Before: + Save g:ale_c_flawfinder_error_severity + + unlet! g:ale_c_flawfinder_error_severity + unlet! b:ale_c_flawfinder_error_severity + + runtime ale_linters/c/flawfinder.vim + +After: + unlet! g:ale_c_flawfinder_error_severity + Restore + +Execute(The Flawfinder handler should ignore other lines of output): + AssertEqual + \ [], + \ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [ + \ 'foo', + \ 'bar', + \ 'baz', + \ ]) + +Execute(The Flawfinder handler should work): + AssertEqual + \ [ + \ { + \ 'lnum': 31, + \ 'col': 4, + \ 'type': 'W', + \ 'text': "(buffer) strncpy: Easily used incorrectly", + \ }, + \ ], + \ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [ + \ ":31:4: [1] (buffer) strncpy:Easily used incorrectly", + \ ]) + +Execute(The Flawfinder error severity level should be configurable): + let b:ale_c_flawfinder_error_severity = 2 + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col': 4, + \ 'type': 'E', + \ 'text': "(buffer) char: Statically-sized arrays can be bad", + \ }, + \ { + \ 'lnum': 31, + \ 'col': 4, + \ 'type': 'W', + \ 'text': "(buffer) strncpy: Easily used incorrectly", + \ }, + \ ], + \ ale#handlers#flawfinder#HandleFlawfinderFormat(bufnr(''), [ + \ ":12:4: [2] (buffer) char:Statically-sized arrays can be bad", + \ ":31:4: [1] (buffer) strncpy:Easily used incorrectly", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_flow_handler.vader b/sources_non_forked/ale/test/handler/test_flow_handler.vader new file mode 100644 index 00000000..055ba026 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_flow_handler.vader @@ -0,0 +1,507 @@ +Before: + runtime ale_linters/javascript/flow.vim + +After: + unlet! g:flow_output + unlet! g:expected + unlet! g:actual + call ale#linter#Reset() + +Execute(The flow handler should throw away non-JSON lines): + AssertEqual + \ [], + \ ale_linters#javascript#flow#Handle(bufnr(''), [ + \ 'Already up-to-date.', + \ '{"flowVersion":"0.50.0","errors":[],"passed":true}', + \ ]) + AssertEqual + \ [], + \ ale_linters#javascript#flow#Handle(bufnr(''), [ + \ 'foo', + \ 'bar', + \ 'baz', + \ '{"flowVersion":"0.50.0","errors":[],"passed":true}', + \ ]) + +Execute(The flow handler should process errors correctly.): + silent! noautocmd file /home/w0rp/Downloads/graphql-js/src/language/parser.js + + let g:flow_output = { + \ "flowVersion": "0.39.0", + \ "errors": [ + \ { + \ "kind": "infer", + \ "level": "error", + \ "message": [ + \ { + \ "context": " return 1", + \ "descr": "number", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 417, + \ "column": 10, + \ "offset": 9503 + \ }, + \ "end": { + \ "line": 417, + \ "column": 10, + \ "offset": 9504 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 417, + \ "endline": 417, + \ "start": 10, + \ "end": 10 + \ }, + \ { + \ "context": v:null, + \ "descr": "This type is incompatible with the expected return type of", + \ "type": "Comment", + \ "path": "", + \ "line": 0, + \ "endline": 0, + \ "start": 1, + \ "end": 0 + \ }, + \ { + \ "context": "function parseArguments(lexer: Lexer<*>): Array {", + \ "descr": "array type", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 416, + \ "column": 43, + \ "offset": 9472 + \ }, + \ "end": { + \ "line": 416, + \ "column": 61, + \ "offset": 9491 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 416, + \ "endline": 416, + \ "start": 43, + \ "end": 61 + \ } + \ ] + \ }, + \ { + \ "kind": "infer", + \ "level": "warning", + \ "message": [ + \ { + \ "context": " return peek(lexer, TokenKind.PAREN_L) ?", + \ "descr": "unreachable code", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 419, + \ "column": 3, + \ "offset": 9508 + \ }, + \ "end": { + \ "line": 421, + \ "column": 7, + \ "offset": 9626 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 419, + \ "endline": 421, + \ "start": 3, + \ "end": 7 + \ } + \ ] + \ } + \ ], + \ "passed": v:false + \} + + let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)]) + let g:expected = [ + \ { + \ 'lnum': 417, + \ 'type': 'E', + \ 'col': 10, + \ 'text': 'number: This type is incompatible with the expected return type of array type', + \ }, + \ { + \ 'lnum': 419, + \ 'type': 'W', + \ 'col': 3, + \ 'text': 'unreachable code:', + \ }, + \] + + AssertEqual g:expected, g:actual + +Execute(The flow handler should fetch the correct location for the currently opened file, even when it's not in the first message.): + silent! noautocmd file /Users/rav/Projects/vim-ale-flow/index.js + + let g:flow_output = { + \ "flowVersion": "0.44.0", + \ "errors": [{ + \ "operation": { + \ "context": " , document.getElementById('foo')", + \ "descr": "React element `Foo`", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 6, + \ "column": 3, + \ "offset": 92 + \ }, + \ "end": { + \ "line": 6, + \ "column": 18, + \ "offset": 108 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 6, + \ "endline": 6, + \ "start": 3, + \ "end": 18 + \ }, + \ "kind": "infer", + \ "level": "error", + \ "message": [{ + \ "context": "module.exports = function(props: Props) {", + \ "descr": "property `bar`", + \ "type": "Blame", + \ "loc": { + \ "source": "/Users/rav/Projects/vim-ale-flow/foo.js", + \ "type": "SourceFile", + \ "start": { + \ "line": 9, + \ "column": 34, + \ "offset": 121 + \ }, + \ "end": { + \ "line": 9, + \ "column": 38, + \ "offset": 126 + \ } + \ }, + \ "path": "/Users/rav/Projects/vim-ale-flow/foo.js", + \ "line": 9, + \ "endline": 9, + \ "start": 34, + \ "end": 38 + \ }, { + \ "context": v:null, + \ "descr": "Property not found in", + \ "type": "Comment", + \ "path": "", + \ "line": 0, + \ "endline": 0, + \ "start": 1, + \ "end": 0 + \ }, { + \ "context": " , document.getElementById('foo')", + \ "descr": "props of React element `Foo`", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 6, + \ "column": 3, + \ "offset": 92 + \ }, + \ "end": { + \ "line": 6, + \ "column": 18, + \ "offset": 108 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 6, + \ "endline": 6, + \ "start": 3, + \ "end": 18 + \ }] + \ }], + \ "passed": v:false + \} + + let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)]) + let g:expected = [ + \ { + \ 'lnum': 6, + \ 'col': 3, + \ 'type': 'E', + \ 'text': 'property `bar`: Property not found in props of React element `Foo` See also: React element `Foo`', + \ } + \] + + AssertEqual g:expected, g:actual + +Execute(The flow handler should handle relative paths): + silent! noautocmd file /Users/rav/Projects/vim-ale-flow/index.js + + let g:flow_output = { + \ "flowVersion": "0.44.0", + \ "errors": [{ + \ "operation": { + \ "context": " , document.getElementById('foo')", + \ "descr": "React element `Foo`", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 6, + \ "column": 3, + \ "offset": 92 + \ }, + \ "end": { + \ "line": 6, + \ "column": 18, + \ "offset": 108 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 6, + \ "endline": 6, + \ "start": 3, + \ "end": 18 + \ }, + \ "kind": "infer", + \ "level": "error", + \ "message": [{ + \ "context": "module.exports = function(props: Props) {", + \ "descr": "property `bar`", + \ "type": "Blame", + \ "loc": { + \ "source": "vim-ale-flow/foo.js", + \ "type": "SourceFile", + \ "start": { + \ "line": 9, + \ "column": 34, + \ "offset": 121 + \ }, + \ "end": { + \ "line": 9, + \ "column": 38, + \ "offset": 126 + \ } + \ }, + \ "path": "vim-ale-flow/foo.js", + \ "line": 9, + \ "endline": 9, + \ "start": 34, + \ "end": 38 + \ }, { + \ "context": v:null, + \ "descr": "Property not found in", + \ "type": "Comment", + \ "path": "", + \ "line": 0, + \ "endline": 0, + \ "start": 1, + \ "end": 0 + \ }, { + \ "context": " , document.getElementById('foo')", + \ "descr": "props of React element `Foo`", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 6, + \ "column": 3, + \ "offset": 92 + \ }, + \ "end": { + \ "line": 6, + \ "column": 18, + \ "offset": 108 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 6, + \ "endline": 6, + \ "start": 3, + \ "end": 18 + \ }] + \ }], + \ "passed": v:false + \} + + let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)]) + let g:expected = [ + \ { + \ 'lnum': 6, + \ 'col': 3, + \ 'type': 'E', + \ 'text': 'property `bar`: Property not found in props of React element `Foo` See also: React element `Foo`', + \ } + \] + + AssertEqual g:expected, g:actual + +Execute(The flow handler should handle extra errors): + silent! noautocmd file /Users/rav/Projects/vim-ale-flow/index.js + + let g:flow_output = { + \ "flowVersion": "0.54.0", + \ "errors": [{ + \ "extra": [{ + \ "message": [{ + \ "context": v:null, + \ "descr": "Property \`setVector\` is incompatible:", + \ "type": "Blame ", + \ "path": "", + \ "line": 0, + \ "endline": 0, + \ "start": 1, + \ "end": 0 + \ }], + \ "children": [{ + \ "message": [{ + \ "context": "setVector = \{2\}", + \ "descr": "number ", + \ "type": "Blame ", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile ", + \ "start": { + \ "line": 90, + \ "column": 30, + \ "offset": 2296 + \ }, + \ "end": { + \ "line": 90, + \ "column": 30, + \ "offset": 2297 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 90, + \ "endline": 90, + \ "start": 30, + \ "end": 30 + \ }, { + \ "context": v:null, + \ "descr": "This type is incompatible with ", + \ "type": "Comment ", + \ "path": "", + \ "line": 0, + \ "endline": 0, + \ "start": 1, + \ "end": 0 + \ }, { + \ "context": "setVector: VectorType => void,", + \ "descr": "function type ", + \ "type": "Blame ", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 9, + \ "column": 14, + \ "offset": 252 + \ }, + \ "end": { + \ "line": 9, + \ "column": 31, + \ "offset": 270 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 9, + \ "endline": 9, + \ "start": 14, + \ "end": 31 + \ }] + \ }] + \ }], + \ "kind": "infer", + \ "level": "error", + \ "suppressions": [], + \ "message": [{ + \ "context": " < New ", + \ "descr": "props of React element `New`", + \ "type": "Blame", + \ "loc": { + \ "source": "vim-ale-flow/foo.js", + \ "type": "SourceFile", + \ "start": { + \ "line": 89, + \ "column": 17, + \ "offset": 2262 + \ }, + \ "end": { + \ "line": 94, + \ "column": 18, + \ "offset": 2488 + \ } + \ }, + \ "path": "", + \ "line": 89, + \ "endline": 94, + \ "start": 17, + \ "end": 18 + \ }, { + \ "context": v:null, + \ "descr": "This type is incompatible with", + \ "type": "Comment", + \ "path": "", + \ "line": 0, + \ "endline": 0, + \ "start": 1, + \ "end": 0 + \ }, { + \ "context": "class New extends React.Component < NewProps,NewState > {", + \ "descr": "object type", + \ "type": "Blame", + \ "loc": { + \ "source": expand('%:p'), + \ "type": "SourceFile", + \ "start": { + \ "line": 20, + \ "column": 35, + \ "offset": 489 + \ }, + \ "end": { + \ "line": 20, + \ "column": 42, + \ "offset": 497 + \ } + \ }, + \ "path": expand('%:p'), + \ "line": 20, + \ "endline": 20, + \ "start": 35, + \ "end": 42 + \ }] + \ }], + \ "passed": v:false + \} + + let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)]) + let g:expected = [ + \ { + \ 'lnum': 20, + \ 'col': 35, + \ 'type': 'E', + \ 'text': 'props of React element `New`: This type is incompatible with object type', + \ 'detail': 'props of React element `New`: This type is incompatible with object type' + \ . "\nProperty `setVector` is incompatible: number This type is incompatible with function type ", + \ } + \] + + AssertEqual g:expected, g:actual diff --git a/sources_non_forked/ale/test/handler/test_foodcritic_handler.vader b/sources_non_forked/ale/test/handler/test_foodcritic_handler.vader new file mode 100644 index 00000000..67cb6cab --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_foodcritic_handler.vader @@ -0,0 +1,44 @@ +Before: + runtime ale_linters/chef/foodcritic.vim + +After: + call ale#linter#Reset() + +Execute(Basic warnings should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'code': 'CINK001', + \ 'type': 'W', + \ 'text': 'Missing CHANGELOG in markdown format', + \ 'filename': '/foo/bar/CHANGELOG.md', + \ }, + \ { + \ 'lnum': 1, + \ 'code': 'FC011', + \ 'type': 'W', + \ 'text': 'Missing README in markdown format', + \ 'filename': '/foo/bar/README.md', + \ }, + \ { + \ 'lnum': 1, + \ 'code': 'FC031', + \ 'type': 'W', + \ 'text': 'Cookbook without metadata.rb file', + \ 'filename': '/foo/bar/metadata.rb', + \ }, + \ { + \ 'lnum': 1, + \ 'code': 'FC071', + \ 'type': 'W', + \ 'text': 'Missing LICENSE file', + \ 'filename': '/foo/bar/LICENSE', + \ }, + \ ], + \ ale_linters#chef#foodcritic#Handle(bufnr(''), [ + \ 'CINK001: Missing CHANGELOG in markdown format: /foo/bar/CHANGELOG.md:1', + \ 'FC011: Missing README in markdown format: /foo/bar/README.md:1', + \ 'FC031: Cookbook without metadata.rb file: /foo/bar/metadata.rb:1', + \ 'FC071: Missing LICENSE file: /foo/bar/LICENSE:1', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_fortran_handler.vader b/sources_non_forked/ale/test/handler/test_fortran_handler.vader new file mode 100644 index 00000000..c55a4c6f --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_fortran_handler.vader @@ -0,0 +1,95 @@ +Before: + runtime ale_linters/fortran/gcc.vim + +After: + call ale#linter#Reset() + +Execute(The fortran handler should parse lines from GCC 4.1.2 correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 357, + \ 'lnum': 4, + \ 'col': 0, + \ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type", + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 357, + \ 'lnum': 3, + \ 'col': 0, + \ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#fortran#gcc#Handle(357, [ + \ " In file :4", + \ "", + \ "write(*,*) b", + \ " 1", + \ "Error: Symbol ‘b’ at (1) has no IMPLICIT type", + \ " In file :3", + \ "", + \ "write(*,*) a", + \ " 1", + \ "Error: Symbol ‘a’ at (1) has no IMPLICIT type", + \ ]) + + +Execute(The fortran handler should parse lines from GCC 4.9.3 correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 357, + \ 'lnum': 3, + \ 'col': 12, + \ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type", + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 357, + \ 'lnum': 4, + \ 'col': 12, + \ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#fortran#gcc#Handle(357, [ + \ ":3.12:", + \ "", + \ "write(*,*) a", + \ " 1", + \ "Error: Symbol ‘a’ at (1) has no IMPLICIT type", + \ ":4.12:", + \ "", + \ "write(*,*) b", + \ " 1", + \ "Error: Symbol ‘b’ at (1) has no IMPLICIT type", + \ ]) + +Execute(The fortran handler should parse lines from GCC 6.3.1 correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 337, + \ 'lnum': 3, + \ 'col': 12, + \ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type", + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 337, + \ 'lnum': 4, + \ 'col': 12, + \ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#fortran#gcc#Handle(337, [ + \ ":3:12:", + \ "", + \ "Error: Symbol ‘a’ at (1) has no IMPLICIT type", + \ ":4:12:", + \ "", + \ "Error: Symbol ‘b’ at (1) has no IMPLICIT type", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_gawk_handler.vader b/sources_non_forked/ale/test/handler/test_gawk_handler.vader new file mode 100644 index 00000000..3a7b5457 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_gawk_handler.vader @@ -0,0 +1,39 @@ +Before: + runtime ale_linters/awk/gawk.vim + +After: + call ale#linter#Reset() + +Execute(gawk syntax errors should be parsed correctly): + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 0, + \ 'text': "invalid char ''' in expression", + \ 'code': 0, + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 0, + \ 'text': 'unterminated string', + \ 'code': 0, + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 0, + \ 'text': "escape sequence `\u' treated as plain `u'", + \ 'code': 0, + \ 'type': 'W', + \ }, + \ ], + \ ale#handlers#gawk#HandleGawkFormat(347, [ + \ "gawk: something.awk:1: BEGIN { system('touch aaaaaaaaa') }", + \ "gawk: something.awk:1: ^ invalid char ''' in expression", + \ 'gawk: something.awk:5: { x = "aaaaaaaaaaa', + \ 'gawk: something.awk:5: ^ unterminated string', + \ "gawk: something.awk:10: warning: escape sequence `\u' treated as plain `u'", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_gcc_handler.vader b/sources_non_forked/ale/test/handler/test_gcc_handler.vader new file mode 100644 index 00000000..a4231cab --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_gcc_handler.vader @@ -0,0 +1,316 @@ +Execute(The GCC handler should ignore other lines of output): + AssertEqual + \ [], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ 'foo', + \ 'bar', + \ 'baz', + \ ]) + +Execute(GCC errors from included files should be parsed correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'filename': 'broken.h', + \ 'type': 'E', + \ 'text': 'expected identifier or ''('' before ''{'' token', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 2, + \ 'text': 'Error found in header. See :ALEDetail', + \ 'detail': join([ + \ 'In file included from :3:2:', + \ 'broken.h:1:1: error: expected identifier or ''('' before ''{'' token', + \ ' {{{', + \ ' ^', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ 'In file included from :3:2:', + \ 'broken.h:1:1: error: expected identifier or ''('' before ''{'' token', + \ ' {{{', + \ ' ^', + \ 'compilation terminated.', + \ ]) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'filename': 'b.h', + \ 'type': 'E', + \ 'text': 'expected identifier or ''('' before ''{'' token', + \ }, + \ { + \ 'lnum': 5, + \ 'text': 'Error found in header. See :ALEDetail', + \ 'detail': join([ + \ 'In file included from a.h:1:0,', + \ ' from :5:', + \ 'b.h:1:1: error: expected identifier or ''('' before ''{'' token', + \ ' {{{', + \ ' ^', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ 'In file included from a.h:1:0,', + \ ' from :5:', + \ 'b.h:1:1: error: expected identifier or ''('' before ''{'' token', + \ ' {{{', + \ ' ^', + \ 'compilation terminated.', + \ ]) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'filename': 'b.h', + \ 'type': 'E', + \ 'text': 'unknown type name ''bad_type''', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'filename': 'b.h', + \ 'type': 'E', + \ 'text': 'unknown type name ''other_bad_type''', + \ }, + \ { + \ 'lnum': 3, + \ 'text': 'Error found in header. See :ALEDetail', + \ 'detail': join([ + \ 'In file included from a.h:1:0,', + \ ' from :3:', + \ 'b.h:1:1: error: unknown type name ‘bad_type’', + \ ' bad_type x;', + \ ' ^', + \ 'b.h:2:1: error: unknown type name ‘other_bad_type’', + \ ' other_bad_type y;', + \ ' ^', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ 'In file included from a.h:1:0,', + \ ' from :3:', + \ 'b.h:1:1: error: unknown type name ‘bad_type’', + \ ' bad_type x;', + \ ' ^', + \ 'b.h:2:1: error: unknown type name ‘other_bad_type’', + \ ' other_bad_type y;', + \ ' ^', + \ 'compilation terminated.', + \ ]) + +Execute(The GCC handler shouldn't complain about #pragma once for headers): + silent file! test.h + + AssertEqual + \ [], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ ':1:1: warning: #pragma once in main file [enabled by default]', + \ ]) + + silent file! test.hpp + + AssertEqual + \ [], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ ':1:1: warning: #pragma once in main file [enabled by default]', + \ ]) + +Execute(The GCC handler should handle syntax errors): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 12, + \ 'type': 'E', + \ 'text': 'invalid suffix "p" on integer constant' + \ }, + \ { + \ 'lnum': 17, + \ 'col': 5, + \ 'type': 'E', + \ 'text': 'invalid suffix "n" on integer constant' + \ }, + \ { + \ 'lnum': 4, + \ 'type': 'E', + \ 'text': 'variable or field ''foo'' declared void' + \ }, + \ { + \ 'lnum': 4, + \ 'type': 'E', + \ 'text': '''cat'' was not declared in this scope' + \ }, + \ { + \ 'lnum': 12, + \ 'type': 'E', + \ 'text': 'expected '';'' before ''o''' + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ ':6:12: error: invalid suffix "p" on integer constant', + \ ':17:5: error: invalid suffix "n" on integer constant', + \ ':4: error: variable or field ''foo'' declared void', + \ ':4: error: ''cat'' was not declared in this scope', + \ ':12: error: expected `;'' before ''o''', + \ ]) + +Execute(The GCC handler should handle notes with no previous message): + AssertEqual + \ [], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ ':1:1: note: x', + \ ':1:1: note: x', + \ ]) + +Execute(The GCC handler should attach notes to previous messages): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 12, + \ 'type': 'E', + \ 'text': 'Some error', + \ 'detail': "Some error\n:1:1: note: x", + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ '-:6:12: error: Some error', + \ ':1:1: note: x', + \ ]) + +Execute(The GCC handler should interpret - as being the current file): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 12, + \ 'type': 'E', + \ 'text': 'Some error', + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ '-:6:12: error: Some error', + \ ]) + +Execute(The GCC handler should handle fatal error messages due to missing files): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col': 12, + \ 'type': 'E', + \ 'text': 'foo.h: No such file or directory' + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ ':3:12: fatal error: foo.h: No such file or directory', + \ ]) + +Execute(The GCC handler should handle errors for inlined header functions): + AssertEqual + \ [ + \ { + \ 'lnum': 50, + \ 'col': 4, + \ 'filename': '/usr/include/bits/fcntl2.h', + \ 'type': 'E', + \ 'text': 'call to ''__open_missing_mode'' declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments', + \ }, + \ { + \ 'lnum': 44, + \ 'col': 5, + \ 'filename': '/usr/include/bits/fcntl2.h', + \ 'type': 'E', + \ 'text': 'call to ''__open_too_many_args'' declared with attribute error: open can be called either with 2 or 3 arguments, not more', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 10, + \ 'type': 'E', + \ 'text': 'call to ''__open_missing_mode'' declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments', + \ }, + \ { + \ 'lnum': 13, + \ 'col': 11, + \ 'type': 'E', + \ 'text': 'call to ''__open_too_many_args'' declared with attribute error: open can be called either with 2 or 3 arguments, not more', + \ }, + \ { + \ 'lnum': 1, + \ 'text': 'Error found in header. See :ALEDetail', + \ 'detail': join([ + \ 'In file included from /usr/include/fcntl.h:328,', + \ ' from :1:', + \ 'In function ‘open’,', + \ ' inlined from ‘main’ at :7:10:', + \ '/usr/include/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments', + \ ' __open_missing_mode ();', + \ ' ^~~~~~~~~~~~~~~~~~~~~~', + \ 'In function ‘open’,', + \ ' inlined from ‘main’ at :13:11:', + \ '/usr/include/bits/fcntl2.h:44:5: error: call to ‘__open_too_many_args’ declared with attribute error: open can be called either with 2 or 3 arguments, not more', + \ ' __open_too_many_args ();', + \ ], "\n") + \ }, + \], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ 'In file included from /usr/include/fcntl.h:328,', + \ ' from :1:', + \ 'In function ‘open’,', + \ ' inlined from ‘main’ at :7:10:', + \ '/usr/include/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments', + \ ' __open_missing_mode ();', + \ ' ^~~~~~~~~~~~~~~~~~~~~~', + \ 'In function ‘open’,', + \ ' inlined from ‘main’ at :13:11:', + \ '/usr/include/bits/fcntl2.h:44:5: error: call to ‘__open_too_many_args’ declared with attribute error: open can be called either with 2 or 3 arguments, not more', + \ ' __open_too_many_args ();', + \ ' ^~~~~~~~~~~~~~~~~~~~~~~', + \ ]) + +Execute(The GCC handler should handle macro expansion errors in current file): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 19, + \ 'type': 'E', + \ 'text': 'error message', + \ 'detail': "error message\n:1:19: note: in expansion of macro 'TEST'", + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ ': error: error message', + \ ':1:19: note: in expansion of macro ‘TEST’', + \ ' 1 | std::string str = TEST;', + \ ' | ^~~~', + \ ]) + +Execute(The GCC handler should handle macro expansion errors in other files): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'type': 'E', + \ 'text': 'Error found in macro expansion. See :ALEDetail', + \ 'detail': "error message\ninc.h:1:19: note: in expansion of macro 'TEST'", + \ }, + \ ], + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ + \ ': error: error message', + \ 'inc.h:1:19: note: in expansion of macro ‘TEST’', + \ ' 1 | std::string str = TEST;', + \ ' | ^~~~', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_ghc_handler.vader b/sources_non_forked/ale/test/handler/test_ghc_handler.vader new file mode 100644 index 00000000..70246ed1 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ghc_handler.vader @@ -0,0 +1,177 @@ +Execute(The ghc handler should handle hdevtools output): + call ale#test#SetFilename('foo.hs') + + AssertEqual + \ [ + \ { + \ 'lnum': 147, + \ 'type': 'W', + \ 'col': 62, + \ 'text': '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’ Expected type: [T.Text]', + \ 'detail': join([ + \ '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’', + \ ' Expected type: [T.Text]', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [ + \ 'foo.hs:147:62: warning:', + \ '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’', + \ ' Expected type: [T.Text]', + \ ]) + +Execute(The ghc handler should handle ghc 8 output): + call ale#test#SetFilename('src/Appoint/Lib.hs') + + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'type': 'E', + \ 'col': 1, + \ 'text': 'Failed to load interface for ‘GitHub.Data’ Use -v to see a list of the files searched for.', + \ 'detail': join([ + \ ' Failed to load interface for ‘GitHub.Data’', + \ ' Use -v to see a list of the files searched for.', + \ ], "\n"), + \ }, + \ { + \ 'lnum': 7, + \ 'type': 'W', + \ 'col': 1, + \ 'text': 'Failed to load interface for ‘GitHub.Endpoints.PullRequests’ Use -v to see a list of the files searched for.', + \ 'detail': join([ + \ ' Failed to load interface for ‘GitHub.Endpoints.PullRequests’', + \ ' Use -v to see a list of the files searched for.', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [ + \ '', + \ ale#path#Simplify('src/Appoint/Lib.hs') . ':6:1: error:', + \ ' Failed to load interface for ‘GitHub.Data’', + \ ' Use -v to see a list of the files searched for.', + \ '', + \ ale#path#Simplify('src/Appoint/Lib.hs') . ':7:1: warning:', + \ ' Failed to load interface for ‘GitHub.Endpoints.PullRequests’', + \ ' Use -v to see a list of the files searched for.', + \ ]) + +Execute(The ghc handler should handle ghc 7 output): + call ale#test#SetFilename('src/Main.hs') + + AssertEqual + \ [ + \ { + \ 'lnum': 168, + \ 'type': 'E', + \ 'col': 1, + \ 'text': 'parse error (possibly incorrect indentation or mismatched brackets)', + \ 'detail': join([ + \ ' parse error (possibly incorrect indentation or mismatched brackets)', + \ ], "\n"), + \ }, + \ { + \ 'lnum': 84, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'Top-level binding with no type signature: myLayout :: Choose Tall (Choose (Mirror Tall) Full) a', + \ 'detail': join([ + \ ' Top-level binding with no type signature:', + \ ' myLayout :: Choose Tall (Choose (Mirror Tall) Full) a', + \ ], "\n"), + \ }, + \ { + \ 'lnum': 94, + \ 'col': 5, + \ 'type': 'E', + \ 'text': 'Some other error', + \ 'detail': join([ + \ ' Some other error', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [ + \ ale#path#Simplify('src/Main.hs') . ':168:1:', + \ ' parse error (possibly incorrect indentation or mismatched brackets)', + \ ale#path#Simplify('src/Main.hs') . ':84:1:Warning:', + \ ' Top-level binding with no type signature:', + \ ' myLayout :: Choose Tall (Choose (Mirror Tall) Full) a', + \ ale#path#Simplify('src/Main.hs') . ':94:5:Error:', + \ ' Some other error', + \ ]) + +Execute(The ghc handler should handle stack 1.5.1 output): + call ale#test#SetFilename('src/Main.hs') + + AssertEqual + \ [ + \ { + \ 'lnum': 160, + \ 'col': 14, + \ 'type': 'E', + \ 'text': '• Expecting one fewer arguments to ‘Exp’ Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’ • In the type ‘Exp a’ | 160 | pattern F :: Exp a | ^^^^^', + \ 'detail': join([ + \ ' • Expecting one fewer arguments to ‘Exp’', + \ ' Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’', + \ ' • In the type ‘Exp a’', + \ ' |', + \ ' 160 | pattern F :: Exp a', + \ ' | ^^^^^', + \ ], "\n"), + \ }, + \ ], + \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [ + \ ' ' . ale#path#Simplify('src/Main.hs') . ':160:14: error:', + \ ' • Expecting one fewer arguments to ‘Exp’', + \ ' Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’', + \ ' • In the type ‘Exp a’', + \ ' |', + \ ' 160 | pattern F :: Exp a', + \ ' | ^^^^^', + \ ]) + +Execute(The ghc handler should handle ghc panic): + let g:detail = [ + \ '[15 of 15] Compiling SizedTypes.List', + \ 'ghc: panic! (the ''impossible'' happened)', + \ ' (GHC version 8.10.3:', + \ ' src/SizedTypes/List.hs:(46,19)-(50,0) Specified type does not refine Haskell type for `SizedTypes.List.out` (Plugged Init types new)', + \ ' The Liquid type', + \ ' .', + \ ' GHC.Types.Int -> (SizedTypes.List.List a) -> (_, (SizedTypes.List.List a))', + \ ' .', + \ ' is inconsistent with the Haskell type', + \ ' .', + \ ' forall p a ->', + \ 'p -> SizedTypes.List.List a -> (a, SizedTypes.List.List a)', + \ ' .', + \ ' defined at src/SizedTypes/List.hs:52:1-3', + \ ' .', + \ ' Specifically, the Liquid component', + \ ' .', + \ ' {VV##0 : GHC.Types.Int | VV##0 >= 0}', + \ ' .', + \ ' is inconsistent with the Haskell component', + \ ' .', + \ ' p', + \ ' .', + \ ' ', + \ ' HINT: Use the hole ''_'' instead of the mismatched component (in the Liquid specification)', + \ '', + \ 'Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug', + \ '', + \ '' + \ ] + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'ghc panic!', + \ 'detail': join(g:detail[1:-3], "\n"), + \ }, + \ ], + \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), g:detail) + unlet g:detail diff --git a/sources_non_forked/ale/test/handler/test_ghc_mod_handler.vader b/sources_non_forked/ale/test/handler/test_ghc_mod_handler.vader new file mode 100644 index 00000000..bed5b13c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ghc_mod_handler.vader @@ -0,0 +1,37 @@ +Execute(HandleGhcFormat should handle ghc-mod problems): + call ale#test#SetFilename('check2.hs') + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Failed to load interface for ‘Missing’Use -v to see a list of the files searched for.', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Suggestion: Use camelCaseFound: my_variable = ...Why not: myVariable = ...', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'Eta reduceFound: myFunc x = succ xWhy not: myFunc = succ', + \ }, + \ { + \ 'lnum': 28, + \ 'col': 28, + \ 'type': 'W', + \ 'text': 'Defaulting the following constraints to type ‘Integer’ (Num a0) arising from the literal ‘3’ at check2.hs:28:28 (Eq a0) arising from a use of ‘lookup’ at check2.hs:28:21-28 • In the first argument of ‘lookup’, namely ‘3’ In the expression: lookup 3 In the second argument of ‘fmap’, namely ‘(lookup 3 $ zip [1, 2, 3] [4, 5, 6])''’' + \ }, + \ ], + \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [ + \ 'check2.hs:2:1:Failed to load interface for ‘Missing’Use -v to see a list of the files searched for.', + \ 'check2.hs:2:1: Suggestion: Use camelCaseFound: my_variable = ...Why not: myVariable = ...', + \ 'check2.hs:6:1: Warning: Eta reduceFound: myFunc x = succ xWhy not: myFunc = succ', + \ 'xxx.hs:6:1: Warning: Eta reduceFound: myFunc x = succ xWhy not: myFunc = succ', + \ printf("check2.hs:28:28: Warning: Defaulting the following constraints to type ‘Integer’ (Num a0) arising from the literal ‘3’ at %s/check2.hs:28:28 (Eq a0) arising from a use of ‘lookup’ at %s/check2.hs:28:21-28 • In the first argument of ‘lookup’, namely ‘3’ In the expression: lookup 3 In the second argument of ‘fmap’, namely ‘(lookup 3 $ zip [1, 2, 3] [4, 5, 6])'’", tempname(), tempname()), + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_ghdl_handler.vader b/sources_non_forked/ale/test/handler/test_ghdl_handler.vader new file mode 100644 index 00000000..a0f5edac --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ghdl_handler.vader @@ -0,0 +1,26 @@ +Before: + runtime ale_linters/vhdl/ghdl.vim + +After: + call ale#linter#Reset() + +Execute(The ghdl handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 41, + \ 'col' : 5, + \ 'type': 'E', + \ 'text': "error: 'begin' is expected instead of 'if'" + \ }, + \ { + \ 'lnum': 12, + \ 'col' : 8, + \ 'type': 'E', + \ 'text': ' no declaration for "i0"' + \ }, + \ ], + \ ale_linters#vhdl#ghdl#Handle(bufnr(''), [ + \ "dff_en.vhd:41:5:error: 'begin' is expected instead of 'if'", + \ '/path/to/file.vhdl:12:8: no declaration for "i0"', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_gitlint_handler.vader b/sources_non_forked/ale/test/handler/test_gitlint_handler.vader new file mode 100644 index 00000000..5c531664 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_gitlint_handler.vader @@ -0,0 +1,89 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/gitcommit/gitlint.vim + +After: + Restore + + unlet! b:ale_warn_about_trailing_whitespace + + call ale#linter#Reset() + +Execute(The gitlint handler should handle basic warnings and syntax errors): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': 'Body message is missing', + \ 'code': 'B6', + \ }, + \ { + \ 'lnum': 2, + \ 'type': 'E', + \ 'text': 'Second line is not empty: "to send to upstream"', + \ 'code': 'B4', + \ }, + \ { + \ 'lnum': 3, + \ 'type': 'E', + \ 'text': 'Body message is too short (19<20): "to send to upstream"', + \ 'code': 'B5', + \ }, + \ { + \ 'lnum': 8, + \ 'type': 'E', + \ 'text': 'Title exceeds max length (92>72): "some very long commit subject line where the author can''t wait to explain what he just fixed"', + \ 'code': 'T1', + \ }, + \ ], + \ ale_linters#gitcommit#gitlint#Handle(1, [ + \ '1: B6 Body message is missing', + \ '2: B4 Second line is not empty: "to send to upstream"', + \ '3: B5 Body message is too short (19<20): "to send to upstream"', + \ '8: T1 Title exceeds max length (92>72): "some very long commit subject line where the author can''t wait to explain what he just fixed"' + \ ]) + +Execute(Disabling trailing whitespace warnings should work): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'type': 'E', + \ 'text': 'Trailing whitespace', + \ 'code': 'T2', + \ }, + \ ], + \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [ + \ '8: T2 Trailing whitespace', + \]) + + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'type': 'E', + \ 'text': 'Trailing whitespace', + \ 'code': 'B2', + \ }, + \ ], + \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [ + \ '8: B2 Trailing whitespace', + \]) + + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [], + \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [ + \ '8: T2 Trailing whitespace', + \ ]) + + AssertEqual + \ [], + \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [ + \ '8: B2 Trailing whitespace', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_glslang_handler.vader b/sources_non_forked/ale/test/handler/test_glslang_handler.vader new file mode 100644 index 00000000..6d3a7999 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_glslang_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/glsl/glslang.vim + +Execute(The glsl glslang handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 0, + \ 'type': 'E', + \ 'text': '''gl_ModelViewProjectionMatrix'' : undeclared identifier', + \ }, + \ { + \ 'lnum': 121, + \ 'col': 0, + \ 'type': 'W', + \ 'text': '''switch'' : last case/default label not followed by statements', + \ }, + \ ], + \ ale_linters#glsl#glslang#Handle(bufnr(''), [ + \ 'ERROR: 0:4: ''gl_ModelViewProjectionMatrix'' : undeclared identifier', + \ 'WARNING: 0:121: ''switch'' : last case/default label not followed by statements', + \ 'ERROR: 2 compilation errors. No code generated.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_go_generic_handler.vader b/sources_non_forked/ale/test/handler/test_go_generic_handler.vader new file mode 100644 index 00000000..2b17fdcb --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_go_generic_handler.vader @@ -0,0 +1,38 @@ +Execute(The golang handler should return the correct filenames): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 0, + \ 'text': 'some error', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ }, + \ { + \ 'lnum': 27, + \ 'col': 5, + \ 'text': 'some error with a column', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/other.go'), + \ }, + \ { + \ 'lnum': 18, + \ 'col': 0, + \ 'text': 'random error', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/go1.14.go'), + \ }, + \ { + \ 'lnum': 36, + \ 'col': 2, + \ 'text': 'another random error', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/anothergo1.14.go'), + \ }, + \ ], + \ ale#handlers#go#Handler(bufnr(''), [ + \ 'test.go:27: some error', + \ 'other.go:27:5: some error with a column', + \ 'vet: go1.14.go:18:0: random error', + \ 'vet: anothergo1.14.go:36:2: another random error', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_gobuild_handler.vader b/sources_non_forked/ale/test/handler/test_gobuild_handler.vader new file mode 100644 index 00000000..17608c3a --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_gobuild_handler.vader @@ -0,0 +1,45 @@ +Before: + runtime ale_linters/go/gobuild.vim + +After: + call ale#linter#Reset() + +Execute (The gobuild handler should handle names with spaces): + " We can't test Windows paths with the path resovling on Linux, but we can + " test the regex. + AssertEqual + \ [ + \ [ + \ 'C:\something\file with spaces.go', + \ '27', + \ '', + \ 'missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ ], + \ [ + \ 'C:\something\file with spaces.go', + \ '5', + \ '2', + \ 'expected declaration, found ''STRING'' "log"', + \ ], + \ ], + \ map(ale_linters#go#gobuild#GetMatches([ + \ 'C:\something\file with spaces.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ 'C:\something\file with spaces.go:5:2: expected declaration, found ''STRING'' "log"', + \ ]), 'v:val[1:4]') + +Execute (The gobuild handler should handle relative paths correctly): + call ale#test#SetFilename('app/test.go') + + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 0, + \ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ }, + \ ], + \ ale_linters#go#gobuild#Handler(bufnr(''), [ + \ 'test.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_golangci_lint_handler.vader b/sources_non_forked/ale/test/handler/test_golangci_lint_handler.vader new file mode 100644 index 00000000..58815f56 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_golangci_lint_handler.vader @@ -0,0 +1,84 @@ +Before: + runtime ale_linters/go/golangci_lint.vim + +After: + call ale#linter#Reset() + +Execute (The golangci-lint handler should handle names with spaces): + " We can't test Windows paths with the path resovling on Linux, but we can + " test the regex. + AssertEqual + \ [ + \ [ + \ 'C:\something\file with spaces.go', + \ '12', + \ '3', + \ 'expected ''package'', found ''IDENT'' gibberish', + \ 'staticcheck', + \ ], + \ [ + \ 'C:\something\file with spaces.go', + \ '37', + \ '5', + \ 'expected ''package'', found ''IDENT'' gibberish', + \ 'golint', + \ ], + \ ], + \ map(ale_linters#go#golangci_lint#GetMatches([ + \ 'C:\something\file with spaces.go:12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)', + \ 'C:\something\file with spaces.go:37:5: expected ''package'', found ''IDENT'' gibberish (golint)', + \ ]), 'v:val[1:5]') + +Execute (The golangci-lint handler should handle paths correctly): + call ale#test#SetFilename('app/test.go') + + let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go') + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col': 3, + \ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ }, + \ { + \ 'lnum': 37, + \ 'col': 5, + \ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ }, + \ ], + \ ale_linters#go#golangci_lint#Handler(bufnr(''), [ + \ file . ':12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)', + \ file . ':37:5: expected ''package'', found ''IDENT'' gibberish (golint)', + \ ]) + +Execute (The golangci-lint handler should handle only typecheck lines as errors): + call ale#test#SetFilename('app/main.go') + + let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go') + + AssertEqual + \ [ + \ { + \ 'lnum': 30, + \ 'col': 5, + \ 'text': 'variable ''err'' is not used (typecheck)', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ }, + \ { + \ 'lnum': 505, + \ 'col': 75, + \ 'text': 'Magic number: 404, in detected (gomnd)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ } + \ ], + \ ale_linters#go#golangci_lint#Handler(bufnr(''), [ + \ file . ':30:5: variable ''err'' is not used (typecheck)', + \ file . ':505:75: Magic number: 404, in detected (gomnd)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_gometalinter_handler.vader b/sources_non_forked/ale/test/handler/test_gometalinter_handler.vader new file mode 100644 index 00000000..1aade8a7 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_gometalinter_handler.vader @@ -0,0 +1,57 @@ +Before: + runtime ale_linters/go/gometalinter.vim + +After: + call ale#linter#Reset() + +Execute (The gometalinter handler should handle names with spaces): + " We can't test Windows paths with the path resovling on Linux, but we can + " test the regex. + AssertEqual + \ [ + \ [ + \ 'C:\something\file with spaces.go', + \ '12', + \ '3', + \ 'warning', + \ 'expected ''package'', found ''IDENT'' gibberish (staticcheck)', + \ ], + \ [ + \ 'C:\something\file with spaces.go', + \ '37', + \ '5', + \ 'error', + \ 'expected ''package'', found ''IDENT'' gibberish (golint)', + \ ], + \ ], + \ map(ale_linters#go#gometalinter#GetMatches([ + \ 'C:\something\file with spaces.go:12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)', + \ 'C:\something\file with spaces.go:37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)', + \ ]), 'v:val[1:5]') + +Execute (The gometalinter handler should handle paths correctly): + call ale#test#SetFilename('app/test.go') + + let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go') + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col': 3, + \ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ }, + \ { + \ 'lnum': 37, + \ 'col': 5, + \ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'), + \ }, + \ ], + \ ale_linters#go#gometalinter#Handler(bufnr(''), [ + \ file . ':12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)', + \ file . ':37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_hadolint.vader b/sources_non_forked/ale/test/handler/test_hadolint.vader new file mode 100644 index 00000000..f84c303d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_hadolint.vader @@ -0,0 +1,59 @@ +Before: + runtime ale_linters/dockerfile/hadolint.vim + +After: + call ale#linter#Reset() + +Execute(The hadolint handler should handle an empty string response): + AssertEqual + \ [], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), []) + +Execute(The hadolint handler should handle a normal example): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 0, + \ 'type': 'W', + \ 'code': 'DL3006', + \ 'text': "DL3006: Always tag the version of an image explicitly", + \ 'detail': "DL3006 ( https://github.com/hadolint/hadolint/wiki/DL3006 )\n\nAlways tag the version of an image explicitly", + \ }, + \ { + \ 'lnum': 4, + \ 'col': 0, + \ 'type': 'W', + \ 'code': 'DL3033', + \ 'text': "DL3033: Specify version with `yum install -y -`.", + \ 'detail': "DL3033 ( https://github.com/hadolint/hadolint/wiki/DL3033 )\n\nSpecify version with `yum install -y -`.", + \ }, + \ { + \ 'lnum': 12, + \ 'col': 0, + \ 'type': 'W', + \ 'code': 'SC2039', + \ 'text': "SC2039: In POSIX sh, brace expansion is undefined.", + \ 'detail': "SC2039 ( https://github.com/koalaman/shellcheck/wiki/SC2039 )\n\nIn POSIX sh, brace expansion is undefined.", + \ }, + \ ], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ '-:1 DL3006 warning: Always tag the version of an image explicitly', + \ '-:4 DL3033 warning: Specify version with `yum install -y -`.', + \ '-:12 SC2039 warning: In POSIX sh, brace expansion is undefined.', + \ ]) + +Execute(The hadolint handler should handle parsing errors): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': "unexpected 'b' expecting '#', ADD, ARG, CMD, COPY, ENTRYPOINT, ENV, EXPOSE, FROM, HEALTHCHECK, LABEL, MAINTAINER, ONBUILD, RUN, SHELL, STOPSIGNAL, USER, VOLUME, WORKDIR, or end of input", + \ 'detail': "hadolint could not parse the file because of a syntax error.", + \ }, + \ ], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ '/dev/stdin:1:1 unexpected ''b'' expecting ''#'', ADD, ARG, CMD, COPY, ENTRYPOINT, ENV, EXPOSE, FROM, HEALTHCHECK, LABEL, MAINTAINER, ONBUILD, RUN, SHELL, STOPSIGNAL, USER, VOLUME, WORKDIR, or end of input', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_haskell_stack_handler.vader b/sources_non_forked/ale/test/handler/test_haskell_stack_handler.vader new file mode 100644 index 00000000..07e7e69c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_haskell_stack_handler.vader @@ -0,0 +1,7 @@ +Before: + runtime ale/handlers/haskell_stack.vim + +Execute(Escape stack should correctly identify a stack exec command): + AssertEqual + \ ale#Escape('stack') . ' exec ' . ale#Escape('hlint') . ' --', + \ ale#handlers#haskell_stack#EscapeExecutable('stack', 'hlint') diff --git a/sources_non_forked/ale/test/handler/test_hlint_handler.vader b/sources_non_forked/ale/test/handler/test_hlint_handler.vader new file mode 100644 index 00000000..915e1748 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_hlint_handler.vader @@ -0,0 +1,80 @@ +Before: + runtime! ale_linters/haskell/hlint.vim + +After: + call ale#linter#Reset() + +Execute(The hlint handler should parse items correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 4, + \ 'end_lnum': 3, + \ 'end_col': 2, + \ 'text': 'Error: Do something. Found: [Char] Why not: String', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 4, + \ 'end_lnum': 7, + \ 'end_col': 2, + \ 'text': 'Warning: Do something. Found: [Char] Why not: String', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 73, + \ 'col': 25, + \ 'end_lnum': 73, + \ 'end_col': 31, + \ 'text': 'Suggestion: Use String. Found: [Char] Why not: String', + \ 'type': 'I', + \ }, + \ ], + \ ale_linters#haskell#hlint#Handle(bufnr(''), [json_encode([ + \ { + \ 'module': 'Main', + \ 'decl': 'foo', + \ 'severity': 'Error', + \ 'hint': 'Do something', + \ 'file': '-', + \ 'startLine': 1, + \ 'startColumn': 4, + \ 'endLine': 3, + \ 'endColumn': 2, + \ 'from': '[Char]', + \ 'to': 'String', + \ }, + \ { + \ 'module': 'Main', + \ 'decl': 'foo', + \ 'severity': 'Warning', + \ 'hint': 'Do something', + \ 'file': '-', + \ 'startLine': 2, + \ 'startColumn': 4, + \ 'endLine': 7, + \ 'endColumn': 2, + \ 'from': '[Char]', + \ 'to': 'String', + \ }, + \ { + \ 'module': 'Main', + \ 'decl': 'myFocusedBorderColor', + \ 'severity': 'Suggestion', + \ 'hint': 'Use String', + \ 'file': '-', + \ 'startLine': 73, + \ 'startColumn': 25, + \ 'endLine': 73, + \ 'endColumn': 31, + \ 'from': '[Char]', + \ 'to': 'String', + \ }, + \ ])]) + +Execute(The hlint handler should handle empty output): + AssertEqual + \ [], + \ ale_linters#haskell#hlint#Handle(bufnr(''), []) diff --git a/sources_non_forked/ale/test/handler/test_ibm_openapi_validator_handler.vader b/sources_non_forked/ale/test/handler/test_ibm_openapi_validator_handler.vader new file mode 100644 index 00000000..e136d5d2 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ibm_openapi_validator_handler.vader @@ -0,0 +1,49 @@ +Before: + runtime! ale_linters/openapi/ibm_validator.vim + +After: + call ale#linter#Reset() + +Execute(Problems should be parsed correctly for openapi-ibm-validator): + AssertEqual + \ [ + \ { + \ 'lnum': 54, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'Items with a description must have content in it.', + \ }, + \ { + \ 'lnum': 24, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'Operations must have a non-empty `operationId`.', + \ }, + \ { + \ 'lnum': 40, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'operationIds must follow case convention: lower_snake_case', + \ }, + \ ], + \ ale_linters#openapi#ibm_validator#Handle(bufnr(''), [ + \ '', + \ '[Warning] No .validaterc file found. The validator will run in default mode.', + \ 'To configure the validator, create a .validaterc file.', + \ '', + \ 'errors', + \ '', + \ ' Message : Items with a description must have content in it.', + \ ' Path : paths./settings.patch.description', + \ ' Line : 54', + \ '', + \ 'warnings', + \ '', + \ ' Message : Operations must have a non-empty `operationId`.', + \ ' Path : paths./stats.get.operationId', + \ ' Line : 24', + \ '', + \ ' Message : operationIds must follow case convention: lower_snake_case', + \ ' Path : paths./settings.get.operationId', + \ ' Line : 40' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_idris_handler.vader b/sources_non_forked/ale/test/handler/test_idris_handler.vader new file mode 100644 index 00000000..6a032ea6 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_idris_handler.vader @@ -0,0 +1,66 @@ +Before: + Save $TMPDIR + + " Set TMPDIR so the temporary file checks work. + let $TMPDIR = '/tmp' + + runtime ale_linters/idris/idris.vim + +After: + Restore + + call ale#linter#Reset() + +Execute(The idris handler should parse messages that reference a single column): + if has('win32') + call ale#test#SetFilename($TEMP . '\foo.idr') + else + call ale#test#SetFilename('/tmp/foo.idr') + endif + + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 5, + \ 'type': 'E', + \ 'text': 'When checking right hand side of main with expected type IO () When checking an application of function Prelude.Monad.>>=: Type mismatch between IO () (Type of putStrLn _) and _ -> _ (Is putStrLn _ applied to too many arguments?) Specifically: Type mismatch between IO and \uv => _ -> uv' + \ } + \ ], + \ ale_linters#idris#idris#Handle(bufnr(''), [ + \ expand('%:p') . ':4:5:', + \ 'When checking right hand side of main with expected type', + \ ' IO ()', + \ '', + \ 'When checking an application of function Prelude.Monad.>>=:', + \ ' Type mismatch between', + \ ' IO () (Type of putStrLn _)', + \ ' and', + \ ' _ -> _ (Is putStrLn _ applied to too many arguments?)', + \ '', + \ ' Specifically:', + \ ' Type mismatch between', + \ ' IO', + \ ' and', + \ ' \uv => _ -> uv', + \ ]) + +Execute(The idris handler should parse messages that reference a column range): + call ale#test#SetFilename('/tmp/foo.idr') + + AssertEqual + \ [ + \ { + \ 'lnum': 11, + \ 'col': 11, + \ 'type': 'E', + \ 'text': 'When checking right hand side of Main.case block in main at /tmp/foo.idr:10:10 with expected type IO () Last statement in do block must be an expression' + \ } + \ ], + \ ale_linters#idris#idris#Handle(bufnr(''), [ + \ expand('%:p') . ':11:11-13:', + \ 'When checking right hand side of Main.case block in main at /tmp/foo.idr:10:10 with expected type', + \ ' IO ()', + \ '', + \ 'Last statement in do block must be an expression', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_inko_handler.vader b/sources_non_forked/ale/test/handler/test_inko_handler.vader new file mode 100644 index 00000000..6621d2d6 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_inko_handler.vader @@ -0,0 +1,54 @@ +Before: + runtime ale_linters/inko/inko.vim + +After: + call ale#linter#Reset() + +Execute(The inko handler should parse errors correctly): + AssertEqual + \ [ + \ { + \ 'filename': ale#path#Simplify('/tmp/foo.inko'), + \ 'lnum': 4, + \ 'col': 5, + \ 'text': 'this is an error', + \ 'type': 'E', + \ } + \ ], + \ ale#handlers#inko#Handle(bufnr(''), [ + \ '[', + \ ' {', + \ ' "file": "/tmp/foo.inko",', + \ ' "line": 4,', + \ ' "column": 5,', + \ ' "message": "this is an error",', + \ ' "level": "error"', + \ ' }', + \ ']' + \ ]) + +Execute(The inko handler should parse warnings correctly): + AssertEqual + \ [ + \ { + \ 'filename': ale#path#Simplify('/tmp/foo.inko'), + \ 'lnum': 4, + \ 'col': 5, + \ 'text': 'this is a warning', + \ 'type': 'W', + \ } + \ ], + \ ale#handlers#inko#Handle(bufnr(''), [ + \ '[', + \ ' {', + \ ' "file": "/tmp/foo.inko",', + \ ' "line": 4,', + \ ' "column": 5,', + \ ' "message": "this is a warning",', + \ ' "level": "warning"', + \ ' }', + \ ']' + \ ]) + +Execute(The inko handler should handle empty output): + AssertEqual [], ale#handlers#inko#Handle(bufnr(''), []) diff --git a/sources_non_forked/ale/test/handler/test_ispc_ispc_handler.vader b/sources_non_forked/ale/test/handler/test_ispc_ispc_handler.vader new file mode 100644 index 00000000..619773fe --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ispc_ispc_handler.vader @@ -0,0 +1,90 @@ +Before: + runtime ale_linters/ispc/ispc.vim + +After: + call ale#linter#Reset() + +Execute(The ispc handler should parse input correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 0, + \ 'lnum': 33, + \ 'col': 14, + \ 'type': 'E', + \ 'text': 'syntax error, unexpected ''int'', expecting '','' or '';''.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 36, + \ 'col': 5, + \ 'type': 'E', + \ 'text': 'syntax error, unexpected ''for''.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 51, + \ 'col': 9, + \ 'type': 'E', + \ 'text': '''foobar.h'' file not found', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 79, + \ 'col': 52, + \ 'type': 'W', + \ 'text': 'Modulus operator with varying types is very inefficient.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 85, + \ 'col': 13, + \ 'type': 'W', + \ 'text': 'Undefined behavior: all program instances are writing to the same location!', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 93, + \ 'col': 19, + \ 'type': 'W', + \ 'text': 'Gather required to load value.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 93, + \ 'col': 9, + \ 'type': 'W', + \ 'text': 'Scatter required to store value.', + \ }, + \ ], + \ ale_linters#ispc#ispc#Handle(0, [ + \ 'Warning: No output file or header file name specified. Program will be compiled and warnings/errors will be issued, but no output will be generated. ', + \ 'Warning: No --target specified on command-line. Using default system target "avx2-i32x8".', + \ 'mandelbrot.ispc:33:14: Error: syntax error, unexpected ''int'', expecting '','' or '';''.', + \ 'static iline int mandel(float c_re, float c_im, int count) {', + \ ' ^^^', + \ '', + \ 'mandelbrot.ispc:36:5: Error: syntax error, unexpected ''for''.', + \ ' for (i = 0; i < count; ++i) {', + \ ' ^^^', + \ '', + \ 'mandelbrot.ispc:51:9: fatal error: ''foobar.h'' file not found', + \ '#include', + \ ' ^~~~~~~~~~', + \ 'mandelbrot.ispc:79:52: Performance Warning: Modulus operator with varying types is very inefficient.', + \ ' double x = x0 + i * (dx + epsilon*(k%2)*delta);', + \ ' ^^^', + \ '', + \ 'mandelbrot.ispc:85:13: Warning: Undefined behavior: all program instances are writing to the same location!', + \ ' output[index] = (NNN) / sample_size;', + \ ' ^^^^^^^^^^^^^', + \ '', + \ 'mandelbrot.ispc:93:19: Performance Warning: Gather required to load value.', + \ ' A[i*8] *= A[i*8];', + \ ' ^^^^^^', + \ '', + \ 'mandelbrot.ispc:93:9: Performance Warning: Scatter required to store value.', + \ ' A[i*8] *= A[i*8];', + \ ' ^^^^^^', + \ '', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_javac_handler.vader b/sources_non_forked/ale/test/handler/test_javac_handler.vader new file mode 100644 index 00000000..3dc245af --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_javac_handler.vader @@ -0,0 +1,97 @@ +Before: + runtime ale_linters/java/javac.vim + + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.java') + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The javac handler should handle cannot find symbol errors): + AssertEqual + \ [ + \ { + \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), + \ 'lnum': 1, + \ 'text': 'error: some error', + \ 'type': 'E', + \ }, + \ { + \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), + \ 'lnum': 2, + \ 'col': 5, + \ 'text': 'error: cannot find symbol: BadName', + \ 'type': 'E', + \ }, + \ { + \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), + \ 'lnum': 34, + \ 'col': 5, + \ 'text': 'error: cannot find symbol: BadName2', + \ 'type': 'E', + \ }, + \ { + \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), + \ 'lnum': 37, + \ 'text': 'warning: some warning', + \ 'type': 'W', + \ }, + \ { + \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), + \ 'lnum': 42, + \ 'col': 11, + \ 'text': 'error: cannot find symbol: bar()', + \ 'type': 'E', + \ }, + \ { + \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), + \ 'lnum': 58, + \ 'col': 19, + \ 'text': 'error: incompatible types: Bar cannot be converted to Foo', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#java#javac#Handle(bufnr(''), [ + \ '/tmp/vLPr4Q5/33/foo.java:1: error: some error', + \ '/tmp/vLPr4Q5/33/foo.java:2: error: cannot find symbol', + \ ' BadName foo() {', + \ ' ^', + \ ' symbol: class BadName', + \ ' location: class Bar', + \ '/tmp/vLPr4Q5/33/foo.java:34: error: cannot find symbol', + \ ' BadName2 foo() {', + \ ' ^', + \ ' symbol: class BadName2', + \ ' location: class Bar', + \ '/tmp/vLPr4Q5/33/foo.java:37: warning: some warning', + \ '/tmp/vLPr4Q5/33/foo.java:42: error: cannot find symbol', + \ ' this.bar();', + \ ' ^', + \ ' symbol: method bar()', + \ '/tmp/vLPr4Q5/33/foo.java:58: error: incompatible types: Bar cannot be converted to Foo', + \ ' this.setFoo(bar);', + \ ' ^', + \ '6 errors', + \ ]) + +Execute(The javac handler should resolve files from different directories): + AssertEqual + \ [ + \ { + \ 'filename': ale#path#Simplify(g:dir . '/Foo.java'), + \ 'lnum': 1, + \ 'text': 'error: some error', + \ 'type': 'E', + \ }, + \ { + \ 'filename': ale#path#Simplify(g:dir . '/Bar.java'), + \ 'lnum': 1, + \ 'text': 'error: some error', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#java#javac#Handle(bufnr(''), [ + \ './Foo.java:1: error: some error', + \ './Bar.java:1: error: some error', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_jscs_handler.vader b/sources_non_forked/ale/test/handler/test_jscs_handler.vader new file mode 100644 index 00000000..5566116f --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_jscs_handler.vader @@ -0,0 +1,39 @@ +Before: + runtime ale_linters/javascript/jscs.vim + +After: + call ale#linter#Reset() + +Execute(jscs should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 7, + \ 'text': 'Variable declarations should use `let` or `const` not `var`', + \ 'code': 'disallowVar', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 21, + \ 'text': 'Illegal trailing whitespace', + \ 'code': 'disallowTrailingWhitespace', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 9, + \ 'text': 'Variable `hello` is not used', + \ 'code': 'disallowUnusedVariables', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'Expected indentation of 1 characters', + \ }, + \ ], + \ ale_linters#javascript#jscs#Handle(347, [ + \ 'foobar.js: line 1, col 7, disallowVar: Variable declarations should use `let` or `const` not `var`', + \ 'foobar.js: line 3, col 21, disallowTrailingWhitespace: Illegal trailing whitespace', + \ 'foobar.js: line 5, col 9, disallowUnusedVariables: Variable `hello` is not used', + \ 'foobar.js: line 2, col 1, Expected indentation of 1 characters', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_ktlint_handler.vader b/sources_non_forked/ale/test/handler/test_ktlint_handler.vader new file mode 100644 index 00000000..f0d634e6 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ktlint_handler.vader @@ -0,0 +1,21 @@ +Before: + Save g:ale_kotlin_ktlint_rulesets + + let g:ale_kotlin_ktlint_rulesets = [] + +After: + Restore + +Execute(The ktlint handler method GetRulesets should properly parse custom rulesets): + let g:ale_kotlin_ktlint_rulesets = ['/path/to/custom/ruleset.jar', '/path/to/other/ruleset.jar'] + + AssertEqual + \ '--ruleset /path/to/custom/ruleset.jar --ruleset /path/to/other/ruleset.jar', + \ ale#handlers#ktlint#GetRulesets(bufnr('')) + +Execute(The ktlint handler method GetRulesets should return an empty string when no rulesets have been configured): + let g:ale_kotlin_ktlint_rulesets = [] + + AssertEqual + \ '', + \ ale#handlers#ktlint#GetRulesets(bufnr('')) diff --git a/sources_non_forked/ale/test/handler/test_lacheck_handler.vader b/sources_non_forked/ale/test/handler/test_lacheck_handler.vader new file mode 100644 index 00000000..5d1b6ace --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_lacheck_handler.vader @@ -0,0 +1,34 @@ +Before: + runtime ale_linters/tex/lacheck.vim + call ale#test#SetDirectory('/testplugin/test/handler') + +After: + call ale#linter#Reset() + call ale#test#RestoreDirectory() + +Execute(The lacheck handler should parse lines correctly): + call ale#test#SetFilename('../test-files/tex/sample1.tex') + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'W', + \ 'text': 'perhaps you should insert a `~'' before "\ref"' + \ } + \ ], + \ ale_linters#tex#lacheck#Handle(bufnr(''), [ + \ "** sample1:", + \ "\"sample1.tex\", line 1: perhaps you should insert a `~' before \"\\ref\"" + \ ]) + +Execute(The lacheck handler should ignore errors from input files): + call ale#test#SetFilename('ale_test.tex') + + AssertEqual + \ [ + \ ], + \ ale_linters#tex#lacheck#Handle(255, [ + \ "** ale_input:", + \ "\"ale_input.tex\", line 1: perhaps you should insert a `~' before \"\\ref\"" + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_languagetool_handler.vader b/sources_non_forked/ale/test/handler/test_languagetool_handler.vader new file mode 100644 index 00000000..61d3abfd --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_languagetool_handler.vader @@ -0,0 +1,62 @@ +Before: + runtime! ale_linters/text/languagetool.vim + +After: + call ale#linter#Reset() + +Execute(languagetool handler should report 3 errors): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col': 19, + \ 'end_col': 20, + \ 'text': 'This sentence does not start with an uppercase letter', + \ 'type': 'W', + \ 'code': 'UPPERCASE_SENTENCE_START', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 36, + \ 'end_col': 42, + \ 'text': "Did you mean 'to see'?", + \ 'type': 'W', + \ 'code': 'TOO_TO[1]', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 44, + \ 'end_col': 45, + \ 'text': "Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'", + \ 'type': 'W', + \ 'code': 'EN_A_VS_AN', + \ } + \ ], + \ ale#handlers#languagetool#HandleOutput(bufnr(''), [ + \ '1.) Line 3, column 19, Rule ID: UPPERCASE_SENTENCE_START', + \ 'Message: This sentence does not start with an uppercase letter', + \ 'Suggestion: Or', + \ '...red phrases for details on potential errors. or use this text too see an few of of the probl...', + \ ' ^^ ', + \ '', + \ '2.) Line 3, column 36, Rule ID: TOO_TO[1]', + \ "Message: Did you mean 'to see'?", + \ 'Suggestion: to see', + \ '...etails on potential errors. or use this text too see an few of of the problems that LanguageTool ...', + \ ' ^^^^^^^ ', + \ '', + \ '3.) Line 3, column 44, Rule ID: EN_A_VS_AN', + \ "Message: Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'", + \ 'Suggestion: a', + \ '...n potential errors. or use this text too see an few of of the problems that LanguageTool can...', + \ ' ^^ ', + \ 'Time: 2629ms for 8 sentences (3.0 sentences/sec)' + \ ]) + +Execute(languagetool handler should report no errors on empty input): + AssertEqual + \ [], + \ ale#handlers#languagetool#HandleOutput(bufnr(''), [ + \ '', + \ 'Time: 2629ms for 8 sentences (3.0 sentences/sec)' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_lessc_handler.vader b/sources_non_forked/ale/test/handler/test_lessc_handler.vader new file mode 100644 index 00000000..31de5593 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_lessc_handler.vader @@ -0,0 +1,69 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/handler') + call ale#test#SetFilename('testfile.less') + + runtime ale_linters/less/lessc.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The lessc handler should handle errors for the current file correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Unrecognised input. Possibly missing something', + \ }, + \ ], + \ ale_linters#less#lessc#Handle(bufnr(''), [ + \ 'ParseError: Unrecognised input. Possibly missing something in - on line 2, column 1:', + \ '1 vwewww', + \ '2 ', + \]) + +Execute(The lessc handler should handle errors for other files in the same directory correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Unrecognised input. Possibly missing something', + \ 'filename': ale#path#Simplify(g:dir . '/imported.less') + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Unrecognised input. Possibly missing something', + \ 'filename': ale#path#Simplify(g:dir . '/imported.less') + \ }, + \ ], + \ ale_linters#less#lessc#Handle(bufnr(''), [ + \ 'ParseError: Unrecognised input. Possibly missing something in imported.less on line 2, column 1:', + \ '1 vwewww', + \ '2 ', + \ 'ParseError: Unrecognised input. Possibly missing something in ./imported.less on line 2, column 1:', + \ '1 vwewww', + \ '2 ', + \]) + +Execute(The lessc handler should handle errors for files in directories above correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Unrecognised input. Possibly missing something', + \ 'filename': ale#path#Simplify(g:dir . '/../imported2.less') + \ }, + \ ], + \ ale_linters#less#lessc#Handle(bufnr(''), [ + \ 'ParseError: Unrecognised input. Possibly missing something in ../imported2.less on line 2, column 1:', + \ '1 vwewww', + \ '2 ', + \]) diff --git a/sources_non_forked/ale/test/handler/test_llc_handler.vader b/sources_non_forked/ale/test/handler/test_llc_handler.vader new file mode 100644 index 00000000..bbe686f2 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_llc_handler.vader @@ -0,0 +1,58 @@ +Before: + runtime! ale_linters/llvm/llc.vim + +After: + call ale#linter#Reset() + +Execute(llc handler should parse errors output for STDIN): + AssertEqual + \ [ + \ { + \ 'lnum': 10, + \ 'col': 7, + \ 'text': "error: value doesn't match function result type 'i32'", + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 13, + \ 'text': "error: use of undefined value '@foo'", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#llvm#llc#HandleErrors(bufnr(''), [ + \ "llc: :10:7: error: value doesn't match function result type 'i32'", + \ 'ret i64 0', + \ ' ^', + \ '', + \ "llc: :10:13: error: use of undefined value '@foo'", + \ 'call void @foo(i64 %0)', + \ ' ^', + \ ]) + +Execute(llc handler should parse errors output for some file): + call ale#test#SetFilename('test.ll') + AssertEqual + \ [ + \ { + \ 'lnum': 10, + \ 'col': 7, + \ 'text': "error: value doesn't match function result type 'i32'", + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 13, + \ 'text': "error: use of undefined value '@foo'", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#llvm#llc#HandleErrors(bufnr(''), [ + \ "llc: /path/to/test.ll:10:7: error: value doesn't match function result type 'i32'", + \ 'ret i64 0', + \ ' ^', + \ '', + \ "llc: /path/to/test.ll:10:13: error: use of undefined value '@foo'", + \ 'call void @foo(i64 %0)', + \ ' ^', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_lua_selene_handler.vader b/sources_non_forked/ale/test/handler/test_lua_selene_handler.vader new file mode 100644 index 00000000..e9410ae9 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_lua_selene_handler.vader @@ -0,0 +1,38 @@ +Before: + runtime ale_linters/lua/selene.vim + +After: + Restore + call ale#linter#Reset() + +Execute(The selene handler for Lua should parse input correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'end_lnum': 2, + \ 'col': 1, + \ 'end_col': 3, + \ 'text': 'empty if block', + \ 'code': 'empty_if', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 1, + \ 'end_lnum': 1, + \ 'col': 4, + \ 'end_col': 11, + \ 'text': 'comparing things to nan directly is not allowed', + \ 'code': 'compare_nan', + \ 'type': 'E', + \ 'detail': "comparing things to nan directly is not allowed\n\ntry: `x ~= x` instead" + \ }, + \ ], + \ ale_linters#lua#selene#Handle(0, [ + \ '{"severity":"Warning","code":"empty_if","message":"empty if block","primary_label":{"span":{"start":0,"start_line":0,"start_column":0,"end":20,"end_line":1,"end_column":3},"message":""},"notes":[],"secondary_labels":[]}', + \ '{"severity":"Error","code":"compare_nan","message":"comparing things to nan directly is not allowed","primary_label":{"span":{"start":3,"start_line":0,"start_column":3,"end":11,"end_line":0,"end_column":11},"message":""},"notes":["try: `x ~= x` instead"],"secondary_labels":[]}', + \ 'Results:', + \ '1 errors', + \ '1 warnings', + \ '0 parse errors', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_luac_handler.vader b/sources_non_forked/ale/test/handler/test_luac_handler.vader new file mode 100644 index 00000000..3a2e769c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_luac_handler.vader @@ -0,0 +1,36 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/lua/luac.vim + +After: + Restore + call ale#linter#Reset() + +Execute(The luac handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'line contains trailing whitespace', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 3, + \ 'text': 'unexpected symbol near ''-''', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 5, + \ 'text': '''='' expected near '')''', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#lua#luac#Handle(347, [ + \ 'luac /file/path/here.lua:1: line contains trailing whitespace', + \ 'luac /file/path/here.lua:3: unexpected symbol near ''-''', + \ 'luac /file/path/here.lua:5: ''='' expected near '')''', + \ ]) + diff --git a/sources_non_forked/ale/test/handler/test_luacheck_handler.vader b/sources_non_forked/ale/test/handler/test_luacheck_handler.vader new file mode 100644 index 00000000..7cebb017 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_luacheck_handler.vader @@ -0,0 +1,62 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/lua/luacheck.vim + +After: + Restore + call ale#linter#Reset() + +Execute(The luacheck handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 8, + \ 'text': 'line contains trailing whitespace', + \ 'code': 'W612', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'text': 'unused loop variable ''k''', + \ 'code': 'W213', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 19, + \ 'text': 'accessing undefined variable ''x''', + \ 'code': 'W113', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#lua#luacheck#Handle(347, [ + \ ' /file/path/here.lua:1:8: (W612) line contains trailing whitespace', + \ ' /file/path/here.lua:3:5: (W213) unused loop variable ''k''', + \ ' /file/path/here.lua:3:19: (W113) accessing undefined variable ''x''', + \ ]) + +Execute(The luacheck handler should respect the warn_about_trailing_whitespace option): + let g:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 43, + \ 'text': 'unused argument ''g''', + \ 'code': 'W212', + \ 'type': 'W', + \ } + \ ], + \ ale_linters#lua#luacheck#Handle(347, [ + \ '/file/path/here.lua:15:97: (W614) trailing whitespace in a comment', + \ '/file/path/here.lua:16:60: (W612) line contains trailing whitespace', + \ '/file/path/here.lua:17:1: (W611) line contains only whitespace', + \ '/file/path/here.lua:27:57: (W613) trailing whitespace in a string', + \ '/file/path/here.lua:5:43: (W212) unused argument ''g''', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_markdownlint_handler.vader b/sources_non_forked/ale/test/handler/test_markdownlint_handler.vader new file mode 100644 index 00000000..f2e6e328 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_markdownlint_handler.vader @@ -0,0 +1,91 @@ +Before: + runtime ale_linters/markdown/markdownlint.vim + +After: + call ale#linter#Reset() + +Execute(The Markdownlint handler should parse pre v0.19.0 output with single digit line correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'code': 'MD013/line-length', + \ 'text': 'Line length [Expected: 80; Actual: 114]', + \ 'type': 'W' + \ } + \ ], + \ ale#handlers#markdownlint#Handle(0, [ + \ 'README.md: 1: MD013/line-length Line length [Expected: 80; Actual: 114]' + \ ]) + +Execute(The Markdownlint handler should parse pre v0.19.0 output with multi digit line correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 100, + \ 'code': 'MD013/line-length', + \ 'text': 'Line length [Expected: 80; Actual: 114]', + \ 'type': 'W' + \ } + \ ], + \ ale#handlers#markdownlint#Handle(0, [ + \ 'README.md: 100: MD013/line-length Line length [Expected: 80; Actual: 114]' + \ ]) + +Execute(The Markdownlint handler should parse post v0.19.0 output with single digit line correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'code': 'MD013/line-length', + \ 'text': 'Line length [Expected: 80; Actual: 114]', + \ 'type': 'W' + \ } + \ ], + \ ale#handlers#markdownlint#Handle(0, [ + \ 'README.md:1 MD013/line-length Line length [Expected: 80; Actual: 114]' + \ ]) + +Execute(The Markdownlint handler should parse post v0.19.0 output with multi digit line correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 100, + \ 'code': 'MD013/line-length', + \ 'text': 'Line length [Expected: 80; Actual: 114]', + \ 'type': 'W' + \ } + \ ], + \ ale#handlers#markdownlint#Handle(0, [ + \ 'README.md:100 MD013/line-length Line length [Expected: 80; Actual: 114]' + \ ]) + + +Execute(The Markdownlint handler should parse post v0.22.0 output with column correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 10, + \ 'col': 20, + \ 'code': 'MD013/line-length', + \ 'text': 'Line length [Expected: 80; Actual: 114]', + \ 'type': 'W' + \ } + \ ], + \ ale#handlers#markdownlint#Handle(0, [ + \ 'README.md:10:20 MD013/line-length Line length [Expected: 80; Actual: 114]' + \ ]) + +Execute(The Markdownlint handler should parse output with multiple slashes in rule name correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 10, + \ 'code': 'MD022/blanks-around-headings/blanks-around-headers', + \ 'text': 'Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "### something"]', + \ 'type': 'W' + \ } + \ ], + \ ale#handlers#markdownlint#Handle(0, [ + \ 'README.md:10 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "### something"]' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_mcs_handler.vader b/sources_non_forked/ale/test/handler/test_mcs_handler.vader new file mode 100644 index 00000000..3defc328 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_mcs_handler.vader @@ -0,0 +1,37 @@ +Before: + runtime ale_linters/cs/mcs.vim + +After: + call ale#linter#Reset() + +Execute(The mcs handler should handle cannot find symbol errors): + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col' : 29, + \ 'text': '; expected', + \ 'code': 'CS1001', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 101, + \ 'col': 0, + \ 'text': 'Unexpected processor directive (no #if for this #endif)', + \ 'code': 'CS1028', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 12, + \ 'text': 'some warning', + \ 'code': 'CS0123', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#cs#mcs#Handle(347, [ + \ 'Tests.cs(12,29): error CS1001: ; expected', + \ 'Tests.cs(101,0): error CS1028: Unexpected processor directive (no #if for this #endif)', + \ 'Tests.cs(10,12): warning CS0123: some warning', + \ 'Compilation failed: 2 error(s), 1 warnings', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_mcsc_handler.vader b/sources_non_forked/ale/test/handler/test_mcsc_handler.vader new file mode 100644 index 00000000..c04f7d27 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_mcsc_handler.vader @@ -0,0 +1,88 @@ +Before: + Save g:ale_cs_mcsc_source + + unlet! g:ale_cs_mcsc_source + + call ale#test#SetDirectory('/testplugin/test/handler') + call ale#test#SetFilename('Test.cs') + + runtime ale_linters/cs/mcsc.vim + +After: + unlet! g:ale_cs_mcsc_source + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The mcs handler should work with the default of the buffer's directory): + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col' : 29, + \ 'text': '; expected', + \ 'code': 'CS1001', + \ 'type': 'E', + \ 'filename': ale#path#Simplify(g:dir . '/Test.cs'), + \ }, + \ ], + \ ale_linters#cs#mcsc#Handle(bufnr(''), [ + \ 'Test.cs(12,29): error CS1001: ; expected', + \ 'Compilation failed: 2 error(s), 1 warnings', + \ ]) + +Execute(The mcs handler should handle cannot find symbol errors): + let g:ale_cs_mcsc_source = '/home/foo/project/bar' + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'col' : 29, + \ 'text': '; expected', + \ 'code': 'CS1001', + \ 'type': 'E', + \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), + \ }, + \ { + \ 'lnum': 101, + \ 'col': 0, + \ 'text': 'Unexpected processor directive (no #if for this #endif)', + \ 'code': 'CS1028', + \ 'type': 'E', + \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), + \ }, + \ { + \ 'lnum': 10, + \ 'col': 12, + \ 'text': 'some warning', + \ 'code': 'CS0123', + \ 'type': 'W', + \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), + \ }, + \ ], + \ ale_linters#cs#mcsc#Handle(bufnr(''), [ + \ 'Test.cs(12,29): error CS1001: ; expected', + \ 'Test.cs(101,0): error CS1028: Unexpected processor directive (no #if for this #endif)', + \ 'Test.cs(10,12): warning CS0123: some warning', + \ 'Compilation failed: 2 error(s), 1 warnings', + \ ]) + +Execute(The mcsc handler should handle non file specific compiler errors without reporting overal status report as error): + let g:ale_cs_mcsc_source = '/home/foo/project/bar' + + AssertEqual + \ [ + \ { + \ 'lnum': -1, + \ 'col' : -1, + \ 'text': 'No files to compile were specified', + \ 'code': 'CS2008', + \ 'type': 'E', + \ 'filename': '', + \ }, + \ ], + \ ale_linters#cs#mcsc#Handle(bufnr(''), [ + \ 'error CS2008: No files to compile were specified', + \ 'Compilation failed: 1 error(s), 0 warnings', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_mdl_handler.vader b/sources_non_forked/ale/test/handler/test_mdl_handler.vader new file mode 100644 index 00000000..d01b52af --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_mdl_handler.vader @@ -0,0 +1,25 @@ +Before: + runtime ale_linters/markdown/mdl.vim + +After: + call ale#linter#Reset() + +Execute(The mdl handler should parse output correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'code': 'MD002/first-header-h1', + \ 'text': 'First header should be a top level header', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 18, + \ 'code': 'MD033/no-inline-html', + \ 'text': 'Inline HTML', + \ 'type': 'W' + \ } + \ ], + \ ale_linters#markdown#mdl#Handle(0, [ + \ '[{"filename":"README.md","line":1,"rule":"MD002","aliases":["first-header-h1"],"description":"First header should be a top level header"},{"filename":"README.md","line":18,"rule":"MD033","aliases":["no-inline-html"],"description":"Inline HTML"}]' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_mercury_mmc_handler.vader b/sources_non_forked/ale/test/handler/test_mercury_mmc_handler.vader new file mode 100644 index 00000000..e862f287 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_mercury_mmc_handler.vader @@ -0,0 +1,58 @@ +Before: + runtime ale_linters/mercury/mmc.vim + +After: + call ale#linter#Reset() + +Execute(The mmc handler should handle syntax errors): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'type': 'E', + \ 'text': "Syntax error at token ',': operator precedence error." + \ } + \ ], + \ ale_linters#mercury#mmc#Handle(1, [ + \ "file_name.m:003: Syntax error at token ',': operator precedence error." + \ ]) + +Execute(The mmc handler should handle warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 10, + \ 'type': 'W', + \ 'text': 'Warning: reference to uninitialized state variable !.X.' + \ }, + \ { + \ 'lnum': 12, + \ 'type': 'W', + \ 'text': 'warning: determinism declaration could be tighter.' + \ } + \ ], + \ ale_linters#mercury#mmc#Handle(1, [ + \ 'file_name.m:010: Warning: reference to uninitialized state variable !.X.', + \ "file_name.m:012: In `some_predicate':", + \ 'file_name.m:012: warning: determinism declaration could be tighter.' + \ ]) + +Execute(The mmc handler should handle semantic errors): + AssertEqual + \ [ + \ { + \ 'lnum': 7, + \ 'type': 'E', + \ 'text': "error: undefined type `bar'/0." + \ }, + \ { + \ 'lnum': 15, + \ 'type': 'E', + \ 'text': "Error: circular equivalence type `file_name.foo'/0." + \ } + \ ], + \ ale_linters#mercury#mmc#Handle(1, [ + \ "file_name.m:007: In clause for predicate `foldit'/4:", + \ "file_name.m:007: error: undefined type `bar'/0.", + \ "file_name.m:015: Error: circular equivalence type `file_name.foo'/0." + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_mix_handler.vader b/sources_non_forked/ale/test/handler/test_mix_handler.vader new file mode 100644 index 00000000..a5549b5d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_mix_handler.vader @@ -0,0 +1,21 @@ +Before: + runtime ale_linters/elixir/mix.vim + +After: + call ale#linter#Reset() + +Execute(The mix handler should parse lines correctly): + + AssertEqual + \ [ + \ { + \ 'bufnr': 347, + \ 'lnum': 87, + \ 'col': 0, + \ 'text': 'undefined function update_in/4', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#elixir#mix#Handle(347, [ + \ '** (CompileError) apps/sim/lib/sim/server.ex:87: undefined function update_in/4' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_msgfmt_hander.vader b/sources_non_forked/ale/test/handler/test_msgfmt_hander.vader new file mode 100644 index 00000000..1a67dbc6 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_msgfmt_hander.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/po/msgfmt.vim + +After: + call ale#linter#Reset() + +Execute(Duplicate messages should be made easier to navigate): + AssertEqual + \ [ + \ {'lnum': 14, 'col': 0, 'type': 'W', 'text': 'some other thing'}, + \ {'lnum': 1746, 'col': 0, 'type': 'W', 'text': 'duplicate of message at line 262'}, + \ {'lnum': 262, 'col': 0, 'type': 'W', 'text': 'first location of duplicate of message at line 1746'}, + \ {'lnum': 666, 'col': 0, 'type': 'W', 'text': 'duplicate message definition...'}, + \ {'lnum': 888, 'col': 0, 'type': 'W', 'text': 'some other thing'}, + \ {'lnum': 999, 'col': 0, 'type': 'W', 'text': '...this is the location of the first definition'}, + \ ], + \ ale_linters#po#msgfmt#Handle(bufnr(''), [ + \ '/tmp/v6GMUFf/16/foo.po:14: some other thing', + \ '/tmp/v6GMUFf/16/foo.po:1746: duplicate message definition...', + \ '/tmp/v6GMUFf/16/foo.po:262: ...this is the location of the first definition', + \ '/tmp/v6GMUFf/16/foo.po:666: duplicate message definition...', + \ '/tmp/v6GMUFf/16/foo.po:888: some other thing', + \ '/tmp/v6GMUFf/16/foo.po:999: ...this is the location of the first definition', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_mypy_handler.vader b/sources_non_forked/ale/test/handler/test_mypy_handler.vader new file mode 100644 index 00000000..039155a2 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_mypy_handler.vader @@ -0,0 +1,141 @@ +Before: + Save g:ale_python_mypy_ignore_invalid_syntax + Save g:ale_python_mypy_show_notes + + unlet! g:ale_python_mypy_show_notes + unlet! g:ale_python_mypy_ignore_invalid_syntax + + runtime ale_linters/python/mypy.vim + + call ale#test#SetDirectory('/testplugin/test/handler') + +After: + Restore + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The mypy handler should parse lines correctly): + call ale#test#SetFilename('__init__.py') + + let g:ale_python_mypy_show_notes = 0 + + AssertEqual + \ [ + \ { + \ 'lnum': 768, + \ 'col': 38, + \ 'filename': ale#path#Simplify(g:dir . '/baz.py'), + \ 'type': 'E', + \ 'text': 'Cannot determine type of ''SOME_SYMBOL''', + \ }, + \ { + \ 'lnum': 821, + \ 'col': 38, + \ 'filename': ale#path#Simplify(g:dir . '/baz.py'), + \ 'type': 'E', + \ 'text': 'Cannot determine type of ''SOME_SYMBOL''', + \ }, + \ { + \ 'lnum': 38, + \ 'col': 44, + \ 'filename': ale#path#Simplify(g:dir . '/other.py'), + \ 'type': 'E', + \ 'text': 'Cannot determine type of ''ANOTHER_SYMBOL''', + \ }, + \ { + \ 'lnum': 15, + \ 'col': 3, + \ 'filename': ale#path#Simplify(g:dir . '/__init__.py'), + \ 'type': 'E', + \ 'text': 'Argument 1 to "somefunc" has incompatible type "int"; expected "str"' + \ }, + \ { + \ 'lnum': 72, + \ 'col': 1, + \ 'filename': ale#path#Simplify(g:dir . '/__init__.py'), + \ 'type': 'W', + \ 'text': 'Some warning', + \ }, + \ ], + \ ale_linters#python#mypy#Handle(bufnr(''), [ + \ 'baz.py: note: In class "SomeClass":', + \ 'baz.py:768:38: error: Cannot determine type of ''SOME_SYMBOL''', + \ 'baz.py: note: In class "AnotherClass":', + \ 'baz.py:821:38: error: Cannot determine type of ''SOME_SYMBOL''', + \ '__init__.py:92: note: In module imported here:', + \ 'other.py: note: In class "YetAnotherClass":', + \ 'other.py:38:44: error: Cannot determine type of ''ANOTHER_SYMBOL''', + \ '__init__.py: note: At top level:', + \ '__init__.py:15:3: error: Argument 1 to "somefunc" has incompatible type "int"; expected "str"', + \ 'another_module/bar.py:14: note: In module imported here,', + \ 'another_module/__init__.py:16: note: ... from here,', + \ '__init__.py:72:1: warning: Some warning', + \ ]) + +Execute(The mypy handler should show notes if enabled): + call ale#test#SetFilename('__init__.py') + + AssertEqual + \ [ + \ { + \ 'lnum': 72, + \ 'col': 1, + \ 'filename': ale#path#Simplify(g:dir . '/__init__.py'), + \ 'type': 'I', + \ 'text': 'A note', + \ }, + \ ], + \ ale_linters#python#mypy#Handle(bufnr(''), [ + \ '__init__.py:72:1: note: A note', + \ ]) + + let g:ale_python_mypy_show_notes = 0 + + AssertEqual + \ [], + \ ale_linters#python#mypy#Handle(bufnr(''), [ + \ '__init__.py:72:1: note: A note', + \ ]) + +Execute(The mypy handler should handle Windows names with spaces): + " This test works on Unix, where this is seen as a single filename + silent file C:\\something\\with\ spaces.py + + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 0, + \ 'filename': ale#path#Simplify('C:\something\with spaces.py'), + \ 'type': 'E', + \ 'text': 'No library stub file for module ''django.db''', + \ }, + \ ], + \ ale_linters#python#mypy#Handle(bufnr(''), [ + \ 'C:\something\with spaces.py:4: error: No library stub file for module ''django.db''', + \ ]) + +Execute(The mypy syntax errors shouldn't be ignored by default): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 0, + \ 'filename': ale#path#Simplify(g:dir . '/foo.py'), + \ 'type': 'E', + \ 'text': 'invalid syntax', + \ }, + \ ], + \ ale_linters#python#mypy#Handle(bufnr(''), [ + \ 'foo.py:4: error: invalid syntax', + \ ]) + +Execute(The mypy syntax errors should be ignored when the option is on): + let g:ale_python_mypy_ignore_invalid_syntax = 1 + + AssertEqual + \ [], + \ ale_linters#python#mypy#Handle(bufnr(''), [ + \ 'foo.py:4: error: invalid syntax', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_naga_handler.vader b/sources_non_forked/ale/test/handler/test_naga_handler.vader new file mode 100644 index 00000000..48b8c281 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_naga_handler.vader @@ -0,0 +1,23 @@ +Before: + runtime ale_linters/wgsl/naga.vim + +After: + call ale#linter#Reset() + +Execute(Error handler should parse error message and position from input): + let example_output = [ + \ "error: expected global item ('struct', 'let', 'var', 'type', ';', 'fn') or the end of the file, found '['", + \ " ┌─ wgsl:5:1", + \ " │", + \ "5 │ [[group(1), binding(0)]]", + \ " │ ^ expected global item ('struct', 'let', 'var', 'type', ';', 'fn') or the end of the file", + \ "Could not parse WGSL", + \ ] + let actual = ale#handlers#naga#Handle(0, example_output) + let expected = [{ + \ "text": "expected global item ('struct', 'let', 'var', 'type', ';', 'fn') or the end of the file, found '['", + \ "lnum": 5, + \ "col": 1, + \ "type": "E", + \ }] + AssertEqual actual, expected diff --git a/sources_non_forked/ale/test/handler/test_nagelfar_handler.vader b/sources_non_forked/ale/test/handler/test_nagelfar_handler.vader new file mode 100644 index 00000000..ceaee19c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_nagelfar_handler.vader @@ -0,0 +1,174 @@ +Before: + runtime ale_linters/tcl/nagelfar.vim + +After: + call ale#linter#Reset() + +Execute(The nagelfar handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'type': 'W', + \ 'text': 'Found constant "bepa" which is also a variable.' + \ }, + \ { + \ 'lnum': 7, + \ 'type': 'E', + \ 'text': 'Unknown variable "cep"' + \ }, + \ { + \ 'lnum': 7, + \ 'type': 'W', + \ 'text': 'Unknown command "se"' + \ }, + \ { + \ 'lnum': 8, + \ 'type': 'E', + \ 'text': 'Unknown variable "epa"' + \ }, + \ { + \ 'lnum': 10, + \ 'type': 'E', + \ 'text': 'Unknown variable "depa"' + \ }, + \ { + \ 'lnum': 10, + \ 'type': 'W', + \ 'text': 'Suspicious variable name "$depa"' + \ }, + \ { + \ 'lnum': 11, + \ 'type': 'W', + \ 'text': 'Suspicious variable name "$cepa"' + \ }, + \ { + \ 'lnum': 13, + \ 'type': 'E', + \ 'text': 'Wrong number of arguments (3) to "set"' + \ }, + \ { + \ 'lnum': 13, + \ 'type': 'W', + \ 'text': 'Found constant "bepa" which is also a variable.' + \ }, + \ { + \ 'lnum': 13, + \ 'type': 'W', + \ 'text': 'Found constant "cepa" which is also a variable.' + \ }, + \ { + \ 'lnum': 18, + \ 'type': 'E', + \ 'text': 'Badly formed if statement' + \ }, + \ { + \ 'lnum': 24, + \ 'type': 'E', + \ 'text': 'Unknown subcommand "gurka" to "info"' + \ }, + \ { + \ 'lnum': 31, + \ 'type': 'W', + \ 'text': 'Switch pattern starting with #. This could be a bad comment.' + \ }, + \ { + \ 'lnum': 31, + \ 'type': 'W', + \ 'text': 'Unknown command "This"' + \ }, + \ { + \ 'lnum': 31, + \ 'type': 'W', + \ 'text': 'Unknown command "bad"' + \ }, + \ { + \ 'lnum': 34, + \ 'type': 'W', + \ 'text': 'Unknown command "miffo"' + \ }, + \ { + \ 'lnum': 55, + \ 'type': 'W', + \ 'text': 'Suspicious variable name "$bepa"' + \ }, + \ { + \ 'lnum': 56, + \ 'type': 'W', + \ 'text': 'Suspicious variable name "$apa"' + \ }, + \ { + \ 'lnum': 61, + \ 'type': 'E', + \ 'text': 'Could not complete statement.' + \ }, + \ { + \ 'lnum': 67, + \ 'type': 'E', + \ 'text': 'Could not complete statement.' + \ }, + \ { + \ 'lnum': 70, + \ 'type': 'E', + \ 'text': 'Wrong number of arguments (4) to "proc"' + \ }, + \ { + \ 'lnum': 72, + \ 'type': 'E', + \ 'text': 'Wrong number of arguments (1) to "if"' + \ }, + \ { + \ 'lnum': 75, + \ 'type': 'E', + \ 'text': 'Unbalanced close brace found' + \ }, + \ { + \ 'lnum': 82, + \ 'type': 'E', + \ 'text': 'Unbalanced close brace found' + \ }, + \ { + \ 'lnum': 88, + \ 'type': 'E', + \ 'text': 'Could not complete statement.' + \ }, + \ { + \ 'lnum': 90, + \ 'type': 'E', + \ 'text': 'Wrong number of arguments (1) to "if"' + \ }, + \ { + \ 'lnum': 93, + \ 'type': 'W', + \ 'text': 'Close brace not aligned with line 90 (4 0)' + \ }, + \ ], + \ ale_linters#tcl#nagelfar#Handle(bufnr(''), [ + \ 'Line 5: W Found constant "bepa" which is also a variable.', + \ 'Line 7: E Unknown variable "cep"', + \ 'Line 7: W Unknown command "se"', + \ 'Line 8: E Unknown variable "epa"', + \ 'Line 10: E Unknown variable "depa"', + \ 'Line 10: N Suspicious variable name "$depa"', + \ 'Line 11: N Suspicious variable name "$cepa"', + \ 'Line 13: E Wrong number of arguments (3) to "set"', + \ 'Line 13: W Found constant "bepa" which is also a variable.', + \ 'Line 13: W Found constant "cepa" which is also a variable.', + \ 'Line 18: E Badly formed if statement', + \ 'Line 24: E Unknown subcommand "gurka" to "info"', + \ 'Line 31: W Switch pattern starting with #. This could be a bad comment.', + \ 'Line 31: W Unknown command "This"', + \ 'Line 31: W Unknown command "bad"', + \ 'Line 34: W Unknown command "miffo"', + \ 'Line 55: N Suspicious variable name "$bepa"', + \ 'Line 56: N Suspicious variable name "$apa"', + \ 'Line 61: E Could not complete statement.', + \ 'Line 67: E Could not complete statement.', + \ 'Line 70: E Wrong number of arguments (4) to "proc"', + \ 'Line 72: E Wrong number of arguments (1) to "if"', + \ 'Line 75: E Unbalanced close brace found', + \ 'Line 82: E Unbalanced close brace found', + \ 'Line 88: E Could not complete statement.', + \ 'Line 90: E Wrong number of arguments (1) to "if"', + \ 'Line 93: N Close brace not aligned with line 90 (4 0)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_nasm_handler.vader b/sources_non_forked/ale/test/handler/test_nasm_handler.vader new file mode 100644 index 00000000..9c7d9650 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_nasm_handler.vader @@ -0,0 +1,30 @@ +Before: + runtime ale_linters/nasm/nasm.vim + +After: + call ale#linter#Reset() + +Execute(The nasm handler should parse GCC style output from nasm correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'text': "label alone on a line without a colon might be in error", + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 4, + \ 'text': "invalid combination of opcode and operands", + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 7, + \ 'text': "unable to open include file `bar.asm'", + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#nasm#nasm#Handle(bufnr(''), [ + \ "tmp.asm:2: warning: label alone on a line without a colon might be in error", + \ "tmp.asm:4: error: invalid combination of opcode and operands", + \ "tmp.asm:7: fatal: unable to open include file `bar.asm'" + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_nim_handler.vader b/sources_non_forked/ale/test/handler/test_nim_handler.vader new file mode 100644 index 00000000..b6784d84 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_nim_handler.vader @@ -0,0 +1,80 @@ +Before: + runtime ale_linters/nim/nimcheck.vim + +After: + call ale#linter#Reset() + +Execute(Parsing nim errors should work): + silent file foobar.nim + + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 8, + \ 'text': 'use {.base.} for base methods; baseless methods are deprecated', + \ 'code': 'UseBase', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 12, + \ 'col': 2, + \ 'text': 'identifier expected, but found ''a.barfoo''', + \ 'type': 'E', + \ 'end_col': 9, + \ }, + \ { + \ 'lnum': 2, + \ 'col': 5, + \ 'text': '''NotUsed'' is declared but not used', + \ 'code': 'XDeclaredButNotUsed', + \ 'type': 'W', + \ 'end_col': 11, + \ }, + \ { + \ 'lnum': 12, + \ 'col': 2, + \ 'text': 'with : character', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 8, + \ 'text': 'imported and not used: ''strutils''', + \ 'code': 'UnusedImport', + \ 'type': 'W', + \ 'end_col': 15, + \ }, + \ { + \ 'lnum': 12, + \ 'col': 9, + \ 'text': 'undeclared identifier: ''total''', + \ 'type': 'E', + \ 'end_col': 13, + \ }, + \ { + \ 'lnum': 14, + \ 'col': 1, + \ 'text': '''sum'' cannot be assigned to', + \ 'type': 'E', + \ 'end_col': 3, + \ }, + \ { + \ 'lnum': 15, + \ 'col': 1, + \ 'text': 'redefinition of ''getName''; previous declaration here: /nested/folder/foobar.nim(14, 6)', + \ 'type': 'E', + \ 'end_col': 7, + \ }, + \ ], + \ ale_linters#nim#nimcheck#Handle(bufnr(''), [ + \ 'Line with wrong( format)', + \ 'foobar.nim(8, 8) Warning: use {.base.} for base methods; baseless methods are deprecated [UseBase]', + \ 'foobar.nim(12, 2) Error: identifier expected, but found ''a.barfoo''', + \ '/nested/folder/foobar.nim(2, 5) Hint: ''NotUsed'' is declared but not used [XDeclaredButNotUsed]', + \ 'foobar.nim(12, 2) Error: with : character', + \ 'foobar.nim(1, 8) Warning: imported and not used: ''strutils'' [UnusedImport]', + \ 'foobar.nim(12, 9) Error: undeclared identifier: ''total''', + \ 'foobar.nim(14, 1) Error: ''sum'' cannot be assigned to', + \ 'foobar.nim(15, 1) Error: redefinition of ''getName''; previous declaration here: /nested/folder/foobar.nim(14, 6)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_nix_handler.vader b/sources_non_forked/ale/test/handler/test_nix_handler.vader new file mode 100644 index 00000000..db6b9a4b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_nix_handler.vader @@ -0,0 +1,91 @@ +Before: + runtime ale_linters/nix/nix.vim + +After: + call ale#linter#Reset() + +Execute(The nix handler should parse nix-instantiate error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 3, + \ 'type': 'E', + \ 'text': "syntax error, unexpected ']', expecting ';'", + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'type': 'E', + \ 'text': "undefined variable 'foo'", + \ }, + \ + \ ], + \ ale_linters#nix#nix#Handle(bufnr(''), [ + \ "@nix {\"line\":6,\"column\":3,\"raw_msg\":\"syntax error, unexpected ']', expecting ';'\"}", + \ "@nix {\"line\":3,\"column\":5,\"raw_msg\":\"undefined variable 'foo'\"}", + \ "@nix {\"unrelated\":\"message\"}" + \ ]) + +Execute(The nix handler should parse message from old nix-instantiate correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 23, + \ 'col': 14, + \ 'text': 'error: syntax error, unexpected IN', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 12, + \ 'text': 'error: syntax error, unexpected ''='', expecting '';''', + \ 'type': 'E', + \ }, + \ + \ ], + \ ale_linters#nix#nix#Handle(47, [ + \ 'This line should be ignored', + \ 'error: syntax error, unexpected IN, at /path/to/filename.nix:23:14', + \ 'error: syntax error, unexpected ''='', expecting '';'', at /path/to/filename.nix:3:12', + \ ]) + +Execute(The nix command should not add 'log-format' option for nix version 2.3): + AssertEqual + \ 'nix-instantiate --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.3.0'], '') + +Execute(The nix command should add 'log-format' option for nix version 2.4): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.4.1'], '') + +Execute(The nix command should add 'log-format' option for nix version 2.5): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.5.0pre20211206_d1aaa7e'], '') + +Execute(The nix command should add 'log-format' option for nix version 2.6): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.6.0pre20211206_ignored'], '') + +Execute(The nix command should add 'log-format' option for nix version 2.7): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.7.0pre20211206_ignored'], '') + +Execute(The nix command should add 'log-format' option for nix version 2.8): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.8.0pre20211206_ignored'], '') + +Execute(The nix command should add 'log-format' option for nix version 2.9): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.9.0pre20211206_ignored'], '') + +Execute(The nix command should add 'log-format' option for nix version 3.0): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 3.0.0pre20211206_ignored'], '') diff --git a/sources_non_forked/ale/test/handler/test_perl6_handler.vader b/sources_non_forked/ale/test/handler/test_perl6_handler.vader new file mode 100644 index 00000000..452a9174 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_perl6_handler.vader @@ -0,0 +1,277 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/handler') + + runtime ale_linters/perl6/perl6.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The Perl6 linter should handle empty output): + call ale#test#SetFilename('bar.pl6') + + AssertEqual [], ale_linters#perl6#perl6#Handle(bufnr(''), []) + +Execute(The Perl6 linter should complain about undeclared variables): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [ + \ { + \ 'lnum': '6', + \ 'text': 'Variable ''$tes'' is not declared. Did you mean any of these? $res $test ', + \ 'type': 'E', + \ 'col': '', + \ 'end_lnum': '', + \ 'code': 'X::Undeclared', + \ } + \ ], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ '{ + \ "X::Undeclared" : { + \ "highexpect" : [ ], + \ "is-compile-time" : 1, + \ "modules" : [ ], + \ "column" : null, + \ "pos" : 18, + \ "symbol" : "$tes", + \ "filename" : "bar.pl6", + \ "what" : "Variable", + \ "pre" : "my $test = 0; say ", + \ "post" : "$tes", + \ "suggestions" : [ + \ "$res", + \ "$test" + \ ], + \ "line" : 6, + \ "message" : "Variable ''$tes'' is not declared. Did you mean any of these?\n $res\n $test\n" + \ } + \ }' + \ ]) + +Execute(The Perl6 linter should complain about Comp::AdHoc errors): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [ + \ { + \ 'lnum': '3', + \ 'type': 'E', + \ 'text': 'is repr(...) trait needs a parameter', + \ 'col': '', + \ 'end_lnum': '', + \ 'code': 'X::Comp::AdHoc', + \ } + \ ], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ '{ + \ "X::Comp::AdHoc" : { + \ "pre" : "class test is repr", + \ "message" : "is repr(...) trait needs a parameter", + \ "line" : 3, + \ "post" : " {}", + \ "is-compile-time" : true, + \ "pos" : 19, + \ "highexpect" : [ ], + \ "payload" : "is repr(...) trait needs a parameter", + \ "filename" : "bar.pl6", + \ "column" : null, + \ "modules" : [ ] + \ } + \ }' + \]) + +Execute(The Perl6 linter should be able to extract a line number from an error message): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [ + \ { + \ 'lnum': '3', + \ 'text': 'Could not find Module::Does::not::exist at line 3 in: /usr/share/perl6/site /usr/share/perl6/vendor /usr/share/perl6 CompUnit::Repository::AbsolutePath<94023691448416> CompUnit::Repository::NQP<94023670532736> CompUnit::Repository::Perl5<94023670532776>', + \ 'col': '', + \ 'type': 'E', + \ 'end_lnum': '', + \ 'code': 'X::CompUnit::UnsatisfiedDependency', + \ } + \ ], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ '{ + \ "X::CompUnit::UnsatisfiedDependency" : { + \ "message" : "Could not find Module::Does::not::exist at line 3 in:\n /usr/share/perl6/site\n /usr/share/perl6/vendor\n /usr/share/perl6\n CompUnit::Repository::AbsolutePath<94023691448416>\n CompUnit::Repository::NQP<94023670532736>\n CompUnit::Repository::Perl5<94023670532776>", + \ "specification" : "Module::Does::not::exist" + \ } + \ }' + \ ]) + +Execute(The Perl6 linter should be able to differentiate between warnings and errors): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [ + \ { + \ 'lnum': '1', + \ 'col': '', + \ 'code': 'X::Syntax::Regex::Unterminated', + \ 'end_lnum': '', + \ 'type': 'E', + \ 'text': 'Regex not terminated.', + \ }, + \ { + \ 'lnum': '1', + \ 'col': '', + \ 'code': 'X::Comp::AdHoc', + \ 'end_lnum': '', + \ 'type': 'W', + \ 'text': 'Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)', + \ } + \ ], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ '{ + \ "X::Comp::Group" : { + \ "message" : "Regex not terminated.\nUnable to parse regex; couldn''t find final ''/''\nSpace is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)", + \ "panic" : "Unable to parse regex; couldn''t find final ''/''", + \ "sorrows" : [ + \ { + \ "X::Syntax::Regex::Unterminated" : { + \ "highexpect" : [ + \ "infix stopper" + \ ], + \ "pos" : 6, + \ "is-compile-time" : 1, + \ "modules" : [ ], + \ "post" : "", + \ "message" : "Regex not terminated.", + \ "line" : 1, + \ "filename" : "bar.pl6", + \ "column" : null, + \ "pre" : "/win 3" + \ } + \ } + \ ], + \ "worries" : [ + \ { + \ "X::Comp::AdHoc" : { + \ "filename" : "bar.pl6", + \ "line" : 1, + \ "column" : null, + \ "pre" : "/win", + \ "highexpect" : [ ], + \ "payload" : "Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)", + \ "post" : " 3", + \ "message" : "Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)", + \ "modules" : [ ], + \ "is-compile-time" : true, + \ "pos" : 4 + \ } + \ } + \ ] + \ } + \ }' + \]) + +Execute(The Perl6 linter should gracefully handle non-JSON messages): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [ + \ { + \ 'lnum': '1', + \ 'text': 'Received output in the default Perl6 error format. See :ALEDetail for details', + \ 'type': 'W', + \ 'detail': join([ + \ 'Potential difficulties:', + \ ' Redeclaration of symbol ''$_''', + \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:1', + \ ' ------> sub foo($_) {.say}; my $_ = 1; .&foo;', + \ ' Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)', + \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:4', + \ ' ------> /win 3/', + \ 'Syntax OK',], "\n") + \ } + \ ], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ 'Potential difficulties:', + \ ' Redeclaration of symbol ''$_''', + \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:1', + \ ' ------> sub foo($_) {.say}; my $_ = 1; .&foo;', + \ ' Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)', + \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:4', + \ ' ------> /win 3/', + \ 'Syntax OK' + \ ]) + +Execute(The Perl6 linter should gracefully handle messages without a line number): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [ + \ { + \ 'lnum': '1', + \ 'end_lnum': '', + \ 'text': 'Cannot find method ''has_compile_time_value'' on object of type NQPMu', + \ 'type': 'E', + \ 'col' : '', + \ 'code': 'X::AdHoc', + \ } + \ ], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ '{', + \ '"X::AdHoc" : {', + \ '"message" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu",', + \ '"payload" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu"', + \ '}', + \ '}', + \ ]) + +Execute(The Perl6 linter should not include errors from a known separate file): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ '{ + \ "X::Undeclared" : { + \ "highexpect" : [ ], + \ "is-compile-time" : 1, + \ "modules" : [ ], + \ "column" : null, + \ "pos" : 18, + \ "symbol" : "$tes", + \ "filename" : "foo.pl6", + \ "what" : "Variable", + \ "pre" : "my $test = 0; say ", + \ "post" : "$tes", + \ "suggestions" : [ + \ "$res", + \ "$test" + \ ], + \ "line" : 6, + \ "message" : "Variable ''$tes'' is not declared. Did you mean any of these?\n $res\n $test\n" + \ } + \ }' + \ ]) + +Execute(The Perl6 linter should not ignore errors without a filename): + call ale#test#SetFilename('bar.pl6') + + AssertEqual + \ [ + \ { + \ 'lnum': '3', + \ 'end_lnum': '', + \ 'text': 'Cannot find method ''has_compile_time_value'' on object of type NQPMu', + \ 'type': 'E', + \ 'col' : '', + \ 'code': 'X::AdHoc', + \ } + \ ], + \ ale_linters#perl6#perl6#Handle(bufnr(''), [ + \ '{', + \ '"X::AdHoc" : {', + \ '"line" : 3,', + \ '"message" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu",', + \ '"payload" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu"', + \ '}', + \ '}', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_perl_handler.vader b/sources_non_forked/ale/test/handler/test_perl_handler.vader new file mode 100644 index 00000000..060b1ffe --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_perl_handler.vader @@ -0,0 +1,109 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/handler') + + runtime ale_linters/perl/perl.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The Perl linter should handle empty output): + call ale#test#SetFilename('bar.pl') + + AssertEqual [], ale_linters#perl#perl#Handle(bufnr(''), []) + +Execute(The Perl linter should ignore errors from other files): + call ale#test#SetFilename('bar.pl') + + AssertEqual + \ [ + \ {'lnum': '2', 'type': 'E', 'text': 'Compilation failed in require'}, + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ 'syntax error at ' . ale#path#Simplify(g:dir . '/foo.pm') . ' line 4, near "aklsdfjmy "', + \ 'Compilation failed in require at ' . ale#path#Simplify(g:dir . '/bar.pl') . ' line 2.', + \ 'BEGIN failed--compilation aborted at ' . ale#path#Simplify(g:dir . '/bar.pl') . ' line 2.', + \ ]) + +Execute(The Perl linter should complain about failing to locate modules): + AssertEqual + \ [ + \ { + \ 'lnum': '23', + \ 'type': 'E', + \ 'text': 'Can''t locate JustOneDb.pm in @INC (you may need to install the JustOneDb module) (@INC contains: /home/local/sean/work/PostgreSQL/6616/../../../../lib /home/local/sean/work/PostgreSQL/6616/lib lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .)', + \ }, + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ 'Can''t locate JustOneDb.pm in @INC (you may need to install the JustOneDb module) (@INC contains: /home/local/sean/work/PostgreSQL/6616/../../../../lib /home/local/sean/work/PostgreSQL/6616/lib lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at - line 23.', + \ 'BEGIN failed--compilation aborted at - line 23.', + \ ]) + + +Execute(The Perl linter should complain about failing to locate modules): + AssertEqual + \ [ + \ {'lnum': '8', 'type': 'E', 'text': 'BEGIN failed--compilation aborted'}, + \ {'lnum': '10', 'type': 'E', 'text': 'BEGIN failed--compilation aborted'} + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ 'Unable to build `ro` accessor for slot `path` in `App::CPANFileUpdate` because the slot cannot be found. at /extlib/Method/Traits.pm line 189.', + \ 'BEGIN failed--compilation aborted at - line 8.', + \ 'Unable to build `ro` accessor for slot `path` in `App::CPANFileUpdate` because the slot cannot be found. at /extlib/Method/Traits.pm line 189.', + \ 'BEGIN failed--compilation aborted at - line 10.', + \ ]) + +Execute(The Perl linter should not report warnings as errors): + AssertEqual + \ [ + \ {'lnum': '5', 'type': 'W', 'text': '"my" variable $foo masks earlier declaration in same scope'}, + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ '"my" variable $foo masks earlier declaration in same scope at - line 5.', + \ 't.pl syntax OK', + \ ]) + +Execute(The Perl linter does not default to reporting generic error): + AssertEqual + \ [ + \ {'lnum': '8', 'type': 'E', 'text': 'Missing right curly or square bracket'}, + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ 'Missing right curly or square bracket at - line 8, at end of line', + \ 'syntax error at - line 8, at EOF', + \ 'Execution of t.pl aborted due to compilation errors.', + \ ]) + +" The first "error" is actually a warning, but the current implementation +" doesn't have a good way of teasing out the warnings from amongst the +" errors. If we're able to do this in future, then we'll want to switch +" the first "E" to a "W". + +Execute(The Perl linter reports errors even when mixed with warnings): + AssertEqual + \ [ + \ {'lnum': '5', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'}, + \ {'lnum': '8', 'type': 'E', 'text': 'Missing right curly or square bracket'}, + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ '"my" variable $foo masks earlier declaration in same scope at - line 5.', + \ 'Missing right curly or square bracket at - line 8, at end of line', + \ 'syntax error at - line 8, at EOF', + \ 'Execution of t.pl aborted due to compilation errors.', + \ ]) + +Execute(The Perl linter reports errors even when an additional file location is included): + AssertEqual + \ [ + \ {'lnum': '5', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'}, + \ {'lnum': '6', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'}, + \ {'lnum': '11', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'}, + \ {'lnum': '12', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'}, + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ '"my" variable $foo masks earlier declaration in same scope at - line 5.', + \ '"my" variable $foo masks earlier declaration in same scope at - line 6, at line 1.', + \ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 11.', + \ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 12, line 1.', + \ 'Execution of t.pl aborted due to compilation errors.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_perlcritic_handler.vader b/sources_non_forked/ale/test/handler/test_perlcritic_handler.vader new file mode 100644 index 00000000..f00b07da --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_perlcritic_handler.vader @@ -0,0 +1,20 @@ +Before: + runtime ale_linters/perl/perlcritic.vim + +After: + call ale#linter#Reset() + +Execute(The Perl::Critic handler should create all issues as warnings): + AssertEqual + \ [ + \ { + \ 'lnum': '21', + \ 'col': '17', + \ 'text': 'Regular expression without "/m" flag', + \ 'type': 'W', + \ } + \ ], + \ ale_linters#perl#perlcritic#Handle(99, [ + \ '21:17 Regular expression without "/m" flag' + \ ]) + diff --git a/sources_non_forked/ale/test/handler/test_php_handler.vader b/sources_non_forked/ale/test/handler/test_php_handler.vader new file mode 100644 index 00000000..6fe9b323 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_php_handler.vader @@ -0,0 +1,93 @@ +Before: + runtime ale_linters/php/php.vim + +After: + call ale#linter#Reset() + +Given (Some invalid lines of PHP): + [foo;] + class Foo { / } + $foo) + ['foo' 'bar'] + function count() {} + +Execute(The php handler should calculate column numbers): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 5, + \ 'end_col': 5, + \ 'text': "syntax error, unexpected ';', expecting ']'", + \ }, + \ { + \ 'lnum': 2, + \ 'col': 13, + \ 'end_col': 13, + \ 'text': "syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST)", + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'end_col': 5, + \ 'text': "syntax error, unexpected ')'", + \ }, + \ { + \ 'lnum': 4, + \ 'col': 8, + \ 'end_col': 12, + \ 'text': "syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ']'", + \ }, + \ ], + \ ale_linters#php#php#Handle(347, [ + \ "This line should be ignored completely", + \ "Parse error: syntax error, unexpected ';', expecting ']' in - on line 1", + \ "Parse error: syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST) in - on line 2", + \ "Parse error: syntax error, unexpected ')' in - on line 3", + \ "Parse error: syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in - on line 4", + \ ]) + +Execute (The php handler should ignore lines starting with 'PHP Parse error'): + AssertEqual + \ [], + \ ale_linters#php#php#Handle(347, [ + \ "PHP Parse error: syntax error, This line should be ignored completely in - on line 1", + \ ]) + +Execute (The php handler should handle lines containing 'Standard input code'): + AssertEqual + \ [ + \ { + \ 'lnum': 47, + \ 'col': 0, + \ 'text': "Invalid numeric literal", + \ }, + \ ], + \ ale_linters#php#php#Handle(347, [ + \ "Parse error: Invalid numeric literal in Standard input code on line 47", + \ ]) +Execute (The php handler should parse lines without column indication): + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 0, + \ 'text': "Cannot redeclare count()", + \ }, + \ { + \ 'lnum': 21, + \ 'col': 0, + \ 'text': "syntax error, unexpected end of file", + \ }, + \ { + \ 'lnum': 47, + \ 'col': 0, + \ 'text': "Invalid numeric literal", + \ }, + \ ], + \ ale_linters#php#php#Handle(347, [ + \ "This line should be ignored completely", + \ "Fatal error: Cannot redeclare count() in - on line 5", + \ "Parse error: syntax error, unexpected end of file in - on line 21", + \ "Parse error: Invalid numeric literal in - on line 47", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_php_phan_handler.vader b/sources_non_forked/ale/test/handler/test_php_phan_handler.vader new file mode 100644 index 00000000..bbdae5dd --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_php_phan_handler.vader @@ -0,0 +1,26 @@ +Before: + runtime ale_linters/php/phan.vim + +After: + call ale#linter#Reset() + +Execute(The php static analyzer handler should parse errors from phan): + AssertEqual + \ [ + \ { + \ 'lnum': 25, + \ 'type': 'W', + \ 'text': 'Return type of getValidator is undeclared type \Respect\Validation\Validator', + \ 'filename': 'example.php', + \ }, + \ { + \ 'lnum': 66, + \ 'type': 'W', + \ 'text': 'Call to method string from undeclared class \Respect\Validation\Validator', + \ 'filename': 'example.php', + \ }, + \ ], + \ ale_linters#php#phan#Handle(347, [ + \ "example.php:25 PhanUndeclaredTypeReturnType Return type of getValidator is undeclared type \\Respect\\Validation\\Validator", + \ "example.php:66 PhanUndeclaredClassMethod Call to method string from undeclared class \\Respect\\Validation\\Validator", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_php_phpmd_handler.vader b/sources_non_forked/ale/test/handler/test_php_phpmd_handler.vader new file mode 100644 index 00000000..f161d731 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_php_phpmd_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/php/phpmd.vim + +After: + call ale#linter#Reset() + +Execute(The php static analyzer handler should parse errors from phpmd): + AssertEqual + \ [ + \ { + \ 'lnum': 22, + \ 'type': 'W', + \ 'text': "Avoid unused local variables such as '$response'.", + \ }, + \ { + \ 'lnum': 14, + \ 'type': 'W', + \ 'text': "The method test uses an else expression. Else is never necessary and you can simplify the code to work without else.", + \ }, + \ ], + \ ale_linters#php#phpmd#Handle(347, [ + \ "example.php:22 Avoid unused local variables such as '$response'.", + \ "example.php:14 The method test uses an else expression. Else is never necessary and you can simplify the code to work without else.", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_phpcs_handler.vader b/sources_non_forked/ale/test/handler/test_phpcs_handler.vader new file mode 100644 index 00000000..26d35cb8 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_phpcs_handler.vader @@ -0,0 +1,28 @@ +Before: + runtime ale_linters/php/phpcs.vim + +After: + call ale#linter#Reset() + +Execute(phpcs errors should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 18, + \ 'col': 3, + \ 'type': 'E', + \ 'sub_type': 'style', + \ 'text': 'Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)', + \ }, + \ { + \ 'lnum': 22, + \ 'col': 3, + \ 'type': 'E', + \ 'sub_type': 'style', + \ 'text': 'All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks)', + \ }, + \ ], + \ ale_linters#php#phpcs#Handle(bufnr(''), [ + \ '/path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)', + \ "/path/to/some-filename.php:22:3: error - All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '\"\n'.", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_phpstan_handler.vader b/sources_non_forked/ale/test/handler/test_phpstan_handler.vader new file mode 100644 index 00000000..58cb574f --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_phpstan_handler.vader @@ -0,0 +1,51 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + + runtime ale_linters/php/phpstan.vim + +After: + Restore + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Output without errors should be parsed correctly): + call ale#test#SetFilename('phpstan-test-files/foo/test.php') + + AssertEqual + \ [], + \ ale_linters#php#phpstan#Handle(bufnr(''), [ + \ '{"totals":{"errors":0,"file_errors":0},"files":[],"errors":[]}', + \ ]) + +Execute(Output with some errors should be parsed correctly): + call ale#test#SetFilename('phpstan-test-files/foo/test.php') + + AssertEqual + \ [ + \ { + \ 'lnum': 9, + \ 'text': 'Call to method format() on an unknown class DateTimeImutable.', + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 16, + \ 'text': 'Sample message.', + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 192, + \ 'text': 'Invalid command testCommand.', + \ 'type': 'E' + \ } + \ ], + \ ale_linters#php#phpstan#Handle(bufnr(''), [json_encode( + \ { + \ "totals":{"errors": 0, "file_errors": 11}, + \ "files":{expand('%:p'): {"errors": 3, "messages": [ + \ {"message": "Call to method format() on an unknown class DateTimeImutable.", "line":9}, + \ {"message": "Sample message.", "line":16}, + \ {"message": "Invalid command testCommand.", "line": 192} + \ ]}} + \ }, + \)]) diff --git a/sources_non_forked/ale/test/handler/test_pmd_handler.vader b/sources_non_forked/ale/test/handler/test_pmd_handler.vader new file mode 100644 index 00000000..4f64c9ca --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pmd_handler.vader @@ -0,0 +1,42 @@ +Before: + runtime ale_linters/java/pmd.vim + +After: + call ale#linter#Reset() + +Execute(The pmd handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 18, + \ 'text': 'Each class should declare at least one constructor', + \ 'code': 'Code Style - AtLeastOneConstructor', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 36, + \ 'text': 'Local variable ''node'' could be declared final', + \ 'code': 'Code Style - LocalVariableCouldBeFinal', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#java#pmd#Handle(666, [ + \ '"Problem","Package","File","Priority","Line","Description","Rule set","Rule"', + \ '"1","rsb.performance.test.ros","/home/languitar/src/rsb-performance-test-api-ros/src/main/java/rsb/performance/test/ros/NodeHolder.java","3","18","Each class should declare at least one constructor","Code Style","AtLeastOneConstructor"', + \ '"2","rsb.performance.test.ros","/home/languitar/src/rsb-performance-test-api-ros/src/main/java/rsb/performance/test/ros/NodeHolder.java","1","36","Local variable ''node'' could be declared final","Code Style","LocalVariableCouldBeFinal"' + \ ]) + +Execute(The pmd handler should parse lines correctly for java files that use unnamed packages): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'text': 'Avoid unused local variables such as ''stest''.', + \ 'code': 'Best Practices - UnusedLocalVariable', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#java#pmd#Handle(666, [ + \ '"Problem","Package","File","Priority","Line","Description","Rule set","Rule"', + \ '"1","","/Users/diego/Projects/github.com/dlresende/kata-fizz-buzz/src/main/java/App.java","3","8","Avoid unused local variables such as ''stest''.","Best Practices","UnusedLocalVariable"' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_pony_handler.vader b/sources_non_forked/ale/test/handler/test_pony_handler.vader new file mode 100644 index 00000000..25a8254b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pony_handler.vader @@ -0,0 +1,21 @@ +Execute(The pony handler should handle ponyc output): + call ale#test#SetFilename('foo.pony') + + AssertEqual + \ [ + \ { + \ 'filename': '/home/projects/Wombat.pony', + \ 'lnum': 22, + \ 'type': 'E', + \ 'col': 30, + \ 'text': 'can''t lookup private fields from outside the type', + \ }, + \ ], + \ ale#handlers#pony#HandlePonycFormat(bufnr(''), [ + \ 'Building builtin -> /usr/lib/pony/0.21.3/packages/builtin', + \ 'Building . -> /home/projects', + \ 'Error:', + \ '/home/projects/Wombat.pony:22:30: can''t lookup private fields from outside the type', + \ ' env.out.print(defaultWombat._hunger_level)', + \ ' ^', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_powershell_handler.vader b/sources_non_forked/ale/test/handler/test_powershell_handler.vader new file mode 100644 index 00000000..77c3dc65 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_powershell_handler.vader @@ -0,0 +1,109 @@ +Before: + runtime ale_linters/powershell/powershell.vim + +After: + call ale#linter#Reset() + +Execute(The powershell handler should process syntax errors from parsing a powershell script): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 29, + \ 'type': 'E', + \ 'text': 'Missing closing ''}'' in statement block or type definition.', + \ 'code': 'ParseException', + \ }, + \ ], + \ ale_linters#powershell#powershell#Handle(bufnr(''), [ + \ "At line:8 char:29", + \ "+ Invoke-Command -ScriptBlock {", + \ "+ ~", + \ "Missing closing '}' in statement block or type definition.", + \ "At /home/harrisj/tester.ps1:5 char:5", + \ "+ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents);", + \ "+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", + \ "+ CategoryInfo : NotSpecified: (:) [], ParseException", + \ "+ FullyQualifiedErrorId : ParseException" + \ ]) + +Execute(The powershell handler should process multiple syntax errors from parsing a powershell script): + AssertEqual + \ [ + \ { + \ 'lnum': 11, + \ 'col': 31, + \ 'type': 'E', + \ 'text': 'The string is missing the terminator: ".', + \ 'code': 'ParseException' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 16, + \ 'type': 'E', + \ 'text': 'Missing closing ''}'' in statement block or type definition.', + \ 'code': 'ParseException' + \ }, + \ ], + \ ale_linters#powershell#powershell#Handle(bufnr(''), [ + \ 'At line:11 char:31', + \ '+ write-verbose ''deleted''', + \ '+ ~', + \ 'The string is missing the terminator: ".', + \ 'At line:3 char:16', + \ '+ invoke-command {', + \ '+ ~', + \ 'Missing closing ''}'' in statement block or type definition.', + \ 'At /var/folders/qv/15ybvt050v9cgwrm7c95x4r4zc4qsg/T/vwhzIc8/1/script.ps1:1 char:150', + \ '+ ... ontents); [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Con ...', + \ '+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', + \ '+ CategoryInfo : NotSpecified: (:) [], ParseException', + \ '+ FullyQualifiedErrorId : ParseException' + \ ]) +Execute(The powershell handler should process unexecpected token that contains a newline character): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 8, + \ 'type': 'E', + \ 'text': 'The string is missing the terminator: ".', + \ 'code': 'ParseException' + \ }, + \ { + \ 'lnum': 2, + \ 'col': 8, + \ 'type': 'E', + \ 'text': 'Unexpected token ''"', + \ 'code': 'ParseException' + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Missing closing ''}'' in statement block or type definition.', + \ 'code': 'ParseException' + \ } + \ ], + \ ale_linters#powershell#powershell#Handle(bufnr(''), [ + \ 'At line:2 char:8', + \ '+ "" "', + \ '+ ~', + \ 'The string is missing the terminator: ".', + \ 'At line:2 char:8', + \ '+ "" "', + \ '+ ~', + \ 'Unexpected token ''"', + \ '', + \ ' }'' in expression or statement.', + \ '', + \ 'At line:1 char:1', + \ '+ {', + \ '+ ~', + \ 'Missing closing ''}'' in statement block or type definition.', + \ 'At C:\Users\jpharris\AppData\Local\Temp\VIAA777.tmp\script.ps1:1 char:150', + \ '+ ... ontents); [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Con ...', + \ '+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', + \ ' + CategoryInfo : NotSpecified: (:) [], ParseException', + \ ' + FullyQualifiedErrorId : ParseException' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_prospector_handler.vader b/sources_non_forked/ale/test/handler/test_prospector_handler.vader new file mode 100644 index 00000000..935c37da --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_prospector_handler.vader @@ -0,0 +1,163 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/prospector.vim + +After: + Restore + + call ale#linter#Reset() + + silent file something_else.py + +Execute(Basic prospector errors should be handle): + AssertEqual + \ [ + \ { + \ 'lnum': 20, + \ 'col': 1, + \ 'text': 'Trailing whitespace', + \ 'code': '(pylint) trailing-whitespace', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Missing module docstring', + \ 'code': '(pylint) missing-docstring', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'Missing function docstring', + \ 'code': '(pylint) missing-docstring', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'text': '''break'' not properly in loop', + \ 'code': '(pylint) not-in-loop', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 5, + \ 'text': 'Unreachable code', + \ 'code': '(pylint) unreachable', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 33, + \ 'text': 'No exception type(s) specified', + \ 'code': '(pylint) bare-except', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#python#prospector#Handle(bufnr(''), [ + \ '{', + \ ' "messages": [', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "trailing-whitespace",', + \ ' "message": "Trailing whitespace",', + \ ' "location": {', + \ ' "character": 0,', + \ ' "line": 20', + \ ' }', + \ ' },', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "missing-docstring",', + \ ' "message": "Missing module docstring",', + \ ' "location": {', + \ ' "character": 0,', + \ ' "line": 1', + \ ' }', + \ ' },', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "missing-docstring",', + \ ' "message": "Missing function docstring",', + \ ' "location": {', + \ ' "character": 0,', + \ ' "line": 2', + \ ' }', + \ ' },', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "not-in-loop",', + \ ' "message": "''break'' not properly in loop",', + \ ' "location": {', + \ ' "character": 4,', + \ ' "line": 3', + \ ' }', + \ ' },', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "unreachable",', + \ ' "message": "Unreachable code",', + \ ' "location": {', + \ ' "character": 4,', + \ ' "line": 4', + \ ' }', + \ ' },', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "bare-except",', + \ ' "message": "No exception type(s) specified",', + \ ' "location": {', + \ ' "character": 32,', + \ ' "line": 7', + \ ' }', + \ ' }', + \ ' ]', + \ '}', + \ ]) + +Execute(Ignoring trailing whitespace messages should work): + let g:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Missing module docstring', + \ 'code': '(pylint) missing-docstring', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#python#prospector#Handle(bufnr(''), [ + \ '{', + \ ' "messages": [', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "trailing-whitespace",', + \ ' "message": "Trailing whitespace",', + \ ' "location": {', + \ ' "character": 0,', + \ ' "line": 4', + \ ' }', + \ ' },', + \ ' {', + \ ' "source": "pylint",', + \ ' "code": "missing-docstring",', + \ ' "message": "Missing module docstring",', + \ ' "location": {', + \ ' "character": 0,', + \ ' "line": 1', + \ ' }', + \ ' }', + \ ' ]', + \ '}', + \ ]) + +Execute(The prospector handler should handle empty output): + AssertEqual + \ [], + \ ale_linters#python#prospector#Handle(bufnr(''), []) diff --git a/sources_non_forked/ale/test/handler/test_psscriptanalyzer_handler.vader b/sources_non_forked/ale/test/handler/test_psscriptanalyzer_handler.vader new file mode 100644 index 00000000..060d5941 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_psscriptanalyzer_handler.vader @@ -0,0 +1,42 @@ +Before: + runtime ale_linters/powershell/psscriptanalyzer.vim + +After: + call ale#linter#Reset() + +Execute(The psscriptanalyzer handler should handle basic information or warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'I', + \ 'text': 'The cmdlet ''Get-GithubRepo'' does not have a help comment.', + \ 'code': 'PSProvideCommentHelp', + \ }, + \ { + \ 'lnum': 9, + \ 'type': 'W', + \ 'text': '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.', + \ 'code': 'PSAvoidUsingCmdletAliases', + \ }, + \ { + \ 'lnum': 23, + \ 'type': 'E', + \ 'text': 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.', + \ 'code': 'PSAvoidUsingComputerNameHardcoded', + \ }, + \ ], + \ ale_linters#powershell#psscriptanalyzer#Handle(bufnr(''), [ + \ '1', + \ 'Information', + \ 'The cmdlet ''Get-GithubRepo'' does not have a help comment.', + \ 'PSProvideCommentHelp', + \ '9', + \ 'Warning', + \ '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.', + \ 'PSAvoidUsingCmdletAliases', + \ '23', + \ 'Error', + \ 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.', + \ 'PSAvoidUsingComputerNameHardcoded', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_puglint_handler.vader b/sources_non_forked/ale/test/handler/test_puglint_handler.vader new file mode 100644 index 00000000..f37518bb --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_puglint_handler.vader @@ -0,0 +1,45 @@ +Before: + runtime ale_linters/pug/puglint.vim + +After: + call ale#linter#Reset() + +Execute(Regular errors should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 5, + \ 'type': 'E', + \ 'text': 'Static attribute "class" must be written as class literal', + \ }, + \ ], + \ ale_linters#pug#puglint#Handle(0, [ + \ '/tmp/vwYwsJA/233/test.pug:1:5 Static attribute "class" must be written as class literal', + \ ]) + +Execute(syntax errors in the configuration file should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'puglint configuration error (type :ALEDetail for more information)', + \ 'detail': join( + \ [ + \ 'undefined:2', + \ ' disallowClassAttributeWithStaticValue: true', + \ ' ^', + \ 'SyntaxError: Unexpected token d in JSON at position 4', + \ ' at JSON.parse ()', + \ ], + \ "\n" + \ ), + \ }, + \ ], + \ ale_linters#pug#puglint#Handle(0, [ + \ 'undefined:2', + \ ' disallowClassAttributeWithStaticValue: true', + \ ' ^', + \ 'SyntaxError: Unexpected token d in JSON at position 4', + \ ' at JSON.parse ()', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_puppet_handler.vader b/sources_non_forked/ale/test/handler/test_puppet_handler.vader new file mode 100644 index 00000000..03adc9f0 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_puppet_handler.vader @@ -0,0 +1,77 @@ +Before: + runtime ale_linters/puppet/puppet.vim + +After: + call ale#linter#Reset() + +Execute(The puppet handler should parse lines correctly when no column is supplied): + " Line Error + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 0, + \ 'text': "Syntax error at '='; expected '}'" + \ }, + \ { + \ 'lnum': 3, + \ 'col': 0, + \ 'text': "Syntax error at '='; expected '}'" + \ }, + \ ], + \ ale_linters#puppet#puppet#Handle(255, [ + \ "Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5", + \ "Error: Could not parse for environment production: Syntax error at '='; expected '}' at C:/puppet/modules/pancakes/manifests/init.pp:3", + \ ]) + +Execute(The puppet handler should parse lines and column correctly): + " Line Error + AssertEqual + \ [ + \ { + \ 'lnum': 43, + \ 'col': 12, + \ 'text': "Syntax error at ':'" + \ }, + \ { + \ 'lnum': 54, + \ 'col': 9, + \ 'text': "Syntax error at ':'" + \ }, + \ { + \ 'lnum': 45, + \ 'col': 12, + \ 'text': "Syntax error at 'parameter1'" + \ }, + \ ], + \ ale_linters#puppet#puppet#Handle(255, [ + \ "Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12", + \ "Error: Could not parse for environment production: Syntax error at ':' at C:/puppet/modules/nginx/manifests/init.pp:54:9", + \ "Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 45, column: 12)", + \ ]) + +Execute(The puppet handler should correctly parse errors that are reported before even trying to parse for an environment): + " Line Error + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 11, + \ 'text': "Illegal attempt to assign to 'a Name'. Not an assignable reference" + \ }, + \ ], + \ ale_linters#puppet#puppet#Handle(255, [ + \ "Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11)", + \ ]) +Execute(The puppet handler should parse lines when end of input is the location): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'col': 0, + \ 'text': "Syntax error at end of input" + \ }, + \ ], + \ ale_linters#puppet#puppet#Handle(255, [ + \ "Error: Could not parse for environment production: Syntax error at end of input (file: /tmp//modules/test/manifests/init.pp)", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_pycodestyle_handler.vader b/sources_non_forked/ale/test/handler/test_pycodestyle_handler.vader new file mode 100644 index 00000000..3664455e --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pycodestyle_handler.vader @@ -0,0 +1,154 @@ +Before: + Save g:ale_warn_about_trailing_blank_lines + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_blank_lines = 1 + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/pycodestyle.vim + +After: + Restore + + unlet! b:ale_warn_about_trailing_blank_lines + unlet! b:ale_warn_about_trailing_whitespace + + call ale#linter#Reset() + silent file something_else.py + +Execute(The pycodestyle handler should parse output): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 3, + \ 'type': 'E', + \ 'text': 'SyntaxError: invalid syntax', + \ 'code': 'E999', + \ }, + \ { + \ 'lnum': 69, + \ 'col': 11, + \ 'text': 'multiple imports on one line', + \ 'code': 'E401', + \ 'type': 'E', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 77, + \ 'col': 1, + \ 'text': 'expected 2 blank lines, found 1', + \ 'code': 'E302', + \ 'type': 'E', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 88, + \ 'col': 5, + \ 'text': 'expected 1 blank line, found 0', + \ 'code': 'E301', + \ 'type': 'E', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 222, + \ 'col': 34, + \ 'text': 'deprecated form of raising exception', + \ 'code': 'W602', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ { + \ 'lnum': 544, + \ 'col': 21, + \ 'text': '.has_key() is deprecated, use ''in''', + \ 'code': 'W601', + \ 'type': 'W', + \ 'sub_type': 'style', + \ }, + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'stdin:8:3: E999 SyntaxError: invalid syntax', + \ 'stdin:69:11: E401 multiple imports on one line', + \ 'stdin:77:1: E302 expected 2 blank lines, found 1', + \ 'stdin:88:5: E301 expected 1 blank line, found 0', + \ 'stdin:222:34: W602 deprecated form of raising exception', + \ 'example.py:544:21: W601 .has_key() is deprecated, use ''in''', + \ ]) + +Execute(Warnings about trailing whitespace should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'code': 'W291', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'who cares', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'code': 'W293', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'who cares', + \ }, + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'foo.py:6:1: W291 who cares', + \ 'foo.py:6:1: W293 who cares', + \ ]) + +Execute(Disabling trailing whitespace warnings should work): + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'foo.py:6:1: W291 who cares', + \ 'foo.py:6:1: W293 who cares', + \ ]) + +Execute(Warnings about trailing blank lines should be reported by default): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'code': 'W391', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'blank line at end of file', + \ }, + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(Disabling trailing blank line warnings should work): + let b:ale_warn_about_trailing_blank_lines = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'foo.py:6:1: W391 blank line at end of file', + \ ]) + +Execute(E112 should be a syntax error): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'code': 'E112', + \ 'type': 'E', + \ 'text': 'expected an indented block', + \ }, + \ ], + \ ale_linters#python#pycodestyle#Handle(bufnr(''), [ + \ 'foo.py:6:1: E112 expected an indented block', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_pydocstyle_handler.vader b/sources_non_forked/ale/test/handler/test_pydocstyle_handler.vader new file mode 100644 index 00000000..cfb75307 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pydocstyle_handler.vader @@ -0,0 +1,116 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/pydocstyle.vim + +After: + Restore + + call ale#linter#Reset() + + silent file something_else.py + +" File sample.py +" # sample.py file +" +" def main(): +" """ +" This is a multi-line description that should produce multiple errors to be +" tested by the handler +" """ +" return Fales +" +" +" if __name__ == '__main__': +" main() +" +" The command to generate the handler input is: +" +" $ python -m pydocstyle --verbose --source --explain sample.py +" [...] +" $ + +Execute(Basic pydocstyle warnings should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Missing docstring in public module', + \ 'code': 'D100', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 1, + \ 'text': '1 blank line required between summary line and description (found 0)', + \ 'code': 'D205', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 1, + \ 'text': 'First line should end with a period (not ''e'')', + \ 'code': 'D400', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 1, + \ 'text': 'First line should be in imperative mood; try rephrasing (found ''This'')', + \ 'code': 'D401', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#python#pydocstyle#Handle(bufnr(''), [ + \ 'Checking file ' . fnamemodify(bufname(bufnr('')), ':p') . '.', + \ './mydir/myfile.py:1 at module level:', + \ ' D100: Missing docstring in public module', + \ '', + \ ' All modules should normally have docstrings. [...] all functions and', + \ ' classes exported by a module should also have docstrings. Public', + \ ' methods (including the __init__ constructor) should also have', + \ ' docstrings.', + \ ' Note: Public (exported) definitions are either those with names listed', + \ ' in __all__ variable (if present), or those that do not start', + \ ' with a single underscore.', + \ '', + \ ' 1: # 2: 3: s 4: a 5: m 6: p 7: l ...', + \ '', + \ '', + \ 'C:\mydir\myfile.py:4 in public function `main`:', + \ ' D205: 1 blank line required between summary line and description (found 0)', + \ '', + \ ' Multi-line docstrings consist of a summary line just like a one-line', + \ ' docstring, followed by a blank line, followed by a more elaborate', + \ ' description. The summary line may be used by automatic indexing tools;', + \ ' it is important that it fits on one line and is separated from the', + \ ' rest of the docstring by a blank line.', + \ '', + \ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...', + \ '', + \ '', + \ 'myfile.py:4 in public function `main`:', + \ ' D400: First line should end with a period (not ''e'')', + \ '', + \ ' The [first line of a] docstring is a phrase ending in a period.', + \ '', + \ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...', + \ '', + \ '', + \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:', + \ ' D401: First line should be in imperative mood; try rephrasing (found ''This'')', + \ '', + \ ' [Docstring] prescribes the function or method''s effect as a command:', + \ ' ("Do this", "Return that"), not as a description; e.g. don''t write', + \ ' "Returns the pathname ...".', + \ '', + \ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...', + \ ]) + +Execute(Handler should handle empty output): + AssertEqual + \ [], + \ ale_linters#python#pydocstyle#Handle(bufnr(''), []) diff --git a/sources_non_forked/ale/test/handler/test_pyflakes_handler.vader b/sources_non_forked/ale/test/handler/test_pyflakes_handler.vader new file mode 100644 index 00000000..ab4fab49 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pyflakes_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/python/pyflakes.vim + +After: + call ale#linter#Reset() + +Execute(The pyflakes handler should handle basic errors): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 0, + \ 'text': 'undefined name ''foo''', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 7, + \ 'text': 'invalid syntax', + \ }, + \ ], + \ ale_linters#python#pyflakes#Handle(bufnr(''), [ + \ 'test.py:1: undefined name ''foo''', + \ 'test.py:1:7: invalid syntax', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_pylama_handler.vader b/sources_non_forked/ale/test/handler/test_pylama_handler.vader new file mode 100644 index 00000000..3d1151b5 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pylama_handler.vader @@ -0,0 +1,268 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/pylama.vim + +After: + Restore + + call ale#linter#Reset() + + silent file something_else.py + +Execute(The pylama handler should handle no messages with version older than 8.1.4): + AssertEqual [], ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], []) + +Execute(The pylama handler should handle no messages with version newer or equal than 8.1.4): + AssertEqual [], ale_linters#python#pylama#Handle(bufnr(''), [8, 2, 0], []) + +Execute(The pylama handler should handle basic warnings and syntax errors with version older than 8.1.4): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 1, + \ 'code': 'W0611', + \ 'type': 'W', + \ 'sub_type': '', + \ 'text': '''foo'' imported but unused [pyflakes]', + \ }, + \ { + \ 'lnum': 8, + \ 'col': 0, + \ 'code': 'E0401', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'Unable to import ''foo'' [pylint]', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 1, + \ 'code': 'E302', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'expected 2 blank lines, found 1 [pycodestyle]', + \ }, + \ { + \ 'lnum': 11, + \ 'col': 1, + \ 'code': 'D401', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'First line should be in imperative mood (''Get'', not ''Gets'') [pydocstyle]', + \ }, + \ { + \ 'lnum': 15, + \ 'col': 81, + \ 'code': 'E501', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'line too long (96 > 80 characters) [pycodestyle]', + \ }, + \ { + \ 'lnum': 16, + \ 'col': 1, + \ 'code': 'D203', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': '1 blank line required before class docstring (found 0) [pydocstyle]', + \ }, + \ { + \ 'lnum': 18, + \ 'col': 1, + \ 'code': 'D107', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'Missing docstring in __init__ [pydocstyle]', + \ }, + \ { + \ 'lnum': 20, + \ 'col': 0, + \ 'code': 'C4001', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'Invalid string quote ", should be '' [pylint]', + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [ + \ 'No config file found, using default configuration', + \ 'index.py:8:1: W0611 ''foo'' imported but unused [pyflakes]', + \ 'index.py:8:0: E0401 Unable to import ''foo'' [pylint]', + \ 'index.py:10:1: E302 expected 2 blank lines, found 1 [pycodestyle]', + \ 'index.py:11:1: D401 First line should be in imperative mood (''Get'', not ''Gets'') [pydocstyle]', + \ 'index.py:15:81: E501 line too long (96 > 80 characters) [pycodestyle]', + \ 'index.py:16:1: D203 1 blank line required before class docstring (found 0) [pydocstyle]', + \ 'index.py:18:1: D107 Missing docstring in __init__ [pydocstyle]', + \ 'index.py:20:0: C4001 Invalid string quote ", should be '' [pylint]', + \ ]) + +Execute(The pylama handler should handle basic warnings and syntax errors with version newer than 8.1.4): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 1, + \ 'code': 'W0611', + \ 'type': 'W', + \ 'sub_type': '', + \ 'text': '''foo'' imported but unused [pyflakes]', + \ }, + \ { + \ 'lnum': 8, + \ 'col': 0, + \ 'code': 'E0401', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'Unable to import ''foo'' [pylint]', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 1, + \ 'code': 'E302', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'expected 2 blank lines, found 1 [pycodestyle]', + \ }, + \ { + \ 'lnum': 11, + \ 'col': 1, + \ 'code': 'D401', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'First line should be in imperative mood (''Get'', not ''Gets'') [pydocstyle]', + \ }, + \ { + \ 'lnum': 15, + \ 'col': 81, + \ 'code': 'E501', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'line too long (96 > 80 characters) [pycodestyle]', + \ }, + \ { + \ 'lnum': 16, + \ 'col': 1, + \ 'code': 'D203', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': '1 blank line required before class docstring (found 0) [pydocstyle]', + \ }, + \ { + \ 'lnum': 18, + \ 'col': 1, + \ 'code': 'D107', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'Missing docstring in __init__ [pydocstyle]', + \ }, + \ { + \ 'lnum': 20, + \ 'col': 0, + \ 'code': 'C4001', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'Invalid string quote ", should be '' [pylint]', + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [8, 2, 0], [ + \ '[{"source":"pyflakes","col":1,"lnum":8,"etype":"W","message":"''foo'' imported but unused","filename":"index.py","number":"W0611"},{"source":"pylint","col":0,"lnum":8,"etype":"E","message":"Unable to import ''foo''","filename":"index.py","number":"E0401"},{"source":"pycodestyle","col":1,"lnum":10,"etype":"E","message":"expected 2 blank lines, found 1","filename":"index.py","number":"E302"},{"source":"pydocstyle","col":1,"lnum":11,"etype":"D","message":"First line should be in imperative mood (''Get'', not ''Gets'')","filename":"index.py","number":"D401"},{"source":"pycodestyle","col":81,"lnum":15,"etype":"E","message":"line too long (96 > 80 characters)","filename":"index.py","number":"E501"},{"source":"pydocstyle","col":1,"lnum":16,"etype":"D","message":"1 blank line required before class docstring (found 0)","filename":"index.py","number":"D203"},{"source":"pydocstyle","col":1,"lnum":18,"etype":"D","message":"Missing docstring in __init__","filename":"index.py","number":"D107"},{"source":"pylint","col":0,"lnum":20,"etype":"C","message":"Invalid string quote \", should be ''","filename":"index.py","number":"C4001"}]', + \ ]) + +Execute(The pylama handler should handle tracebacks with parsable messages with version older than 8.1.4): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'ParseError: Cannot parse file. (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/core.py", line 66, in run', + \ ' path, code=code, ignore=ignore, select=select, params=lparams)', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/lint/pylama_pydocstyle.py", line 37, in run', + \ ' } for e in PyDocChecker().check_source(*check_source_args)]', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/checker.py", line 64, in check_source', + \ ' module = parse(StringIO(source), filename)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 340, in __call__', + \ ' return self.parse(*args, **kwargs)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 328, in parse', + \ ' six.raise_from(ParseError(), error)', + \ ' File "/usr/local/lib/python2.7/site-packages/six.py", line 737, in raise_from', + \ ' raise value', + \ 'ParseError: Cannot parse file.', + \ ], "\n"), + \ }, + \ { + \ 'lnum': 11, + \ 'col': 1, + \ 'code': 'E302', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'expected 2 blank lines, found 1 [pycodestyle]', + \ }, + \ { + \ 'lnum': 16, + \ 'col': 81, + \ 'code': 'E501', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'line too long (96 > 80 characters) [pycodestyle]', + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/core.py", line 66, in run', + \ ' path, code=code, ignore=ignore, select=select, params=lparams)', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/lint/pylama_pydocstyle.py", line 37, in run', + \ ' } for e in PyDocChecker().check_source(*check_source_args)]', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/checker.py", line 64, in check_source', + \ ' module = parse(StringIO(source), filename)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 340, in __call__', + \ ' return self.parse(*args, **kwargs)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 328, in parse', + \ ' six.raise_from(ParseError(), error)', + \ ' File "/usr/local/lib/python2.7/site-packages/six.py", line 737, in raise_from', + \ ' raise value', + \ 'ParseError: Cannot parse file.', + \ '', + \ 'index.py:11:1: E302 expected 2 blank lines, found 1 [pycodestyle]', + \ 'index.py:16:81: E501 line too long (96 > 80 characters) [pycodestyle]', + \ ]) + +" Note: This is probably a bug, since all pylama plugins produce codes, but +" should be handled for compatibility. +" Note: The pylama isort plugin is distributed in the isort package. +Execute(The pylama handler should handle messages without codes with version older than 8.1.4): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'col': 0, + \ 'code': '', + \ 'type': 'W', + \ 'sub_type': '', + \ 'text': 'Incorrectly sorted imports. [isort]' + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [ + \ 'index.py:0:0: Incorrectly sorted imports. [isort]', + \ ]) + +" Note: This is a pylama bug, but should be handled for compatibility. +" See https://github.com/klen/pylama/pull/146 +Execute(The pylama handler should handle message codes followed by a colon with version older than 8.1.4): + AssertEqual + \ [ + \ { + \ 'lnum': 31, + \ 'col': 1, + \ 'code': 'E800', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'Found commented out code: # needs_sphinx = ''1.0'' [eradicate]', + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [ + \ 'index.py:31:1: E800: Found commented out code: # needs_sphinx = ''1.0'' [eradicate]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_pylint_handler.vader b/sources_non_forked/ale/test/handler/test_pylint_handler.vader new file mode 100644 index 00000000..ce7322f3 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pylint_handler.vader @@ -0,0 +1,135 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/pylint.vim + +After: + Restore + + call ale#linter#Reset() + + silent file something_else.py + +Execute(Basic pylint errors should be handle): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 1, + \ 'text': 'Trailing whitespace', + \ 'code': 'trailing-whitespace', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Missing module docstring', + \ 'code': 'missing-docstring', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'Missing function docstring', + \ 'code': 'missing-docstring', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'text': '''break'' not properly in loop', + \ 'code': 'not-in-loop', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 5, + \ 'text': 'Unreachable code', + \ 'code': 'unreachable', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 33, + \ 'text': 'No exception type(s) specified', + \ 'code': 'bare-except', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#python#pylint#Handle(bufnr(''), [ + \ 'No config file found, using default configuration', + \ '************* Module test', + \ 'test.py:4:0: C0303 (trailing-whitespace) Trailing whitespace', + \ 'test.py:1:0: C0111 (missing-docstring) Missing module docstring', + \ 'test.py:2:0: C0111 (missing-docstring) Missing function docstring', + \ 'test.py:3:4: E0103 (not-in-loop) ''break'' not properly in loop', + \ 'test.py:4:4: W0101 (unreachable) Unreachable code', + \ 'test.py:7:32: W0702 (bare-except) No exception type(s) specified', + \ '', + \ '------------------------------------------------------------------', + \ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)', + \ ]) + +Execute(Ignoring trailing whitespace messages should work): + let g:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Missing module docstring', + \ 'code': 'missing-docstring', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#python#pylint#Handle(bufnr(''), [ + \ 'No config file found, using default configuration', + \ '************* Module test', + \ 'test.py:4:0: C0303 (trailing-whitespace) Trailing whitespace', + \ 'test.py:1:0: C0111 (missing-docstring) Missing module docstring', + \ '', + \ '------------------------------------------------------------------', + \ 'Your code has been rated at 0.00/10 (previous run: 2.50/10, -2.50)', + \ ]) + +Execute(The pylint handler should parse Windows filenames): + AssertEqual + \ [ + \ { + \ 'lnum': 13, + \ 'col': 6, + \ 'text': 'Undefined variable ''x''', + \ 'code': 'undefined-variable', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#python#pylint#Handle(bufnr(''), [ + \ '************* Module test', + \ 'D:\acm\github\vim\tools\test.py:13:5: E0602 (undefined-variable) Undefined variable ''x''', + \ '', + \ '------------------------------------------------------------------', + \ 'Your code has been rated at 5.83/10 (previous run: 5.83/10, +0.00)', + \ ]) + +Execute(Use msg_id): + let g:ale_python_pylint_use_msg_id = 1 + AssertEqual + \ [ + \ { + \ 'lnum': 13, + \ 'col': 6, + \ 'text': 'Undefined variable ''x''', + \ 'code': 'E0602', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#python#pylint#Handle(bufnr(''), [ + \ '************* Module test', + \ 'D:\acm\github\vim\tools\test.py:13:5: E0602 (undefined-variable) Undefined variable ''x''', + \ '', + \ '------------------------------------------------------------------', + \ 'Your code has been rated at 5.83/10 (previous run: 5.83/10, +0.00)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_pyrex_cython_handler.vader b/sources_non_forked/ale/test/handler/test_pyrex_cython_handler.vader new file mode 100644 index 00000000..fd0f9a8b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_pyrex_cython_handler.vader @@ -0,0 +1,26 @@ +Before: + runtime ale_linters/pyrex/cython.vim + +After: + call ale#linter#Reset() + +Execute(The cython handler should handle warnings and errors): + AssertEqual + \ [ + \ { + \ 'lnum': 42, + \ 'col': 7, + \ 'text': 'some warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 777, + \ 'col': 21, + \ 'text': 'some error', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#pyrex#cython#Handle(347, [ + \ 'warning: file:42:7: some warning', + \ 'file:777:21: some error', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_qmlfmt_handler.vader b/sources_non_forked/ale/test/handler/test_qmlfmt_handler.vader new file mode 100644 index 00000000..fc8ef355 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_qmlfmt_handler.vader @@ -0,0 +1,19 @@ +Before: + runtime ale_linters/qml/qmlfmt.vim + +After: + call ale#linter#Reset() + +Execute(The qmlfmt handler should parse error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 22, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'Expected token ''}''.' + \ } + \ ], + \ ale_linters#qml#qmlfmt#Handle(1, [ + \ 'Error:22:1: Expected token ''}''.' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_qmllint_handler.vader b/sources_non_forked/ale/test/handler/test_qmllint_handler.vader new file mode 100644 index 00000000..fcc65eb5 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_qmllint_handler.vader @@ -0,0 +1,19 @@ +Before: + runtime ale_linters/qml/qmllint.vim + +After: + call ale#linter#Reset() + +Execute(The qmllint handler should parse error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'Expected token ''}''' + \ } + \ ], + \ ale_linters#qml#qmllint#Handle(1, [ + \ '/tmp/ab34cd56/Test.qml:2 : Expected token ''}''' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_raco_handler.vader b/sources_non_forked/ale/test/handler/test_raco_handler.vader new file mode 100644 index 00000000..565fd795 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_raco_handler.vader @@ -0,0 +1,27 @@ +Before: + runtime ale_linters/racket/raco.vim + +After: + call ale#linter#Reset() + +Execute(The raco handler should handle errors for the current file correctly): + AssertEqual + \ [ + \ { + \ 'filename': 'foo.rkt', + \ 'lnum': 4, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'dfine: unbound identifier in modulemessage', + \ }, + \ ], + \ ale_linters#racket#raco#Handle(bufnr(''), [ + \ 'foo.rkt:4:1: dfine: unbound identifier in modulemessage', + \ ' in: dfine', + \ ' context...:', + \ ' /usr/local/Cellar/racket/6.5/share/racket/pkgs/compiler-lib/compiler/commands/expand.rkt:34:15: loop', + \ ' /usr/local/Cellar/racket/6.5/share/racket/pkgs/compiler-lib/compiler/commands/expand.rkt:10:2: show-program', + \ ' /usr/local/Cellar/racket/6.5/share/racket/pkgs/compiler-lib/compiler/commands/expand.rkt: [running body]', + \ ' /usr/local/Cellar/minimal-racket/6.6/share/racket/collects/raco/raco.rkt: [running body]', + \ ' /usr/local/Cellar/minimal-racket/6.6/share/racket/collects/raco/main.rkt: [running body]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_rails_best_practices_handler.vader b/sources_non_forked/ale/test/handler/test_rails_best_practices_handler.vader new file mode 100644 index 00000000..f6d69eee --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_rails_best_practices_handler.vader @@ -0,0 +1,52 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/handler') + cd .. + + runtime ale_linters/ruby/rails_best_practices.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The rails_best_practices handler should parse JSON correctly): + call ale#test#SetFilename('test-files/ruby/valid_rails_app/app/models/thing.rb') + + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'text': 'use local variable', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 10, + \ 'text': 'other advice', + \ 'type': 'W', + \ } + \ ], + \ ale_linters#ruby#rails_best_practices#Handle(bufnr(''), [ + \ '[', + \ '{', + \ '"message": "use local variable",', + \ '"line_number": "5",', + \ printf('"filename": "%s"', substitute(expand('%:p'), '\\', '\\\\', 'g')), + \ '},{', + \ '"message": "other advice",', + \ '"line_number": "10",', + \ printf('"filename": "%s"', substitute(expand('%:p'), '\\', '\\\\', 'g')), + \ '}', + \ ']' + \ ]) + +Execute(The rails_best_practices handler should parse JSON correctly when there is no output from the tool): + AssertEqual + \ [], + \ ale_linters#ruby#rails_best_practices#Handle(347, [ + \ ]) + +Execute(The rails_best_practices handler should handle garbage output): + AssertEqual + \ [], + \ ale_linters#ruby#rails_best_practices#Handle(347, [ + \ 'No such command in 2.4.1 of ruby', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_redpen_handler.vader b/sources_non_forked/ale/test/handler/test_redpen_handler.vader new file mode 100644 index 00000000..0b030e2d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_redpen_handler.vader @@ -0,0 +1,98 @@ +Before: + runtime! ale_linters/markdown/redpen.vim + +After: + call ale#linter#Reset() + +Execute(redpen handler should handle errors output): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'end_lnum': 1, + \ 'end_col': 15, + \ 'text': 'Found possibly misspelled word "plugin".', + \ 'type': 'W', + \ 'code': 'Spelling', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Found possibly misspelled word "NeoVim".', + \ 'type': 'W', + \ 'code': 'Spelling', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 35, + \ 'end_lnum': 1, + \ 'end_col': 55, + \ 'text': 'Found possibly misspelled word "コードチェック".', + \ 'type': 'W', + \ 'code': 'Spelling', + \ }, + \ ], + \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [ + \ '[', + \ ' {', + \ ' "document": "test.md",', + \ ' "errors": [', + \ ' {', + \ ' "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",', + \ ' "endPosition": {', + \ ' "offset": 15,', + \ ' "lineNum": 1', + \ ' },', + \ ' "validator": "Spelling",', + \ ' "lineNum": 1,', + \ ' "sentenceStartColumnNum": 0,', + \ ' "message": "Found possibly misspelled word \"plugin\".",', + \ ' "startPosition": {', + \ ' "offset": 9,', + \ ' "lineNum": 1', + \ ' }', + \ ' },', + \ ' {', + \ ' "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",', + \ ' "validator": "Spelling",', + \ ' "lineNum": 1,', + \ ' "sentenceStartColumnNum": 0,', + \ ' "message": "Found possibly misspelled word \"NeoVim\"."', + \ ' },', + \ ' {', + \ ' "sentence": "ALEはNeoVimとVim8で非同期のコードチェックを実現するプラグインです。",', + \ ' "endPosition": {', + \ ' "offset": 27,', + \ ' "lineNum": 1', + \ ' },', + \ ' "validator": "Spelling",', + \ ' "lineNum": 1,', + \ ' "sentenceStartColumnNum": 0,', + \ ' "message": "Found possibly misspelled word \"コードチェック\".",', + \ ' "startPosition": {', + \ ' "offset": 20,', + \ ' "lineNum": 1', + \ ' }', + \ ' }', + \ ' ]', + \ ' }', + \ ']', + \ ]) + +Execute(The redpen handler should handle an empty error list): + AssertEqual + \ [], + \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [ + \ '[', + \ ' {', + \ ' "document": "test.md",', + \ ' "errors": []', + \ ' }', + \ ']', + \ ]) + +Execute(The redpen handler should handle totally empty output): + AssertEqual + \ [], + \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), []) diff --git a/sources_non_forked/ale/test/handler/test_reek_handler.vader b/sources_non_forked/ale/test/handler/test_reek_handler.vader new file mode 100644 index 00000000..db0a1119 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_reek_handler.vader @@ -0,0 +1,81 @@ +Before: + runtime ale_linters/ruby/reek.vim + +After: + call ale#linter#Reset() + +Execute(The reek handler should parse JSON correctly, with only context enabled): + let g:ale_ruby_reek_show_context = 1 + let g:ale_ruby_reek_show_wiki_link = 0 + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'text': 'Context#method violates rule number one', + \ 'code': 'Rule1', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 34, + \ 'text': 'Context#method violates rule number two', + \ 'code': 'Rule2', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 56, + \ 'text': 'Context#method violates rule number two', + \ 'code': 'Rule2', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#ruby#reek#Handle(347, [ + \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"},{"context":"Context#method","lines":[34, 56],"message":"violates rule number two","smell_type":"Rule2","source":"/home/user/file.rb","name":"bad code","count":2,"wiki_link":"https://example.com/Rule1.md"}]' + \ ]) + +Execute(The reek handler should parse JSON correctly, with no context or wiki links): + let g:ale_ruby_reek_show_context = 0 + let g:ale_ruby_reek_show_wiki_link = 0 + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'text': 'violates rule number one', + \ 'code': 'Rule1', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#ruby#reek#Handle(347, [ + \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]' + \ ]) + +Execute(The reek handler should parse JSON correctly, with both context and wiki links): + let g:ale_ruby_reek_show_context = 1 + let g:ale_ruby_reek_show_wiki_link = 1 + + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'text': 'Context#method violates rule number one [https://example.com/Rule1.md]', + \ 'code': 'Rule1', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#ruby#reek#Handle(347, [ + \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]' + \ ]) + +Execute(The reek handler should parse JSON correctly when there is no output from reek): + AssertEqual + \ [], + \ ale_linters#ruby#reek#Handle(347, [ + \ ]) + +Execute(The reek handler should handle garbage output): + AssertEqual + \ [], + \ ale_linters#ruby#reek#Handle(347, [ + \ 'No such command in 2.4.1 of ruby', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_remark_lint_handler.vader b/sources_non_forked/ale/test/handler/test_remark_lint_handler.vader new file mode 100644 index 00000000..0794d51c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_remark_lint_handler.vader @@ -0,0 +1,39 @@ +Before: + runtime ale_linters/markdown/remark_lint.vim + +After: + call ale#linter#Reset() + +Execute(Warning and error messages should be handled correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 4, + \ 'type': 'W', + \ 'text': 'Incorrect list-item indent: add 1 space list-item-indent remark-lint', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'type': 'E', + \ 'text': 'Incorrect list-item indent: remove 1 space list-item-indent remark-lint', + \ }, + \ { + \ 'lnum': 18, + \ 'col': 71, + \ 'end_lnum': 19, + \ 'end_col': 1, + \ 'type': 'E', + \ 'text': 'Missing new line after list item list-item-spacing remark-lint', + \ }, + \ ], + \ ale_linters#markdown#remark_lint#Handle(1, [ + \ 'foo.md', + \ ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint', + \ ' 3:5 error Incorrect list-item indent: remove 1 space list-item-indent remark-lint', + \ ' 18:71-19:1 error Missing new line after list item list-item-spacing remark-lint', + \ '', + \ '⚠ 1 warnings', + \ '✘ 2 errors', + \]) diff --git a/sources_non_forked/ale/test/handler/test_rflint_handler.vader b/sources_non_forked/ale/test/handler/test_rflint_handler.vader new file mode 100644 index 00000000..f2670141 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_rflint_handler.vader @@ -0,0 +1,33 @@ +Before: + runtime ale_linters/robot/rflint.vim + +After: + call ale#linter#Reset() + +Execute(Warning and error messages should be handled correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 1, + \ 'filename': 'test.robot', + \ 'type': 'W', + \ 'lnum': 1, + \ 'col': 2, + \ 'text': 'RequireSuiteDocumentation', + \ 'detail': 'No suite documentation', + \ }, + \ { + \ 'bufnr': 1, + \ 'filename': 'test.robot', + \ 'type': 'E', + \ 'lnum': 3, + \ 'col': 4, + \ 'text': 'RequireTestDocumentation', + \ 'detail': 'No testcase documentation', + \ }, + \ ], + \ ale_linters#robot#rflint#Handle(1, [ + \ 'test.robot:W:1:2:RequireSuiteDocumentation:No suite documentation', + \ 'test.robot:E:3:4:RequireTestDocumentation:No testcase documentation' + \]) + diff --git a/sources_non_forked/ale/test/handler/test_rpmlint_handler.vader b/sources_non_forked/ale/test/handler/test_rpmlint_handler.vader new file mode 100644 index 00000000..2ea9e5cf --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_rpmlint_handler.vader @@ -0,0 +1,33 @@ +Before: + runtime ale_linters/spec/rpmlint.vim + +After: + call ale#linter#Reset() + +Execute(The rpmlint handler should parse error messages correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 42, + \ 'lnum': 23, + \ 'text': 'macro-in-comment %version', + \ 'type': 'W', + \ }, + \ { + \ 'bufnr': 42, + \ 'lnum': 17, + \ 'text': 'hardcoded-library-path in %_prefix/lib/%name', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': 42, + \ 'lnum': 1, + \ 'text': 'specfile-error warning: bogus date in %changelog: Mon Oct 1 2005 - Foo', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#spec#rpmlint#Handle(42, [ + \ 'cyrus-imapd.spec:23: W: macro-in-comment %version', + \ 'cyrus-imapd.spec:17: E: hardcoded-library-path in %_prefix/lib/%name', + \ 'apcupsd.spec: E: specfile-error warning: bogus date in %changelog: Mon Oct 1 2005 - Foo', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_rstcheck_lint_handler.vader b/sources_non_forked/ale/test/handler/test_rstcheck_lint_handler.vader new file mode 100644 index 00000000..c65c15eb --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_rstcheck_lint_handler.vader @@ -0,0 +1,42 @@ +Before: + runtime ale_linters/rst/rstcheck.vim + +After: + call ale#linter#Reset() + +Execute(Warning and error messages should be handled correctly): + " For some reason we can't set the directory such that the filenames are + " correct here when running the tests from the Docker image, so we have to + " just check the basenames of the files instead. + AssertEqual + \ [ + \ { + \ 'filename': 'bad_python.rst', + \ 'lnum': 7, + \ 'col': 0, + \ 'type': 'W', + \ 'text': '(python) unexpected EOF while parsing', + \ }, + \ { + \ 'filename': 'bad_cpp.rst', + \ 'lnum': 9, + \ 'col': 0, + \ 'type': 'W', + \ 'text': '(cpp) error: ''x'' was not declared in this scope', + \ }, + \ { + \ 'filename': 'bad_rst.rst', + \ 'lnum': 1, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'Title overline & underline mismatch.', + \ }, + \ ], + \ map( + \ ale_linters#rst#rstcheck#Handle(1, [ + \ 'bad_python.rst:7: (ERROR/3) (python) unexpected EOF while parsing', + \ 'bad_cpp.rst:9: (ERROR/3) (cpp) error: ''x'' was not declared in this scope', + \ 'bad_rst.rst:1: (SEVERE/4) Title overline & underline mismatch.', + \ ]), + \ 'extend(v:val, {''filename'': fnamemodify(v:val.filename, '':t'')})' + \ ) diff --git a/sources_non_forked/ale/test/handler/test_rubocop_handler.vader b/sources_non_forked/ale/test/handler/test_rubocop_handler.vader new file mode 100644 index 00000000..d7868f26 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_rubocop_handler.vader @@ -0,0 +1,76 @@ +Before: + runtime ale_linters/ruby/rubocop.vim + +After: + unlet! g:lines + call ale#linter#Reset() + +Execute(The rubocop handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 83, + \ 'col': 29, + \ 'end_col': 35, + \ 'text': 'Prefer single-quoted strings...', + \ 'code': 'Style/SomeCop', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 12, + \ 'col': 2, + \ 'end_col': 2, + \ 'text': 'Some error', + \ 'code': 'Style/SomeOtherCop', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 5, + \ 'end_col': 12, + \ 'text': 'Regular warning', + \ 'code': 'Style/WarningCop', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 11, + \ 'col': 1, + \ 'end_col': 1, + \ 'text': 'Another error', + \ 'code': 'Style/SpaceBeforeBlockBraces', + \ 'type': 'E', + \ }, + \ ], + \ ale#ruby#HandleRubocopOutput(347, [ + \ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[{"path":"my_great_file.rb","offenses":[{"severity":"convention","message":"Prefer single-quoted strings...","cop_name":"Style/SomeCop","corrected":false,"location":{"line":83,"column":29,"length":7}},{"severity":"fatal","message":"Some error","cop_name":"Style/SomeOtherCop","corrected":false,"location":{"line":12,"column":2,"length":1}},{"severity":"warning","message":"Regular warning","cop_name":"Style/WarningCop","corrected":false,"location":{"line":10,"column":5,"length":8}},{"severity":"error","message":"Another error","cop_name":"Style/SpaceBeforeBlockBraces","corrected":false,"location":{"line":11,"column":1,"length":1}}]}],"summary":{"offense_count":4,"target_file_count":1,"inspected_file_count":1}}' + \ ]) + +Execute(The rubocop handler should handle when files are checked and no offenses are found): + AssertEqual + \ [], + \ ale#ruby#HandleRubocopOutput(347, [ + \ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[{"path":"my_great_file.rb","offenses":[]}],"summary":{"offense_count":0,"target_file_count":1,"inspected_file_count":1}}' + \ ]) + +Execute(The rubocop handler should handle when no files are checked): + AssertEqual + \ [], + \ ale#ruby#HandleRubocopOutput(347, [ + \ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[],"summary":{"offense_count":0,"target_file_count":0,"inspected_file_count":0}}' + \ ]) + +Execute(The rubocop handler should handle output without any errors): + let g:lines = [ + \ '{"metadata":{"rubocop_version":"0.48.1","ruby_engine":"ruby","ruby_version":"2.4.1","ruby_patchlevel":"111","ruby_platform":"x86_64-darwin16"},"files":[]}', + \] + + AssertEqual + \ [], + \ ale#ruby#HandleRubocopOutput(347, g:lines) + \ + AssertEqual + \ [], + \ ale#ruby#HandleRubocopOutput(347, ['{}']) + AssertEqual + \ [], + \ ale#ruby#HandleRubocopOutput(347, []) diff --git a/sources_non_forked/ale/test/handler/test_ruby_handler.vader b/sources_non_forked/ale/test/handler/test_ruby_handler.vader new file mode 100644 index 00000000..824d8c58 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_ruby_handler.vader @@ -0,0 +1,38 @@ +Before: + runtime ale_linters/ruby/ruby.vim + +After: + call ale#linter#Reset() + +Execute(The ruby handler should parse lines correctly and add the column if it can): + " Point Error + " Warning + " Line Error + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 13, + \ 'type': 'E', + \ 'text': 'syntax error, unexpected '';''' + \ }, + \ { + \ 'lnum': 9, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'warning: statement not reached' + \ }, + \ { + \ 'lnum': 12, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'syntax error, unexpected end-of-input, expecting keyword_end' + \ } + \ ], + \ ale#handlers#ruby#HandleSyntaxErrors(255, [ + \ "test.rb:6: syntax error, unexpected ';'", + \ " t = ;", + \ " ^", + \ "test.rb:9: warning: statement not reached", + \ "test.rb:12: syntax error, unexpected end-of-input, expecting keyword_end", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_rust_handler.vader b/sources_non_forked/ale/test/handler/test_rust_handler.vader new file mode 100644 index 00000000..845df2b5 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_rust_handler.vader @@ -0,0 +1,483 @@ +Execute(The Rust handler should handle rustc output): + call ale#test#SetFilename('src/playpen.rs') + + AssertEqual + \ [ + \ { + \ 'lnum': 15, + \ 'end_lnum': 15, + \ 'type': 'E', + \ 'col': 5, + \ 'end_col': 7, + \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', + \ }, + \ { + \ 'lnum': 13, + \ 'end_lnum': 13, + \ 'type': 'E', + \ 'col': 7, + \ 'end_col': 9, + \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', + \ }, + \ ], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ '', + \ 'ignore this', + \ json_encode({ + \ 'message': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', + \ 'code': v:null, + \ 'level': 'error', + \ 'spans': [ + \ { + \ 'file_name': '', + \ 'byte_start': 418, + \ 'byte_end': 421, + \ 'line_start': 15, + \ 'line_end': 15, + \ 'column_start': 5, + \ 'column_end': 8, + \ 'is_primary': v:true, + \ 'label': v:null, + \ }, + \ ], + \ }), + \ json_encode({ + \ 'message': 'main function not found', + \ 'code': v:null, + \ 'level': 'error', + \ 'spans': [], + \ }), + \ json_encode({ + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'no method named `wat` found for type `std::string::String` in the current scope', + \ 'spans': [ + \ { + \ 'byte_end': 410, + \ 'byte_start': 407, + \ 'column_end': 10, + \ 'column_start': 7, + \ 'file_name': '', + \ 'is_primary': v:true, + \ 'label': v:null, + \ 'line_end': 13, + \ 'line_start': 13, + \ } + \ ] + \ }), + \ json_encode({ + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'aborting due to previous error', + \ 'spans': [ + \ ] + \ }), + \ ]) + +Execute(The Rust handler should handle cargo output): + call ale#test#SetFilename('src/playpen.rs') + + AssertEqual + \ [ + \ { + \ 'lnum': 15, + \ 'end_lnum': 15, + \ 'type': 'E', + \ 'col': 5, + \ 'end_col': 7, + \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', + \ }, + \ { + \ 'lnum': 13, + \ 'end_lnum': 13, + \ 'type': 'E', + \ 'col': 7, + \ 'end_col': 9, + \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', + \ }, + \ ], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ '', + \ 'ignore this', + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', + \ 'spans': [ + \ { + \ 'byte_end': 11508, + \ 'byte_start': 11505, + \ 'column_end': 8, + \ 'column_start': 5, + \ 'file_name': ale#path#Simplify('src/playpen.rs'), + \ 'is_primary': v:true, + \ 'label': v:null, + \ 'line_end': 15, + \ 'line_start': 15, + \ } + \ ] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'no method named `wat` found for type `std::string::String` in the current scope', + \ 'spans': [ + \ { + \ 'byte_end': 11497, + \ 'byte_start': 11494, + \ 'column_end': 10, + \ 'column_start': 7, + \ 'file_name': ale#path#Simplify('src/playpen.rs'), + \ 'is_primary': v:true, + \ 'label': v:null, + \ 'line_end': 13, + \ 'line_start': 13, + \ } + \ ] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'aborting due to previous error', + \ 'spans': [ + \ ] + \ }, + \ }), + \ ]) + +Execute(The Rust handler should should errors from expansion spans): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'end_lnum': 4, + \ 'type': 'E', + \ 'col': 21, + \ 'end_col': 22, + \ 'text': 'mismatched types: expected bool, found integral variable', + \ }, + \ ], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'mismatched types', + \ 'spans': [ + \ { + \ 'byte_end': 1, + \ 'byte_start': 1, + \ 'column_end': 1, + \ 'column_start': 1, + \ 'file_name': ale#path#Simplify('src/other.rs'), + \ 'is_primary': v:true, + \ 'label': 'some other error', + \ 'line_end': 4, + \ 'line_start': 4, + \ 'expansion': { + \ 'span': { + \ 'byte_end': 54, + \ 'byte_start': 52, + \ 'column_end': 23, + \ 'column_start': 21, + \ 'file_name': ale#path#Simplify('src/playpen.rs'), + \ 'is_primary': v:true, + \ 'label': 'expected bool, found integral variable', + \ 'line_end': 4, + \ 'line_start': 4, + \ } + \ } + \ } + \ ] + \ }, + \ }), + \ ]) + +Execute(The Rust handler should show detailed errors): + call ale#test#SetFilename('src/playpen.rs') + + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'end_lnum': 4, + \ 'type': 'E', + \ 'col': 21, + \ 'end_col': 22, + \ 'text': 'mismatched types: expected bool, found integral variable', + \ }, + \ ], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ '', + \ 'ignore this', + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'mismatched types', + \ 'spans': [ + \ { + \ 'byte_end': 54, + \ 'byte_start': 52, + \ 'column_end': 23, + \ 'column_start': 21, + \ 'expansion': v:null, + \ 'file_name': ale#path#Simplify('src/playpen.rs'), + \ 'is_primary': v:true, + \ 'label': 'expected bool, found integral variable', + \ 'line_end': 4, + \ 'line_start': 4, + \ } + \ ] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'aborting due to previous error(s)', + \ 'spans': [ + \ ] + \ }, + \ }), + \ ]) + +Execute(The Rust handler should show detailed clippy errors with rendered field if it's available): + call ale#test#SetFilename('src/playpen.rs') + + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'end_lnum': 4, + \ 'type': 'E', + \ 'col': 21, + \ 'end_col': 22, + \ 'text': 'mismatched types: expected bool, found integral variable', + \ 'detail': 'this is a detailed description', + \ }, + \ ], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ '', + \ 'ignore this', + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'mismatched types', + \ 'rendered': 'this is a detailed description', + \ 'spans': [ + \ { + \ 'byte_end': 54, + \ 'byte_start': 52, + \ 'column_end': 23, + \ 'column_start': 21, + \ 'expansion': v:null, + \ 'file_name': ale#path#Simplify('src/playpen.rs'), + \ 'is_primary': v:true, + \ 'label': 'expected bool, found integral variable', + \ 'line_end': 4, + \ 'line_start': 4, + \ } + \ ] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'aborting due to previous error(s)', + \ 'spans': [ + \ ] + \ }, + \ }), + \ ]) + +Execute(The Rust handler should find correct files): + call ale#test#SetFilename('src/noerrors/mod.rs') + + AssertEqual + \ [], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ '', + \ 'ignore this', + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'unresolved import `Undefined`', + \ 'spans': [ + \ { + \ 'byte_end': 103, + \ 'byte_start': 94, + \ 'column_end': 14, + \ 'column_start': 5, + \ 'file_name': 'src/haserrors/mod.rs', + \ 'is_primary': v:true, + \ 'label': 'no `Undefined` in the root', + \ 'line_end': 1, + \ 'line_start': 1, + \ } + \ ] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'aborting due to previous error', + \ 'spans': [ + \ ] + \ }, + \ }), + \ ]) + +Execute(The Rust handler should remove secondary spans if set): + call ale#test#SetFilename('src/noerrors/mod.rs') + + let g:ale_rust_ignore_secondary_spans = 0 + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'end_lnum': 1, + \ 'type': 'E', + \ 'end_col': 20, + \ 'col': 1, + \ 'text': 'this function takes 1 parameter but 0 were supplied: defined here', + \ }, + \ { + \ 'lnum': 1, + \ 'end_lnum': 1, + \ 'type': 'E', + \ 'end_col': 45, + \ 'col': 40, + \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter', + \ }, + \ ], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ '', + \ 'fn test(x: u8) -> u8 { x } fn main() { x(); }', + \ json_encode({ + \ 'message': { + \ 'code': { + \ 'code': 'E0061', + \ 'explanation': 'Dummy explanation; not used' + \ }, + \ 'level': 'error', + \ 'message': 'this function takes 1 parameter but 0 were supplied', + \ 'spans': [ + \ { + \ 'byte_end': 20, + \ 'byte_start': 0, + \ 'column_end': 21, + \ 'column_start': 1, + \ 'file_name': 'src/noerrors/mod.rs', + \ 'is_primary': v:false, + \ 'label': 'defined here', + \ 'line_end': 1, + \ 'line_start': 1, + \ }, + \ { + \ 'byte_end': 45, + \ 'byte_start': 39, + \ 'column_end': 46, + \ 'column_start': 40, + \ 'file_name': '', + \ 'is_primary': v:true, + \ 'label': 'expected 1 parameter', + \ 'line_end': 1, + \ 'line_start': 1, + \ }, + \ ] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'aborting due to previous error', + \ 'spans': [] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'For more information about this error, try `rustc --explain E0061`.', + \ 'spans': [] + \ }, + \ }), + \ ]) + + let g:ale_rust_ignore_secondary_spans = 1 + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'end_lnum': 1, + \ 'type': 'E', + \ 'end_col': 45, + \ 'col': 40, + \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter', + \ }, + \ ], + \ ale#handlers#rust#HandleRustErrors(bufnr(''), [ + \ '', + \ 'fn test(x: u8) -> u8 { x } fn main() { x(); }', + \ json_encode({ + \ 'message': { + \ 'code': { + \ 'code': 'E0061', + \ 'explanation': 'Dummy explanation; not used' + \ }, + \ 'level': 'error', + \ 'message': 'this function takes 1 parameter but 0 were supplied', + \ 'spans': [ + \ { + \ 'byte_end': 20, + \ 'byte_start': 0, + \ 'column_end': 21, + \ 'column_start': 1, + \ 'file_name': 'src/noerrors/mod.rs', + \ 'is_primary': v:false, + \ 'label': 'defined here', + \ 'line_end': 1, + \ 'line_start': 1, + \ }, + \ { + \ 'byte_end': 45, + \ 'byte_start': 39, + \ 'column_end': 46, + \ 'column_start': 40, + \ 'file_name': '', + \ 'is_primary': v:true, + \ 'label': 'expected 1 parameter', + \ 'line_end': 1, + \ 'line_start': 1, + \ }, + \ ] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'aborting due to previous error', + \ 'spans': [] + \ }, + \ }), + \ json_encode({ + \ 'message': { + \ 'code': v:null, + \ 'level': 'error', + \ 'message': 'For more information about this error, try `rustc --explain E0061`.', + \ 'spans': [] + \ }, + \ }), + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_salt_salt_lint.vader b/sources_non_forked/ale/test/handler/test_salt_salt_lint.vader new file mode 100644 index 00000000..7e234785 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_salt_salt_lint.vader @@ -0,0 +1,34 @@ +Before: + runtime ale_linters/salt/salt_lint.vim + +After: + call ale#linter#Reset() + +Execute(The salt handler should parse lines correctly and show error in severity HIGH): + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'code': 207, + \ 'text': 'File modes should always be encapsulated in quotation marks', + \ 'type': 'E' + \ } + \ ], + \ ale_linters#salt#salt_lint#Handle(255, [ + \ '[{"id": "207", "message": "File modes should always be encapsulated in quotation marks", "filename": "test.sls", "linenumber": 5, "line": " - mode: 0755", "severity": "HIGH"}]' + \ ]) + + +Execute(The salt handler should parse lines correctly and show error in severity not HIGH): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'code': 204, + \ 'text': 'Lines should be no longer that 160 chars', + \ 'type': 'W' + \ } + \ ], + \ ale_linters#salt#salt_lint#Handle(255, [ + \ '[{"id": "204", "message": "Lines should be no longer that 160 chars", "filename": "test2.sls", "linenumber": 27, "line": "this line is definitely longer than 160 chars, this line is definitely longer than 160 chars, this line is definitely longer than 160 chars", "severity": "VERY_LOW"}]' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_scala_handler.vader b/sources_non_forked/ale/test/handler/test_scala_handler.vader new file mode 100644 index 00000000..3214bdbc --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_scala_handler.vader @@ -0,0 +1,32 @@ +After: + call ale#linter#Reset() + +Execute(The handler should return an empty list with empty input): + AssertEqual [], ale#handlers#scala#HandleScalacLintFormat(bufnr(''), []) + +Execute(The handler should correctly parse error messages): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 8, + \ 'text': ''':'' expected but identifier found.', + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 6, + \ 'col': 2, + \ 'text': 'identifier expected but eof found.', + \ 'type': 'E' + \ } + \ ], + \ ale#handlers#scala#HandleScalacLintFormat(bufnr(''), + \ [ + \ "hi.scala:4: error: ':' expected but identifier found.", + \ " Some stupid scala code", + \ " ^", + \ "hi.scala:6: error: identifier expected but eof found.", + \ ")", + \ " ^", + \ "two errors found", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_scalastyle_handler.vader b/sources_non_forked/ale/test/handler/test_scalastyle_handler.vader new file mode 100644 index 00000000..32da79c0 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_scalastyle_handler.vader @@ -0,0 +1,53 @@ +Before: + runtime! ale_linters/scala/scalastyle.vim + +After: + call ale#linter#Reset() + +Execute(The scalastyle handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 190, + \ 'text': 'Missing or badly formed ScalaDoc: Missing @param str', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 200, + \ 'col': 34, + \ 'text': 'There should be a space before the plus (+) sign', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 200, + \ 'col': 1, + \ 'text': 'There should be a space before the plus (+) sign', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#scala#scalastyle#Handle(347, [ + \ 'Starting scalastyle', + \ 'start file /home/test/Doop.scala', + \ 'warning file=/home/test/Doop.scala message=Missing or badly formed ScalaDoc: Missing @param str line=190', + \ 'error file=/home/test/Doop.scala message=There should be a space before the plus (+) sign line=200 column=33', + \ 'error file=/home/test/Doop.scala message=There should be a space before the plus (+) sign line=200 column=0', + \ 'end file /home/test/Doop.scala', + \ 'Processed 1 file(s)', + \ 'Found 0 errors', + \ 'Found 3 warnings', + \ 'Finished in 934 ms', + \ ]) + +Execute(The scalastyle linter should complain when there is no configuration file): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': '(See :help ale-scala-scalastyle) No scalastyle configuration file was found.', + \ }, + \ ], + \ ale_linters#scala#scalastyle#Handle(347, [ + \ 'scalastyle 1.0.0', + \ 'Usage: scalastyle [options] ', + \ ' -c, --config FILE configuration file (required)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_shell_handler.vader b/sources_non_forked/ale/test/handler/test_shell_handler.vader new file mode 100644 index 00000000..c61cf37d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_shell_handler.vader @@ -0,0 +1,177 @@ +Before: + runtime ale_linters/sh/shell.vim + +After: + call ale#linter#Reset() + +Execute(The shell handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 13, + \ 'text': 'syntax error near unexpected token d', + \ }, + \ { + \ 'lnum': 7, + \ 'text': 'line 42: line 36:', + \ }, + \ { + \ 'lnum': 11, + \ 'text': 'Syntax error: "(" unexpected', + \ }, + \ { + \ 'lnum': 95, + \ 'text': 'parse error near `out=$(( $1 / 1024. )...', + \ }, + \ { + \ 'lnum': 22, + \ 'text': ':11: :33: :44:', + \ }, + \ { + \ 'lnum': 9, + \ 'text': '`done'' unexpected', + \ }, + \ ], + \ ale_linters#sh#shell#Handle(347, [ + \ 'bash: line 13: syntax error near unexpected token d', + \ 'bash: line 7: line 42: line 36:', + \ 'sh: 11: Syntax error: "(" unexpected', + \ 'qfm:95: parse error near `out=$(( $1 / 1024. )...', + \ 'qfm:22: :11: :33: :44:', + \ 'foo.sh: syntax error at line 9: `done'' unexpected', + \ ]) + +Execute(The shell handler should parse Simplified Chinese lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'text': '未预期的符号“done”附近有语法错误', + \ }, + \ { + \ 'lnum': 90, + \ 'text': '寻找匹配的“"”时遇到了未预期的文件结束符', + \ }, + \ { + \ 'lnum': 111, + \ 'text': '语法错误: 未预期的文件结尾', + \ }, + \ { + \ 'lnum': 22, + \ 'text': ':11: :33: :44:', + \ }, + \ ], + \ ale_linters#sh#shell#Handle(347, [ + \ '/tmp/nvimWL5sOL/2/a.sh:行0: 未预期的符号“done”附近有语法错误', + \ '/tmp/nvimWL5sOL/2/a.sh:行90: 寻找匹配的“"”时遇到了未预期的文件结束符', + \ '/tmp/nvimWL5sOL/2/a.sh:行111: 语法错误: 未预期的文件结尾', + \ '/tmp/nvimWL5sOL/2/a.sh:行22: :11: :33: :44:', + \ ]) + +Execute(The shell handler should parse Traditional Chinese lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'text': '未預期的字組「(」附近有語法錯誤', + \ }, + \ { + \ 'lnum': 90, + \ 'text': '尋找匹配的「"」時遇到了未預期的檔案結束符', + \ }, + \ { + \ 'lnum': 111, + \ 'text': '語法錯誤: 未預期的檔案結尾', + \ }, + \ { + \ 'lnum': 22, + \ 'text': ':11: :33: :44:', + \ }, + \ ], + \ ale_linters#sh#shell#Handle(347, [ + \ '/tmp/nvimWL5sOL/2/a.sh: 列 0: 未預期的字組「(」附近有語法錯誤', + \ '/tmp/nvimWL5sOL/2/a.sh: 列 90: 尋找匹配的「"」時遇到了未預期的檔案結束符', + \ '/tmp/nvimWL5sOL/2/a.sh: 列 111: 語法錯誤: 未預期的檔案結尾', + \ '/tmp/nvimWL5sOL/2/a.sh: 列 22: :11: :33: :44:', + \ ]) + +Execute(The shell handler should parse Japanese lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'text': "予期しないトークン `(' 周辺に構文エラーがあります", + \ }, + \ { + \ 'lnum': 90, + \ 'text': "予期しないトークン `done' 周辺に構文エラーがあります", + \ }, + \ { + \ 'lnum': 111, + \ 'text': "対応する `\"' を探索中に予期しないファイル終了 (EOF) です", + \ }, + \ { + \ 'lnum': 22, + \ 'text': ':11: :33: :44:', + \ }, + \ ], + \ ale_linters#sh#shell#Handle(347, [ + \ "/tmp/nvimWL5sOL/2/a.sh: 行 0: 予期しないトークン `(' 周辺に構文エラーがあります", + \ "/tmp/nvimWL5sOL/2/a.sh: 行 90: 予期しないトークン `done' 周辺に構文エラーがあります", + \ "/tmp/nvimWL5sOL/2/a.sh: 行 111: 対応する `\"' を探索中に予期しないファイル終了 (EOF) です", + \ "/tmp/nvimWL5sOL/2/a.sh: 行 22: :11: :33: :44:", + \ ]) + +Execute(The shell handler should parse Greek lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'text': 'συντακτικό σφάλμα κοντά στο μη αναμενόμενο σύμβολο «done»', + \ }, + \ { + \ 'lnum': 90, + \ 'text': 'syntax error: μη αναμενόμενο τέλος αρχείου', + \ }, + \ { + \ 'lnum': 111, + \ 'text': 'μη αναμενόμενο EOF κατά την αναζήτηση «"»', + \ }, + \ { + \ 'lnum': 22, + \ 'text': ':11: :33: :44:', + \ }, + \ ], + \ ale_linters#sh#shell#Handle(347, [ + \ '/tmp/nvimWL5sOL/2/a.sh: γραμμή 0: συντακτικό σφάλμα κοντά στο μη αναμενόμενο σύμβολο «done»', + \ '/tmp/nvimWL5sOL/2/a.sh: γραμμή 90: syntax error: μη αναμενόμενο τέλος αρχείου', + \ '/tmp/nvimWL5sOL/2/a.sh: γραμμή 111: μη αναμενόμενο EOF κατά την αναζήτηση «"»', + \ "/tmp/nvimWL5sOL/2/a.sh: γραμμή 22: :11: :33: :44:", + \ ]) + +Execute(The shell handler should parse Russian lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'text': 'синтаксическая ошибка рядом с неожиданным маркером «done»', + \ }, + \ { + \ 'lnum': 90, + \ 'text': 'синтаксическая ошибка: неожиданный конец файла', + \ }, + \ { + \ 'lnum': 111, + \ 'text': 'неожиданный конец файла во время поиска «"»', + \ }, + \ { + \ 'lnum': 22, + \ 'text': ':11: :33: :44:', + \ }, + \ ], + \ ale_linters#sh#shell#Handle(347, [ + \ '/tmp/nvimWL5sOL/2/a.sh: строка 0: синтаксическая ошибка рядом с неожиданным маркером «done»', + \ '/tmp/nvimWL5sOL/2/a.sh: строка 90: синтаксическая ошибка: неожиданный конец файла', + \ '/tmp/nvimWL5sOL/2/a.sh: строка 111: неожиданный конец файла во время поиска «"»', + \ '/tmp/nvimWL5sOL/2/a.sh: строка 22: :11: :33: :44:', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_shellcheck_handler.vader b/sources_non_forked/ale/test/handler/test_shellcheck_handler.vader new file mode 100644 index 00000000..33f12989 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_shellcheck_handler.vader @@ -0,0 +1,43 @@ +Before: + runtime ale_linters/shell/shellcheck.vim + +After: + call ale#linter#Reset() + +Execute(The shellcheck handler should handle basic errors or warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'In POSIX sh, ''let'' is not supported.', + \ 'code': 'SC2039', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'type': 'E', + \ 'text': 'Don''t put spaces around the = in assignments.', + \ 'code': 'SC1068', + \ }, + \ ], + \ ale#handlers#shellcheck#Handle(bufnr(''), [ + \ '-:2:1: warning: In POSIX sh, ''let'' is not supported. [SC2039]', + \ '-:2:3: error: Don''t put spaces around the = in assignments. [SC1068]', + \ ]) + +Execute(The shellcheck handler should handle notes): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col': 3, + \ 'type': 'I', + \ 'text': 'Double quote to prevent globbing and word splitting.', + \ 'code': 'SC2086', + \ }, + \ ], + \ ale#handlers#shellcheck#Handle(bufnr(''), [ + \ '-:3:3: note: Double quote to prevent globbing and word splitting. [SC2086]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_slim_handler.vader b/sources_non_forked/ale/test/handler/test_slim_handler.vader new file mode 100644 index 00000000..bfd29f3a --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_slim_handler.vader @@ -0,0 +1,34 @@ +" Author: Markus Doits +Before: + runtime ale_linters/slim/slimlint.vim + +After: + call ale#linter#Reset() + +Execute(The slim handler should parse lines correctly): + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': '`div` is redundant when class attribute shortcut is present', + \ 'code': 'RedundantDiv', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'text': 'Line is too long. [136/80]', + \ 'code': 'LineLength', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 3, + \ 'text': 'Invalid syntax', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#slim#slimlint#Handle(347, [ + \ 'inv.slim:1 [W] RedundantDiv: `div` is redundant when class attribute shortcut is present', + \ 'inv.slim:2 [W] LineLength: Line is too long. [136/80]', + \ 'inv.slim:3 [E] Invalid syntax', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_sml_handler.vader b/sources_non_forked/ale/test/handler/test_sml_handler.vader new file mode 100644 index 00000000..ef93cc47 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_sml_handler.vader @@ -0,0 +1,119 @@ +Execute (Testing on EOF error): + AssertEqual [ + \ { + \ 'filename': 'a.sml', + \ 'lnum': 2, + \ 'col': 15, + \ 'type': 'E', + \ 'text': 'Error: syntax error found at EOF', + \ }, + \], + \ ale#handlers#sml#Handle(42, [ + \ "Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]", + \ "[opening a.sml]", + \ "a.sml:2.16 Error: syntax error found at EOF", + \ '/usr/lib/smlnj/bin/sml: Fatal error -- Uncaught exception Compile with "syntax error" raised at ../compiler/Parse/main/smlfile.sml:15.24-15.46', + \]) + +Execute (Testing if the handler can handle multiple errors on the same line): + AssertEqual [ + \ { + \ 'filename': 'a.sml', + \ 'lnum': 1, + \ 'col': 5, + \ 'type': 'E', + \ 'text': "Error: can't find function arguments in clause", + \ }, + \ { + \ 'filename': 'a.sml', + \ 'lnum': 1, + \ 'col': 12, + \ 'type': 'E', + \ 'text': 'Error: unbound variable or constructor: wow', + \ }, + \], + \ ale#handlers#sml#Handle(42, [ + \ "Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]", + \ "[opening test.sml]", + \ "a.sml:1.6-1.10 Error: can't find function arguments in clause", + \ "a.sml:1.13-1.16 Error: unbound variable or constructor: wow", + \ "/usr/lib/smlnj/bin/sml: Fatal error -- Uncaught exception Error with 0", + \ "raised at ../compiler/TopLevel/interact/evalloop.sml:66.19-66.27", + \]) + +Execute (Testing rarer errors): + AssertEqual [ + \ { + \ 'filename': 'a.sml', + \ 'lnum': 5, + \ 'col': 18, + \ 'type': 'E', + \ 'text': "Error: syntax error found at ID", + \ }, + \ { + \ 'filename': 'a.sml', + \ 'lnum': 7, + \ 'col': 0, + \ 'type': 'E', + \ 'text': "Error: value type in structure doesn't match signature spec", + \ }, + \], + \ ale#handlers#sml#Handle(42, [ + \ "Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]", + \ "[opening test.sml]", + \ "a.sml:5.19 Error: syntax error found at ID", + \ "a.sml:7.1-9.27 Error: value type in structure doesn't match signature spec", + \ "/usr/lib/smlnj/bin/sml: Fatal error -- Uncaught exception Error with 0", + \ "raised at ../compiler/TopLevel/interact/evalloop.sml:66.19-66.27", + \]) + +Execute (Testing a warning): + AssertEqual [ + \ { + \ 'filename': 'a.sml', + \ 'lnum': 4, + \ 'col': 4, + \ 'type': 'W', + \ 'text': "Warning: match nonexhaustive", + \ }, + \], + \ ale#handlers#sml#Handle(42, [ + \ "Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]", + \ "[opening a.sml]", + \ "a.sml:4.5-4.12 Warning: match nonexhaustive", + \ "0 => ...", + \ "val f = fn : int -> int", + \ "-", + \]) + +Execute (Testing stdIn): + AssertEqual [ + \ { + \ 'bufnr': 42, + \ 'lnum': 1, + \ 'col': 5, + \ 'type': 'E', + \ 'text': "Error: operator and operand don't agree [overload conflict]", + \ }, + \ { + \ 'bufnr': 42, + \ 'lnum': 2, + \ 'col': 4, + \ 'type': 'E', + \ 'text': "Error: operator and operand don't agree [overload conflict]", + \ }, + \], + \ ale#handlers#sml#Handle(42, [ + \ "Standard ML of New Jersey v110.79 [built: Sat Oct 26 12:27:04 2019]", + \ "- = stdIn:1.6-1.21 Error: operator and operand don't agree [overload conflict]", + \ " operator domain: [+ ty] * [+ ty]", + \ " operand: string * [int ty]", + \ " in expression:", + \ ' "abc" + 123', + \ "stdIn:2.5-2.20 Error: operator and operand don't agree [overload conflict]", + \ " operator domain: [+ ty] * [+ ty]", + \ " operand: [+ ty] * string", + \ " in expression:", + \ ' 890 + "xyz"', + \ "-", + \]) diff --git a/sources_non_forked/ale/test/handler/test_solc_handler.vader b/sources_non_forked/ale/test/handler/test_solc_handler.vader new file mode 100644 index 00000000..dcaa8b2d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_solc_handler.vader @@ -0,0 +1,34 @@ +Before: + runtime ale_linters/solidity/solc.vim + +After: + call ale#linter#Reset() + +Execute(Check solc output parsing): + AssertEqual + \ [ + \ { + \ 'lnum': 40, + \ 'col': 48, + \ 'text': 'This declaration shadows an existing declaration.', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 23, + \ 'col': 16, + \ 'text': 'Member "getSinleSignature" not found or not visible after argument-dependent lookup in type(contract OneToN).', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#solidity#solc#Handle(bufnr(''), [ + \ 'Warning: This declaration shadows an existing declaration.', + \ ' --> /path/to/file.sol:40:48:', + \ ' |', + \ '40 | function decimals() external view returns (uint8 decimals);', + \ ' | ^------------^', + \ 'Error: Member "getSinleSignature" not found or not visible after argument-dependent lookup in type(contract OneToN).', + \ ' --> /path/to/file.sol:23:16: ', + \ ' | ', + \ '23 | return OneToN.getSinleSignature(signatures, i);', + \ ' | ^----------------------^', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_solhint_handler.vader b/sources_non_forked/ale/test/handler/test_solhint_handler.vader new file mode 100644 index 00000000..f8fffb60 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_solhint_handler.vader @@ -0,0 +1,84 @@ +Before: + runtime ale_linters/solidity/solhint.vim + +After: + call ale#linter#Reset() + +Execute(The solhint handler should parse linter error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 17, + \ 'text': 'Compiler version must be fixed', + \ 'code': 'compiler-fixed', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 8, + \ 'text': 'Use double quotes for string literals', + \ 'code': 'quotes', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 8, + \ 'text': 'Use double quotes for string literals', + \ 'code': 'quotes', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 13, + \ 'col': 3, + \ 'text': 'Expected indentation of 4 spaces but found 2', + \ 'code': 'indent', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 14, + \ 'col': 3, + \ 'text': 'Expected indentation of 4 spaces but found 2', + \ 'code': 'indent', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 47, + \ 'col': 3, + \ 'text': 'Function order is incorrect, public function can not go after internal function.', + \ 'code': 'func-order', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#solhint#Handle(bufnr(''), [ + \ 'contracts/Bounty.sol: line 1, col 17, Warning - Compiler version must be fixed (compiler-fixed)', + \ 'contracts/Bounty.sol: line 4, col 8, Error - Use double quotes for string literals (quotes)', + \ 'contracts/Bounty.sol: line 5, col 8, Error - Use double quotes for string literals (quotes)', + \ 'contracts/Bounty.sol: line 13, col 3, Error - Expected indentation of 4 spaces but found 2 (indent)', + \ 'contracts/Bounty.sol: line 14, col 3, Error - Expected indentation of 4 spaces but found 2 (indent)', + \ 'contracts/Bounty.sol: line 47, col 3, Error - Function order is incorrect, public function can not go after internal function. (func-order)', + \ ]) + + +Execute(The solhint handler should parse syntax error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 30, + \ 'col': 4, + \ 'text': "missing ';' at 'uint248'", + \ 'code': 'Parse error', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 203, + \ 'col': 4, + \ 'text': "no viable alternative at input '_loserStakeMultiplier}'", + \ 'code': 'Parse error', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#solhint#Handle(bufnr(''), [ + \ "contracts/Bounty.sol: line 30, col 4, Error - Parse error: missing ';' at 'uint248'", + \ "contracts/Bounty.sol: line 203, col 4, Error - Parse error: no viable alternative at input '_loserStakeMultiplier}'", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_spectral_handler.vader b/sources_non_forked/ale/test/handler/test_spectral_handler.vader new file mode 100644 index 00000000..89a3ff1b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_spectral_handler.vader @@ -0,0 +1,52 @@ +Before: + runtime ale_linters/yaml/spectral.vim + +After: + call ale#linter#Reset() + +Execute(spectral handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'oas3-api-servers', + \ 'text': 'OpenAPI `servers` must be present and non-empty array.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'oas3-schema', + \ 'text': 'Object should have required property `paths`.', + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'openapi-tags', + \ 'text': 'OpenAPI object should have non-empty `tags` array.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 6, + \ 'code': 'info-contact', + \ 'text': 'Info object should contain `contact` object.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 6, + \ 'code': 'oas3-schema', + \ 'text': '`info` property should have required property `version`.', + \ 'type': 'E' + \ }, + \ ], + \ ale#handlers#spectral#HandleSpectralOutput(bufnr(''), [ + \ 'openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array."', + \ 'openapi.yml:1:1 error oas3-schema "Object should have required property `paths`."', + \ 'openapi.yml:1:1 warning openapi-tags "OpenAPI object should have non-empty `tags` array."', + \ 'openapi.yml:3:6 warning info-contact "Info object should contain `contact` object."', + \ 'openapi.yml:3:6 error oas3-schema "`info` property should have required property `version`."', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_sqlint_handler.vader b/sources_non_forked/ale/test/handler/test_sqlint_handler.vader new file mode 100644 index 00000000..5567ca41 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_sqlint_handler.vader @@ -0,0 +1,34 @@ +Before: + runtime! ale_linters/sql/sqlint.vim + +After: + call ale#linter#Reset() + +Execute(The sqlint handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col': 1, + \ 'text': 'syntax error at or near "WIBBLE"', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 47, + \ 'col': 11, + \ 'text': 'unterminated quoted string at or near "''', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 50, + \ 'col': 12, + \ 'text': 'some warning at end of input', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#sql#sqlint#Handle(347, [ + \ 'This line should be ignored completely', + \ 'stdin:3:1:ERROR syntax error at or near "WIBBLE"', + \ 'stdin:47:11:ERROR unterminated quoted string at or near "''', + \ 'stdin:50:12:WARNING some warning at end of input', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_sqllint_handler.vader b/sources_non_forked/ale/test/handler/test_sqllint_handler.vader new file mode 100644 index 00000000..2f2283c8 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_sqllint_handler.vader @@ -0,0 +1,23 @@ +Before: + " Load the file which defines the linter. + runtime ale_linters/sql/sqllint.vim + +After: + " Unload all linters again. + call ale#linter#Reset() + +Execute (The output should be correct): + + " Test that the right loclist items are parsed from the handler. + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 0, + \ 'type': '', + \ 'text': 'stdin:1 [ER_NO_DB_ERROR] No database selected' + \ }, + \ ], + \ ale_linters#sql#sqllint#Handle(bufnr(''), [ + \ 'stdin:1 [ER_NO_DB_ERROR] No database selected' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_standard_handler.vader b/sources_non_forked/ale/test/handler/test_standard_handler.vader new file mode 100644 index 00000000..31e3a36b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_standard_handler.vader @@ -0,0 +1,37 @@ +Before: + Save g:ale_javascript_eslint_suppress_eslintignore + + let g:ale_javascript_eslint_suppress_eslintignore = 0 + +After: + Restore + +Execute(The standard handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 47, + \ 'col': 14, + \ 'text': 'Expected indentation of 2 spaces but found 4.', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 56, + \ 'col': 41, + \ 'text': 'Strings must use singlequote.', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 13, + \ 'col': 3, + \ 'text': 'Parsing error: Unexpected token', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#eslint#Handle(347, [ + \ 'This line should be ignored completely', + \ '/path/to/some-filename.js:47:14: Expected indentation of 2 spaces but found 4.', + \ '/path/to/some-filename.js:56:41: Strings must use singlequote.', + \ 'This line should be ignored completely', + \ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_statix_handler.vader b/sources_non_forked/ale/test/handler/test_statix_handler.vader new file mode 100644 index 00000000..f2a105ee --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_statix_handler.vader @@ -0,0 +1,16 @@ +Execute(The statix handler should handle statix output): + call ale#test#SetFilename('flake.nix') + + AssertEqual + \ [ + \ { + \ 'lnum': 46, + \ 'type': 'W', + \ 'col': 13, + \ 'code': '3', + \ 'text': 'This assignment is better written with `inherit`' + \ }, + \ ], + \ ale#handlers#statix#Handle(bufnr(''), + \ '>46:13:W:3:This assignment is better written with `inherit`' + \) diff --git a/sources_non_forked/ale/test/handler/test_stylelint_handler.vader b/sources_non_forked/ale/test/handler/test_stylelint_handler.vader new file mode 100644 index 00000000..5cb34601 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_stylelint_handler.vader @@ -0,0 +1,43 @@ +After: + unlet! g:error_lines + +Execute (stylelint errors should be handled correctly): + " Stylelint includes trailing spaces for output. This needs to be taken into + " account for parsing errors. + AssertEqual + \ [ + \ { + \ 'lnum': 108, + \ 'col': 10, + \ 'type': 'E', + \ 'text': 'Unexpected leading zero', + \ 'code': 'number-leading-zero', + \ }, + \ { + \ 'lnum': 116, + \ 'col': 20, + \ 'type': 'E', + \ 'text': 'Expected a trailing semicolon', + \ 'code': 'declaration-block-trailing-semicolon', + \ }, + \ ], + \ ale#handlers#css#HandleStyleLintFormat(42, [ + \ 'src/main.css', + \ ' 108:10 ✖ Unexpected leading zero number-leading-zero ', + \ ' 116:20 ✖ Expected a trailing semicolon declaration-block-trailing-semicolon', + \ ]) + +Execute (stylelint should complain when no configuration file is used): + let g:error_lines = [ + \ 'Error: No configuration provided for /home/w0rp/.vim/bundle/ale/test.stylus', + \ ' at module.exports (/home/w0rp/.vim/bundle/ale/node_modules/stylelint/lib/utils/configurationError.js:8:27)', + \ ' at stylelint._fullExplorer.load.then.then.config (/home/w0rp/.vim/bundle/ale/node_modules/stylelint/lib/getConfigForFile.js:39:13)', + \] + + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'stylelint exception thrown (type :ALEDetail for more information)', + \ 'detail': join(g:error_lines, "\n"), + \ }], + \ ale#handlers#css#HandleStyleLintFormat(347, g:error_lines[:]) diff --git a/sources_non_forked/ale/test/handler/test_swaglint_handler.vader b/sources_non_forked/ale/test/handler/test_swaglint_handler.vader new file mode 100644 index 00000000..7ab10439 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_swaglint_handler.vader @@ -0,0 +1,68 @@ +Before: + runtime ale_linters/yaml/swaglint.vim + +After: + call ale#linter#Reset() + +Execute(The swaglint handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Missing required property: info', + \ 'code': 'sway_object_missing_required_property', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 9, + \ 'text': 'Not a valid response definition', + \ 'code': 'sway_one_of_missing', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 11, + \ 'text': 'Missing required property: description', + \ 'code': 'sway_object_missing_required_property', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 11, + \ 'text': 'Missing required property: $ref', + \ 'code': 'sway_object_missing_required_property', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'text': 'Expected type string but found type integer', + \ 'code': 'sway_invalid_type', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'text': 'No enum match for: 2', + \ 'code': 'sway_enum_mismatch', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 14, + \ 'col': 3, + \ 'text': 'Definition is not used: #/definitions/Foo', + \ 'code': 'sway_unused_definition', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#yaml#swaglint#Handle(347, [ + \ 'swagger.yaml: error @ 1:1 - Missing required property: info (sway_object_missing_required_property)', + \ 'swagger.yaml: error @ 6:9 - Not a valid response definition (sway_one_of_missing)', + \ 'swagger.yaml: error @ 7:11 - Missing required property: description (sway_object_missing_required_property)', + \ 'swagger.yaml: error @ 7:11 - Missing required property: $ref (sway_object_missing_required_property)', + \ 'swagger.yaml: error @ 1:10 - Expected type string but found type integer (sway_invalid_type)', + \ 'swagger.yaml: error @ 1:10 - No enum match for: 2 (sway_enum_mismatch)', + \ 'swagger.yaml: warning @ 14:3 - Definition is not used: #/definitions/Foo (sway_unused_definition)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_swiftlint_handler.vader b/sources_non_forked/ale/test/handler/test_swiftlint_handler.vader new file mode 100644 index 00000000..725ff97c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_swiftlint_handler.vader @@ -0,0 +1,30 @@ +Before: + runtime ale_linters/swift/swiftlint.vim + +After: + call ale#linter#Reset() + +Execute(The swiftint handler should parse error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 7, + \ 'text': 'Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used.', + \ 'code': 'operator_usage_whitespace', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 11, + \ 'text': 'Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used.', + \ 'code': 'operator_usage_whitespace', + \ 'type': 'W', + \ }, + \ + \ ], + \ ale_linters#swift#swiftlint#Handle(bufnr(''), [ + \ 'This line should be ignored', + \ ':1:7: warning: Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)', + \ ':1:11: warning: Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_swipl_handler.vader b/sources_non_forked/ale/test/handler/test_swipl_handler.vader new file mode 100644 index 00000000..81b8b9e5 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_swipl_handler.vader @@ -0,0 +1,155 @@ +Before: + runtime ale_linters/prolog/swipl.vim + +After: + call ale#linter#Reset() + +Execute (The swipl handler should handle oneline warning / error): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 1, + \ 'text': 'Syntax error: Operator expected', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'ERROR: /path/to/test.pl:5:1: Syntax error: Operator expected', + \ ]) + +Execute (The swipl handler should handle a warning / error of two lines): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [ + \ { + \ 'lnum': 9, + \ 'col': 0, + \ 'text': 'Singleton variables: [M]', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'Warning: /path/to/test.pl:9:', + \ ' Singleton variables: [M]', + \ ]) + +Execute (The swipl handler should handle a warning / error of two lines in the new format): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [ + \ { + \ 'lnum': 9, + \ 'col': 0, + \ 'text': 'Singleton variables: [M]', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'Warning: /path/to/test.pl:9:', + \ 'Warning: Singleton variables: [M]', + \ ]) + +Execute (The swipl handler should join three or more lines with '. '): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [ + \ { + \ 'lnum': 10, + \ 'col': 0, + \ 'text': 'Clauses of fib/2 are not together in the source-file. Earlier definition at /path/to/test.pl:7. Current predicate: f/0. Use :- discontiguous fib/2. to suppress this message', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'Warning: /path/to/test.pl:10:', + \ ' Clauses of fib/2 are not together in the source-file', + \ ' Earlier definition at /path/to/test.pl:7', + \ ' Current predicate: f/0', + \ ' Use :- discontiguous fib/2. to suppress this message', + \ ]) + +Execute (The swipl handler should ignore warnings / errors 'No permission to call sandboxed ...'): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'ERROR: /path/to/test.pl:11:', + \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G3416:_G3417,_G3413,_G3414)''', + \ ' Reachable from:', + \ ' system:''$set_pattr''(A,B,C,D)', + \ ' system:''$set_pattr''(vimscript:A,B,C)', + \ ' vimscript: (multifile A)', + \ 'ERROR: /path/to/test.pl:12:', + \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G205:_G206,_G202,_G203)''', + \ ' Reachable from:', + \ ' system:''$set_pattr''(A,B,C,D)', + \ ' system:''$set_pattr''(vimscript:A,B,C)', + \ ' vimscript: (multifile A)', + \ 'ERROR: /path/to/test.pl:13:', + \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G1808:_G1809,_G1805,_G1806)''', + \ ' Reachable from:', + \ ' system:''$set_pattr''(A,B,C,D)', + \ ' system:''$set_pattr''(vimscript:A,B,C)', + \ ' vimscript: (multifile A)', + \ ]) + +Execute (The swipl handler should join three or more lines with '. ' on latest swipl): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [ + \ { + \ 'lnum': 10, + \ 'col': 0, + \ 'text': 'Clauses of fib/2 are not together in the source-file. Earlier definition at /path/to/test.pl:7. Current predicate: f/0. Use :- discontiguous fib/2. to suppress this message', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'Warning: /path/to/test.pl:10:', + \ 'Warning: Clauses of fib/2 are not together in the source-file', + \ 'Warning: Earlier definition at /path/to/test.pl:7', + \ 'Warning: Current predicate: f/0', + \ 'Warning: Use :- discontiguous fib/2. to suppress this message', + \ ]) + +Execute (The swipl handler should ignore warnings / errors 'No permission to call sandboxed with latest swpl...'): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'ERROR: /path/to/test.pl:11:', + \ 'ERROR: No permission to call sandboxed `''$set_predicate_attribute''(_G3416:_G3417,_G3413,_G3414)''', + \ 'ERROR: Reachable from:', + \ 'ERROR: system:''$set_pattr''(A,B,C,D)', + \ 'ERROR: system:''$set_pattr''(vimscript:A,B,C)', + \ 'ERROR: vimscript: (multifile A)', + \ 'ERROR: /path/to/test.pl:12:', + \ 'ERROR: No permission to call sandboxed `''$set_predicate_attribute''(_G205:_G206,_G202,_G203)''', + \ 'ERROR: Reachable from:', + \ 'ERROR: system:''$set_pattr''(A,B,C,D)', + \ 'ERROR: system:''$set_pattr''(vimscript:A,B,C)', + \ 'ERROR: vimscript: (multifile A)', + \ 'ERROR: /path/to/test.pl:13:', + \ 'ERROR: No permission to call sandboxed `''$set_predicate_attribute''(_G1808:_G1809,_G1805,_G1806)''', + \ 'ERROR: Reachable from:', + \ 'ERROR: system:''$set_pattr''(A,B,C,D)', + \ 'ERROR: system:''$set_pattr''(vimscript:A,B,C)', + \ 'ERROR: vimscript: (multifile A)', + \ ]) + +Execute (The swipl handler should handle a warning / error with no line number): + call ale#test#SetFilename('test.pl') + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 0, + \ 'text': 'Exported procedure module_name:pred/0 is not defined', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#prolog#swipl#Handle(bufnr(''), [ + \ 'ERROR: Exported procedure module_name:pred/0 is not defined', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_syntaxerl_handler.vader b/sources_non_forked/ale/test/handler/test_syntaxerl_handler.vader new file mode 100644 index 00000000..95f2bfef --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_syntaxerl_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/erlang/syntaxerl.vim + +After: + call ale#linter#Reset() + +Execute (Handle SyntaxErl output): + AssertEqual + \ [ + \ { + \ 'lnum': 42, + \ 'text': "syntax error before: ','", + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 42, + \ 'text': 'function foo/0 is unused', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#erlang#syntaxerl#Handle(bufnr(''), [ + \ "/tmp/v2wDixk/1/module.erl:42: syntax error before: ','", + \ '/tmp/v2wDixk/2/module.erl:42: warning: function foo/0 is unused', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_systemd_analyze_handler.vader b/sources_non_forked/ale/test/handler/test_systemd_analyze_handler.vader new file mode 100644 index 00000000..c7d668e0 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_systemd_analyze_handler.vader @@ -0,0 +1,19 @@ +Before: + runtime ale_linters/systemd/systemd_analyze.vim + +After: + call ale#linter#Reset() + +Execute(The systemd-analyze handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 9, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'Unknown key name ''Wat'' in section ''Service'', ignoring.', + \ }, + \ ], + \ ale_linters#systemd#systemd_analyze#Handle(bufnr(''), [ + \ '/home/user/.config/systemd/user/foo.service:9: Unknown key name ''Wat'' in section ''Service'', ignoring.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_terraform_handler.vader b/sources_non_forked/ale/test/handler/test_terraform_handler.vader new file mode 100644 index 00000000..4be89cb1 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_terraform_handler.vader @@ -0,0 +1,138 @@ +Before: + " Load the file which defines the linter. + runtime ale_linters/terraform/terraform.vim + call ale#test#SetDirectory('/testplugin/test/test-files/terraform') + call ale#test#SetFilename('providers.tf') + +After: + " Unload all linters again. + call ale#linter#Reset() + call ale#test#RestoreDirectory() + +Execute(The output should be correct): + AssertEqual + \ [ + \ { + \ 'lnum': 17, + \ 'col': 13, + \ 'filename': ale#path#Simplify(g:dir . '/providers.tf'), + \ 'type': 'W', + \ 'text': 'Terraform 0.13 and earlier allowed provider version', + \ }, + \ { + \ 'lnum': 0, + \ 'col': 0, + \ 'filename': ale#path#Simplify(g:dir . '/providers.tf'), + \ 'type': 'E', + \ 'text': 'Plugin reinitialization required. Please run "terraform"', + \ } + \ ], + \ ale_linters#terraform#terraform#Handle(bufnr(''), [ + \ '{', + \ '"valid": false,', + \ '"error_count": 1,', + \ '"warning_count": 1,', + \ '"diagnostics": [', + \ ' {', + \ ' "severity": "warning",', + \ ' "summary": "Version constraints inside provider configuration blocks are deprecated",', + \ ' "detail": "Terraform 0.13 and earlier allowed provider version",', + \ ' "range": {', + \ ' "filename": "providers.tf",', + \ ' "start": {', + \ ' "line": 17,', + \ ' "column": 13,', + \ ' "byte": 669', + \ ' },', + \ ' "end": {', + \ ' "line": 17,', + \ ' "column": 24,', + \ ' "byte": 680', + \ ' }', + \ ' }', + \ ' },', + \ ' {', + \ ' "severity": "error",', + \ ' "summary": "Could not load plugin",', + \ ' "detail": "Plugin reinitialization required. Please run \"terraform\""', + \ ' }', + \ ' ]', + \ '}', + \ ]) + +Execute(Should use summary if detail not available): + AssertEqual + \ [ + \ { + \ 'lnum': 91, + \ 'col': 41, + \ 'filename': ale#path#Simplify(g:dir . '/main.tf'), + \ 'type': 'E', + \ 'text': 'storage_os_disk: required field is not set', + \ } + \ ], + \ ale_linters#terraform#terraform#Handle(bufnr(''), [ + \ '{', + \ ' "valid": false,', + \ ' "error_count": 1,', + \ ' "warning_count": 0,', + \ ' "diagnostics": [', + \ ' {', + \ ' "severity": "error",', + \ ' "summary": "storage_os_disk: required field is not set",', + \ ' "range": {', + \ ' "filename": "main.tf",', + \ ' "start": {', + \ ' "line": 91,', + \ ' "column": 41,', + \ ' "byte": 2381', + \ ' },', + \ ' "end": {', + \ ' "line": 91,', + \ ' "column": 41,', + \ ' "byte": 2381', + \ ' }', + \ ' }', + \ ' }', + \ ' ]', + \ '}' + \ ]) + +Execute(Should use summary if detail available but empty): + AssertEqual + \ [ + \ { + \ 'lnum': 91, + \ 'col': 41, + \ 'filename': ale#path#Simplify(g:dir . '/main.tf'), + \ 'type': 'E', + \ 'text': 'storage_os_disk: required field is not set', + \ } + \ ], + \ ale_linters#terraform#terraform#Handle(bufnr(''), [ + \ '{', + \ ' "valid": false,', + \ ' "error_count": 1,', + \ ' "warning_count": 0,', + \ ' "diagnostics": [', + \ ' {', + \ ' "severity": "error",', + \ ' "summary": "storage_os_disk: required field is not set",', + \ ' "detail": "",', + \ ' "range": {', + \ ' "filename": "main.tf",', + \ ' "start": {', + \ ' "line": 91,', + \ ' "column": 41,', + \ ' "byte": 2381', + \ ' },', + \ ' "end": {', + \ ' "line": 91,', + \ ' "column": 41,', + \ ' "byte": 2381', + \ ' }', + \ ' }', + \ ' }', + \ ' ]', + \ '}' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_textlint_handler.vader b/sources_non_forked/ale/test/handler/test_textlint_handler.vader new file mode 100644 index 00000000..c00d54de --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_textlint_handler.vader @@ -0,0 +1,41 @@ +Before: + runtime! ale_linters/markdown/textlint.vim + +After: + call ale#linter#Reset() + +Execute(textlint handler should handle errors output): + AssertEqual + \ [ + \ { + \ 'lnum': 16, + \ 'col': 50, + \ 'text': 'Found possibly misspelled word "NeoVim".', + \ 'type': 'W', + \ 'code': 'preset-japanese/no-doubled-joshi', + \ }, + \ ], + \ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), [ + \ '[', + \ ' {', + \ ' "filePath": "test.md",', + \ ' "messages": [', + \ ' {', + \ ' "type": "lint",', + \ ' "ruleId": "preset-japanese/no-doubled-joshi",', + \ ' "index": 1332,', + \ ' "line": 16,', + \ ' "column": 50,', + \ ' "severity": 2,', + \ ' "message": "Found possibly misspelled word \"NeoVim\"."', + \ ' }', + \ ' ]', + \ ' }', + \ ']', + \ ]) + +Execute(textlint handler should no error output): + AssertEqual + \ [], + \ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), [ + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_tflint_handler.vader b/sources_non_forked/ale/test/handler/test_tflint_handler.vader new file mode 100644 index 00000000..6b8173af --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_tflint_handler.vader @@ -0,0 +1,99 @@ +Before: + runtime! ale_linters/terraform/tflint.vim + +After: + call ale#linter#Reset() + +Execute(The tflint handler should parse items correctly for pre 0.11): + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'text': 'be warned, traveller', + \ 'code': 'aws_db_instance_readable_password', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 9, + \ 'text': 'error message', + \ 'code': 'aws_elasticache_cluster_invalid_type', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 5, + \ 'text': 'just so ya know', + \ 'code': 'aws_instance_not_specified_iam_profile', + \ 'type': 'I', + \ }, + \ ], + \ ale_linters#terraform#tflint#Handle(123, [ + \ '[ { "detector": "aws_db_instance_readable_password", "type": "WARNING", "message": "be warned, traveller", "line": 12, "file": "github.com/wata727/example-module/aws_db_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md" }, { "detector": "aws_elasticache_cluster_invalid_type", "type": "ERROR", "message": "error message", "line": 9, "file": "github.com/wata727/example-module/aws_elasticache_cluster.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md" }, { "detector": "aws_instance_not_specified_iam_profile", "type": "NOTICE", "message": "just so ya know", "line": 5, "file": "github.com/wata727/example-module/aws_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md" } ]' + \ ]) + +Execute(The tflint handler should parse items correctly): + AssertEqual + \ [ + \ { + \ 'filename': 'github.com/wata727/example-module/aws_instance.tf', + \ 'lnum': 1, + \ 'col': 30, + \ 'end_lnum': 2, + \ 'end_col': 1, + \ 'text': 'A block definition must have block content delimited by "{" and "}", starting on the same line as the block header.', + \ 'code': 'Invalid block definition', + \ 'type': 'E', + \ }, + \ { + \ 'filename': 'github.com/wata727/example-module/aws_instance.tf', + \ 'lnum': 2, + \ 'col': 3, + \ 'end_lnum': 2, + \ 'end_col': 6, + \ 'text': 'An argument named "ami" is not expected here.', + \ 'code': 'Unsupported argument', + \ 'type': 'E', + \ }, + \ { + \ 'filename': 'github.com/wata727/example-module/aws_instance.tf', + \ 'lnum': 3, + \ 'col': 3, + \ 'end_lnum': 1, + \ 'end_col': 6, + \ 'text': 'An argument named "instance_type" is not expected here.', + \ 'code': 'Unsupported argument', + \ 'type': 'E', + \ }, + \ { + \ 'filename': 'github.com/wata727/example-module/aws_db_instance.tf', + \ 'lnum': 12, + \ 'col': 11, + \ 'end_lnum': 12, + \ 'end_col': 21, + \ 'text': 'be warned, traveller', + \ 'code': 'aws_db_instance_readable_password', + \ 'type': 'W', + \ }, + \ { + \ 'filename': 'github.com/wata727/example-module/aws_elasticache_cluster.tf', + \ 'lnum': 9, + \ 'col': 29, + \ 'end_lnum': 9, + \ 'end_col': 29, + \ 'text': 'error message', + \ 'code': 'aws_elasticache_cluster_invalid_type', + \ 'type': 'E', + \ }, + \ { + \ 'filename': 'github.com/wata727/example-module/aws_instance.tf', + \ 'lnum': 5, + \ 'col': 15, + \ 'end_lnum': 5, + \ 'end_col': 25, + \ 'text': 'just so ya know', + \ 'code': 'aws_instance_not_specified_iam_profile', + \ 'type': 'I', + \ }, + \ ], + \ ale_linters#terraform#tflint#Handle(123, [ + \ '{"issues":[{"rule":{"name":"aws_db_instance_readable_password","severity":"WARNING","link":"https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md"},"message":"be warned, traveller","range":{"filename":"github.com/wata727/example-module/aws_db_instance.tf","start":{"line":12,"column":11},"end":{"line":12,"column":21},"callers":[]}},{"rule":{"name":"aws_elasticache_cluster_invalid_type","severity":"ERROR","link":"https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md"},"message":"error message","range":{"filename":"github.com/wata727/example-module/aws_elasticache_cluster.tf","start":{"line":9,"column":29},"end":{"line":9,"column":29},"callers":[]}},{"rule":{"name":"aws_instance_not_specified_iam_profile","severity":"NOTICE","link":"https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md"},"message":"just so ya know","range":{"filename":"github.com/wata727/example-module/aws_instance.tf","start":{"line":5,"column":15},"end":{"line":5,"column":25},"callers":[]}}],"errors":[{"message":"github.com/wata727/example-module/aws_instance.tf:1,30-2,1: Invalid block definition; A block definition must have block content delimited by \"{\" and \"}\", starting on the same line as the block header."},{"message":"github.com/wata727/example-module/aws_instance.tf:2,3-6: Unsupported argument; An argument named \"ami\" is not expected here."},{"message":"github.com/wata727/example-module/aws_instance.tf:3,3-16: Unsupported argument; An argument named \"instance_type\" is not expected here."}]}' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_thrift_handler.vader b/sources_non_forked/ale/test/handler/test_thrift_handler.vader new file mode 100644 index 00000000..9bdb9378 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_thrift_handler.vader @@ -0,0 +1,63 @@ +Before: + runtime ale_linters/thrift/thrift.vim + +After: + call ale#linter#Reset() + +Execute(The thrift handler should handle basic warnings and errors): + AssertEqual + \ [ + \ { + \ 'lnum': 17, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'The "byte" type is a compatibility alias for "i8". Use i8" to emphasize the signedness of this type.', + \ }, + \ { + \ 'lnum': 20, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'Could not find include file include.thrift', + \ }, + \ { + \ 'lnum': 83, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'Enum FOO is already defined!', + \ }, + \ ], + \ ale_linters#thrift#thrift#Handle(1, [ + \ '[WARNING:/path/filename.thrift:17] The "byte" type is a compatibility alias for "i8". Use i8" to emphasize the signedness of this type.', + \ '[WARNING:/path/filename.thrift:20] Could not find include file include.thrift', + \ '[FAILURE:/path/filename.thrift:83] Enum FOO is already defined!', + \ ]) + +Execute(The thrift handler should handle multiline errors): + AssertEqual + \ [ + \ { + \ 'lnum': 75, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'This integer is too big: "11111111114213213453243"', + \ }, + \ { + \ 'lnum': 76, + \ 'col': 0, + \ 'type': 'E', + \ 'text': 'Implicit field keys are deprecated and not allowed with -strict', + \ }, + \ { + \ 'lnum': 77, + \ 'col': 0, + \ 'type': 'E', + \ 'text': "Unknown error (last token was ';')", + \ }, + \ ], + \ ale_linters#thrift#thrift#Handle(1, [ + \ "[ERROR:/path/filename.thrift:75] (last token was '11111111114213213453243')", + \ 'This integer is too big: "11111111114213213453243"', + \ "[ERROR:/path/filename.thrift:76] (last token was ';')", + \ 'Implicit field keys are deprecated and not allowed with -strict', + \ "[ERROR:/path/filename.thrift:77] (last token was ';')", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_thriftcheck_handler.vader b/sources_non_forked/ale/test/handler/test_thriftcheck_handler.vader new file mode 100644 index 00000000..e80e5050 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_thriftcheck_handler.vader @@ -0,0 +1,28 @@ +Before: + runtime ale_linters/thrift/thriftcheck.vim + +After: + call ale#linter#Reset() + +Execute(The thriftcheck handler should handle basic warnings and errors): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': '"py" namespace must match "^idl\\."', + \ 'code': 'namespace.pattern', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'type': 'W', + \ 'text': '64-bit integer constant -2147483649 may not work in all languages', + \ 'code': 'int.64bit', + \ }, + \ ], + \ ale_linters#thrift#thriftcheck#Handle(1, [ + \ 'file.thrift:1:1: error: "py" namespace must match "^idl\\." (namespace.pattern)', + \ 'file.thrift:3:5: warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_tlint_handler.vader b/sources_non_forked/ale/test/handler/test_tlint_handler.vader new file mode 100644 index 00000000..e146346c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_tlint_handler.vader @@ -0,0 +1,34 @@ +Before: + runtime ale_linters/php/tlint.vim + +After: + call ale#linter#Reset() + +Execute(The tlint handler should calculate line numbers): + AssertEqual + \ [ + \ { + \ 'lnum': '5', + \ 'col': 0, + \ 'sub_type': + \ 'style', + \ 'type': 'W', + \ 'text': ['! There should be no unused imports.', 'There should be no unused imports.', '', '', '', '', '', '', '', ''] + \ }, + \ { + \ 'lnum': '15', + \ 'col': 0, + \ 'sub_type': + \ 'style', + \ 'type': 'W', + \ 'text': ['! There should be no method visibility in test methods.', 'There should be no method visibility in test methods.', '', '', '', '', '', '', '', ''] + \ }, + \ ], + \ ale_linters#php#tlint#Handle(347, [ + \ "Lints for /Users/jose/Code/Tighten/tester/tests/Unit/ExampleTest.php", + \ "============", + \ "! There should be no unused imports.", + \ "5 : `use Illuminate\Foundation\Testing\RefreshDatabase;`", + \ "! There should be no method visibility in test methods.", + \ "15 : ` public function testBasicTest()`", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_tslint_handler.vader b/sources_non_forked/ale/test/handler/test_tslint_handler.vader new file mode 100644 index 00000000..32036edf --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_tslint_handler.vader @@ -0,0 +1,315 @@ +Before: + Save g:ale_typescript_tslint_ignore_empty_files + + unlet! g:ale_typescript_tslint_ignore_empty_files + unlet! b:ale_typescript_tslint_ignore_empty_files + + runtime ale_linters/typescript/tslint.vim + + call ale#test#SetDirectory('/testplugin/test/handler') + +After: + Restore + + unlet! b:ale_typescript_tslint_ignore_empty_files + unlet! b:relative_to_root + unlet! b:tempname_suffix + unlet! b:relative_tempname + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(The tslint handler should parse lines correctly): + call ale#test#SetFilename('app/test.ts') + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 15, + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'), + \ 'end_lnum': 1, + \ 'type': 'E', + \ 'end_col': 15, + \ 'text': 'Missing semicolon', + \ 'code': 'semicolon', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 8, + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'), + \ 'end_lnum': 3, + \ 'type': 'W', + \ 'end_col': 12, + \ 'text': 'Something else', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 8, + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/something-else.ts'), + \ 'end_lnum': 3, + \ 'type': 'W', + \ 'end_col': 12, + \ 'text': 'Something else', + \ 'code': 'something', + \ }, + \ { + \ 'lnum': 31, + \ 'col': 9, + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'), + \ 'end_lnum': 31, + \ 'type': 'E', + \ 'end_col': 20, + \ 'text': 'Calls to console.log are not allowed.', + \ 'code': 'no-console', + \ }, + \ ] , + \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([ + \ { + \ 'endPosition': { + \ 'character': 14, + \ 'line': 0, + \ 'position': 1000 + \ }, + \ 'failure': 'Missing semicolon', + \ 'fix': { + \ 'innerLength': 0, + \ 'innerStart': 14, + \ 'innerText': ';' + \ }, + \ 'name': 'test.ts', + \ 'ruleName': 'semicolon', + \ 'ruleSeverity': 'ERROR', + \ 'startPosition': { + \ 'character': 14, + \ 'line': 0, + \ 'position': 1000 + \ } + \ }, + \ { + \ 'endPosition': { + \ 'character': 11, + \ 'line': 2, + \ 'position': 1000 + \ }, + \ 'failure': 'Something else', + \ 'fix': { + \ 'innerLength': 0, + \ 'innerStart': 14, + \ 'innerText': ';' + \ }, + \ 'name': 'test.ts', + \ 'ruleSeverity': 'WARNING', + \ 'startPosition': { + \ 'character': 7, + \ 'line': 1, + \ 'position': 1000 + \ } + \ }, + \ { + \ 'endPosition': { + \ 'character': 11, + \ 'line': 2, + \ 'position': 22 + \ }, + \ 'failure': 'Something else', + \ 'fix': { + \ 'innerLength': 0, + \ 'innerStart': 14, + \ 'innerText': ';' + \ }, + \ 'name': 'something-else.ts', + \ 'ruleName': 'something', + \ 'ruleSeverity': 'WARNING', + \ 'startPosition': { + \ 'character': 7, + \ 'line': 1, + \ 'position': 14 + \ } + \ }, + \ { + \ "endPosition": { + \ "character": 19, + \ "line": 30, + \ "position": 14590 + \ }, + \ "failure": "Calls to console.log are not allowed.", + \ 'name': 'test.ts', + \ "ruleName": "no-console", + \ "startPosition": { + \ "character": 8, + \ "line": 30, + \ "position": 14579 + \ } + \ }, + \])]) + +Execute(The tslint handler should handle empty output): + AssertEqual + \ [], + \ ale_linters#typescript#tslint#Handle(bufnr(''), []) + +Execute(The tslint handler report errors for empty files by default): + call ale#test#SetFilename('app/test.ts') + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'), + \ 'end_lnum': 2, + \ 'type': 'E', + \ 'end_col': 1, + \ 'text': 'Consecutive blank lines are forbidden', + \ 'code': 'no-consecutive-blank-lines', + \ }, + \ ], + \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{ + \ 'endPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ }, + \ 'failure': 'Consecutive blank lines are forbidden', + \ 'fix': [{ + \ 'innerStart': 0, + \ 'innerLength': 1, + \ 'innerText': '' + \ }], + \ 'name': 'test.ts', + \ 'ruleName': 'no-consecutive-blank-lines', + \ 'ruleSeverity': 'ERROR', + \ 'startPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ } + \ }])]) + +Execute(The tslint handler should not report errors for empty files when the ignore option is on): + let b:ale_typescript_tslint_ignore_empty_files = 1 + call ale#test#SetFilename('app/test.ts') + + AssertEqual + \ [ + \ ], + \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{ + \ 'endPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ }, + \ 'failure': 'Consecutive blank lines are forbidden', + \ 'fix': [{ + \ 'innerStart': 0, + \ 'innerLength': 1, + \ 'innerText': '' + \ }], + \ 'name': 'test.ts', + \ 'ruleName': 'no-consecutive-blank-lines', + \ 'ruleSeverity': 'ERROR', + \ 'startPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ } + \ }])]) + +Given typescript(A file with extra blank lines): + const x = 3 + + + const y = 4 + +Execute(The tslint handler should report errors when the ignore option is on, but the file is not empty): + let b:ale_typescript_tslint_ignore_empty_files = 1 + call ale#test#SetFilename('app/test.ts') + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'), + \ 'end_lnum': 2, + \ 'type': 'E', + \ 'end_col': 1, + \ 'text': 'Consecutive blank lines are forbidden', + \ 'code': 'no-consecutive-blank-lines', + \ }, + \ ], + \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{ + \ 'endPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ }, + \ 'failure': 'Consecutive blank lines are forbidden', + \ 'fix': [{ + \ 'innerStart': 0, + \ 'innerLength': 1, + \ 'innerText': '' + \ }], + \ 'name': 'test.ts', + \ 'ruleName': 'no-consecutive-blank-lines', + \ 'ruleSeverity': 'ERROR', + \ 'startPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ } + \ }])]) + +Execute(The tslint handler should not report no-implicit-dependencies errors): + call ale#test#SetFilename('app/test.ts') + + AssertEqual + \ [ + \ ], + \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{ + \ 'endPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ }, + \ 'failure': 'this is ignored', + \ 'name': 'test.ts', + \ 'ruleName': 'no-implicit-dependencies', + \ 'ruleSeverity': 'ERROR', + \ 'startPosition': { + \ 'character': 0, + \ 'line': 1, + \ 'position': 1 + \ }, + \ }])]) + +Execute(The tslint handler should set filename keys for temporary files): + " The temporay filename below is hacked into being a relative path so we can + " test that we resolve the temporary filename first. + let b:relative_to_root = substitute(expand('%:p'), '\v[^/\\]*([/\\])[^/\\]*', '../', 'g') + let b:tempname_suffix = substitute(tempname(), '^\v([A-Z]:)?[/\\]', '', '') + let b:relative_tempname = substitute(b:relative_to_root . b:tempname_suffix, '\\', '/', 'g') + + AssertEqual + \ [ + \ {'lnum': 47, 'col': 1, 'code': 'curly', 'end_lnum': 47, 'type': 'E', 'end_col': 26, 'text': 'if statements must be braced'}, + \ ], + \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([ + \ { + \ 'endPosition': { + \ 'character':25, + \ 'line':46, + \ 'position':1383, + \ }, + \ 'failure': 'if statements must be braced', + \ 'name': b:relative_tempname, + \ 'ruleName': 'curly', + \ 'ruleSeverity':'ERROR', + \ 'startPosition': { + \ 'character':0, + \ 'line':46, + \ 'position':1358, + \ } + \ }, + \ ])]) diff --git a/sources_non_forked/ale/test/handler/test_typecheck_handler.vader b/sources_non_forked/ale/test/handler/test_typecheck_handler.vader new file mode 100644 index 00000000..fda55d68 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_typecheck_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/typescript/typecheck.vim + +After: + call ale#linter#Reset() + +Execute(The typecheck handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 16, + \ 'col': 7, + \ 'text': "Type 'A' is not assignable to type 'B'", + \ }, + \ { + \ 'lnum': 7, + \ 'col': 41, + \ 'text': "Property 'a' does not exist on type 'A'", + \ }, + \ ], + \ ale_linters#typescript#typecheck#Handle(347, [ + \ "somets.ts[16, 7]: Type 'A' is not assignable to type 'B'", + \ "somets.ts[7, 41]: Property 'a' does not exist on type 'A'", + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_unimport_handler.vader b/sources_non_forked/ale/test/handler/test_unimport_handler.vader new file mode 100644 index 00000000..5acdcbb9 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_unimport_handler.vader @@ -0,0 +1,18 @@ +Before: + runtime ale_linters/python/unimport.vim + +After: + call ale#linter#Reset() + +Execute(The unimport handler should handle import warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 9, + \ 'type': 'W', + \ 'text': 'unused: urllib.parse', + \ }, + \ ], + \ ale_linters#python#unimport#Handle(1, [ + \ 'urllib.parse at path/to/file.py:9', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_v_handler.vader b/sources_non_forked/ale/test/handler/test_v_handler.vader new file mode 100644 index 00000000..4d6e3d9b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_v_handler.vader @@ -0,0 +1,54 @@ +Before: + runtime ale_linters/v/v.vim + +After: + call ale#linter#Reset() + +Execute (The v handler should correctly parse error messages): + AssertEqual + \ [{ + \ 'lnum': 4, + \ 'col': 3, + \ 'filename': ale#path#GetAbsPath(expand('%:p:h'), 'const ants.v'), + \ 'type': 'W', + \ 'end_col': 14, + \ 'text': 'const names cannot contain uppercase letters, use snake_case instead' + \ }, + \ { + \ 'lnum': 4, + \ 'col': 8, + \ 'filename': ale#path#GetAbsPath(expand('%:p:h'), 'main.v'), + \ 'type': 'W', + \ 'end_col': 10, + \ 'text': 'module "os" is imported but never used' + \ }, + \ { + \ 'lnum': 20, + \ 'col': 10, + \ 'filename': ale#path#GetAbsPath(expand('%:p:h'), 'main.v'), + \ 'type': 'E', + \ 'end_col': 18, + \ 'text': 'undefined ident: `win_widt`' + \ }], + \ ale_linters#v#v#Handler('', [ + \ './const ants.v:4:3: warning: const names cannot contain uppercase letters, use snake_case instead', + \ ' 2 |', + \ ' 3 | const (', + \ ' 4 | BUTTON_TEXT = "OK"', + \ ' | ~~~~~~~~~~~', + \ ' 5 | )', + \ './main.v:4:8: warning: module "os" is imported but never used', + \ ' 2 |', + \ ' 3 | import ui', + \ ' 4 | import os', + \ ' | ~~', + \ ' 5 |', + \ ' 6 | const (', + \ './main.v:20:10: error: undefined ident: `win_widt`', + \ ' 18 | mut app := &App{}', + \ ' 19 | app.window = ui.window({', + \ ' 20 | width: win_widt', + \ ' | ~~~~~~~~', + \ ' 21 | height: win_height', + \ ' 22 | title: "Counter"', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_vala_lint_handler.vader b/sources_non_forked/ale/test/handler/test_vala_lint_handler.vader new file mode 100644 index 00000000..b8a4fbfa --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_vala_lint_handler.vader @@ -0,0 +1,54 @@ +Before: + runtime ale_linters/vala/vala_lint.vim + +After: + call ale#linter#Reset() + +Execute(The Vala-Lint handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 18, + \ 'col': 18, + \ 'text': 'Expected space before paren', + \ 'code': 'space-before-paren', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 64, + \ 'col': 37, + \ 'text': 'Expected space before paren', + \ 'code': 'space-before-paren', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 73, + \ 'col': 37, + \ 'text': 'Expected space before paren', + \ 'code': 'space-before-paren', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#vala#vala_lint#Handle(bufnr(''), [ + \ 'Application.vala', + \ ' 18.18 error Expected space before paren space-before-paren', + \ ' 64.37 warn Expected space before paren space-before-paren', + \ ' 73.37 error Expected space before paren space-before-paren', + \ ]) + +Execute(The Vala-Lint handler should ignore unknown error types): + AssertEqual + \ [ + \ { + \ 'lnum': 73, + \ 'col': 37, + \ 'text': 'Expected space before paren', + \ 'code': 'space-before-paren', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#vala#vala_lint#Handle(bufnr(''), [ + \ 'Application.vala', + \ ' 18.18 test Expected space before paren space-before-paren', + \ ' 73.37 error Expected space before paren space-before-paren', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_vale_handler.vader b/sources_non_forked/ale/test/handler/test_vale_handler.vader new file mode 100644 index 00000000..37badb47 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_vale_handler.vader @@ -0,0 +1,88 @@ +Execute(The vale handler should handle broken JSON): + AssertEqual + \ [], + \ ale#handlers#vale#Handle(bufnr(''), ["{asdf"]) + +Execute(The vale handler should handle am empty string response): + AssertEqual + \ [], + \ ale#handlers#vale#Handle(bufnr(''), []) + +Execute(The vale handler should handle an empty result): + AssertEqual + \ [], + \ ale#handlers#vale#Handle(bufnr(''), ["{}"]) + +Execute(The vale handler should handle a normal example): + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 195, + \ 'end_col': 201, + \ 'type': 'W', + \ 'text': "Consider removing 'usually'", + \ 'code': 'vale.Hedging', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 1, + \ 'end_col': 27, + \ 'type': 'E', + \ 'text': "'Documentation' is repeated!", + \ 'code': 'vale.Repetition', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 1, + \ 'end_col': 27, + \ 'type': 'I', + \ 'text': "'Documentation' is repeated!", + \ 'code': 'vale.Repetition', + \ }, + \ ], + \ ale#handlers#vale#Handle(bufnr(''), [ + \ '{', + \ ' "/home/languitar/src/autosuspend/README.md": [', + \ ' {', + \ ' "Check": "vale.Hedging",', + \ ' "Description": "",', + \ ' "Line": 5,', + \ ' "Link": "",', + \ " \"Message\": \"Consider removing 'usually'\",", + \ ' "Severity": "warning",', + \ ' "Span": [', + \ ' 195,', + \ ' 201', + \ ' ],', + \ ' "Hide": false', + \ ' },', + \ ' {', + \ ' "Check": "vale.Repetition",', + \ ' "Description": "",', + \ ' "Line": 7,', + \ ' "Link": "",', + \ " \"Message\": \"'Documentation' is repeated!\",", + \ ' "Severity": "error",', + \ ' "Span": [', + \ ' 1,', + \ ' 27', + \ ' ],', + \ ' "Hide": false', + \ ' },', + \ ' {', + \ ' "Check": "vale.Repetition",', + \ ' "Description": "",', + \ ' "Line": 7,', + \ ' "Link": "",', + \ " \"Message\": \"'Documentation' is repeated!\",", + \ ' "Severity": "suggestion",', + \ ' "Span": [', + \ ' 1,', + \ ' 27', + \ ' ],', + \ ' "Hide": false', + \ ' }', + \ ' ]', + \ '}', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_vcom_handler.vader b/sources_non_forked/ale/test/handler/test_vcom_handler.vader new file mode 100644 index 00000000..943b525a --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_vcom_handler.vader @@ -0,0 +1,36 @@ +Before: + runtime ale_linters/vhdl/vcom.vim + +After: + call ale#linter#Reset() + +Execute(The vcom handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 218, + \ 'type': 'W', + \ 'text': '(vcom-1236) Shared variables must be of a protected type.' + \ }, + \ { + \ 'lnum': 73, + \ 'type': 'E', + \ 'text': '(vcom-1136) Unknown identifier "aresetn".' + \ }, + \ { + \ 'lnum': 73, + \ 'type': 'E', + \ 'text': 'Bad resolution function (STD_LOGIC) for type (error).' + \ }, + \ { + \ 'lnum': 73, + \ 'type': 'E', + \ 'text': 'near ":": (vcom-1576) expecting ";" or ")".' + \ }, + \ ], + \ ale_linters#vhdl#vcom#Handle(bufnr(''), [ + \ '** Warning: ../path/to/file.vhd(218): (vcom-1236) Shared variables must be of a protected type.', + \ '** Error: tb_file.vhd(73): (vcom-1136) Unknown identifier "aresetn".', + \ '** Error: tb_file.vhd(73): Bad resolution function (STD_LOGIC) for type (error).', + \ '** Error: tb_file.vhd(73): near ":": (vcom-1576) expecting ";" or ")".', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_verilator_handler.vader b/sources_non_forked/ale/test/handler/test_verilator_handler.vader new file mode 100644 index 00000000..59ec1361 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_verilator_handler.vader @@ -0,0 +1,52 @@ +Before: + runtime ale_linters/verilog/verilator.vim + +After: + call ale#linter#Reset() + + +Execute (The verilator handler should parse legacy messages with only line numbers): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'type': 'E', + \ 'text': 'syntax error, unexpected IDENTIFIER', + \ 'filename': 'foo.v' + \ }, + \ { + \ 'lnum': 10, + \ 'type': 'W', + \ 'text': 'Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).', + \ 'filename': 'bar.v' + \ }, + \ ], + \ ale_linters#verilog#verilator#Handle(bufnr(''), [ + \ '%Error: foo.v:3: syntax error, unexpected IDENTIFIER', + \ '%Warning-BLKSEQ: bar.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).', + \ ]) + + +Execute (The verilator handler should parse new format messages with line and column numbers): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col' : 1, + \ 'type': 'E', + \ 'text': 'syntax error, unexpected endmodule, expecting ;', + \ 'filename': 'bar.v' + \ }, + \ { + \ 'lnum': 4, + \ 'col' : 6, + \ 'type': 'W', + \ 'text': 'Signal is not used: r', + \ 'filename': 'foo.v' + \ }, + \ ], + \ ale_linters#verilog#verilator#Handle(bufnr(''), [ + \ '%Error: bar.v:3:1: syntax error, unexpected endmodule, expecting ;', + \ '%Warning-UNUSED: foo.v:4:6: Signal is not used: r', + \ ]) + diff --git a/sources_non_forked/ale/test/handler/test_vint_handler.vader b/sources_non_forked/ale/test/handler/test_vint_handler.vader new file mode 100644 index 00000000..c542b4ea --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_vint_handler.vader @@ -0,0 +1,65 @@ +Before: + runtime ale_linters/vim/vint.vim + +After: + call ale#linter#Reset() + +Execute(The vint handler should parse error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'filename': 'gcc.vim', + \ 'text': 'Use scriptencoding when multibyte char exists (see :help :script encoding)', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 17, + \ 'filename': 'gcc.vim', + \ 'end_col': 18, + \ 'text': 'Use robust operators ''==#'' or ''==?'' instead of ''=='' (see Google VimScript Style Guide (Matching))', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 8, + \ 'filename': 'gcc.vim', + \ 'end_col': 15, + \ 'text': 'Make the scope explicit like ''l:filename'' (see Anti-pattern of vimrc (Scope of identifier))', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 7, + \ 'col': 8, + \ 'filename': 'gcc.vim', + \ 'end_col': 15, + \ 'text': 'Undefined variable: filename (see :help E738)', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 8, + \ 'col': 11, + \ 'filename': 'gcc.vim', + \ 'end_col': 16, + \ 'text': 'E128: Function name must start with a capital or contain a colon: foobar (see ynkdir/vim-vimlparser)', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 9, + \ 'col': 12, + \ 'filename': 'gcc.vim', + \ 'end_col': 13, + \ 'text': 'Use robust operators ''=~#'' or ''=~?'' instead of ''=~'' (see Google VimScript Style Guide (Matching))', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#vim#vint#Handle(bufnr(''), [ + \ 'gcc.vim:1:1: warning: Use scriptencoding when multibyte char exists (see :help :script encoding)', + \ 'gcc.vim:3:17: warning: Use robust operators `==#` or `==?` instead of `==` (see Google VimScript Style Guide (Matching))', + \ 'gcc.vim:3:8: style_problem: Make the scope explicit like `l:filename` (see Anti-pattern of vimrc (Scope of identifier))', + \ 'gcc.vim:7:8: warning: Undefined variable: filename (see :help E738)', + \ 'gcc.vim:8:11: error: E128: Function name must start with a capital or contain a colon: foobar (see ynkdir/vim-vimlparser)', + \ 'gcc.vim:9:12: warning: Use robust operators `=~#` or `=~?` instead of `=~` (see Google VimScript Style Guide (Matching))', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_vlog_handler.vader b/sources_non_forked/ale/test/handler/test_vlog_handler.vader new file mode 100644 index 00000000..7262f63d --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_vlog_handler.vader @@ -0,0 +1,47 @@ +Before: + runtime ale_linters/verilog/vlog.vim + +After: + call ale#linter#Reset() + +Execute(The vlog handler should parse old-style lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 7, + \ 'type': 'W', + \ 'text': '(vlog-2623) Undefined variable: C.', + \ 'filename': 'add.v' + \ }, + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.', + \ 'filename': 'file.v' + \ }, + \ ], + \ ale_linters#verilog#vlog#Handle(bufnr(''), [ + \ '** Warning: add.v(7): (vlog-2623) Undefined variable: C.', + \ '** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C.', + \ ]) + +Execute(The vlog handler should parse new-style lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 7, + \ 'type': 'W', + \ 'text': '(vlog-2623) Undefined variable: C.', + \ 'filename': 'add.v' + \ }, + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.', + \ 'filename': 'file.v' + \ }, + \ ], + \ ale_linters#verilog#vlog#Handle(bufnr(''), [ + \ '** Warning: (vlog-2623) add.v(7): Undefined variable: C.', + \ '** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C.', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_vulture_handler.vader b/sources_non_forked/ale/test/handler/test_vulture_handler.vader new file mode 100644 index 00000000..b28055db --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_vulture_handler.vader @@ -0,0 +1,92 @@ +Before: + runtime ale_linters/python/vulture.vim + + call ale#test#SetDirectory('/testplugin/test/handler') + +After: + Restore + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + silent file something_else.py + +Execute(Basic vulture check with relative path in result should be handled): + call ale#test#SetFilename('something_else.py') + AssertEqual + \ [ + \ { + \ 'lnum': 34, + \ 'text': 'unused variable ''foo'' (60% confidence)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(g:dir . '/something_else.py'), + \ }, + \ ], + \ ale_linters#python#vulture#Handle(bufnr(''), [ + \ './something_else.py:34: unused variable ''foo'' (60% confidence)', + \ ]) + +Execute(Basic vulture check with absolute path in result should be handled): + call ale#test#SetFilename('something_else.py') + AssertEqual + \ [ + \ { + \ 'lnum': 34, + \ 'text': 'unused variable ''foo'' (60% confidence)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(g:dir . '/something_else.py'), + \ }, + \ ], + \ ale_linters#python#vulture#Handle(bufnr(''), [ + \ ale#path#Simplify(g:dir . '/something_else.py') . ':34: unused variable ''foo'' (60% confidence)', + \ ]) + +Execute(Vulture check for two files should be handled): + call ale#test#SetFilename('something_else.py') + AssertEqual + \ [ + \ { + \ 'lnum': 34, + \ 'text': 'unused variable ''foo'' (60% confidence)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(g:dir . '/something_else.py'), + \ }, + \ { + \ 'lnum': 12, + \ 'text': 'unused variable ''bar'' (60% confidence)', + \ 'type': 'W', + \ 'filename': ale#path#Simplify(g:dir . '/second_one.py'), + \ }, + \ ], + \ ale_linters#python#vulture#Handle(bufnr(''), [ + \ './something_else.py:34: unused variable ''foo'' (60% confidence)', + \ './second_one.py:12: unused variable ''bar'' (60% confidence)', + \ ]) + + +Execute(Vulture exception should be handled): + call ale#test#SetFilename('something_else.py') + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'BaddestException: Everything gone wrong (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in ', + \ ' from .core import stuff', + \ 'BaddestException: Everything gone wrong', + \ ], "\n"), + \ } + \ ], + \ ale_linters#python#vulture#Handle(bufnr(''), [ + \ 'Traceback (most recent call last):', + \ ' File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in ', + \ ' from .core import stuff', + \ 'BaddestException: Everything gone wrong', + \ ]) + +Execute(The vulture handler should handle empty output): + AssertEqual + \ [], + \ ale_linters#python#vulture#Handle(bufnr(''), []) diff --git a/sources_non_forked/ale/test/handler/test_write_good_handler.vader b/sources_non_forked/ale/test/handler/test_write_good_handler.vader new file mode 100644 index 00000000..8bf4b223 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_write_good_handler.vader @@ -0,0 +1,37 @@ +Execute(The write-good handler should handle the example from the write-good README): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'end_col': 2, + \ 'type': 'W', + \ 'text': '"So" adds no meaning', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 12, + \ 'end_col': 21, + \ 'type': 'W', + \ 'text': '"was stolen" may be passive voice', + \ }, + \ { + \ 'lnum': 6, + \ 'col': 2, + \ 'end_col': 2, + \ 'type': 'W', + \ 'text': '"foo bar" bla', + \ }, + \ ], + \ ale#handlers#writegood#Handle(bufnr(''), [ + \ 'In /tmp/vBYivbZ/6/test.md', + \ '=============', + \ 'So the cat was stolen.', + \ '^^', + \ '"So" adds no meaning on line 1 at column 0', + \ '-------------', + \ 'So the cat was stolen.', + \ ' ^^^^^^^^^^', + \ '"was stolen" may be passive voice on line 1 at column 11', + \ '"foo bar" bla on line 6 at column 1', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_xmllint_handler.vader b/sources_non_forked/ale/test/handler/test_xmllint_handler.vader new file mode 100644 index 00000000..a17d74a9 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_xmllint_handler.vader @@ -0,0 +1,30 @@ +Before: + runtime ale_linters/xml/xmllint.vim + +After: + call ale#linter#Reset() + +Execute(The xmllint handler should parse error messages correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 22, + \ 'type': 'W', + \ 'text': 'warning: Unsupported version ''dummy''' + \ }, + \ { + \ 'lnum': 34, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'parser error : Start tag expected, ''<'' not found' + \ } + \ ], + \ ale_linters#xml#xmllint#Handle(1, [ + \ 'path/to/file.xml:1: warning: Unsupported version ''dummy''', + \ '', + \ ' ^', + \ '-:34: parser error : Start tag expected, ''<'' not found', + \ 'blahblah>', + \ '^' + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_xvhdl_handler.vader b/sources_non_forked/ale/test/handler/test_xvhdl_handler.vader new file mode 100644 index 00000000..b90539b8 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_xvhdl_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/vhdl/xvhdl.vim + +After: + call ale#linter#Reset() + +Execute(The xvhdl handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 17, + \ 'type': 'E', + \ 'text': '[VRFC 10-91] aresetn is not declared ' + \ }, + \ { + \ 'lnum': 128, + \ 'type': 'E', + \ 'text': '[VRFC 10-91] m_axis_tx_tdata is not declared ' + \ }, + \ ], + \ ale_linters#vhdl#xvhdl#Handle(bufnr(''), [ + \ 'ERROR: [VRFC 10-91] aresetn is not declared [/path/to/file.vhd:17]', + \ 'ERROR: [VRFC 10-91] m_axis_tx_tdata is not declared [/home/user/tx_data.vhd:128]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_xvlog_handler.vader b/sources_non_forked/ale/test/handler/test_xvlog_handler.vader new file mode 100644 index 00000000..2e1f83fc --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_xvlog_handler.vader @@ -0,0 +1,18 @@ +Before: + runtime ale_linters/verilog/xvlog.vim + +After: + call ale#linter#Reset() + +Execute(The xvlog handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'type': 'E', + \ 'text': '[VRFC 10-1412] syntax error near output ' + \ }, + \ ], + \ ale_linters#verilog#xvlog#Handle(bufnr(''), [ + \ 'ERROR: [VRFC 10-1412] syntax error near output [/path/to/file.v:5]', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_yamllint_handler.vader b/sources_non_forked/ale/test/handler/test_yamllint_handler.vader new file mode 100644 index 00000000..dd51119c --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_yamllint_handler.vader @@ -0,0 +1,59 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime! ale/handlers/yamllint.vim + +After: + Restore + + unlet! b:ale_warn_about_trailing_whitespace + + call ale#linter#Reset() + +Execute(Problems should be parsed correctly for yamllint): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'missing document start "---"', + \ 'code': 'document-start', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'syntax error: expected the node content, but found ''''', + \ }, + \ ], + \ ale#handlers#yamllint#Handle(bufnr(''), [ + \ 'something.yaml:1:1: [warning] missing document start "---" (document-start)', + \ 'something.yml:2:1: [error] syntax error: expected the node content, but found ''''', + \ ]) + +Execute(The yamllint handler should respect ale_warn_about_trailing_whitespace): + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'col': 18, + \ 'type': 'E', + \ 'text': 'trailing spaces', + \ 'code': 'trailing-spaces', + \ }, + \ ], + \ ale#handlers#yamllint#Handle(bufnr(''), [ + \ 'something.yml:5:18: [error] trailing spaces (trailing-spaces)', + \ ]) + + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ ], + \ ale#handlers#yamllint#Handle(bufnr(''), [ + \ 'something.yml:5:18: [error] trailing spaces (trailing-spaces)', + \ ]) diff --git a/sources_non_forked/ale/test/handler/test_yosys_handler.vader b/sources_non_forked/ale/test/handler/test_yosys_handler.vader new file mode 100644 index 00000000..a55d0b5b --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_yosys_handler.vader @@ -0,0 +1,27 @@ +Before: + runtime ale_linters/verilog/yosys.vim + +After: + call ale#linter#Reset() + +Execute(The yosys handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'type': 'E', + \ 'text': 'syntax error, unexpected TOK_ID', + \ 'filename': 'file.v' + \ }, + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': 'internal error', + \ }, + \ ], + \ ale_linters#verilog#yosys#Handle(bufnr(''), [ + \ '1. Executing Verilog-2005 frontend: file.v', + \ 'ERROR: internal error', + \ 'file.v:3: ERROR: syntax error, unexpected TOK_ID', + \ ]) + diff --git a/sources_non_forked/ale/test/handler/test_zeek_handler.vader b/sources_non_forked/ale/test/handler/test_zeek_handler.vader new file mode 100644 index 00000000..07a80d86 --- /dev/null +++ b/sources_non_forked/ale/test/handler/test_zeek_handler.vader @@ -0,0 +1,17 @@ +Before: + runtime ale_linters/zeek/zeek.vim + +After: + call ale#linter#Reset() + +Execute(The zeek handler should parse input correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'text': 'unknown identifier bar, at or near "bar"' + \ }, + \ ], + \ ale_linters#zeek#zeek#HandleErrors(bufnr(''), [ + \ 'error in /tmp/foo.zeek, line 2: unknown identifier bar, at or near "bar"' + \ ]) diff --git a/sources_non_forked/ale/test/jsonnet_files/testfile.jsonnet b/sources_non_forked/ale/test/jsonnet_files/testfile.jsonnet new file mode 100644 index 00000000..fc8fb78a --- /dev/null +++ b/sources_non_forked/ale/test/jsonnet_files/testfile.jsonnet @@ -0,0 +1 @@ +{ foo: bar } diff --git a/sources_non_forked/ale/test/linter/test_ada_gcc.vader b/sources_non_forked/ale/test/linter/test_ada_gcc.vader new file mode 100644 index 00000000..906b31a4 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ada_gcc.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('ada', 'gcc') + call ale#test#SetFilename('dummy.adb') + + function! GetOutputDir(command) abort + let l:split_command = split(a:command) + let l:index = index(l:split_command, '-o') + return l:split_command[l:index + 1] + endfunction + + let b:out_file = GetOutputDir(ale_linters#ada#gcc#GetCommand(bufnr(''))) + +After: + delfunction GetOutputDir + + unlet! b:out_file + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'gcc', + \ ale#Escape('gcc') . ' -x ada -c -gnatc' + \ . ' -o ' . b:out_file + \ . ' -I %s:h' + \ . ' -gnatwa -gnatq %t' + + let b:ale_ada_gcc_executable = 'foo' + + AssertLinter 'foo', + \ ale#Escape('foo') . ' -x ada -c -gnatc' + \ . ' -o ' . b:out_file + \ . ' -I %s:h' + \ . ' -gnatwa -gnatq %t' + +Execute(The options should be configurable): + let g:ale_ada_gcc_options = '--foo --bar' + + AssertLinter 'gcc', + \ ale#Escape('gcc') . ' -x ada -c -gnatc' + \ . ' -o ' . b:out_file + \ . ' -I %s:h' + \ . ' --foo --bar %t' diff --git a/sources_non_forked/ale/test/linter/test_adals.vader b/sources_non_forked/ale/test/linter/test_adals.vader new file mode 100644 index 00000000..5a04594e --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_adals.vader @@ -0,0 +1,17 @@ +Before: + call ale#assert#SetUpLinterTest('ada', 'adals') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Sets adals executable): + let g:ale_ada_adals_executable = '/path/to /Ada' + AssertLinter '/path/to /Ada', ale#Escape('/path/to /Ada') + +Execute(Sets adals encoding): + let b:ale_ada_adals_encoding = 'iso-8859-1' + AssertLSPConfig {'ada.defaultCharset': 'iso-8859-1', 'ada.projectFile': 'default.gpr'} + +Execute(Sets adals project): + let g:ale_ada_adals_project = 'myproject.gpr' + AssertLSPConfig {'ada.defaultCharset': 'utf-8', 'ada.projectFile': 'myproject.gpr'} diff --git a/sources_non_forked/ale/test/linter/test_alex.vader b/sources_non_forked/ale/test/linter/test_alex.vader new file mode 100644 index 00000000..08a0ee10 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_alex.vader @@ -0,0 +1,34 @@ +Before: + call ale#assert#SetUpLinterTest('tex', 'alex') + call ale#test#SetFilename('test_file.tex') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The global executable should be used when the local one cannot be found): + AssertLinter 'alex', + \ ale#Escape('alex') . ' --stdin --text', + +Execute(Should use the node_modules/.bin executable, if available): + call ale#test#SetFilename('../test-files/alex/node-modules/test_file.tex') + + AssertLinter ale#path#Simplify(g:dir . '/../test-files/alex/node-modules/node_modules/.bin/alex'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/alex/node-modules/node_modules/.bin/alex')) + \ . ' --stdin --text', + +Execute(Should use the node_modules/alex executable, if available): + call ale#test#SetFilename('../test-files/alex/node-modules-2/test_file.tex') + + AssertLinter ale#path#Simplify(g:dir . '/../test-files/alex/node-modules-2/node_modules/alex/cli.js'), + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/alex/node-modules-2/node_modules/alex/cli.js')) + \ . ' --stdin --text', + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('../test-files/write-good/node-modules-2/test_file.tex') + + let g:ale_alex_executable = '/path/to/custom/alex' + let g:ale_alex_use_global = 1 + + AssertLinter '/path/to/custom/alex', + \ ale#Escape('/path/to/custom/alex') . ' --stdin --text' diff --git a/sources_non_forked/ale/test/linter/test_ameba.vader b/sources_non_forked/ale/test/linter/test_ameba.vader new file mode 100644 index 00000000..7746b44f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ameba.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('crystal', 'ameba') + call ale#test#SetFilename('dummy.cr') + + let g:ale_crystal_ameba_executable = 'bin/ameba' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to bin/ameba): + AssertLinter 'bin/ameba', ale#Escape('bin/ameba') + \ . ' --format json ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.cr')) + +Execute(Should be able to set a custom executable): + let g:ale_crystal_ameba_executable = 'ameba' + + AssertLinter 'ameba' , ale#Escape('ameba') + \ . ' --format json ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.cr')) diff --git a/sources_non_forked/ale/test/linter/test_angular.vader b/sources_non_forked/ale/test/linter/test_angular.vader new file mode 100644 index 00000000..2e407a00 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_angular.vader @@ -0,0 +1,28 @@ +Before: + call ale#assert#SetUpLinterTest('html', 'angular') + let g:paths = {} + +After: + call ale#assert#TearDownLinterTest() + unlet g:paths + +Execute(The Angular LSP connection shouldn't be created outside of Angular projects): + AssertLSPLanguage 'html' + AssertLSPConfig {} + AssertLSPProject '' + AssertLinterNotExecuted + +Execute(The default command for Angular should be correct): + call ale#test#SetFilename('../test-files/angular/test.html') + let g:paths = { + \ 'ngserver': ale#test#GetFilename('../test-files/angular/node_modules/@angular/language-server/bin/ngserver'), + \ 'service': ale#test#GetFilename('../test-files/angular/node_modules/@angular/language-service'), + \ 'typescript': ale#test#GetFilename('../test-files/angular/node_modules/typescript'), + \} + + AssertLSPLanguage 'html' + AssertLSPProject ale#test#GetFilename('../test-files/angular') + AssertLinter 'node', ale#Escape('node') . ' ' . ale#Escape(g:paths.ngserver) + \ . ' --ngProbeLocations ' . ale#Escape(g:paths.service) + \ . ' --tsProbeLocations ' . ale#Escape(g:paths.typescript) + \ . ' --stdio' diff --git a/sources_non_forked/ale/test/linter/test_ansible_lint.vader b/sources_non_forked/ale/test/linter/test_ansible_lint.vader new file mode 100644 index 00000000..3191fa7b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ansible_lint.vader @@ -0,0 +1,26 @@ +Before: + call ale#assert#SetUpLinterTest('ansible', 'ansible_lint') + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(The ansible_lint version <5.0.0 command callback should return default string): + GivenCommandOutput ['v4.1.2'] + AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor -p %t' + +Execute(The ansible_lint version >=5.0.0 command callback should return default string): + GivenCommandOutput ['v5.1.2'] + AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor --parseable-severity -x yaml %s' + +Execute(The ansible_lint version >=6.0.0 command callback should return default string): + GivenCommandOutput ['v6.0.2'] + AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor -f json -x yaml %s' + +Execute(The ansible_lint executable should be configurable): + let g:ale_ansible_ansible_lint_executable = '~/.local/bin/ansible-lint' + GivenCommandOutput ['v4.1.2'] + AssertLinter '~/.local/bin/ansible-lint', + \ ale#Escape('~/.local/bin/ansible-lint') . ' --nocolor -p %t' diff --git a/sources_non_forked/ale/test/linter/test_asciidoc_textlint.vader b/sources_non_forked/ale/test/linter/test_asciidoc_textlint.vader new file mode 100644 index 00000000..a79a0ae3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_asciidoc_textlint.vader @@ -0,0 +1,65 @@ +" Author: januswel, w0rp + +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('asciidoc', 'textlint') + + " The configuration is shared between many languages. + Save g:ale_textlint_executable + Save g:ale_textlint_use_global + Save g:ale_textlint_options + + let g:ale_textlint_executable = 'textlint' + let g:ale_textlint_use_global = 0 + let g:ale_textlint_options = '' + + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + +After: + unlet! b:command_tail + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' + +Execute(The executable should be configurable): + let b:ale_textlint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' + +Execute(The options should be configurable): + let b:ale_textlint_options = '--something' + + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint')) + \ . ' -f json --stdin --stdin-filename %s' + +Execute(The local executable from textlint/bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_textlint_bin_path/foo.txt') + + if has('win32') + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + else + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + endif diff --git a/sources_non_forked/ale/test/linter/test_asm_gcc.vader b/sources_non_forked/ale/test/linter/test_asm_gcc.vader new file mode 100644 index 00000000..5976b5f2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_asm_gcc.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('asm', 'gcc') + call ale#test#SetFilename('test.cpp') + let b:command_tail = ' -x assembler' + \ . ' -o ' . (has('win32') ? 'nul': '/dev/null') + \ . '-iquote %s:h' + \ . ' -Wall -' + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail + + let b:ale_asm_gcc_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail diff --git a/sources_non_forked/ale/test/linter/test_avra_avra.vader b/sources_non_forked/ale/test/linter/test_avra_avra.vader new file mode 100644 index 00000000..04722d68 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_avra_avra.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('avra', 'avra') + + let b:command_tail = ' %t -o ' . g:ale#util#nul_file + let b:command_tail_opt = ' %t --max_errors 20 -o ' . g:ale#util#nul_file + +After: + unlet! b:command_tail + unlet! b:command_tail_opt + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'avra', ale#Escape('avra') . b:command_tail, + + let b:ale_avra_avra_executable = '~/avra' + + AssertLinter '~/avra', ale#Escape('~/avra') . b:command_tail + +Execute(The options should be configurable): + let b:ale_avra_avra_options = '--max_errors 20' + + AssertLinter 'avra', ale#Escape('avra') + \ . ' %t --max_errors 20 -o ' . g:ale#util#nul_file + +Execute(The options should be used in command): + let b:ale_avra_avra_options = '--max_errors 20' + + AssertLinter 'avra', ale#Escape('avra') . b:command_tail_opt diff --git a/sources_non_forked/ale/test/linter/test_bandit.vader b/sources_non_forked/ale/test/linter/test_bandit.vader new file mode 100644 index 00000000..e9488c00 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_bandit.vader @@ -0,0 +1,90 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'bandit') + let b:bandit_flags = ' --format custom ' + \ . '--msg-template "{line}:{test_id}:{severity}:{msg}" ' + +After: + call ale#assert#TearDownLinterTest() + unlet! b:bandit_flags + +Execute(The bandit command callback should return default string): + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . b:bandit_flags + \ . ' -' + +Execute(The bandit command callback should allow options): + let g:ale_python_bandit_options = '--configfile bandit.yaml' + + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . b:bandit_flags + \ . ' --configfile bandit.yaml -' + +Execute(The bandit executable should be configurable): + let g:ale_python_bandit_executable = '~/.local/bin/bandit' + + AssertLinter '~/.local/bin/bandit', + \ ale#Escape('~/.local/bin/bandit') + \ . b:bandit_flags + \ . ' -' + +Execute(Setting executable to 'pipenv' appends 'run bandit'): + let g:ale_python_bandit_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') + \ . ' run bandit' + \ . b:bandit_flags + \ . ' -' + +Execute(Pipenv is detected when python_bandit_auto_pipenv is set): + let g:ale_python_bandit_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#Escape('pipenv') + \ . ' run bandit' + \ . b:bandit_flags + \ . ' -' + +Execute(Setting executable to 'poetry' appends 'run bandit'): + let g:ale_python_bandit_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') + \ . ' run bandit' + \ . b:bandit_flags + \ . ' -' + +Execute(Poetry is detected when python_bandit_auto_poetry is set): + let g:ale_python_bandit_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', + \ ale#Escape('poetry') + \ . ' run bandit' + \ . b:bandit_flags + \ . ' -' + +Execute(The bandit command callback should add .bandit by default): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py') + + let b:config_path = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_bandit/.bandit' + \) + + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . ' --ini ' . ale#Escape(b:config_path) + \ . b:bandit_flags + \ . ' -' + +Execute(The bandit command callback should support not using .bandit): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/subdir/foo/bar.py') + let g:ale_python_bandit_use_config = 0 + + AssertLinter 'bandit', + \ ale#Escape('bandit') + \ . b:bandit_flags + \ . ' -' diff --git a/sources_non_forked/ale/test/linter/test_bashate.vader b/sources_non_forked/ale/test/linter/test_bashate.vader new file mode 100644 index 00000000..714cf690 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_bashate.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('sh', 'bashate') + call ale#test#SetFilename('test.sh') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default bashate command should be correct): + AssertLinter 'bashate', ale#Escape('bashate') . ' %t' + +Execute(The bashate command should accept options): + let b:ale_sh_bashate_options = '-i E310 --max-line-length 100' + + AssertLinter 'bashate', + \ ale#Escape('bashate') . ' -i E310 --max-line-length 100 %t' diff --git a/sources_non_forked/ale/test/linter/test_bib_bibclean.vader b/sources_non_forked/ale/test/linter/test_bib_bibclean.vader new file mode 100644 index 00000000..fa6f7d33 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_bib_bibclean.vader @@ -0,0 +1,24 @@ +Before: + call ale#assert#SetUpLinterTest('bib', 'bibclean') + + let g:ale_ruby_rubocop_executable = 'bibclean' + let g:ale_ruby_rubocop_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to bibclean): + AssertLinter 'bibclean', ale#Escape('bibclean') + \ . ' -file-position ' + +Execute(Should be able to set a custom executable): + let g:ale_bib_bibclean_executable = 'bin/bibclean' + + AssertLinter 'bin/bibclean' , ale#Escape('bin/bibclean') + \ . ' -file-position ' + +Execute(Should not include custom options): + let g:ale_bib_bibclean_options = '-no-prettryprint' + + AssertLinter 'bibclean' , ale#Escape('bibclean') + \ . ' -file-position ' diff --git a/sources_non_forked/ale/test/linter/test_bingo.vader b/sources_non_forked/ale/test/linter/test_bingo.vader new file mode 100644 index 00000000..d8328414 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_bingo.vader @@ -0,0 +1,74 @@ +Before: + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'bingo') + +After: + Restore + + if isdirectory(g:dir . '/.git') + call delete(g:dir . '/.git', 'd') + endif + + unlet! b:ale_completion_enabled + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio' + +Execute(should configure bingo callback executable): + let b:ale_go_bingo_executable = 'boo' + let b:ale_go_bingo_options = '' + + AssertLinter 'boo', ale#Escape('boo') + +Execute(should set bingo options): + call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') + " let b:ale_completion_enabled = 1 + let b:ale_go_bingo_options = '' + + AssertLinter 'bingo', + \ ale#Escape('bingo') . '' + + let b:ale_go_bingo_options = '--mode stdio --trace' + + AssertLinter 'bingo', + \ ale#Escape('bingo') . ' --mode stdio --trace' + +Execute(should support Go environment variables): + call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') + let b:ale_go_go111module = 'on' + + AssertLinter 'bingo', + \ ale#Env('GO111MODULE', 'on') . ale#Escape('bingo') . ' --mode stdio' + + +Execute(Should return directory for 'go.mod' if found in parent directory): + call ale#test#SetFilename('../test-files/go/test.go') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go') + +Execute(Should return nearest directory with '.git' if found in parent directory): + call ale#test#SetFilename('test.go') + call mkdir(g:dir . '/.git') + + AssertLSPProject g:dir + +Execute(Should ignore 'go.mod' and return '.git' dir if modules off): + call ale#test#SetFilename('../test-files/go/test.go') + + let b:ale_go_go111module = 'off' + let b:parent_dir = ale#path#Simplify(g:dir . '/..') + let b:git_dir = b:parent_dir . '/.git' + + if !isdirectory(b:git_dir) + call mkdir(b:git_dir) + endif + + AssertLSPProject b:parent_dir + + call delete(b:git_dir, 'd') + unlet! b:parent_dir + unlet! b:git_dir diff --git a/sources_non_forked/ale/test/linter/test_bitbake.vader b/sources_non_forked/ale/test/linter/test_bitbake.vader new file mode 100755 index 00000000..ba502aa0 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_bitbake.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('bitbake', 'oelint_adv') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'oelint-adv', ale#Escape('oelint-adv') . ' --quiet %s' + +Execute(The executable should be configurable): + let b:ale_bitbake_oelint_adv_executable = 'xyz' + + AssertLinter 'xyz', ale#Escape('xyz') . ' --quiet %s' diff --git a/sources_non_forked/ale/test/linter/test_brakeman.vader b/sources_non_forked/ale/test/linter/test_brakeman.vader new file mode 100644 index 00000000..d3bf1920 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_brakeman.vader @@ -0,0 +1,37 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'brakeman') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The brakeman command callback should detect absence of a valid Rails app): + call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/test.rb') + + AssertLinter 'brakeman', '' + +Execute(The brakeman command callback should find a valid Rails app root): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb') + + AssertLinter 'brakeman', ale#Escape('brakeman') + \ . ' -f json -q -p ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app')) + +Execute(The brakeman command callback should include configured options): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb') + + let g:ale_ruby_brakeman_options = '--combobulate' + + AssertLinter 'brakeman', ale#Escape('brakeman') + \ . ' -f json -q --combobulate -p ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app')) + +Execute(Setting bundle appends 'exec brakeman'): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb') + + let g:ale_ruby_brakeman_executable = 'bundle' + let g:ale_ruby_brakeman_options = '--combobulate' + + AssertLinter 'bundle', ale#Escape('bundle') + \ . ' exec brakeman' + \ . ' -f json -q --combobulate -p ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app')) diff --git a/sources_non_forked/ale/test/linter/test_buf_lint.vader b/sources_non_forked/ale/test/linter/test_buf_lint.vader new file mode 100644 index 00000000..7b8bb52c --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_buf_lint.vader @@ -0,0 +1,22 @@ +Before: + call ale#assert#SetUpLinterTest('proto', 'buf_lint') + call ale#test#SetFilename('test.proto') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'buf', + \ ale#Escape('buf') + \ . ' lint' + \ . ' %s#include_package_files=true' + +Execute(The callback should include any additional options): + let b:ale_proto_buf_lint_executable = '/tmp/buf' + let b:ale_proto_buf_lint_config = '/tmp/buf.yaml' + + AssertLinter '/tmp/buf', + \ ale#Escape('/tmp/buf') + \ . ' lint' + \ . ' --config=' . ale#Escape('/tmp/buf.yaml') + \ . ' %s#include_package_files=true' diff --git a/sources_non_forked/ale/test/linter/test_c_cc.vader b/sources_non_forked/ale/test/linter/test_c_cc.vader new file mode 100644 index 00000000..c8c2de7d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_cc.vader @@ -0,0 +1,55 @@ +Before: + Save g:ale_c_parse_makefile + Save g:ale_history_enabled + + let g:ale_c_parse_makefile = 0 + let g:ale_history_enabled = 0 + + let g:get_cflags_return_value = '' + let g:executable_map = {} + + runtime autoload/ale/c.vim + runtime autoload/ale/engine.vim + + function! ale#engine#IsExecutable(buffer, executable) abort + return has_key(g:executable_map, a:executable) + endfunction + + function! ale#c#GetCFlags(buffer, output) abort + return g:get_cflags_return_value + endfunction + + call ale#assert#SetUpLinterTest('c', 'cc') + + let b:command_tail = ' -S -x c' + \ . ' -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -std=c11 -Wall -' + +After: + unlet! g:get_cflags_return_value + unlet! g:executable_map + unlet! b:command_tail + + runtime autoload/ale/c.vim + runtime autoload/ale/engine.vim + + call ale#assert#TearDownLinterTest() + +Execute(clang should be used instead of gcc, if available): + let g:executable_map = {'clang': 1} + + AssertLinter 'clang', [ale#Escape('clang') . b:command_tail] + +Execute(The executable should be configurable): + AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail] + + let b:ale_c_cc_executable = 'foobar' + + AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail] + +Execute(The -std flag should be replaced by parsed C flags): + let b:command_tail = substitute(b:command_tail, 'c11', 'c99 ', '') + let g:get_cflags_return_value = '-std=c99' + + AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail diff --git a/sources_non_forked/ale/test/linter/test_c_ccls.vader b/sources_non_forked/ale/test/linter/test_c_ccls.vader new file mode 100644 index 00000000..a4f575c6 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_ccls.vader @@ -0,0 +1,69 @@ +" Author: Ye Jingchen , Ben Falconer +" Description: A language server for C + +Before: + call ale#assert#SetUpLinterTest('c', 'ccls') + + Save b:ale_c_build_dir_names + Save b:ale_c_ccls_executable + Save b:ale_c_ccls_init_options + +After: + call ale#assert#TearDownLinterTest() + +Execute(The project root should be detected correctly using compile_commands.json file): + call ale#test#SetFilename(tempname() . '/dummy.c') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') + +Execute(The project root should be detected correctly using .ccls file): + call ale#test#SetFilename(tempname() . '/dummy.c') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls') + +Execute(The project root should be detected correctly using .ccls-root file): + call ale#test#SetFilename(tempname() . '/dummy.c') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_ccls-root/dummy.c') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls-root') + +Execute(The executable should be configurable): + AssertLinter 'ccls', ale#Escape('ccls') + + let b:ale_c_ccls_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(The initialization options should be configurable): + AssertLSPOptions {} + + let b:ale_c_ccls_init_options = { 'cacheDirectory': '/tmp/ccls' } + + AssertLSPOptions { 'cacheDirectory': '/tmp/ccls' } + +Execute(The compile command database should be detected correctly): + call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c') + + AssertLSPOptions {} + + call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c') + + AssertLSPOptions { 'compilationDatabaseDirectory': + \ ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') } + + call ale#test#SetFilename('../test-files/ccls/with_build_dir/dummy.c') + let b:ale_c_build_dir_names = ['unusual_build_dir_name'] + + AssertLSPOptions { 'compilationDatabaseDirectory': + \ ale#path#Simplify(g:dir . '/../test-files/ccls/with_build_dir/unusual_build_dir_name') } diff --git a/sources_non_forked/ale/test/linter/test_c_clang_tidy.vader b/sources_non_forked/ale/test/linter/test_c_clang_tidy.vader new file mode 100644 index 00000000..c4433550 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_clang_tidy.vader @@ -0,0 +1,77 @@ +Before: + Save g:ale_c_parse_makefile + let g:ale_c_parse_makefile = 0 + + call ale#assert#SetUpLinterTest('c', 'clangtidy') + call ale#test#SetFilename('test.c') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The clangtidy command default should be correct): + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' %s' + +Execute(You should be able to remove the -checks option for clang-tidy): + let b:ale_c_clangtidy_checks = [] + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' %s' + +Execute(You should be able to set other checks for clang-tidy): + let b:ale_c_clangtidy_checks = ['-*', 'clang-analyzer-*'] + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s' + +Execute(You should be able to manually set compiler flags for clang-tidy): + let b:ale_c_clangtidy_checks = ['*'] + let b:ale_c_clangtidy_options = '-Wall' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall' + +Execute(You should be able to manually set flags for clang-tidy): + let b:ale_c_clangtidy_extra_options = '-config=' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' ' . ale#Escape('-config=') . ' %s' + +Execute(The build directory should be configurable): + let b:ale_c_clangtidy_checks = ['*'] + let b:ale_c_build_dir = '/foo/bar' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s' + \ . ' -p ' . ale#Escape('/foo/bar') + +Execute(The build directory setting should override the options): + let b:ale_c_clangtidy_checks = ['*'] + let b:ale_c_build_dir = '/foo/bar' + let b:ale_c_clangtidy_options = '-Wall' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s' + \ . ' -p ' . ale#Escape('/foo/bar') + +Execute(The build directory should be used for header files): + call ale#test#SetFilename('test.h') + + let b:ale_c_clangtidy_checks = ['*'] + let b:ale_c_build_dir = '/foo/bar' + let b:ale_c_clangtidy_options = '-Wall' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s' + \ . ' -p ' . ale#Escape('/foo/bar') + +Execute(The executable should be configurable): + let b:ale_c_clangtidy_checks = ['*'] + let b:ale_c_clangtidy_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_c_clangd.vader b/sources_non_forked/ale/test/linter/test_c_clangd.vader new file mode 100644 index 00000000..b7a4e029 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_clangd.vader @@ -0,0 +1,47 @@ +Before: + call ale#assert#SetUpLinterTest('c', 'clangd') + + Save b:ale_c_clangd_options + Save b:ale_c_build_dir + Save b:ale_c_build_dir_names + Save b:ale_c_parse_compile_commands + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'c' + +Execute(The default executable should be correct): + AssertLinter 'clangd', ale#Escape('clangd') + +Execute(The project root should be detected correctly): + call ale#test#SetFilename(tempname() . '/dummy.c') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/clangd/with_compile_commands/dummy.c') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/clangd/with_compile_commands') + +Execute(The executable should be configurable): + let g:ale_c_clangd_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(The options should be configurable): + let b:ale_c_clangd_options = '-compile-commands-dir=foo' + + AssertLinter 'clangd', ale#Escape('clangd') . ' ' . b:ale_c_clangd_options + +Execute(The compile command database should be detected correctly): + call ale#test#SetFilename('../test-files/clangd/with_build_dir/dummy_src/dummy.c') + + let b:ale_c_clangd_options = '' + let b:ale_c_build_dir = '' + let b:ale_c_build_dir_names = ['unusual_build_dir_name'] + let b:ale_c_parse_compile_commands = 1 + + AssertLinter 'clangd', ale#Escape('clangd') + \ . ' -compile-commands-dir=' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/clangd/with_build_dir/unusual_build_dir_name')) diff --git a/sources_non_forked/ale/test/linter/test_c_cppcheck.vader b/sources_non_forked/ale/test/linter/test_c_cppcheck.vader new file mode 100644 index 00000000..0cc3a5d3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_cppcheck.vader @@ -0,0 +1,63 @@ +Before: + call ale#assert#SetUpLinterTest('c', 'cppcheck') + let b:command_tail = ' -q --language=c --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') . ' --enable=style -I' . ale#Escape(ale#path#Simplify(g:dir)) .' %t' + +After: + unlet! b:rel_file_path + unlet! b:command_tail + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail + + let b:ale_c_cppcheck_executable = 'foobar' + + AssertLinterCwd '' + AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail + +Execute(cppcheck for C should detect compile_commands.json files): + let b:rel_file_path = '../test-files/cppcheck/one/foo.c' + call ale#test#SetFilename(b:rel_file_path) + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one') + AssertLinter 'cppcheck', ale#Escape('cppcheck') + \ . ' -q --language=c' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' --project=' . ale#Escape('compile_commands.json') + \ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path)) + \ . ' --enable=style %t' + +Execute(cppcheck for C should detect compile_commands.json files in build directories): + let b:rel_file_path = '../test-files/cppcheck/with_build_dir/foo.c' + call ale#test#SetFilename(b:rel_file_path) + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/with_build_dir') + AssertLinter 'cppcheck', ale#Escape('cppcheck') + \ . ' -q --language=c' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json')) + \ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path)) + \ . ' --enable=style %t' + +Execute(cppcheck for C should include file dir if compile_commands.json file is not found): + call ale#test#SetFilename('../test-files/cppcheck/foo.c') + + AssertLinter 'cppcheck', + \ ale#Escape('cppcheck') + \ . ' -q --language=c' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' --enable=style' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck')) + \ . ' %t' + +Execute(cppcheck for C header should include file dir and not use compile_commands.json): + call ale#test#SetFilename('../test-files/cppcheck/one/foo.h') + + AssertLinter 'cppcheck', + \ ale#Escape('cppcheck') + \ . ' -q --language=c' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')) + \ . ' --suppress=unusedStructMember' + \ . ' --enable=style' + \ . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_c_cquery.vader b/sources_non_forked/ale/test/linter/test_c_cquery.vader new file mode 100644 index 00000000..bca0dbbc --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_cquery.vader @@ -0,0 +1,37 @@ +Before: + call ale#assert#SetUpLinterTest('c', 'cquery') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The project root should be detected correctly using compile_commands.json file): + call ale#test#SetFilename(tempname() . '/dummy.c') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/cquery/dummy.c') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery') + +Execute(The project root should be detected correctly using .cquery file): + call ale#test#SetFilename(tempname() . '/dummy.c') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/cquery/with_cquery/dummy.c') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery/with_cquery') + +Execute(The executable should be configurable): + AssertLinter 'cquery', ale#Escape('cquery') + + let b:ale_c_cquery_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(The cache directory should be configurable): + AssertLSPOptions {'cacheDirectory': expand('$HOME/.cache/cquery')} + + let b:ale_c_cquery_cache_directory = '/foo/bar' + + AssertLSPOptions {'cacheDirectory': '/foo/bar'} diff --git a/sources_non_forked/ale/test/linter/test_c_flawfinder.vader b/sources_non_forked/ale/test/linter/test_c_flawfinder.vader new file mode 100644 index 00000000..38385e2b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_flawfinder.vader @@ -0,0 +1,24 @@ +Before: + call ale#assert#SetUpLinterTest('c', 'flawfinder') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The flawfinder command should be correct): + AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t' + +Execute(The minlevel of flawfinder should be configurable): + let b:ale_c_flawfinder_minlevel = 8 + + AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t' + +Execute(Additional flawfinder options should be configurable): + let b:ale_c_flawfinder_options = '--foobar' + + AssertLinter 'flawfinder', + \ ale#Escape('flawfinder') . ' -CDQS --foobar --minlevel=1 %t' + +Execute(The flawfinder exectable should be configurable): + let b:ale_c_flawfinder_executable = 'foo/bar' + + AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t' diff --git a/sources_non_forked/ale/test/linter/test_c_import_paths.vader b/sources_non_forked/ale/test/linter/test_c_import_paths.vader new file mode 100644 index 00000000..19e39915 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_c_import_paths.vader @@ -0,0 +1,162 @@ +Before: + " Make sure the c.vim file is loaded first. + call ale#c#FindProjectRoot(bufnr('')) + + Save g:ale_c_parse_compile_commands + Save g:ale_c_parse_makefile + Save g:__ale_c_project_filenames + + let g:original_project_filenames = g:__ale_c_project_filenames + let g:executable_map = {} + + " Remove the .git/HEAD dir for C import paths for these tests. + " The tests run inside of a git repo. + let g:__ale_c_project_filenames = filter( + \ copy(g:__ale_c_project_filenames), + \ 'v:val isnot# ''.git/HEAD''' + \) + + let g:ale_c_parse_compile_commands = 0 + let g:ale_c_parse_makefile = 0 + + runtime autoload/ale/engine.vim + + function! ale#engine#IsExecutable(buffer, executable) abort + return has_key(g:executable_map, a:executable) + endfunction + +After: + Restore + + unlet! g:original_project_filenames + unlet! g:executable_map + + runtime autoload/ale/engine.vim + + call ale#assert#TearDownLinterTest() + +Execute(The C cc linter should include 'include' directories for projects with a Makefile): + call ale#assert#SetUpLinterTest('c', 'cc') + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.c') + let g:ale_c_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include')) + \ . ' -' + +Execute(The C cc linter should include 'include' directories for projects with a configure file): + call ale#assert#SetUpLinterTest('c', 'cc') + call ale#test#SetFilename('../test-files/c/configure_project/subdir/file.c') + let g:ale_c_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/configure_project/include')) + \ . ' -' + +Execute(The C cc linter should include root directories for projects with .h files in them): + call ale#assert#SetUpLinterTest('c', 'cc') + call ale#test#SetFilename('../test-files/c/h_file_project/subdir/file.c') + let g:ale_c_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/h_file_project')) + \ . ' -' + +Execute(The C cc linter should include root directories for projects with .hpp files in them): + call ale#assert#SetUpLinterTest('c', 'cc') + call ale#test#SetFilename('../test-files/c/hpp_file_project/subdir/file.c') + let g:ale_c_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/hpp_file_project')) + \ . ' -' + +Execute(The C ClangTidy handler should include 'include' directories for projects with a Makefile): + call ale#assert#SetUpLinterTest('c', 'clangtidy') + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp') + let g:ale_c_clangtidy_options = '' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' %s ' + \ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include')) + +Execute(The C++ cc linter should include 'include' directories for projects with a Makefile): + call ale#assert#SetUpLinterTest('cpp', 'cc') + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp') + let g:ale_cpp_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include')) + \ . ' -' + +Execute(The C++ cc linter should include 'include' directories for projects with a configure file): + call ale#assert#SetUpLinterTest('cpp', 'cc') + call ale#test#SetFilename('../test-files/c/configure_project/subdir/file.cpp') + let g:ale_cpp_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/configure_project/include')) + \ . ' -' + +Execute(The C++ cc linter should include root directories for projects with .h files in them): + call ale#assert#SetUpLinterTest('cpp', 'cc') + call ale#test#SetFilename('../test-files/c/h_file_project/subdir/file.cpp') + let g:ale_cpp_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/h_file_project')) + \ . ' -' + +Execute(The C++ cc linter should include root directories for projects with .hpp files in them): + call ale#assert#SetUpLinterTest('cpp', 'cc') + call ale#test#SetFilename('../test-files/c/hpp_file_project/subdir/file.cpp') + let g:ale_cpp_cc_options = '' + + AssertLinter 'gcc', + \ ale#Escape('gcc') + \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/hpp_file_project')) + \ . ' -' + +Execute(The C++ ClangTidy handler should include json folders for projects with suitable build directory in them): + call ale#assert#SetUpLinterTest('cpp', 'clangtidy') + call ale#test#SetFilename('../test-files/c/json_project/subdir/file.cpp') + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' %s ' + \ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/json_project/build')) + +Execute(The C++ ClangTidy handler should include 'include' directories for projects with a Makefile): + call ale#assert#SetUpLinterTest('cpp', 'clangtidy') + call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp') + let g:ale_cpp_clangtidy_options = '' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' %s ' + \ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include')) + diff --git a/sources_non_forked/ale/test/linter/test_cargo.vader b/sources_non_forked/ale/test/linter/test_cargo.vader new file mode 100644 index 00000000..25dd0253 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cargo.vader @@ -0,0 +1,222 @@ +Before: + call ale#assert#SetUpLinterTest('rust', 'cargo') + call ale#test#SetFilename('../test-files/cargo/test.rs') + + let g:cd = 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cargo')) . ' && ' + let g:suffix = ' --frozen --message-format=json -q' + let g:ale_rust_cargo_avoid_whole_workspace = 0 + + " Test with version 0.22.0 by default. + GivenCommandOutput ['cargo 0.22.0 (3423351a5 2017-10-06)'] + +After: + call ale#assert#TearDownLinterTest() + + unlet! g:cd + unlet! g:suffix + +Execute(The linter should not be executed when there's no Cargo.toml file): + call ale#test#SetFilename('../foo.rs') + AssertLinterNotExecuted + +Execute(The linter should be executed when there is a Cargo.toml file): + GivenCommandOutput [] + AssertLinter 'cargo', 'cargo build --frozen --message-format=json -q' + +Execute(`cargo check` should be used when the version is new enough): + GivenCommandOutput ['cargo 0.17.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check' . g:suffix, + \] + + " We should cache the version check + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check' . g:suffix] + +Execute(`cargo build` should be used when cargo is too old): + GivenCommandOutput ['cargo 0.16.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo build' . g:suffix, + \] + + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo build' . g:suffix] + +Execute(`cargo build` should be used when g:ale_rust_cargo_use_check is set to 0): + let g:ale_rust_cargo_use_check = 0 + + GivenCommandOutput ['cargo 0.24.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo build' . g:suffix, + \] + + " We should cache the version check + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo build' . g:suffix] + +Execute(`cargo check` should be used when the version is new enough): + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check' . g:suffix, + \] + + " We should cache the version check + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check' . g:suffix] + +Execute(--all-targets should be used when g:ale_rust_cargo_check_all_targets is set to 1): + let g:ale_rust_cargo_check_all_targets = 1 + + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --all-targets' . g:suffix] + " We should cache the version check + AssertLinter 'cargo', ['cargo check --all-targets' . g:suffix] + +Execute(--tests should be used when g:ale_rust_cargo_check_tests is set to 1): + let g:ale_rust_cargo_check_tests = 1 + + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --tests' . g:suffix] + + " We should cache the version check + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check --tests' . g:suffix] + +Execute(--examples should be used when g:ale_rust_cargo_check_examples is set to 1): + let g:ale_rust_cargo_check_examples = 1 + + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --examples' . g:suffix] + + " We should cache the version check + GivenCommandOutput [] + AssertLinter 'cargo', ['cargo check --examples' . g:suffix] + +Execute(--no-default-features should be used when g:ale_rust_cargo_default_feature_behavior is none): + let b:ale_rust_cargo_default_feature_behavior = 'none' + + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --no-default-features'] + +Execute(g:ale_rust_cargo_include_features added when g:ale_rust_cargo_default_feature_behavior is none): + let b:ale_rust_cargo_default_feature_behavior = 'none' + let b:ale_rust_cargo_include_features = 'foo bar' + + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --no-default-features --features ' . ale#Escape('foo bar')] + +Execute(g:ale_rust_cargo_include_features added and escaped): + let b:ale_rust_cargo_default_feature_behavior = 'default' + let b:ale_rust_cargo_include_features = "foo bar baz" + + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --features ' . ale#Escape('foo bar baz')] + +Execute(--all-features should be used when g:ale_rust_cargo_default_feature_behavior is all): + let b:ale_rust_cargo_default_feature_behavior = 'all' + " When all features are enabled we should ignore extra features to add + " since it won't do anything + let b:ale_rust_cargo_include_features = 'foo bar' + + GivenCommandOutput ['cargo 0.22.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --all-features'] + +Execute(Cargo should run from the crate directory when set to avoid the workspace): + let g:ale_rust_cargo_avoid_whole_workspace = 1 + call ale#test#SetFilename('../test-files/cargo/workspace_paths/subpath/test.rs') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cargo/workspace_paths/subpath') + call ale#semver#ResetVersionCache() + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check --frozen --message-format=json -q', + \] + +Execute(Cargo should not run from the crate directory when not set to avoid the workspace): + let g:ale_rust_cargo_avoid_whole_workspace = 0 + call ale#test#SetFilename('../test-files/cargo/workspace_paths/subpath/test.rs') + + AssertLinterCwd '' + call ale#semver#ResetVersionCache() + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check --frozen --message-format=json -q', + \] + +Execute(When ale_rust_cargo_use_clippy is set, cargo-clippy is used as linter): + let b:ale_rust_cargo_use_clippy = 1 + + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo clippy --frozen --message-format=json -q', + \] + +Execute(When ale_rust_cargo_clippy_options is set, cargo-clippy appends it to commandline): + let b:ale_rust_cargo_use_clippy = 1 + let b:ale_rust_cargo_clippy_options = '-- -D warnings' + + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo clippy --frozen --message-format=json -q -- -D warnings', + \] + +Execute(Clippy options work without prepending --): + let b:ale_rust_cargo_use_clippy = 1 + let b:ale_rust_cargo_clippy_options = '-D warnings' + + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo clippy --frozen --message-format=json -q -- -D warnings', + \] + +Execute(Build supports all cargo flags): + let g:ale_rust_cargo_use_check = 0 + let g:ale_rust_cargo_check_all_targets = 1 + let g:ale_rust_cargo_check_tests = 1 + let g:ale_rust_cargo_check_examples = 1 + let b:ale_rust_cargo_default_feature_behavior = 'all' + let b:ale_rust_cargo_target_dir = 'target/ale' + + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo build --all-targets --examples --tests --target-dir ' . ale#Escape('target/ale') . ' --frozen --message-format=json -q --all-features', + \] + +Execute(Clippy supports all cargo flags): + let b:ale_rust_cargo_use_clippy = 1 + let g:ale_rust_cargo_check_all_targets = 1 + let g:ale_rust_cargo_check_tests = 1 + let g:ale_rust_cargo_check_examples = 1 + let b:ale_rust_cargo_default_feature_behavior = 'all' + let b:ale_rust_cargo_clippy_options = '-D warnings' + let b:ale_rust_cargo_target_dir = 'target/ale' + + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo clippy --all-targets --examples --tests --target-dir ' . ale#Escape('target/ale') . ' --frozen --message-format=json -q --all-features -- -D warnings', + \] + +Execute(cargo-check does not refer ale_rust_cargo_clippy_options): + let b:ale_rust_cargo_use_clippy = 0 + let b:ale_rust_cargo_use_check = 1 + let b:ale_rust_cargo_clippy_options = '-- -D warnings' + + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check --frozen --message-format=json -q', + \] + +Execute(`cargo --target-dir` should be used when the version is new enough and it is set): + let b:ale_rust_cargo_target_dir = 'target/ale' + + GivenCommandOutput ['cargo 0.17.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo check --target-dir ' . ale#Escape('target/ale') . g:suffix, + \] + +Execute(`cargo --target-dir` should not be used when the version is not new enough and it is set): + let b:ale_rust_cargo_target_dir = 'target/ale' + + GivenCommandOutput ['cargo 0.16.0 (3423351a5 2017-10-06)'] + AssertLinter 'cargo', [ + \ ale#Escape('cargo') . ' --version', + \ 'cargo build' . g:suffix, + \] diff --git a/sources_non_forked/ale/test/linter/test_checkov.vader b/sources_non_forked/ale/test/linter/test_checkov.vader new file mode 100644 index 00000000..f93d34f3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_checkov.vader @@ -0,0 +1,14 @@ +Before: + call ale#assert#SetUpLinterTest('terraform', 'checkov') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be direct): + AssertLinter 'checkov', + \ ale#Escape('checkov') . ' -f %t -o json --quiet ' + +Execute(It should be possible to override the default command): + let b:ale_terraform_checkov_executable = '/bin/other/checkov' + AssertLinter '/bin/other/checkov', + \ ale#Escape('/bin/other/checkov') . ' -f %t -o json --quiet ' diff --git a/sources_non_forked/ale/test/linter/test_checkstyle.vader b/sources_non_forked/ale/test/linter/test_checkstyle.vader new file mode 100644 index 00000000..8197e6b5 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_checkstyle.vader @@ -0,0 +1,72 @@ +Before: + call ale#assert#SetUpLinterTest('java', 'checkstyle') + call ale#test#SetFilename('dummy.java') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The checkstyle callback should return the correct default value): + AssertLinter 'checkstyle', + \ ale#Escape('checkstyle') + \ . ' -c ' . ale#Escape('/google_checks.xml') + \ . ' %s' + +Execute(The checkstyle executable should be configurable): + let b:ale_java_checkstyle_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') + \ . ' -c ' . ale#Escape('/google_checks.xml') + \ . ' %s' + +Execute(Custom options should be supported): + let b:ale_java_checkstyle_options = '--foobar -cp -classpath /path/to/checkstyle-8.7-all.jar' + + AssertLinter 'checkstyle', + \ ale#Escape('checkstyle') + \ . ' --foobar -cp -classpath /path/to/checkstyle-8.7-all.jar' + \ . ' -c ' . ale#Escape('/google_checks.xml') + \ . ' %s' + +Execute(configuration files set in _config should be supported): + let b:ale_java_checkstyle_config = ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml') + + AssertLinter 'checkstyle', + \ ale#Escape('checkstyle') + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml')) + \ . ' %s' + +Execute(configuration files set in _options should be preferred over _config): + let b:ale_java_checkstyle_config = '/foo.xml' + let b:ale_java_checkstyle_options = '-c /bar.xml' + + AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -c /bar.xml %s' + + let b:ale_java_checkstyle_options = '-x -c /bar.xml' + + AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -x -c /bar.xml %s' + +Execute(google_checks.xml should be used by default): + call ale#test#SetFilename('../test-files/checkstyle/test.java') + + AssertLinter 'checkstyle', + \ ale#Escape('checkstyle') + \ . ' -c ' . ale#Escape('/google_checks.xml') + \ . ' %s' + +Execute(Other relative paths should be supported): + let b:ale_java_checkstyle_config = '../test-files/checkstyle/other_config.xml' + + AssertLinter 'checkstyle', + \ ale#Escape('checkstyle') + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml')) + \ . ' %s' + + call ale#test#SetFilename('../test-files/checkstyle/test.java') + + let b:ale_java_checkstyle_config = 'other_config.xml' + + AssertLinter 'checkstyle', + \ ale#Escape('checkstyle') + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml')) + \ . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_circleci.vader b/sources_non_forked/ale/test/linter/test_circleci.vader new file mode 100644 index 00000000..000a77ec --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_circleci.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('yaml', 'circleci') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The linter should not run for every YAML file): + AssertLinterNotExecuted + +Execute(The linter should for YAML files in a .circleci directory): + call ale#test#SetFilename('../test-files/.circleci/config.yml') + + AssertLinter 'circleci', 'circleci --skip-update-check config validate - < %s' diff --git a/sources_non_forked/ale/test/linter/test_clang_tidy.vader b/sources_non_forked/ale/test/linter/test_clang_tidy.vader new file mode 100644 index 00000000..eb1220be --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_clang_tidy.vader @@ -0,0 +1,84 @@ +Before: + Save g:ale_c_parse_makefile + let g:ale_c_parse_makefile = 0 + + call ale#assert#SetUpLinterTest('cpp', 'clangtidy') + call ale#test#SetFilename('test.cpp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The clangtidy command default should be correct): + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' %s' + +Execute(You should be able to remove the -checks option for clang-tidy): + let b:ale_cpp_clangtidy_checks = [] + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' %s' + +Execute(You should be able to set other checks for clang-tidy): + let b:ale_cpp_clangtidy_checks = ['-*', 'clang-analyzer-*'] + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s' + +Execute(You should be able to manually set compiler flags for clang-tidy): + let b:ale_cpp_clangtidy_checks = ['*'] + let b:ale_cpp_clangtidy_options = '-Wall' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall' + +Execute(You should be able to manually set flags for clang-tidy): + let b:ale_cpp_clangtidy_extra_options = '-config=' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') . ' ' . ale#Escape('-config=') . ' %s' + +Execute(The build directory should be configurable): + let b:ale_cpp_clangtidy_checks = ['*'] + let b:ale_c_build_dir = '/foo/bar' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s' + \ . ' -p ' . ale#Escape('/foo/bar') + +Execute(The build directory setting should override the options): + let b:ale_cpp_clangtidy_checks = ['*'] + let b:ale_c_build_dir = '/foo/bar' + let b:ale_cpp_clangtidy_options = '-Wall' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s' + \ . ' -p ' . ale#Escape('/foo/bar') + +Execute(The build directory should be used for header files): + call ale#test#SetFilename('test.h') + + let b:ale_cpp_clangtidy_checks = ['*'] + let b:ale_c_build_dir = '/foo/bar' + let b:ale_cpp_clangtidy_options = '-Wall' + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s' + \ . ' -p ' . ale#Escape('/foo/bar') + + call ale#test#SetFilename('test.hpp') + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s' + \ . ' -p ' . ale#Escape('/foo/bar') + +Execute(The executable should be configurable): + let b:ale_cpp_clangtidy_checks = ['*'] + let b:ale_cpp_clangtidy_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_clj_kondo.vader b/sources_non_forked/ale/test/linter/test_clj_kondo.vader new file mode 100644 index 00000000..869f9f2a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_clj_kondo.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('clojure', 'clj_kondo') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'clj-kondo', 'clj-kondo' + \ . ' --cache --lint %t' + +Execute(Extra options should be supported): + let g:ale_clojure_clj_kondo_options = '--config ./clj-kondo/config.edn' + + AssertLinter 'clj-kondo', 'clj-kondo' + \ . ' --config ./clj-kondo/config.edn --lint %t' diff --git a/sources_non_forked/ale/test/linter/test_cmake_cmake_lint.vader b/sources_non_forked/ale/test/linter/test_cmake_cmake_lint.vader new file mode 100644 index 00000000..6cf09149 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cmake_cmake_lint.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('cmake', 'cmake_lint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'cmake-lint', ale#Escape('cmake-lint') . ' %t' + +Execute(The executable should be configurable): + let g:ale_cmake_cmake_lint_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_cookstyle.vader b/sources_non_forked/ale/test/linter/test_cookstyle.vader new file mode 100644 index 00000000..ad7391cc --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cookstyle.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('chef', 'cookstyle') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --force-exclusion --format json --stdin %s' + +Execute(The executable path should be configurable): + let b:ale_chef_cookstyle_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --force-exclusion --format json --stdin %s' + +Execute(The linter options should be configurable): + let b:ale_chef_cookstyle_options = '--parallel' + + AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --parallel --force-exclusion --format json --stdin %s' + diff --git a/sources_non_forked/ale/test/linter/test_cpp_cc.vader b/sources_non_forked/ale/test/linter/test_cpp_cc.vader new file mode 100644 index 00000000..dec3a07c --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpp_cc.vader @@ -0,0 +1,55 @@ +Before: + Save g:ale_c_parse_makefile + Save g:ale_history_enabled + + let g:ale_c_parse_makefile = 0 + let g:ale_history_enabled = 0 + + let g:get_cflags_return_value = '' + let g:executable_map = {} + + runtime autoload/ale/c.vim + runtime autoload/ale/engine.vim + + function! ale#engine#IsExecutable(buffer, executable) abort + return has_key(g:executable_map, a:executable) + endfunction + + function! ale#c#GetCFlags(buffer, output) abort + return g:get_cflags_return_value + endfunction + + call ale#assert#SetUpLinterTest('cpp', 'cc') + + let b:command_tail = ' -S -x c++' + \ . ' -o ' . (has('win32') ? 'nul': '/dev/null') + \ . ' -iquote %s:h' + \ . ' -std=c++14 -Wall -' + +After: + unlet! g:get_cflags_return_value + unlet! g:executable_map + unlet! b:command_tail + + runtime autoload/ale/c.vim + runtime autoload/ale/engine.vim + + call ale#assert#TearDownLinterTest() + +Execute(clang++ should be used instead of gcc, if available): + let g:executable_map = {'clang++': 1} + + AssertLinter 'clang++', [ale#Escape('clang++') . b:command_tail] + +Execute(The executable should be configurable): + AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail] + + let b:ale_cpp_cc_executable = 'foobar' + + AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail] + +Execute(The -std flag should be replaced by parsed C flags): + let b:command_tail = substitute(b:command_tail, 'c++14', 'c++11 ', '') + let g:get_cflags_return_value = '-std=c++11' + + AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail diff --git a/sources_non_forked/ale/test/linter/test_cpp_ccls.vader b/sources_non_forked/ale/test/linter/test_cpp_ccls.vader new file mode 100644 index 00000000..12aa30e3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpp_ccls.vader @@ -0,0 +1,69 @@ +" Author: Ye Jingchen , Ben Falconer +" Description: A language server for C++ + +Before: + call ale#assert#SetUpLinterTest('cpp', 'ccls') + + Save b:ale_c_build_dir_names + Save b:ale_cpp_ccls_executable + Save b:ale_cpp_ccls_init_options + +After: + call ale#assert#TearDownLinterTest() + +Execute(The project root should be detected correctly using compile_commands.json file): + call ale#test#SetFilename(tempname() . '/dummy.cpp') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.cpp') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') + +Execute(The project root should be detected correctly using .ccls file): + call ale#test#SetFilename(tempname() . '/dummy.cpp') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.cpp') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls') + +Execute(The project root should be detected correctly using .ccls-root file): + call ale#test#SetFilename(tempname() . '/dummy.cpp') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_ccls-root/dummy.cpp') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls-root') + +Execute(The executable should be configurable): + AssertLinter 'ccls', ale#Escape('ccls') + + let b:ale_cpp_ccls_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(The initialization options should be configurable): + AssertLSPOptions {} + + let b:ale_cpp_ccls_init_options = { 'cacheDirectory': '/tmp/ccls' } + + AssertLSPOptions { 'cacheDirectory': '/tmp/ccls' } + +Execute(The compile command database should be detected correctly): + call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c') + + AssertLSPOptions {} + + call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c') + + AssertLSPOptions { 'compilationDatabaseDirectory': + \ ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') } + + call ale#test#SetFilename('../test-files/ccls/with_build_dir/dummy.c') + let b:ale_c_build_dir_names = ['unusual_build_dir_name'] + + AssertLSPOptions { 'compilationDatabaseDirectory': + \ ale#path#Simplify(g:dir . '/../test-files/ccls/with_build_dir/unusual_build_dir_name') } diff --git a/sources_non_forked/ale/test/linter/test_cpp_clangcheck.vader b/sources_non_forked/ale/test/linter/test_cpp_clangcheck.vader new file mode 100644 index 00000000..188141d5 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpp_clangcheck.vader @@ -0,0 +1,35 @@ +Before: + call ale#assert#SetUpLinterTest('cpp', 'clangcheck') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'clang-check', + \ ale#Escape('clang-check') + \ . ' -analyze %s --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics' + + let b:ale_cpp_clangcheck_executable = 'foobar' + + " The extra arguments in the command are used to prevent .plist files from + " being generated. + AssertLinter 'foobar', + \ ale#Escape('foobar') + \ . ' -analyze %s --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics' + +Execute(The options should be configurable): + let b:ale_cpp_clangcheck_options = '--something' + + AssertLinter 'clang-check', + \ ale#Escape('clang-check') + \ . ' -analyze %s' + \ . ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics' + \ . ' --something' + +Execute(The build directory should be used when set): + let b:ale_cpp_clangcheck_options = '--something' + let b:ale_c_build_dir = '/foo/bar' + + AssertLinter 'clang-check', + \ ale#Escape('clang-check') + \ . ' -analyze %s --something -p ' . ale#Escape('/foo/bar') diff --git a/sources_non_forked/ale/test/linter/test_cpp_clazy.vader b/sources_non_forked/ale/test/linter/test_cpp_clazy.vader new file mode 100644 index 00000000..e5a81b8f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpp_clazy.vader @@ -0,0 +1,56 @@ +Before: + call ale#assert#SetUpLinterTest('cpp', 'clazy') + call ale#test#SetFilename('test.cpp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The clazy command default should be correct): + AssertLinter 'clazy-standalone', + \ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' %s' + +Execute(You should be able to remove the -checks option for clazy-standalone): + let b:ale_cpp_clazy_checks = [] + + AssertLinter 'clazy-standalone', ale#Escape('clazy-standalone') . ' %s' + +Execute(You should be able to set other checks for clazy-standalone): + let b:ale_cpp_clazy_checks = ['level2', 'level3'] + + AssertLinter 'clazy-standalone', + \ ale#Escape('clazy-standalone') + \ . ' -checks=' . ale#Escape('level2,level3') . ' %s' + +Execute(You should be able to manually set compiler flags for clazy-standalone): + let b:ale_cpp_clazy_options = '-qt4-compat' + + AssertLinter 'clazy-standalone', + \ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' -qt4-compat' . ' %s' + \ +Execute(The build directory should be configurable): + let b:ale_c_build_dir = '/foo/bar' + + AssertLinter 'clazy-standalone', + \ ale#Escape('clazy-standalone') + \ . ' -checks=' . ale#Escape('level1') . ' -p ' . ale#Escape('/foo/bar') . ' %s' + +Execute(The build directory should be used for header files): + call ale#test#SetFilename('test.h') + + let b:ale_c_build_dir = '/foo/bar' + + AssertLinter 'clazy-standalone', + \ ale#Escape('clazy-standalone') + \ . ' -checks=' . ale#Escape('level1') . ' -p ' . ale#Escape('/foo/bar') . ' %s' + + call ale#test#SetFilename('test.hpp') + + AssertLinter 'clazy-standalone', + \ ale#Escape('clazy-standalone') + \ . ' -checks=' . ale#Escape('level1') . ' -p ' . ale#Escape('/foo/bar') . ' %s' + +Execute(The executable should be configurable): + let b:ale_cpp_clazy_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -checks=' . ale#Escape('level1') . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_cpp_cppcheck.vader b/sources_non_forked/ale/test/linter/test_cpp_cppcheck.vader new file mode 100644 index 00000000..880bcb41 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpp_cppcheck.vader @@ -0,0 +1,83 @@ +Before: + call ale#assert#SetUpLinterTest('cpp', 'cppcheck') + let b:command_tail = ' -q --language=c++ --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') . ' --enable=style -I' . ale#Escape(ale#path#Simplify(g:dir)) .' %t' + +After: + " Remove a test file we might open for some tests. + if &buftype != 'nofile' + set nomodified + set buftype=nofile + endif + + unlet! b:rel_file_path + unlet! b:command_tail + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail + + let b:ale_cpp_cppcheck_executable = 'foobar' + + AssertLinterCwd '' + AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail + +Execute(cppcheck for C++ should detect compile_commands.json files): + let b:rel_file_path = '../test-files/cppcheck/one/foo.cpp' + call ale#test#SetFilename(b:rel_file_path) + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one') + AssertLinter 'cppcheck', ale#Escape('cppcheck') + \ . ' -q --language=c++' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' --project=' . ale#Escape('compile_commands.json') + \ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path)) + \ . ' --enable=style %t' + +Execute(cppcheck for C++ should detect compile_commands.json files in build directories): + let b:rel_file_path = '../test-files/cppcheck/with_build_dir/foo.cpp' + call ale#test#SetFilename(b:rel_file_path) + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/with_build_dir') + AssertLinter 'cppcheck', ale#Escape('cppcheck') + \ . ' -q --language=c++' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json')) + \ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path)) + \ . ' --enable=style %t' + +Execute(cppcheck for C++ should include file dir if compile_commands.json file is not found): + call ale#test#SetFilename('../test-files/cppcheck/foo.cpp') + + AssertLinter 'cppcheck', + \ ale#Escape('cppcheck') + \ . ' -q --language=c++' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' --enable=style' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck')) + \ . ' %t' + +Execute(cppcheck for C++ header should include file dir and not use compile_commands.json): + call ale#test#SetFilename('../test-files/cppcheck/one/foo.hpp') + + AssertLinter 'cppcheck', + \ ale#Escape('cppcheck') + \ . ' -q --language=c++' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')) + \ . ' --suppress=unusedStructMember' + \ . ' --enable=style' + \ . ' %t' + +Execute(cppcheck for C++ should ignore compile_commands.json file if buffer is modified): + call ale#test#SetFilename('../test-files/cppcheck/one/foo.cpp') + + set buftype= + set modified + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one') + AssertLinter 'cppcheck', ale#Escape('cppcheck') + \ . ' -q --language=c++' + \ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') + \ . ' --enable=style' + \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')) + \ . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_cpp_cquery.vader b/sources_non_forked/ale/test/linter/test_cpp_cquery.vader new file mode 100644 index 00000000..f638e401 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpp_cquery.vader @@ -0,0 +1,40 @@ +" Author: Ben Falconer +" Description: A language server for C++ + +Before: + call ale#assert#SetUpLinterTest('cpp', 'cquery') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The project root should be detected correctly using compile_commands.json file): + call ale#test#SetFilename(tempname() . '/dummy.cpp') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/cquery/dummy.cpp') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery') + +Execute(The project root should be detected correctly using .cquery file): + call ale#test#SetFilename(tempname() . '/dummy.cpp') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/cquery/with_cquery/dummy.cpp') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery/with_cquery') + +Execute(The executable should be configurable): + AssertLinter 'cquery', ale#Escape('cquery') + + let b:ale_cpp_cquery_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(The cache directory should be configurable): + AssertLSPOptions {'cacheDirectory': expand('$HOME/.cache/cquery')} + + let b:ale_cpp_cquery_cache_directory = '/foo/bar' + + AssertLSPOptions {'cacheDirectory': '/foo/bar'} diff --git a/sources_non_forked/ale/test/linter/test_cpp_flawfinder.vader b/sources_non_forked/ale/test/linter/test_cpp_flawfinder.vader new file mode 100644 index 00000000..3f4067ea --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpp_flawfinder.vader @@ -0,0 +1,26 @@ +Before: + call ale#assert#SetUpLinterTest('cpp', 'flawfinder') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The flawfinder command should be correct): + AssertLinter 'flawfinder', + \ ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t' + +Execute(The minlevel of flawfinder should be configurable): + let b:ale_cpp_flawfinder_minlevel = 8 + + AssertLinter 'flawfinder', + \ ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t' + +Execute(Additional flawfinder options should be configurable): + let b:ale_cpp_flawfinder_options = ' --foobar' + + AssertLinter 'flawfinder', + \ ale#Escape('flawfinder') . ' -CDQS --foobar --minlevel=1 %t' + +Execute(The flawfinder exectable should be configurable): + let b:ale_cpp_flawfinder_executable = 'foo/bar' + + AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t' diff --git a/sources_non_forked/ale/test/linter/test_cpplint.vader b/sources_non_forked/ale/test/linter/test_cpplint.vader new file mode 100644 index 00000000..d5fd457b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cpplint.vader @@ -0,0 +1,17 @@ +Before: + call ale#assert#SetUpLinterTest('cpp', 'cpplint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'cpplint', ale#Escape('cpplint') . ' %s' + + let b:ale_cpp_cpplint_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %s' + +Execute(The options should be configurable): + let b:ale_cpp_cpplint_options = '--something' + + AssertLinter 'cpplint', ale#Escape('cpplint') . ' --something %s' diff --git a/sources_non_forked/ale/test/linter/test_cs_csc.vader b/sources_non_forked/ale/test/linter/test_cs_csc.vader new file mode 100644 index 00000000..28d0304a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cs_csc.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('cs', 'csc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The csc linter should return the correct default command): + AssertLinterCwd expand('%:p:h') + AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs') + +Execute(The options should be be used in the command): + let g:ale_cs_csc_options = '' + + AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs') + +Execute(The souce path should be be used in the command): + let g:ale_cs_csc_source = '../foo/bar' + + AssertLinterCwd '../foo/bar' + AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs') + +Execute(The list of search pathes for assemblies should be be used in the command if not empty): + let g:ale_cs_csc_assembly_path = ['/usr/lib/mono', '../foo/bar'] + + AssertLinter 'csc', 'csc /unsafe' + \ . ' /lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar') + \ . ' /out:TEMP /t:module /recurse:' . ale#Escape('*.cs') + + let g:ale_cs_csc_assembly_path = [] + + AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs') + +Execute(The list of assemblies should be be used in the command if not empty): + let g:ale_cs_csc_assemblies = ['foo.dll', 'bar.dll'] + + AssertLinter 'csc', 'csc /unsafe' + \ . ' /r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll') + \ . ' /out:TEMP /t:module /recurse:' . ale#Escape('*.cs') + + let g:ale_cs_csc_assemblies = [] + + AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs') diff --git a/sources_non_forked/ale/test/linter/test_cs_mcs.vader b/sources_non_forked/ale/test/linter/test_cs_mcs.vader new file mode 100644 index 00000000..dbebd106 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cs_mcs.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('cs', 'mcs') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'mcs', 'mcs -unsafe --parse %t' + +Execute(The options should be be used in the command): + let b:ale_cs_mcs_options = '-pkg:dotnet' + + AssertLinter 'mcs', 'mcs -unsafe --parse -pkg:dotnet %t' diff --git a/sources_non_forked/ale/test/linter/test_cs_mcsc.vader b/sources_non_forked/ale/test/linter/test_cs_mcsc.vader new file mode 100644 index 00000000..e784cf15 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cs_mcsc.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('cs', 'mcsc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The mcsc linter should return the correct default command): + AssertLinterCwd expand('%:p:h') + AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') + +Execute(The options should be be used in the command): + let g:ale_cs_mcsc_options = '-pkg:dotnet' + + AssertLinter 'mcs', 'mcs -unsafe -pkg:dotnet -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') + +Execute(The souce path should be be used in the command): + let g:ale_cs_mcsc_source = '../foo/bar' + + AssertLinterCwd '../foo/bar' + AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') + +Execute(The list of search pathes for assemblies should be be used in the command if not empty): + let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar'] + + AssertLinter 'mcs', 'mcs -unsafe' + \ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar') + \ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') + + let g:ale_cs_mcsc_assembly_path = [] + + AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') + +Execute(The list of assemblies should be be used in the command if not empty): + let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll'] + + AssertLinter 'mcs', 'mcs -unsafe' + \ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll') + \ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') + + let g:ale_cs_mcsc_assemblies = [] + + AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') diff --git a/sources_non_forked/ale/test/linter/test_cspell.vader b/sources_non_forked/ale/test/linter/test_cspell.vader new file mode 100644 index 00000000..0302edc5 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cspell.vader @@ -0,0 +1,71 @@ +Before: + call ale#assert#SetUpLinterTest('tex', 'cspell') + + " We have to manually do our own variable reset because SetUpLinterTest calls + " ale#assert#ResetVariables, which specifically only resets variables that + " begin with ale__, per https://github.com/dense-analysis/ale/blob/76c2293e68a6cad3b192062743d25b8daa082205/autoload/ale/assert.vim#L256 + " + " Took a lot of debugging and reading both junegunn/vader.vim and most ALE + " files to find this behavior + + Save g:ale_cspell_executable + Save g:ale_cspell_use_global + Save g:ale_cspell_options + + unlet! g:ale_cspell_executable + unlet! g:ale_cspell_use_global + unlet! g:ale_cspell_options + + let g:ale_cspell_executable = 'cspell' + let g:ale_cspell_use_global = 0 + let g:ale_cspell_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The global executable should be used when the local one cannot be found): + AssertLinter + \ 'cspell', + \ ale#Escape('cspell') + \ . ' lint --no-color --no-progress --no-summary -- stdin' + +Execute(Should use the node_modules/.bin executable if available): + call ale#test#SetFilename('../test-files/cspell/node-modules/test.tex') + + AssertLinter + \ ale#path#Simplify(g:dir + \ . '/../test-files/cspell/node-modules/node_modules/.bin/cspell'), + \ ale#Escape(ale#path#Simplify(g:dir + \ . '/../test-files/cspell/node-modules/node_modules/.bin/cspell')) + \ . ' lint --no-color --no-progress --no-summary -- stdin' + +Execute(Should use the node_modules/cspell executable if available): + call ale#test#SetFilename('../test-files/cspell/node-modules-2/test.tex') + + AssertLinter + \ ale#path#Simplify(g:dir + \ . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js'), + \ (has('win32') ? 'node.exe ': '') + \ . ale#Escape(ale#path#Simplify(g:dir + \ . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js')) + \ . ' lint --no-color --no-progress --no-summary -- stdin' + +Execute(Should let users configure a global executable and override local paths): + let g:ale_cspell_executable = '/path/to/custom/cspell' + let g:ale_cspell_use_global = 1 + + AssertLinter + \ '/path/to/custom/cspell', + \ ale#Escape('/path/to/custom/cspell') + \ . ' lint --no-color --no-progress --no-summary -- stdin' + +Execute(Additional cspell options should be configurable): + call ale#test#SetFilename('../test-files/dummy') + + let g:ale_cspell_options = '--foobar' + + AssertLinter + \ 'cspell', + \ ale#Escape('cspell') + \ . ' lint --no-color --no-progress --no-summary --foobar -- stdin' + diff --git a/sources_non_forked/ale/test/linter/test_cucumber.vader b/sources_non_forked/ale/test/linter/test_cucumber.vader new file mode 100644 index 00000000..6a7851ef --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cucumber.vader @@ -0,0 +1,18 @@ +Before: + call ale#assert#SetUpLinterTest('cucumber', 'cucumber') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Should require the nearest features dir, if one is found): + call ale#test#SetFilename('../test-files/cucumber/features/cuke.feature') + + AssertLinter 'cucumber', + \ 'cucumber --dry-run --quiet --strict --format=json ' + \ . '-r ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cucumber/features/')) . ' %t' + +Execute(Should require nothing if no features dir is found): + call ale#test#SetFilename('something/without/a/features/dir') + + AssertLinter 'cucumber', + \ 'cucumber --dry-run --quiet --strict --format=json %t' diff --git a/sources_non_forked/ale/test/linter/test_cuda_nvcc.vader b/sources_non_forked/ale/test/linter/test_cuda_nvcc.vader new file mode 100644 index 00000000..4578d052 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cuda_nvcc.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('cuda', 'nvcc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'nvcc', + \ ale#Escape('nvcc') . ' -cuda -std=c++11 %s -o ' . g:ale#util#nul_file + + let b:ale_cuda_nvcc_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -cuda -std=c++11 %s -o ' . g:ale#util#nul_file + +Execute(The options should be configurable): + let g:ale_cuda_nvcc_options = '--foobar' + + AssertLinter 'nvcc', + \ ale#Escape('nvcc') . ' -cuda --foobar %s -o ' . g:ale#util#nul_file diff --git a/sources_non_forked/ale/test/linter/test_cypher_cypher_lint.vader b/sources_non_forked/ale/test/linter/test_cypher_cypher_lint.vader new file mode 100644 index 00000000..6b64dc1f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_cypher_cypher_lint.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('cypher', 'cypher_lint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command and executable should be correct): + AssertLinter 'cypher-lint', 'cypher-lint' diff --git a/sources_non_forked/ale/test/linter/test_d_dls.vader b/sources_non_forked/ale/test/linter/test_d_dls.vader new file mode 100644 index 00000000..156ebf66 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_d_dls.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('d', 'dls') + + Save &filetype + let &filetype = 'd' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'd' + +Execute(The default executable should be correct): + AssertLinter 'dls', 'dls' + +Execute(The executable should be configurable): + let g:ale_d_dls_executable = 'foobar' + + AssertLinter 'foobar', 'foobar' diff --git a/sources_non_forked/ale/test/linter/test_dart_analysis_server.vader b/sources_non_forked/ale/test/linter/test_dart_analysis_server.vader new file mode 100644 index 00000000..1754109a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_dart_analysis_server.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('dart', 'analysis_server') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'dart', ale#Escape('dart') + \ . ' ./snapshots/analysis_server.dart.snapshot --lsp' + +Execute(The executable should be configurable): + let g:ale_dart_analysis_server_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + \ . ' ./snapshots/analysis_server.dart.snapshot --lsp' diff --git a/sources_non_forked/ale/test/linter/test_dart_language_server.vader b/sources_non_forked/ale/test/linter/test_dart_language_server.vader new file mode 100644 index 00000000..5567f271 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_dart_language_server.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('dart', 'language_server') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'dart_language_server', ale#Escape('dart_language_server') diff --git a/sources_non_forked/ale/test/linter/test_desktop_file_validate.vader b/sources_non_forked/ale/test/linter/test_desktop_file_validate.vader new file mode 100644 index 00000000..4a49057b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_desktop_file_validate.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('desktop', 'desktop_file_validate') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'desktop-file-validate', + \ ale#Escape('desktop-file-validate') . ' %t' + +Execute(Extra options should work): + let b:ale_desktop_desktop_file_validate_options = '--warn-kde' + + AssertLinter 'desktop-file-validate', + \ ale#Escape('desktop-file-validate') . ' --warn-kde %t' diff --git a/sources_non_forked/ale/test/linter/test_dialyxir.vader b/sources_non_forked/ale/test/linter/test_dialyxir.vader new file mode 100644 index 00000000..250ffefd --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_dialyxir.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpLinterTest('elixir', 'dialyxir') + call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Builds dialyxir command with a normal project): + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project') + AssertLinter 'mix', 'mix help dialyzer && mix dialyzer' + +Execute(Builds dialyxir command with an umbrella project): + call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project') + AssertLinter 'mix', 'mix help dialyzer && mix dialyzer' diff --git a/sources_non_forked/ale/test/linter/test_dmd_commandline.vader b/sources_non_forked/ale/test/linter/test_dmd_commandline.vader new file mode 100644 index 00000000..609fc073 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_dmd_commandline.vader @@ -0,0 +1,96 @@ +Before: + runtime ale_linters/d/dmd.vim + +After: + call ale#linter#Reset() + +Execute(DMD command line should be correct with imports): + AssertEqual + \ 'dmd ' . + \ '-I' . ale#Escape('source') . ' ' . + \ '-I' . ale#Escape('/prefix/include/d') . ' ' . + \ '-I' . ale#Escape('/home/user/.dub/packages/pkg-0.0.1/pkg/src') . ' ' . + \ ' ' . + \ ' ' . + \ ' ' . + \ '-o- -wi -vcolumns -c %t', + \ ale_linters#d#dmd#DMDCommand(bufnr(''), [ + \ 'source', + \ '/prefix/include/d', + \ '/home/user/.dub/packages/pkg-0.0.1/pkg/src', + \ '', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], {}) + +Execute(DMD command line should be correct with imports and version): + AssertEqual + \ 'dmd ' . + \ '-I' . ale#Escape('source') . ' ' . + \ '-I' . ale#Escape('/prefix/include/d') . ' ' . + \ '-I' . ale#Escape('/home/user/.dub/packages/pkg-0.0.1/pkg/src') . ' ' . + \ ' ' . + \ '-version=' . ale#Escape('SOME_VERSION') . ' ' . + \ ' ' . + \ '-o- -wi -vcolumns -c %t', + \ ale_linters#d#dmd#DMDCommand(bufnr(''), [ + \ 'source', + \ '/prefix/include/d', + \ '/home/user/.dub/packages/pkg-0.0.1/pkg/src', + \ '', + \ '', + \ '', + \ 'SOME_VERSION', + \ '', + \ '', + \ ], {}) + +Execute(DMD command line should be correct): + AssertEqual + \ 'dmd ' . + \ '-I' . ale#Escape('source') . ' ' . + \ '-I' . ale#Escape('/prefix/include/d') . ' ' . + \ '-I' . ale#Escape('/home/user/.dub/packages/pkg-0.0.1/pkg/src') . ' ' . + \ '-J' . ale#Escape('views') . ' ' . + \ '-version=' . ale#Escape('SOME_VERSION') . ' ' . + \ '-version=' . ale#Escape('SOME_OTHER_VERSION') . ' ' . + \ '-debug=' . ale#Escape('SomeFeature') . ' ' . + \ '-o- -wi -vcolumns -c %t', + \ ale_linters#d#dmd#DMDCommand(bufnr(''), [ + \ 'source', + \ '/prefix/include/d', + \ '/home/user/.dub/packages/pkg-0.0.1/pkg/src', + \ '', + \ 'views', + \ '', + \ 'SOME_VERSION', + \ 'SOME_OTHER_VERSION', + \ '', + \ 'SomeFeature', + \ ], {}) + +Execute(DMD command line should be correct with CR): + " on windows, the function is called with carriage return + AssertEqual + \ 'dmd ' . + \ '-I' . ale#Escape('source') . ' ' . + \ '-I' . ale#Escape('C:\prefix\include\d') . ' ' . + \ '-I' . ale#Escape('C:\Users\user\AppData\Local\Dub\packages\pkg-0.0.1\pkg\src') . ' ' . + \ ' ' . + \ ' ' . + \ ' ' . + \ '-o- -wi -vcolumns -c %t', + \ ale_linters#d#dmd#DMDCommand(bufnr(''), [ + \ "source\r", + \ "C:\\prefix\\include\\d\r", + \ "C:\\Users\\user\\AppData\\Local\\Dub\\packages\\pkg-0.0.1\\pkg\\src\r", + \ "\r", + \ "\r", + \ "\r", + \ "\r", + \ "\r", + \ "\r", + \ ], {}) diff --git a/sources_non_forked/ale/test/linter/test_dockerfile_lint.vader b/sources_non_forked/ale/test/linter/test_dockerfile_lint.vader new file mode 100644 index 00000000..abc32e0d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_dockerfile_lint.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('dockerfile', 'dockerfile_lint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'dockerfile_lint', ale#Escape('dockerfile_lint') . ' -p -j -f %t' + +Execute(The executable should be configurable): + let b:ale_dockerfile_dockerfile_lint_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -p -j -f %t' + +Execute(The options should be configurable): + let b:ale_dockerfile_dockerfile_lint_options = '-r additional.yaml' + + AssertLinter 'dockerfile_lint', ale#Escape('dockerfile_lint') . ' -r additional.yaml -p -j -f %t' + diff --git a/sources_non_forked/ale/test/linter/test_dogma.vader b/sources_non_forked/ale/test/linter/test_dogma.vader new file mode 100644 index 00000000..c8b599af --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_dogma.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpLinterTest('elixir', 'dogma') + call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Builds dogma command with a normal project): + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project') + AssertLinter 'mix', 'mix help dogma && mix dogma %s --format=flycheck' + +Execute(Builds dogma command with an umbrella project): + call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project') + AssertLinter 'mix', 'mix help dogma && mix dogma %s --format=flycheck' diff --git a/sources_non_forked/ale/test/linter/test_eclipselsp.vader b/sources_non_forked/ale/test/linter/test_eclipselsp.vader new file mode 100644 index 00000000..6bbc4053 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_eclipselsp.vader @@ -0,0 +1,111 @@ +Before: + call ale#assert#SetUpLinterTest('java', 'eclipselsp') + call ale#test#SetFilename('dummy.java') + + let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls' + + let b:cfg = ale#path#Simplify(g:dir . '/../config_linux') + + if has('win32') + let b:cfg = ale#path#Simplify(g:dir . '/../config_win') + elseif has('macunix') + let b:cfg = ale#path#Simplify(g:dir . '/../config_mac') + endif + +After: + unlet! b:ale_java_eclipselsp_path + unlet! b:cfg + + call ale#assert#TearDownLinterTest() + +Execute(VersionCheck should return correct version): + + " OpenJDK Java 1.8 + AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([ + \ 'openjdk version "1.8.0_191"', + \ 'OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12)', + \ 'OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)' + \]) + + " OpenJDK Java 10 + AssertEqual [10, 0, 2], ale_linters#java#eclipselsp#VersionCheck([ + \ 'openjdk version "10.0.2" 2018-07-17', + \ 'OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)', + \ 'OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)' + \]) + + " Oracle Java 1.8 + AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([ + \ 'java version "1.8.0_161"', + \ 'Java(TM) SE Runtime Environment (build 1.8.0_161-b12)', + \ 'Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)' + \]) + + " Oracle Java 10 + AssertEqual [10, 0, 1], ale_linters#java#eclipselsp#VersionCheck([ + \ 'java version "10.0.1" 2018-04-17', + \ 'Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)', + \ 'Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)' + \]) + + AssertEqual [], ale_linters#java#eclipselsp#VersionCheck(['x']) + + AssertEqual [], ale_linters#java#eclipselsp#VersionCheck([]) + +Execute(The eclipselsp callback should return the correct default value): + let cmd = [ ale#Escape('java'), + \ '', + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ ale#Escape(''), + \ '-configuration', + \ ale#Escape(b:cfg), + \ '-data', + \ ale#Escape(ale#path#Simplify('')) + \] + AssertLinter 'java', join(cmd, ' ') + +Execute(The eclipselsp callback should allow custom executable): + let b:ale_java_eclipselsp_executable='/bin/foobar' + let cmd = [ ale#Escape('/bin/foobar'), + \ '', + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ ale#Escape(''), + \ '-configuration', + \ ale#Escape(b:cfg), + \ '-data', + \ ale#Escape(ale#path#Simplify('')) + \] + AssertLinter '/bin/foobar', join(cmd, ' ') + +Execute(The eclipselsp callback should allow custom configuration path and javaagent): + let b:ale_java_eclipselsp_config_path = '/home/config' + let b:ale_java_eclipselsp_javaagent = '/home/lombok.jar /home/lombok2.jar' + let cmd = [ ale#Escape('java'), + \ ale#Escape('-javaagent:/home/lombok.jar'), + \ ale#Escape('-javaagent:/home/lombok2.jar'), + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ ale#Escape(''), + \ '-configuration', + \ ale#Escape(ale#path#Simplify('/home/config')), + \ '-data', + \ ale#Escape(ale#path#Simplify('')) + \] + AssertLinter 'java', join(cmd, ' ') diff --git a/sources_non_forked/ale/test/linter/test_elixir_credo.vader b/sources_non_forked/ale/test/linter/test_elixir_credo.vader new file mode 100644 index 00000000..9c639c57 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_elixir_credo.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('elixir', 'credo') + call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex') + + +After: + unlet! g:ale_elixir_credo_strict + + call ale#assert#TearDownLinterTest() + +Execute(Builds credo command with normal project): + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project') + AssertLinter 'mix', + \ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' + +Execute(Builds credo command with umbrella project): + call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project') + AssertLinter 'mix', + \ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' + +Execute(Builds credo command with --strict mode when set to 1): + let g:ale_elixir_credo_strict = 1 + + AssertLinter 'mix', + \ 'mix help credo && mix credo --strict --format=flycheck --read-from-stdin %s' + +Execute(Builds credo command with suggest mode by default): + AssertLinter 'mix', + \ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' + +Execute(Builds credo command with suggest mode when set to 0): + let g:ale_elixir_credo_strict = 0 + + AssertLinter 'mix', + \ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' + +Execute(Builds credo command with a custom config file): + let g:ale_elixir_credo_config_file = '/home/user/custom_credo.exs' + + AssertLinter 'mix', + \ 'mix help credo && mix credo suggest --config-file /home/user/custom_credo.exs --format=flycheck --read-from-stdin %s' diff --git a/sources_non_forked/ale/test/linter/test_elixir_ls.vader b/sources_non_forked/ale/test/linter/test_elixir_ls.vader new file mode 100644 index 00000000..84e805ba --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_elixir_ls.vader @@ -0,0 +1,34 @@ +Before: + call ale#assert#SetUpLinterTest('elixir', 'elixir_ls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + if has('win32') + AssertLinter 'elixir-ls\language_server.bat', 'elixir-ls\language_server.bat' + else + AssertLinter 'elixir-ls/language_server.sh', 'elixir-ls/language_server.sh' + endif + +Execute(should configure elixir-ls release location): + let b:ale_elixir_elixir_ls_release = 'boo' + + if has('win32') + AssertLinter 'boo\language_server.bat', 'boo\language_server.bat' + else + AssertLinter 'boo/language_server.sh', 'boo/language_server.sh' + endif + +Execute(should set correct LSP values): + call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/app1/lib/app.ex') + + AssertLSPLanguage 'elixir' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project') + +Execute(should accept configuration settings): + AssertLSPConfig {} + let b:ale_elixir_elixir_ls_config = {'elixirLS': {'dialyzerEnabled': v:false}} + AssertLSPConfig {'elixirLS': {'dialyzerEnabled': v:false}} diff --git a/sources_non_forked/ale/test/linter/test_elixir_mix.vader b/sources_non_forked/ale/test/linter/test_elixir_mix.vader new file mode 100644 index 00000000..a04bee55 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_elixir_mix.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('elixir', 'mix') + call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex') + let g:env_prefix = ale#Env('MIX_BUILD_PATH', 'TEMP_DIR') + +After: + unlet! g:env_prefix + + call ale#assert#TearDownLinterTest() + +Execute(The default mix command should be correct): + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project') + AssertLinter 'mix', g:env_prefix . 'mix compile %s' + +Execute(Build mix commands with an umbrella root): + call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project') + AssertLinter 'mix', g:env_prefix . 'mix compile %s' diff --git a/sources_non_forked/ale/test/linter/test_elm_ls.vader b/sources_non_forked/ale/test/linter/test_elm_ls.vader new file mode 100644 index 00000000..98b01c96 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_elm_ls.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('elm', 'elm_ls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm') + + AssertLinter 'elm-language-server', ale#Escape('elm-language-server') . ' --stdio' + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/elm/newapp') + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm') + + let g:ale_elm_ls_executable = '/path/to/custom/elm-language-server' + let g:ale_elm_ls_use_global = 1 + + AssertLinter '/path/to/custom/elm-language-server', + \ ale#Escape('/path/to/custom/elm-language-server') . ' --stdio' + +Execute(The language should be correct): + AssertLSPLanguage 'elm' diff --git a/sources_non_forked/ale/test/linter/test_elm_make.vader b/sources_non_forked/ale/test/linter/test_elm_make.vader new file mode 100644 index 00000000..90e0c920 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_elm_make.vader @@ -0,0 +1,63 @@ +Before: + call ale#assert#SetUpLinterTest('elm', 'make') + +After: + unlet! g:executable + + call ale#assert#TearDownLinterTest() + +Execute(should get valid executable with default params): + call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm') + + let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/newapp/node_modules/.bin/elm') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp') + AssertLinter g:executable, + \ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' + +Execute(should get elm-test executable for test code with elm >= 0.19): + call ale#test#SetFilename('../test-files/elm/newapp/tests/TestSuite.elm') + + let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/newapp/node_modules/.bin/elm-test') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp') + AssertLinter g:executable, + \ ale#Escape(g:executable) . ' make --report=json --output=/dev/null --compiler ' + \ . ale#path#Simplify(g:dir . '/../test-files/elm/newapp/node_modules/.bin/elm') . ' %t' + +Execute(should fallback to elm executable with elm >= 0.19): + call ale#test#SetFilename('../test-files/elm/newapp-notests/tests/TestMain.elm') + + let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/newapp-notests/node_modules/.bin/elm') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp-notests') + AssertLinter g:executable, + \ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' + +Execute(should get plain elm executable for test code with elm < 0.19): + call ale#test#SetFilename('../test-files/elm/oldapp/tests/TestSuite.elm') + + let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/oldapp/node_modules/.bin/elm') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/oldapp') + AssertLinter g:executable, + \ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' + +Execute(should get valid executable with 'use_global' params): + let g:ale_elm_make_use_global = 1 + + call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp') + AssertLinter 'elm', + \ ale#Escape('elm') . ' make --report=json --output=/dev/null %t' + +Execute(should get valid executable with 'use_global' and 'executable' params): + let g:ale_elm_make_executable = 'other-elm' + let g:ale_elm_make_use_global = 1 + + call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp') + AssertLinter 'other-elm', + \ ale#Escape('other-elm') . ' make --report=json --output=/dev/null %t' diff --git a/sources_non_forked/ale/test/linter/test_embertemplatelint.vader b/sources_non_forked/ale/test/linter/test_embertemplatelint.vader new file mode 100644 index 00000000..7cba83e2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_embertemplatelint.vader @@ -0,0 +1,23 @@ +Before: + call ale#assert#SetUpLinterTest('handlebars', 'embertemplatelint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Runs the right command for ember-template-lint >= 4.x): + GivenCommandOutput ['4.0.0'] + + AssertLinter 'ember-template-lint', + \ ale#Escape('ember-template-lint') . ' --format=json --filename %s' + +Execute(Runs the right command for ember-template-lint >= 1.6, < 4.x): + GivenCommandOutput ['1.6.0'] + + AssertLinter 'ember-template-lint', + \ ale#Escape('ember-template-lint') . ' --json --filename %s' + +Execute(Runs the right command for ember-template-lint < 1.6): + GivenCommandOutput ['1.5.0'] + + AssertLinter 'ember-template-lint', + \ ale#Escape('ember-template-lint') . ' --json %t' diff --git a/sources_non_forked/ale/test/linter/test_erb.vader b/sources_non_forked/ale/test/linter/test_erb.vader new file mode 100644 index 00000000..c64c7ba5 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erb.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpLinterTest('eruby', 'erb') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should not contain any filter code by default): + call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/file.rb') + + AssertLinter 'erb', 'erb -P -T - -x %t | ruby -c' + +Execute(Executable should filter invalid eRuby when inside a Rails project): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb') + + AssertLinter 'erb', + \ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c' diff --git a/sources_non_forked/ale/test/linter/test_erblint.vader b/sources_non_forked/ale/test/linter/test_erblint.vader new file mode 100644 index 00000000..147b5965 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erblint.vader @@ -0,0 +1,26 @@ +Before: + call ale#assert#SetUpLinterTest('eruby', 'erblint') + call ale#test#SetFilename('dummy.html.erb') + + let g:ale_eruby_erblint_executable = 'erblint' + let g:ale_eruby_erblint_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to erblint): + AssertLinter 'erblint', ale#Escape('erblint') + \ . ' --format json --stdin %s' + +Execute(Should be able to set a custom executable): + let g:ale_eruby_erblint_executable = 'bin/erblint' + + AssertLinter 'bin/erblint' , ale#Escape('bin/erblint') + \ . ' --format json --stdin %s' + +Execute(Setting bundle appends 'exec erblint'): + let g:ale_eruby_erblint_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + \ . ' exec erblint' + \ . ' --format json --stdin %s' diff --git a/sources_non_forked/ale/test/linter/test_erlang_dialyzer.vader b/sources_non_forked/ale/test/linter/test_erlang_dialyzer.vader new file mode 100644 index 00000000..5e818d7f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erlang_dialyzer.vader @@ -0,0 +1,45 @@ +Before: + call ale#assert#SetUpLinterTest('erlang', 'dialyzer') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct.): + AssertLinter 'dialyzer', + \ ale#Escape('dialyzer') + \ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt')) + \ . ' -Wunmatched_returns' + \ . ' -Werror_handling' + \ . ' -Wrace_conditions' + \ . ' -Wunderspecs' + \ . ' %s' + +Execute(The command should accept configured executable.): + let b:ale_erlang_dialyzer_executable = '/usr/bin/dialyzer' + AssertLinter '/usr/bin/dialyzer', + \ ale#Escape('/usr/bin/dialyzer') + \ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt')) + \ . ' -Wunmatched_returns' + \ . ' -Werror_handling' + \ . ' -Wrace_conditions' + \ . ' -Wunderspecs' + \ . ' %s' + +Execute(The command should accept configured options.): + let b:ale_erlang_dialyzer_options = '-r ' . expand('$HOME') + AssertLinter 'dialyzer', + \ ale#Escape('dialyzer') + \ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt')) + \ . ' -r ' . expand('$HOME') + \ . ' %s' + +Execute(The command should accept configured PLT file.): + let b:ale_erlang_dialyzer_plt_file = 'custom-plt' + AssertLinter 'dialyzer', + \ ale#Escape('dialyzer') + \ . ' -n --plt ' . ale#Escape(expand('custom-plt')) + \ . ' -Wunmatched_returns' + \ . ' -Werror_handling' + \ . ' -Wrace_conditions' + \ . ' -Wunderspecs' + \ . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_erlang_elvis.vader b/sources_non_forked/ale/test/linter/test_erlang_elvis.vader new file mode 100644 index 00000000..4aab49d6 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erlang_elvis.vader @@ -0,0 +1,16 @@ +Before: + let b:file = fnamemodify(bufname(''), ':.') + call ale#assert#SetUpLinterTest('erlang', 'elvis') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Default command should be correct): + AssertLinter 'elvis', + \ ale#Escape('elvis') . ' rock --output-format=parsable ' . ale#Escape(b:file) + +Execute(Executable should be configurable): + let b:ale_erlang_elvis_executable = '/path/to/elvis' + + AssertLinter '/path/to/elvis', + \ ale#Escape('/path/to/elvis') . ' rock --output-format=parsable ' . ale#Escape(b:file) diff --git a/sources_non_forked/ale/test/linter/test_erlang_erlc.vader b/sources_non_forked/ale/test/linter/test_erlang_erlc.vader new file mode 100644 index 00000000..0651b512 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erlang_erlc.vader @@ -0,0 +1,62 @@ +Before: + call ale#assert#SetUpLinterTest('erlang', 'erlc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct.): + let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) + let g:regex = 'erlc.\+-o.\+%t' + let g:matched = match(g:cmd, g:regex) + + " match returns -1 if not found + AssertNotEqual + \ g:matched, + \ -1, + \ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']' + +Execute(The command should accept configured executable.): + let b:ale_erlang_erlc_executable = '/usr/bin/erlc' + let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) + let g:regex = '/usr/bin/erlc.\+-o.\+%t' + let g:matched = match(g:cmd, g:regex) + + " match returns -1 if not found + AssertNotEqual + \ g:matched, + \ -1, + \ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']' + +Execute(The command should accept configured options.): + let b:ale_erlang_erlc_options = '-I include' + let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) + let g:regex = 'erlc.\+-o.\+-I include.\+%t' + let g:matched = match(g:cmd, g:regex) + + " match returns -1 if not found + AssertNotEqual + \ g:matched, + \ -1, + \ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']' + +Execute(Linter should recognize OTP23 format.): + let g:lines = ["t.erl:6: only association operators '=>' are allowed in map construction"] + let g:output_text = ale_linters#erlang#erlc#Handle(bufnr(''), g:lines)[0].text + + let g:expected = "only association operators '=>' are allowed in map construction" + AssertEqual + \ g:output_text, + \ g:expected, + \ 'Command error: expected [' . g:output_text . '] to match [' . g:expected . ']' + +Execute(Linter should recognize OTP24 format.): + let g:lines = ["t.erl:6:16: only association operators '=>' are allowed in map construction", + \ "% 6| #{ a => A, b := B }.", + \ "% | ^"] + let g:output_text = ale_linters#erlang#erlc#Handle(bufnr(''), g:lines)[0].text + + let g:expected = "only association operators '=>' are allowed in map construction" + AssertEqual + \ g:output_text, + \ g:expected, + \ 'Command error: expected [' . g:output_text . '] to match [' . g:expected . ']' diff --git a/sources_non_forked/ale/test/linter/test_erlang_syntaxerl.vader b/sources_non_forked/ale/test/linter/test_erlang_syntaxerl.vader new file mode 100644 index 00000000..e7cc26ea --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erlang_syntaxerl.vader @@ -0,0 +1,45 @@ +Before: + call ale#assert#SetUpLinterTest('erlang', 'syntaxerl') + +After: + call ale#assert#TearDownLinterTest() + +Execute (The default commands should be correct): + AssertLinter 'syntaxerl', [ + \ ale#Escape('syntaxerl') . ' -h', + \ ale#Escape('syntaxerl') . ' %t', + \] + +Execute (The executable should be configurable): + let b:ale_erlang_syntaxerl_executable = 'foobar' + + AssertLinter 'foobar', [ + \ ale#Escape('foobar') . ' -h', + \ ale#Escape('foobar') . ' %t', + \] + +Execute (The -b option should be used when available): + GivenCommandOutput [ + \ 'Syntax checker for Erlang (0.14.0)', + \ 'Usage: syntaxerl [-d | --debug] ', + \ ' syntaxerl <-h | --help>', + \ ' -d, --debug Enable debug output', + \ ' -h, --help Show this message', + \] + AssertLinter 'syntaxerl', [ + \ ale#Escape('syntaxerl') . ' -h', + \ ale#Escape('syntaxerl') . ' %t', + \] + + GivenCommandOutput [ + \ 'Syntax checker for Erlang (0.14.0)', + \ 'Usage: syntaxerl [-b | --base ] [-d | --debug] ', + \ ' syntaxerl <-h | --help>', + \ ' -b, --base Set original filename', + \ ' -d, --debug Enable debug output', + \ ' -h, --help Show this message', + \] + AssertLinter 'syntaxerl', [ + \ ale#Escape('syntaxerl') . ' -h', + \ ale#Escape('syntaxerl') . ' -b %s %t', + \] diff --git a/sources_non_forked/ale/test/linter/test_erubi.vader b/sources_non_forked/ale/test/linter/test_erubi.vader new file mode 100644 index 00000000..cd4a0b68 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erubi.vader @@ -0,0 +1,32 @@ +Before: + call ale#assert#SetUpLinterTest('eruby', 'erubi') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should not contain any filter code by default): + call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/file.rb') + + AssertLinter 'ruby', [ + \ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'), + \ 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c', + \] + +Execute(Executable should filter invalid eRuby when inside a Rails project): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb') + + AssertLinter 'ruby', [ + \ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'), + \ 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c', + \] + +Execute(Command should be blank if the first command in the chain returns output): + GivenCommandOutput [ + \ "/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erubi/capture_end (LoadError)", + \ " from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'", + \] + + AssertLinter 'ruby', [ + \ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'), + \ '', + \] diff --git a/sources_non_forked/ale/test/linter/test_erubis.vader b/sources_non_forked/ale/test/linter/test_erubis.vader new file mode 100644 index 00000000..cfca54a2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_erubis.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpLinterTest('eruby', 'erubis') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should not contain any filter code by default): + call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/file.rb') + + AssertLinter 'erubis', 'erubis -x %t | ruby -c' + +Execute(Executable should filter invalid eRuby when inside a Rails project): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb') + + AssertLinter 'erubis', + \ 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c' diff --git a/sources_non_forked/ale/test/linter/test_eslint.vader b/sources_non_forked/ale/test/linter/test_eslint.vader new file mode 100644 index 00000000..4dde5639 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_eslint.vader @@ -0,0 +1,85 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'eslint') + runtime autoload/ale/handlers/eslint.vim + + let b:args = ' -f json --stdin --stdin-filename %s' + +After: + unlet! b:args + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinterCwd '' + AssertLinter 'eslint', ale#Escape('eslint') . b:args + +Execute(create-react-app directories should be detected correctly): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js') + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app') + AssertLinter b:executable, + \ (has('win32') ? ale#Escape('node.exe') . ' ' : '') + \ . ale#Escape(b:executable) . b:args + +Execute(use-global should override create-react-app detection): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js') + + let g:ale_javascript_eslint_use_global = 1 + let g:ale_javascript_eslint_executable = 'eslint_d' + + let b:executable = 'eslint_d' + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app') + AssertLinter b:executable, ale#Escape(b:executable) . b:args + +Execute(other app directories should be detected correctly): + call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/node_modules/.bin/eslint') + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint') + AssertLinter b:executable, ale#Escape(b:executable) . b:args + +Execute(use-global should override other app directories): + call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js') + + let g:ale_javascript_eslint_use_global = 1 + let g:ale_javascript_eslint_executable = 'eslint_d' + + let b:executable = 'eslint_d' + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint') + AssertLinter b:executable, ale#Escape(b:executable) . b:args + +Execute(eslint_d should be detected correctly): + call ale#test#SetFilename('../test-files/eslint/app-with-eslint-d/testfile.js') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d') + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d') + AssertLinter b:executable, ale#Escape(b:executable) . b:args + +Execute(eslint.js executables should be run with node on Windows): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js') + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app') + AssertLinter b:executable, + \ (has('win32') ? ale#Escape('node.exe') . ' ' : '') + \ . ale#Escape(b:executable) . b:args + +Execute(eslint.js should be run from a containing project with node_modules): + call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-package-json/testfile.js') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js') + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app') + AssertLinter b:executable, + \ (has('win32') ? ale#Escape('node.exe') . ' ' : '') + \ . ale#Escape(b:executable) . b:args + +Execute(eslint.js should be run from a containing project with .yarn/sdks): + call ale#test#SetFilename('../test-files/eslint/yarn2-app/subdir/testfile.js') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app/.yarn/sdks/eslint/bin/eslint.js') + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app') + AssertLinter b:executable, + \ (has('win32') ? ale#Escape('node.exe') . ' ' : '') + \ . ale#Escape(b:executable) . b:args diff --git a/sources_non_forked/ale/test/linter/test_fecs.vader b/sources_non_forked/ale/test/linter/test_fecs.vader new file mode 100644 index 00000000..4287d324 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_fecs.vader @@ -0,0 +1,9 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'fecs') + runtime autoload/ale/handlers/fecs.vim + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'fecs', ale#Escape('fecs') . ' check --colors=false --rule=true %t' diff --git a/sources_non_forked/ale/test/linter/test_flake8.vader b/sources_non_forked/ale/test/linter/test_flake8.vader new file mode 100644 index 00000000..53b40b29 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_flake8.vader @@ -0,0 +1,219 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'flake8') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + + GivenCommandOutput ['3.0.0'] + +After: + unlet! b:executable + unlet! b:bin_dir + call ale#assert#TearDownLinterTest() + +Execute(The flake8 callbacks should return the correct default values): + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + + " The version check should be cached. + GivenCommandOutput [] + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + + " Try with older versions. + call ale#semver#ResetVersionCache() + GivenCommandOutput ['2.9.9'] + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#Escape('flake8') . ' --format=default -', + \] + +Execute(The option for disabling changing directories should work): + let g:ale_python_flake8_change_directory = 'off' + + AssertLinterCwd ['', ''] + call ale#semver#ResetVersionCache() + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + + let g:ale_python_flake8_change_directory = 0 + + AssertLinterCwd [''] + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + + " Invalid options should be considered the same as turning the setting off. + let g:ale_python_flake8_change_directory = 'xxx' + + AssertLinterCwd [''] + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + +Execute(The option for changing directory to project root should work): + call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py') + + AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) + call ale#semver#ResetVersionCache() + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + +Execute(The option for changing directory to file dir should work): + let g:ale_python_flake8_change_directory = 'file' + call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py') + + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + + let g:ale_python_flake8_change_directory = 1 + + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + +Execute(The flake8 command callback should let you set options): + let g:ale_python_flake8_options = '--some-option' + + GivenCommandOutput ['3.0.4'] + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#Escape('flake8') . ' --some-option' + \ . ' --format=default --stdin-display-name %s -', + \] + + call ale#semver#ResetVersionCache() + GivenCommandOutput ['2.9.9'] + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#Escape('flake8') . ' --some-option --format=default -', + \] + +Execute(You should be able to set a custom executable and it should be escaped): + call ale#test#SetFilename('../test-files/dummy') + + let g:ale_python_flake8_executable = 'executable with spaces' + + AssertLinterCwd ['%s:h', '%s:h'] + call ale#semver#ResetVersionCache() + AssertLinter 'executable with spaces', [ + \ ale#Escape('executable with spaces') . ' --version', + \ ale#Escape('executable with spaces') + \ . ' --format=default' + \ . ' --stdin-display-name %s -', + \] + +Execute(The flake8 callbacks should detect virtualenv directories): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/flake8' + \) + + AssertLinter b:executable, [ + \ ale#Escape(b:executable) . ' --version', + \ ale#Escape(b:executable) + \ . ' --format=default' + \ . ' --stdin-display-name %s -', + \] + +Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in): + call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf): + call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini): + call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini): + call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for non-namespace package): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'), + \ ale#python#FindProjectRoot(bufnr('')) + +" Some users currently run flake8 this way, so we should support it. +Execute(Using `python -m flake8` should be supported for running flake8): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let g:ale_python_flake8_executable = 'python' + let g:ale_python_flake8_options = '-m flake8 --some-option' + + GivenCommandOutput ['2.9.9'] + AssertLinter 'python', [ + \ ale#Escape('python') . ' -m flake8 --version', + \ ale#Escape('python') + \ . ' -m flake8 --some-option --format=default -' + \] + + call ale#semver#ResetVersionCache() + + " Leading spaces shouldn't matter + let g:ale_python_flake8_options = ' -m flake8 --some-option' + + GivenCommandOutput ['2.9.9'] + AssertLinter 'python', [ + \ ale#Escape('python') . ' -m flake8 --version', + \ ale#Escape('python') + \ . ' -m flake8 --some-option --format=default -' + \] + +Execute(Setting executable to 'pipenv' should append 'run flake8'): + let g:ale_python_flake8_executable = 'path/to/pipenv' + + " FIXME: pipenv should check the version with flake8. + GivenCommandOutput [] + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run flake8 --format=default -' + +Execute(Pipenv is detected when python_flake8_auto_pipenv is set): + let g:ale_python_flake8_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run flake8 --format=default --stdin-display-name %s -' + +Execute(Setting executable to 'poetry' should append 'run flake8'): + let g:ale_python_flake8_executable = 'path/to/poetry' + + " FIXME: poetry should check the version with flake8. + GivenCommandOutput [] + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run flake8 --format=default -' + +Execute(poetry is detected when python_flake8_auto_poetry is set): + let g:ale_python_flake8_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run flake8 --format=default --stdin-display-name %s -' diff --git a/sources_non_forked/ale/test/linter/test_flakehell.vader b/sources_non_forked/ale/test/linter/test_flakehell.vader new file mode 100644 index 00000000..98314408 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_flakehell.vader @@ -0,0 +1,203 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'flakehell') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + + GivenCommandOutput ['0.8.0'] + +After: + unlet! b:executable + unlet! b:bin_dir + call ale#assert#TearDownLinterTest() + +Execute(The flakehell callbacks should return the correct default values): + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' --version', + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + + " The version check should be cached. + GivenCommandOutput [] + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + +Execute(The option for disabling changing directories should work): + let g:ale_python_flakehell_change_directory = 'off' + + AssertLinterCwd ['', ''] + call ale#semver#ResetVersionCache() + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' --version', + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + + let g:ale_python_flakehell_change_directory = 0 + + AssertLinterCwd [''] + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + + " Invalid options should be considered the same as turning the setting off. + let g:ale_python_flakehell_change_directory = 'xxx' + + AssertLinterCwd [''] + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + +Execute(The option for changing directory to project root should work): + call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py') + + AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) + call ale#semver#ResetVersionCache() + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' --version', + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + +Execute(The option for changing directory to file dir should work): + let g:ale_python_flakehell_change_directory = 'file' + call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py') + + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' --version', + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + + let g:ale_python_flakehell_change_directory = 1 + + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -', + \] + +Execute(The flakehell command callback should let you set options): + let g:ale_python_flakehell_options = '--some-option' + + GivenCommandOutput ['0.8.0'] + AssertLinter 'flakehell', [ + \ ale#Escape('flakehell') . ' --version', + \ ale#Escape('flakehell') . ' lint --some-option' + \ . ' --format=default --stdin-display-name %s -', + \] + +Execute(You should be able to set a custom executable and it should be escaped): + let g:ale_python_flakehell_executable = 'executable with spaces' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinterCwd ['%s:h', '%s:h'] + call ale#semver#ResetVersionCache() + AssertLinter 'executable with spaces', [ + \ ale#Escape('executable with spaces') . ' --version', + \ ale#Escape('executable with spaces') + \ . ' lint' + \ . ' --format=default' + \ . ' --stdin-display-name %s -', + \] + +Execute(The flakehell callbacks should detect virtualenv directories): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/flakehell' + \) + + AssertLinter b:executable, [ + \ ale#Escape(b:executable) . ' --version', + \ ale#Escape(b:executable) + \ . ' lint' + \ . ' --format=default' + \ . ' --stdin-display-name %s -', + \] + +Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in): + call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf): + call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini): + call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini): + call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'), + \ ale#python#FindProjectRoot(bufnr('')) + +Execute(The FindProjectRoot should detect the project root directory for non-namespace package): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'), + \ ale#python#FindProjectRoot(bufnr('')) + +" Some users currently run flakehell this way, so we should support it. +Execute(Using `python -m flakehell` should be supported for running flakehell): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let g:ale_python_flakehell_executable = 'python' + let g:ale_python_flakehell_options = '--some-option' + + AssertLinter 'python', [ + \ ale#Escape('python') . ' -m flakehell --version', + \ ale#Escape('python') + \ . ' -m flakehell lint --some-option --format=default --stdin-display-name %s -' + \] + + call ale#semver#ResetVersionCache() + + " Leading spaces shouldn't matter + let g:ale_python_flakehell_options = ' --some-option' + + AssertLinter 'python', [ + \ ale#Escape('python') . ' -m flakehell --version', + \ ale#Escape('python') + \ . ' -m flakehell lint --some-option --format=default --stdin-display-name %s -' + \] + +Execute(Setting executable to 'pipenv' should append 'run flakehell'): + let g:ale_python_flakehell_executable = 'path/to/pipenv' + + " FIXME: pipenv should check the version with flakehell. + GivenCommandOutput [] + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run flakehell lint --format=default -' + +Execute(Pipenv is detected when python_flakehell_auto_pipenv is set): + let g:ale_python_flakehell_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run flakehell lint --format=default --stdin-display-name %s -' + +Execute(Setting executable to 'poetry' should append 'run flakehell'): + let g:ale_python_flakehell_executable = 'path/to/poetry' + + " FIXME: poetry should check the version with flakehell. + GivenCommandOutput [] + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run flakehell lint --format=default -' + +Execute(poetry is detected when python_flakehell_auto_poetry is set): + let g:ale_python_flakehell_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run flakehell lint --format=default --stdin-display-name %s -' diff --git a/sources_non_forked/ale/test/linter/test_flow.vader b/sources_non_forked/ale/test/linter/test_flow.vader new file mode 100644 index 00000000..8488a2e9 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_flow.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'flow') + +After: + call ale#assert#TearDownLinterTest() + +Execute(flow should return a command to run if a .flowconfig file exists): + call ale#test#SetFilename('../test-files/flow/a/sub/dummy') + + AssertLinter 'flow', + \ ale#Escape('flow') + \ . ' check-contents --respect-pragma --json --from ale %s < %t' + \ . (!has('win32') ? '; echo' : '') + +Execute(flow should not use the respect pragma argument if the option is off): + call ale#test#SetFilename('../test-files/flow/a/sub/dummy') + + let b:ale_javascript_flow_use_respect_pragma = 0 + + AssertLinter 'flow', + \ ale#Escape('flow') + \ . ' check-contents --json --from ale %s < %t' + \ . (!has('win32') ? '; echo' : '') + +Execute(flow should should not use --respect-pragma for old versions): + call ale#test#SetFilename('../test-files/flow/a/sub/dummy') + + GivenCommandOutput [ + \ 'Warning: `flow --version` is deprecated in favor of `flow version`', + \ 'Flow, a static type checker for JavaScript, version 0.27.0', + \] + AssertLinter 'flow', [ + \ ale#Escape('flow') . ' --version', + \ ale#Escape('flow') + \ . ' check-contents --json --from ale %s < %t' + \ . (!has('win32') ? '; echo' : ''), + \] + +Execute(flow should not return a command to run if no .flowconfig file exists): + call ale#test#SetFilename('../test-files/flow/b/sub/dummy') + + AssertLinterNotExecuted diff --git a/sources_non_forked/ale/test/linter/test_foodcritic.vader b/sources_non_forked/ale/test/linter/test_foodcritic.vader new file mode 100644 index 00000000..c5564cb1 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_foodcritic.vader @@ -0,0 +1,18 @@ +Before: + call ale#assert#SetUpLinterTest('chef', 'foodcritic') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' %s' + +Execute(Extra options should be included with escapeed tildes (~)): + let b:ale_chef_foodcritic_options = '-t ~F011' + + AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' -t \~F011 %s' + +Execute(The executable should be configurable): + let b:ale_chef_foodcritic_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_fortran_fortls.vader b/sources_non_forked/ale/test/linter/test_fortran_fortls.vader new file mode 100644 index 00000000..581f94ba --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_fortran_fortls.vader @@ -0,0 +1,18 @@ +Before: + call ale#assert#SetUpLinterTest('fortran', 'language_server') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'fortls', ale#Escape('fortls') + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/fortls-project/test.F90') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/fortls-project') + +Execute(The language should be correct): + AssertLSPLanguage 'fortran' diff --git a/sources_non_forked/ale/test/linter/test_fsc.vader b/sources_non_forked/ale/test/linter/test_fsc.vader new file mode 100644 index 00000000..278e7c16 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_fsc.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('scala', 'fsc') + +After: + call ale#assert#TearDownLinterTest() + +Given scala(An empty Scala file): +Execute(The default executable and command should be correct): + AssertLinter 'fsc', ale#Escape('fsc') . ' -Ystop-after:parser %t' + +Given scala.sbt(An empty SBT file): +Execute(fsc should not be run for sbt files): + AssertLinterNotExecuted diff --git a/sources_non_forked/ale/test/linter/test_fusionlint.vader b/sources_non_forked/ale/test/linter/test_fusionlint.vader new file mode 100644 index 00000000..1c63b811 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_fusionlint.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('fuse', 'fusionlint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The fuse fusionlint command callback should return the correct default string): + AssertLinter 'fusion-lint', ale#Escape('fusion-lint') . ' --filename %s -i' + +Execute(The fuse fusionlint command callback should let you set options): + let g:ale_fuse_fusionlint_options = '--example-option argument' + + AssertLinter 'fusion-lint', + \ ale#Escape('fusion-lint') . ' --example-option argument --filename %s -i' + +Execute(The fusionlint executable should be configurable): + let g:ale_fuse_fusionlint_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --filename %s -i' diff --git a/sources_non_forked/ale/test/linter/test_gawk.vader b/sources_non_forked/ale/test/linter/test_gawk.vader new file mode 100644 index 00000000..f4364291 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gawk.vader @@ -0,0 +1,25 @@ +Before: + call ale#assert#SetUpLinterTest('awk', 'gawk') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'gawk', + \ ale#Escape('gawk') . ' --source ' . ale#Escape('BEGIN { exit } END { exit 1 }') + \ . ' --lint -f %t /dev/null' + +Execute(The executable should be configurable): + let b:ale_awk_gawk_executable = '/other/gawk' + + AssertLinter '/other/gawk', + \ ale#Escape('/other/gawk') . ' --source ' . ale#Escape('BEGIN { exit } END { exit 1 }') + \ . ' --lint -f %t /dev/null' + +Execute(The options should be configurable): + let b:ale_awk_gawk_executable = 'gawk' + let b:ale_awk_gawk_options = '--lint=no-ext' + + AssertLinter 'gawk', + \ ale#Escape('gawk') . ' --source ' . ale#Escape('BEGIN { exit } END { exit 1 }') + \ . ' --lint --lint=no-ext -f %t /dev/null' diff --git a/sources_non_forked/ale/test/linter/test_gfortran.vader b/sources_non_forked/ale/test/linter/test_gfortran.vader new file mode 100644 index 00000000..3e6ef951 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gfortran.vader @@ -0,0 +1,24 @@ +Before: + call ale#assert#SetUpLinterTest('fortran', 'gcc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The fortran gcc command callback should return the correct default string): + AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -' + +Execute(The fortran gcc command callback should let you set options): + let g:ale_fortran_gcc_options = '-Wotherthings' + + AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wotherthings -' + +Execute(The fortran gcc command callback should let you use -ffixed-form): + let g:ale_fortran_gcc_use_free_form = 0 + + AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffixed-form -Wall -' + +Execute(The fortran executable should be configurable): + let g:ale_fortran_gcc_executable = 'gfortran' + + AssertLinter 'gfortran', + \ ale#Escape('gfortran') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -' diff --git a/sources_non_forked/ale/test/linter/test_ghdl.vader b/sources_non_forked/ale/test/linter/test_ghdl.vader new file mode 100644 index 00000000..f254e11f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ghdl.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('vhdl', 'ghdl') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'ghdl', ale#Escape('ghdl') . ' -s --std=08 %t' + + let b:ale_vhdl_ghdl_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -s --std=08 %t' + +Execute(The options should be configurable): + let b:ale_vhdl_ghdl_options = '--something' + + AssertLinter 'ghdl', ale#Escape('ghdl') . ' -s --something %t' diff --git a/sources_non_forked/ale/test/linter/test_gitlint.vader b/sources_non_forked/ale/test/linter/test_gitlint.vader new file mode 100644 index 00000000..4df675f3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gitlint.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('gitcommit', 'gitlint') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(The gitlint callbacks should return the correct default values): + AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint' + +Execute(The gitlint executable should be configurable, and escaped properly): + let g:ale_gitcommit_gitlint_executable = 'executable with spaces' + + AssertLinter 'executable with spaces', + \ ale#Escape('executable with spaces') . ' lint' + +Execute(The gitlint command callback should let you set options): + let g:ale_gitcommit_gitlint_options = '--some-option' + + AssertLinter 'gitlint', ale#Escape('gitlint') . ' --some-option lint' + +Execute(The gitlint callbacks shouldn't detect virtualenv directories where they don't exist): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/COMMIT_EDITMSG') + + AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint' + +Execute(The gitlint callbacks should detect virtualenv directories): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/COMMIT_EDITMSG') + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/gitlint' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' lint' + +Execute(You should able able to use the global gitlint instead): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/COMMIT_EDITMSG') + let g:ale_gitcommit_gitlint_use_global = 1 + + AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint' diff --git a/sources_non_forked/ale/test/linter/test_glslang.vader b/sources_non_forked/ale/test/linter/test_glslang.vader new file mode 100644 index 00000000..980406af --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_glslang.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('glsl', 'glslang') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'glslangValidator', ale#Escape('glslangValidator') . ' -C %t' + +Execute(The executable should be configurable): + let b:ale_glsl_glslang_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -C %t' + +Execute(Options should work): + let g:ale_glsl_glslang_options = '--test' + + AssertLinter 'glslangValidator', + \ ale#Escape('glslangValidator') . ' --test -C %t' diff --git a/sources_non_forked/ale/test/linter/test_glslls.vader b/sources_non_forked/ale/test/linter/test_glslls.vader new file mode 100644 index 00000000..133c2a2f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_glslls.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('glsl', 'glslls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'glslls', ale#Escape('glslls') . ' --stdin' + +Execute(Executable should be configurable): + let b:ale_glsl_glslls_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin' + +Execute(Setting logfile should work): + let b:ale_glsl_glslls_logfile = '/tmp/test.log' + + AssertLinter 'glslls', + \ ale#Escape('glslls') . ' --verbose -l /tmp/test.log --stdin' diff --git a/sources_non_forked/ale/test/linter/test_gobuild.vader b/sources_non_forked/ale/test/linter/test_gobuild.vader new file mode 100644 index 00000000..bac4d74e --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gobuild.vader @@ -0,0 +1,33 @@ +Before: + Save g:ale_go_go_executable + + call ale#assert#SetUpLinterTest('go', 'gobuild') + + GivenCommandOutput ['/foo/bar', '/foo/baz'] + +After: + Restore + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinterCwd '%s:h' + AssertLinter 'go', 'go test -c -o /dev/null ./' + +Execute(Go environment variables should be supported): + let b:ale_go_go111module = 'on' + + AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go test -c -o /dev/null ./' + + unlet! b:ale_go_go111module + +Execute(Extra options should be supported): + let g:ale_go_gobuild_options = '--foo-bar' + + AssertLinter 'go', 'go test --foo-bar -c -o /dev/null ./' + + let g:ale_go_gobuild_options = '' + +Execute(The executable should be configurable): + let g:ale_go_go_executable = 'foobar' + + AssertLinter 'foobar', 'foobar test -c -o /dev/null ./' diff --git a/sources_non_forked/ale/test/linter/test_gofmt.vader b/sources_non_forked/ale/test/linter/test_gofmt.vader new file mode 100644 index 00000000..b056a659 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gofmt.vader @@ -0,0 +1,26 @@ +Before: + Save g:ale_go_go111module + Save b:ale_go_go111module + + let b:ale_go_go111module = '' + + call ale#assert#SetUpLinterTest('go', 'gofmt') + call ale#test#SetFilename('../test-files/go/testfile2.go') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The default gofmt command should be correct): + AssertLinter 'gofmt', + \ ale#Escape('gofmt') . ' -e %t' + +Execute(The gofmt command should support Go environment variables): + let b:ale_go_go111module = 'on' + + AssertLinter 'gofmt', + \ ale#Env('GO111MODULE', 'on') + \ . ale#Escape('gofmt') . ' -e %t' diff --git a/sources_non_forked/ale/test/linter/test_golangci_lint.vader b/sources_non_forked/ale/test/linter/test_golangci_lint.vader new file mode 100644 index 00000000..ee754bba --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_golangci_lint.vader @@ -0,0 +1,50 @@ +Before: + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'golangci_lint') + call ale#test#SetFilename('test.go') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The golangci-lint defaults should be correct): + AssertLinterCwd '%s:h', + AssertLinter 'golangci-lint', + \ ale#Escape('golangci-lint') + \ . ' run ' . ale#Escape(expand('%' . ':t')) + \ . ' --enable-all' + +Execute(The golangci-lint callback should use a configured executable): + let b:ale_go_golangci_lint_executable = 'something else' + + AssertLinter 'something else', + \ ale#Escape('something else') + \ . ' run ' . ale#Escape(expand('%' . ':t')) + \ . ' --enable-all' + +Execute(The golangci-lint callback should use configured options): + let b:ale_go_golangci_lint_options = '--foobar' + + AssertLinter 'golangci-lint', + \ ale#Escape('golangci-lint') + \ . ' run ' . ale#Escape(expand('%' . ':t')) + \ . ' --foobar' + +Execute(The golangci-lint callback should support environment variables): + let b:ale_go_go111module = 'on' + + AssertLinter 'golangci-lint', + \ ale#Env('GO111MODULE', 'on') + \ . ale#Escape('golangci-lint') + \ . ' run ' . ale#Escape(expand('%' . ':t')) + \ . ' --enable-all' + +Execute(The golangci-lint `lint_package` option should use the correct command): + let b:ale_go_golangci_lint_package = 1 + + AssertLinter 'golangci-lint', + \ ale#Escape('golangci-lint') . ' run --enable-all' diff --git a/sources_non_forked/ale/test/linter/test_golangserver.vader b/sources_non_forked/ale/test/linter/test_golangserver.vader new file mode 100644 index 00000000..b31d8dc8 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_golangserver.vader @@ -0,0 +1,76 @@ +Before: + Save $GOPATH + Save g:ale_completion_enabled + Save g:ale_go_go111module + + let g:ale_completion_enabled = 0 + let g:sep = has('win32') ? ';' : ':' + + call ale#assert#SetUpLinterTest('go', 'langserver') + let $GOPATH = ale#path#Simplify(g:dir . '/../test-files/go/go1') + \ . g:sep + \ . ale#path#Simplify(g:dir . '/../test-files/go/go2') + +After: + Restore + + unlet! b:ale_completion_enabled + unlet! b:ale_go_go111module + unlet! g:sep + + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'go-langserver', ale#Escape('go-langserver') + +Execute(should configure go-langserver callback executable): + let b:ale_go_langserver_executable = 'boo' + + AssertLinter 'boo', ale#Escape('boo') + +Execute(should set go-langserver options): + call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') + let b:ale_completion_enabled = 1 + let b:ale_go_langserver_options = '' + + AssertLinter 'go-langserver', + \ ale#Escape('go-langserver') . ' -gocodecompletion' + + let b:ale_go_langserver_options = '-trace' + + AssertLinter 'go-langserver', + \ ale#Escape('go-langserver') . ' -gocodecompletion -trace' + +Execute(should ignore go-langserver -gocodecompletion option): + call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') + + let b:ale_go_langserver_options = '-trace -gocodecompletion' + let b:ale_completion_enabled = 1 + + AssertLinter 'go-langserver', + \ ale#Escape('go-langserver') . ' -gocodecompletion -trace' + + let b:ale_completion_enabled = 0 + + AssertLinter 'go-langserver', ale#Escape('go-langserver') . ' -trace' + +Execute(should support Go environment variables): + let b:ale_go_go111module = 'on' + + AssertLinter 'go-langserver', + \ ale#Env('GO111MODULE', 'on') . ale#Escape('go-langserver') + +Execute(should set go-langserver for go app1): + call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') + + AssertLSPLanguage 'go' + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go/go1') + +Execute(should set go-langserver for go app2): + call ale#test#SetFilename('../test-files/go/go2/prj1/file.go') + + AssertLSPLanguage 'go' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go/go2') diff --git a/sources_non_forked/ale/test/linter/test_golint.vader b/sources_non_forked/ale/test/linter/test_golint.vader new file mode 100644 index 00000000..64916707 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_golint.vader @@ -0,0 +1,30 @@ +Before: + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'golint') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The default golint command should be correct): + AssertLinter 'golint', ale#Escape('golint') . ' %t' + +Execute(The golint executable should be configurable): + let b:ale_go_golint_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %t' + +Execute(The golint options should be configurable): + let b:ale_go_golint_options = '--foo' + + AssertLinter 'golint', ale#Escape('golint') . ' --foo %t' + +Execute(The golint command should support Go environment variables): + let b:ale_go_go111module = 'on' + + AssertLinter 'golint', + \ ale#Env('GO111MODULE', 'on') . ale#Escape('golint') . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_gometalinter.vader b/sources_non_forked/ale/test/linter/test_gometalinter.vader new file mode 100644 index 00000000..5ff744f5 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gometalinter.vader @@ -0,0 +1,49 @@ +Before: + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'gometalinter') + call ale#test#SetFilename('test.go') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The gometalinter defaults should be correct): + AssertLinterCwd '%s:h', + AssertLinter 'gometalinter', + \ ale#Escape('gometalinter') + \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t'))) + \ . ' .' + +Execute(The gometalinter callback should use a configured executable): + let b:ale_go_gometalinter_executable = 'something else' + + AssertLinter 'something else', + \ ale#Escape('something else') + \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t'))) + \ . ' .' + +Execute(The gometalinter callback should use configured options): + let b:ale_go_gometalinter_options = '--foobar' + + AssertLinter 'gometalinter', + \ ale#Escape('gometalinter') + \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t'))) + \ . ' --foobar' . ' .' + +Execute(The gometalinter should use configured environment variables): + let b:ale_go_go111module = 'off' + + AssertLinter 'gometalinter', + \ ale#Env('GO111MODULE', 'off') + \ . ale#Escape('gometalinter') + \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t'))) + \ . ' .' + +Execute(The gometalinter `lint_package` option should use the correct command): + let b:ale_go_gometalinter_lint_package = 1 + + AssertLinter 'gometalinter', ale#Escape('gometalinter') . ' .' diff --git a/sources_non_forked/ale/test/linter/test_gopls.vader b/sources_non_forked/ale/test/linter/test_gopls.vader new file mode 100644 index 00000000..1c91fa10 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gopls.vader @@ -0,0 +1,96 @@ +Before: + Save g:ale_go_go111module + Save $GOPATH + + let $GOPATH = '/non/existent/directory' + + call ale#assert#SetUpLinterTest('go', 'gopls') + +After: + if isdirectory(g:dir . '/.git') + call delete(g:dir . '/.git', 'd') + endif + + unlet! b:ale_go_go111module + unlet! b:ale_go_go111module + unlet! b:ale_completion_enabled + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'gopls', ale#Escape('gopls') . ' --mode stdio' + +Execute(The executable should be configurable): + let b:ale_go_gopls_executable = 'boo' + + AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio' + +Execute(gopls should be found in GOPATH): + " This is a directory with a fake executable + let $GOPATH = ale#test#GetFilename('../test-files/go/gopath') + + AssertLinter + \ ale#test#GetFilename('../test-files/go/gopath/bin/gopls'), + \ ale#Escape(ale#test#GetFilename('../test-files/go/gopath/bin/gopls')) + \ . ' --mode stdio' + +Execute(Global settings should be preferre for gopls if use_global = 1): + " This is a directory with a fake executable + let $GOPATH = ale#test#GetFilename('../test-files/go/gopath') + let b:ale_go_gopls_executable = 'boo' + let b:ale_go_gopls_use_global = 1 + + AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio' + +Execute(Settings options should work): + call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') + " let b:ale_completion_enabled = 1 + let b:ale_go_gopls_options = '' + + AssertLinter 'gopls', + \ ale#Escape('gopls') . '' + + let b:ale_go_gopls_options = '--mode stdio --trace' + + AssertLinter 'gopls', + \ ale#Escape('gopls') . ' --mode stdio --trace' + + let b:ale_go_gopls_init_options = {'ui.diagnostic.analyses': {'composites': v:false}} + AssertLSPOptions {'ui.diagnostic.analyses': {'composites': v:false}} + +Execute(Go environment variables should be passed on): + let b:ale_go_go111module = 'off' + + AssertLinter 'gopls', + \ ale#Env('GO111MODULE', 'off') . ale#Escape('gopls') . ' --mode stdio' + +Execute(Project directories should be detected based on 'go.mod' being present): + call ale#test#SetFilename('../test-files/go/test.go') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go') + +Execute(Project directories with .git should be detected): + call ale#test#SetFilename('test.go') + + if !isdirectory(g:dir . '/.git') + call mkdir(g:dir . '/.git') + endif + + AssertLSPProject g:dir + +Execute('go.mod' should be ignored if modules are off): + call ale#test#SetFilename('../test-files/go/test.go') + + let b:ale_go_go111module = 'off' + let b:parent_dir = ale#path#Simplify(g:dir . '/..') + let b:git_dir = b:parent_dir . '/.git' + + if !isdirectory(b:git_dir) + call mkdir(b:git_dir) + endif + + AssertLSPProject b:parent_dir + + call delete(b:git_dir, 'd') + unlet! b:parent_dir + unlet! b:git_dir diff --git a/sources_non_forked/ale/test/linter/test_gosimple.vader b/sources_non_forked/ale/test/linter/test_gosimple.vader new file mode 100644 index 00000000..960f8ee9 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gosimple.vader @@ -0,0 +1,19 @@ +Before: + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'gosimple') + call ale#test#SetFilename('../test-files/go/testfile2.go') + +After: + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The default gosimple command should be correct): + AssertLinterCwd '%s:h' + AssertLinter 'gosimple', 'gosimple .' + +Execute(The gosimple command should support Go environment variables): + let b:ale_go_go111module = 'on' + + AssertLinter 'gosimple', ale#Env('GO111MODULE', 'on') . 'gosimple .' diff --git a/sources_non_forked/ale/test/linter/test_gotype.vader b/sources_non_forked/ale/test/linter/test_gotype.vader new file mode 100644 index 00000000..22829a17 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_gotype.vader @@ -0,0 +1,24 @@ +Before: + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'gotype') + call ale#test#SetFilename('../test-files/go/testfile2.go') + +After: + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The default gotype command should be correct): + AssertLinterCwd '%s:h' + AssertLinter 'gotype', 'gotype -e .' + +Execute(The gotype callback should ignore test files): + call ale#test#SetFilename('bla_test.go') + + AssertLinterNotExecuted + +Execute(The gotype callback should support Go environment variables): + let b:ale_go_go111module = 'on' + + AssertLinter 'gotype', ale#Env('GO111MODULE', 'on') . 'gotype -e .' diff --git a/sources_non_forked/ale/test/linter/test_govet.vader b/sources_non_forked/ale/test/linter/test_govet.vader new file mode 100644 index 00000000..12ec168a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_govet.vader @@ -0,0 +1,32 @@ +Before: + Save g:ale_go_go_executable + Save g:ale_go_govet_options + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'govet') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'go', 'go vet .' + +Execute(Extra options should be supported): + let g:ale_go_govet_options = '--foo-bar' + + AssertLinterCwd '%s:h' + AssertLinter 'go', 'go vet --foo-bar .' + +Execute(The executable should be configurable): + let g:ale_go_go_executable = 'foobar' + + AssertLinter 'foobar', 'foobar vet .' + +Execute(Go environment variables should be supported): + let b:ale_go_go111module = 'on' + + AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go vet .' diff --git a/sources_non_forked/ale/test/linter/test_graphql_gqlint.vader b/sources_non_forked/ale/test/linter/test_graphql_gqlint.vader new file mode 100644 index 00000000..22c05a6a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_graphql_gqlint.vader @@ -0,0 +1,9 @@ +Before: + call ale#assert#SetUpLinterTest('graphql', 'gqlint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The linter should run from the directory of the file in the buffer): + AssertLinterCwd '%s:h' + AssertLinter 'gqlint', 'gqlint --reporter=simple %t' diff --git a/sources_non_forked/ale/test/linter/test_haml_hamllint.vader b/sources_non_forked/ale/test/linter/test_haml_hamllint.vader new file mode 100644 index 00000000..1f5e2fa4 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haml_hamllint.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('haml', 'hamllint') + + let g:default_command = 'haml-lint %t' + +After: + unlet! b:conf + unlet! b:conf_hamllint + unlet! b:conf_rubocop + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'haml-lint', 'haml-lint %t' + +Execute(The command should have the .rubocop.yml prepended as an env var if one exists): + call ale#test#SetFilename('../test-files/hamllint/rubocop-yml/subdir/file.haml') + let b:conf = ale#path#Simplify(g:dir . '/../test-files/hamllint/rubocop-yml/.rubocop.yml') + + AssertLinter 'haml-lint', + \ ale#Env('HAML_LINT_RUBOCOP_CONF', b:conf) . 'haml-lint %t' + +Execute(The command should have the nearest .haml-lint.yml set as --config if it exists): + call ale#test#SetFilename('../test-files/hamllint/haml-lint-yml/subdir/file.haml') + let b:conf = ale#path#Simplify(g:dir . '/../test-files/hamllint/haml-lint-yml/.haml-lint.yml') + + AssertLinter 'haml-lint', + \ 'haml-lint --config ' . ale#Escape(b:conf) . ' %t', + +Execute(The command should include a .rubocop.yml and a .haml-lint if both are found): + call ale#test#SetFilename('../test-files/hamllint/haml-lint-and-rubocop/subdir/file.haml') + let b:conf_hamllint = ale#path#Simplify(g:dir . '/../test-files/hamllint/haml-lint-and-rubocop/.haml-lint.yml') + let b:conf_rubocop = ale#path#Simplify(g:dir . '/../test-files/hamllint/haml-lint-and-rubocop/.rubocop.yml') + + AssertLinter 'haml-lint', + \ ale#Env('HAML_LINT_RUBOCOP_CONF', b:conf_rubocop) + \ . 'haml-lint --config ' . ale#Escape(b:conf_hamllint) . ' %t' + +Execute(The executable can be overridden): + let b:ale_haml_hamllint_executable = 'bin/haml-lint' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'bin/haml-lint', 'bin/haml-lint %t' diff --git a/sources_non_forked/ale/test/linter/test_haskell_cabal_ghc.vader b/sources_non_forked/ale/test/linter/test_haskell_cabal_ghc.vader new file mode 100644 index 00000000..b4976b34 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_cabal_ghc.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'cabal_ghc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The options should be used in the command): + AssertLinterCwd '%s:h' + AssertLinter 'cabal', 'cabal exec -- ghc -fno-code -v0 %t' + + let b:ale_haskell_cabal_ghc_options = 'foobar' + + AssertLinter 'cabal', 'cabal exec -- ghc foobar %t' diff --git a/sources_non_forked/ale/test/linter/test_haskell_ghc.vader b/sources_non_forked/ale/test/linter/test_haskell_ghc.vader new file mode 100644 index 00000000..2f33477d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_ghc.vader @@ -0,0 +1,12 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'ghc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The options should be used in the command): + AssertLinter 'ghc', 'ghc -fno-code -v0 %t' + + let b:ale_haskell_ghc_options = 'foobar' + + AssertLinter 'ghc', 'ghc foobar %t' diff --git a/sources_non_forked/ale/test/linter/test_haskell_ghc_mod.vader b/sources_non_forked/ale/test/linter/test_haskell_ghc_mod.vader new file mode 100644 index 00000000..c1cc8597 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_ghc_mod.vader @@ -0,0 +1,10 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'ghc_mod') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Default should use ghc-mod): + AssertLinter + \ 'ghc-mod', + \ ale#Escape('ghc-mod') . ' --map-file %s=%t check %s' diff --git a/sources_non_forked/ale/test/linter/test_haskell_hdevtools.vader b/sources_non_forked/ale/test/linter/test_haskell_hdevtools.vader new file mode 100644 index 00000000..0ef2f0e3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_hdevtools.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'hdevtools') + + let b:command_tail = ' check -g -Wall -p %s %t' + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'hdevtools', ale#Escape('hdevtools') . b:command_tail + + let b:ale_haskell_hdevtools_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail diff --git a/sources_non_forked/ale/test/linter/test_haskell_hie.vader b/sources_non_forked/ale/test/linter/test_haskell_hie.vader new file mode 100644 index 00000000..3cababad --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_hie.vader @@ -0,0 +1,27 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'hie') + + Save &filetype + let &filetype = 'haskell' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'haskell' + +Execute(The default executable should be correct): + AssertLinter 'hie', + \ ale#Escape('hie') . ' --lsp' + +Execute(The project root should be detected correctly): + AssertLSPProject g:dir + + call ale#test#SetFilename('../test-files/hie_paths/file.hs') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/hie_paths') + +Execute(The executable should be configurable): + let g:ale_haskell_hie_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --lsp' diff --git a/sources_non_forked/ale/test/linter/test_haskell_hlint.vader b/sources_non_forked/ale/test/linter/test_haskell_hlint.vader new file mode 100644 index 00000000..6d227c9d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_hlint.vader @@ -0,0 +1,17 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'hlint') + + let b:base_opts = '--color=never --json -' + +After: + unlet! b:base_opts + call ale#assert#TearDownLinterTest() + +Execute(executable should be configurable): + AssertLinter 'hlint', ale#Escape('hlint') . ' ' . b:base_opts + let b:ale_haskell_hlint_executable = 'myHlint' + AssertLinter 'myHlint', ale#Escape('myHlint') . ' ' . b:base_opts + +Execute(should accept options): + let b:ale_haskell_hlint_options= '-h myhlintfile.yaml' + AssertLinter 'hlint', ale#Escape('hlint') . ' -h myhlintfile.yaml ' . b:base_opts diff --git a/sources_non_forked/ale/test/linter/test_haskell_hls.vader b/sources_non_forked/ale/test/linter/test_haskell_hls.vader new file mode 100644 index 00000000..4452d53c --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_hls.vader @@ -0,0 +1,32 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'hls') + + Save &filetype + let &filetype = 'haskell' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'haskell' + +Execute(The default executable should be correct): + AssertLinter 'haskell-language-server-wrapper', + \ ale#Escape('haskell-language-server-wrapper') . ' --lsp' + +Execute(The project root should be detected correctly): + AssertLSPProject g:dir + + call ale#test#SetFilename('hls_paths/file.hs') + + AssertLSPProject ale#path#Simplify(g:dir . '/hls_paths') + +Execute(The executable should be configurable): + let g:ale_haskell_hls_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --lsp' + +Execute(Should accept configuration settings): + AssertLSPConfig {} + let b:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}} + AssertLSPConfig {'haskell': {'maxCompletions': 250}} diff --git a/sources_non_forked/ale/test/linter/test_haskell_stack_build.vader b/sources_non_forked/ale/test/linter/test_haskell_stack_build.vader new file mode 100644 index 00000000..8b5b0971 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_stack_build.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'stack_build') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The linter should not be executed when there's no stack.yaml file): + AssertLinterNotExecuted + +Execute(The linter should be executed when there is a stack.yaml file): + call ale#test#SetFilename('../test-files/stack/test.hs') + + AssertLinter 'stack', 'stack build --fast' diff --git a/sources_non_forked/ale/test/linter/test_haskell_stack_ghc.vader b/sources_non_forked/ale/test/linter/test_haskell_stack_ghc.vader new file mode 100644 index 00000000..04bd23f5 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_haskell_stack_ghc.vader @@ -0,0 +1,18 @@ +Before: + call ale#assert#SetUpLinterTest('haskell', 'stack_ghc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The linter should not be executed when there's no stack.yaml file): + AssertLinterNotExecuted + +Execute(The linter should be executed when there is a stack.yaml file): + call ale#test#SetFilename('../test-files/stack/test.hs') + + AssertLinterCwd '%s:h' + AssertLinter 'stack', 'stack ghc -- -fno-code -v0 %t' + + let b:ale_haskell_stack_ghc_options = 'foobar' + + AssertLinter 'stack', 'stack ghc -- foobar %t' diff --git a/sources_non_forked/ale/test/linter/test_hdl_checker_options.vader b/sources_non_forked/ale/test/linter/test_hdl_checker_options.vader new file mode 100644 index 00000000..6e7eef46 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_hdl_checker_options.vader @@ -0,0 +1,86 @@ +Before: + call ale#assert#SetUpLinterTest('vhdl', 'hdl_checker') + + Save g:ale_hdl_checker_executable + Save g:ale_hdl_checker_config_file + Save g:ale_hdl_checker_options + + let g:default_config_file = has('unix') ? '.hdl_checker.config' : '_hdl_checker.config' + + runtime autoload/ale/handlers/hdl_checker.vim + +After: + Restore + + call ale#assert#TearDownLinterTest() + + unlet! g:default_config_file + unlet! g:call_count + + runtime autoload/ale/handlers/hdl_checker.vim + +Execute(Get default initialization dict): + AssertEqual + \ {'project_file': g:default_config_file}, + \ ale#handlers#hdl_checker#GetInitOptions(bufnr('')) + +Execute(Get custom initialization dict): + let g:ale_hdl_checker_config_file = 'some_file_name' + + AssertEqual + \ {'project_file': 'some_file_name'}, + \ ale#handlers#hdl_checker#GetInitOptions(bufnr('')) + +Execute(Get the checker command without extra user parameters): + AssertEqual + \ ale#Escape('hdl_checker') . ' --lsp', + \ ale#handlers#hdl_checker#GetCommand(bufnr('')) + +Execute(Get the checker command with user configured parameters): + let g:ale_hdl_checker_options = '--log-level DEBUG' + + AssertEqual + \ ale#Escape('hdl_checker') . ' --lsp --log-level DEBUG', + \ ale#handlers#hdl_checker#GetCommand(bufnr('')) + +Execute(Customize executable): + let g:ale_hdl_checker_executable = '/some/other/path' + AssertEqual + \ ale#Escape('/some/other/path') . ' --lsp', + \ ale#handlers#hdl_checker#GetCommand(bufnr('')) + +Execute(Get project root based on .git): + call ale#test#SetFilename('../test-files/hdl_server/with_git/files/foo.vhd') + " Create .git file + silent! call mkdir(g:dir . '/../test-files/hdl_server/with_git/.git') + AssertNotEqual '', glob(g:dir . '/../test-files/hdl_server/with_git/.git') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/hdl_server/with_git'), + \ ale#handlers#hdl_checker#GetProjectRoot(bufnr('')) + +Execute(Get project root based on config file): + call ale#test#SetFilename('../test-files/hdl_server/with_config_file/foo.vhd') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/hdl_server/with_config_file'), + \ ale#handlers#hdl_checker#GetProjectRoot(bufnr('')) + +Execute(Return no project root if neither .git or config file are found): + let g:call_count = 0 + + " Mock this command to avoid the test to find ale's own .git folder + function! ale#handlers#hdl_checker#IsDotGit(path) abort + let g:call_count += 1 + return 0 + endfunction + + call ale#test#SetFilename('../test-files/hdl_server/foo.vhd') + + AssertEqual + \ '', + \ ale#handlers#hdl_checker#GetProjectRoot(bufnr('')) + + AssertEqual g:call_count, 1 + + unlet! g:call_count diff --git a/sources_non_forked/ale/test/linter/test_html_stylelint.vader b/sources_non_forked/ale/test/linter/test_html_stylelint.vader new file mode 100644 index 00000000..c5ac1b98 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_html_stylelint.vader @@ -0,0 +1,60 @@ +Before: + Save g:ale_html_stylelint_executable + Save g:ale_html_stylelint_use_global + Save g:ale_html_stylelint_options + + unlet! b:executable + + unlet! g:ale_html_stylelint_executable + unlet! g:ale_html_stylelint_use_global + unlet! g:ale_html_stylelint_options + + call ale#test#SetDirectory('/testplugin/test/linter') + call ale#test#SetFilename('testfile.html') + + runtime ale_linters/html/stylelint.vim + +After: + Restore + + unlet! b:executable + unlet! b:ale_html_stylelint_executable + unlet! b:ale_html_stylelint_use_global + unlet! b:ale_html_stylelint_options + + call ale#test#SetFilename('test.txt') + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(node_modules directories should be discovered): + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.html') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/stylelint/node_modules/.bin/stylelint' + \) + + AssertEqual b:executable, ale_linters#html#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape(b:executable) . ' --stdin-filename %s', + \ ale_linters#html#stylelint#GetCommand(bufnr('')) + +Execute(The global override should work): + let b:ale_html_stylelint_executable = 'foobar' + let b:ale_html_stylelint_use_global = 1 + + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.html') + + AssertEqual 'foobar', ale_linters#html#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('foobar') . ' --stdin-filename %s', + \ ale_linters#html#stylelint#GetCommand(bufnr('')) + +Execute(Extra options should be configurable): + let b:ale_html_stylelint_options = '--whatever' + + AssertEqual 'stylelint', ale_linters#html#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('stylelint') . ' --whatever --stdin-filename %s', + \ ale_linters#html#stylelint#GetCommand(bufnr('')) diff --git a/sources_non_forked/ale/test/linter/test_htmlhint.vader b/sources_non_forked/ale/test/linter/test_htmlhint.vader new file mode 100644 index 00000000..df5797af --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_htmlhint.vader @@ -0,0 +1,51 @@ +Before: + call ale#assert#SetUpLinterTest('html', 'htmlhint') + call ale#test#SetFilename('../test-files/htmlhint/test.html') + + let g:node_executable = ale#path#Simplify( + \ g:dir . '/../test-files/htmlhint/node_modules/.bin/htmlhint' + \) + let g:config_path = ale#path#Simplify( + \ g:dir . '/../test-files/htmlhint/with_config/.htmlhintrc' + \) + +After: + unlet! g:node_executable + unlet! g:config_path + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter g:node_executable, + \ ale#Escape(g:node_executable) . ' --format=unix %t' + +Execute(The global executable should be uesd if the option is set): + let g:ale_html_htmlhint_executable = 'foo' + let g:ale_html_htmlhint_use_global = 1 + + AssertLinter 'foo', ale#Escape('foo') . ' --format=unix %t', + +" This is so old configurations which might include this still work. +Execute(--format=unix should be removed from the options if added): + let g:ale_html_htmlhint_options = '--format=unix' + + AssertLinter g:node_executable, + \ ale#Escape(g:node_executable) . ' --format=unix %t' + +Execute(The configuration file should be automatically detected): + call ale#test#SetFilename('../test-files/htmlhint/with_config/test.html') + + AssertLinter g:node_executable, + \ ale#Escape(g:node_executable) + \ . ' --config ' . ale#Escape(g:config_path) + \ . ' --format=unix %t' + +" This is so old configurations which might include the config will work. +Execute(The configuration file should be configurable through the options variable): + call ale#test#SetFilename('../test-files/htmlhint/with_config/test.html') + let g:ale_html_htmlhint_options = '--config=/foo/bar/.htmlhintrc' + + AssertLinter g:node_executable, + \ ale#Escape(g:node_executable) + \ . ' --config=/foo/bar/.htmlhintrc' + \ . ' --format=unix %t' diff --git a/sources_non_forked/ale/test/linter/test_ibm_openapi_validator.vader b/sources_non_forked/ale/test/linter/test_ibm_openapi_validator.vader new file mode 100644 index 00000000..3484cc09 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ibm_openapi_validator.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('openapi', 'ibm_validator') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The yaml ibm-openapi-validator command callback should return the correct default string): + AssertLinter 'lint-openapi', ale#Escape('lint-openapi') . ' %t' + +Execute(The yaml ibm-openapi-validator command callback should be configurable): + let g:ale_openapi_ibm_validator_executable = '~/.local/bin/lint-openapi' + let g:ale_openapi_ibm_validator_options = '-c ~/.config' + + AssertLinter '~/.local/bin/lint-openapi', ale#Escape('~/.local/bin/lint-openapi') + \ . ' -c ~/.config %t' diff --git a/sources_non_forked/ale/test/linter/test_idris.vader b/sources_non_forked/ale/test/linter/test_idris.vader new file mode 100644 index 00000000..ce7cd270 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_idris.vader @@ -0,0 +1,21 @@ +Before: + call ale#assert#SetUpLinterTest('idris', 'idris') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be used in the command): + AssertLinter 'idris', + \ ale#Escape('idris') . ' --total --warnpartial --warnreach --warnipkg --check %s' + + let b:ale_idris_idris_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' --total --warnpartial --warnreach --warnipkg --check %s' + +Execute(The options should be configurable): + let b:ale_idris_idris_options = '--something' + + AssertLinter 'idris', ale#Escape('idris') . ' --something --check %s' diff --git a/sources_non_forked/ale/test/linter/test_ink_ls.vader b/sources_non_forked/ale/test/linter/test_ink_ls.vader new file mode 100644 index 00000000..a832a250 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ink_ls.vader @@ -0,0 +1,22 @@ +Before: + call ale#assert#SetUpLinterTest('ink', 'ls') + set ft=ink + +After: + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'ink-language-server', ale#Escape('ink-language-server') . ' --stdio' + +Execute(should set correct LSP values): + call ale#test#SetFilename('../test-files/ink/story/main.ink') + + AssertLSPLanguage 'ink' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ink/story') + +Execute(should accept configuration settings): + AssertLSPConfig {} + let b:ale_ink_ls_initialization_options = {'ink': {'runThroughMono': v:true}} + AssertLSPOptions {'ink': {'runThroughMono': v:true}} diff --git a/sources_non_forked/ale/test/linter/test_inko_inko.vader b/sources_non_forked/ale/test/linter/test_inko_inko.vader new file mode 100644 index 00000000..c08cbed4 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_inko_inko.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('inko', 'inko') + call ale#test#SetFilename('../test-files/inko/test.inko') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'inko', ale#Escape('inko') . ' build --check --format=json %s' + +Execute(The inko callback should include tests/ for test paths): + call ale#engine#Cleanup(bufnr('')) + noautocmd e! ../test-files/inko/tests/test/test_foo.inko + call ale#engine#InitBufferInfo(bufnr('')) + + AssertLinter 'inko', + \ ale#Escape('inko') + \ . ' build --check --format=json --include ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/inko/tests/')) + \ . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_ispc_ispc.vader b/sources_non_forked/ale/test/linter/test_ispc_ispc.vader new file mode 100644 index 00000000..f1aeb2f8 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ispc_ispc.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('ispc', 'ispc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'ispc', + \ ale#Escape('ispc') . ' --nowrap %s' + + let b:ale_ispc_ispc_executable = 'foo' + + AssertLinter 'foo', + \ ale#Escape('foo') . ' --nowrap %s' + +Execute(The options should be configurable): + let g:ale_ispc_ispc_options = '--foo' + + AssertLinter 'ispc', + \ ale#Escape('ispc') . ' --nowrap --foo' . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_iverilog.vader b/sources_non_forked/ale/test/linter/test_iverilog.vader new file mode 100644 index 00000000..d7a29f05 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_iverilog.vader @@ -0,0 +1,14 @@ +Before: + call ale#assert#SetUpLinterTest('verilog', 'iverilog') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default iverilog command should be correct): + AssertLinter 'iverilog', 'iverilog -t null -Wall %t' + +Execute(iverilog options should be configurable): + " Additional args for the linter + let g:ale_verilog_iverilog_options = '-y.' + + AssertLinter 'iverilog', 'iverilog -t null -Wall -y. %t' diff --git a/sources_non_forked/ale/test/linter/test_javac.vader b/sources_non_forked/ale/test/linter/test_javac.vader new file mode 100644 index 00000000..85a76e6a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_javac.vader @@ -0,0 +1,326 @@ +Before: + call ale#assert#SetUpLinterTest('java', 'javac') + call ale#test#SetFilename('dummy.java') + + let g:cp_sep = has('unix') ? ':' : ';' + let g:prefix = ale#Escape('javac') . ' -Xlint' + + function! GetCommand(previous_output) abort + let l:command = ale_linters#java#javac#GetCommand( + \ bufnr(''), + \ a:previous_output + \) + + let l:split_command = split(l:command) + let l:index = index(l:split_command, '-d') + + let l:split_command[l:index + 1] = 'TEMP' + + return join(l:split_command) + endfunction + +After: + unlet! g:cp_sep + unlet! g:prefix + + delfunction GetCommand + + call ale#assert#TearDownLinterTest() + +Execute(The javac callback should return the correct default value): + AssertLinterCwd '%s:h' + AssertLinter 'javac', g:prefix . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should use string type g:ale_java_javac_classpath correctly): + let g:ale_java_javac_classpath = 'foo.jar' + + AssertLinter 'javac', + \ g:prefix + \ . ' -cp ' . ale#Escape('foo.jar') + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should use list type g:ale_java_javac_classpath correctly): + let g:ale_java_javac_classpath = ['foo.jar'] + + AssertLinter 'javac', + \ g:prefix + \ . ' -cp ' . ale#Escape('foo.jar') + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The executable should be configurable): + let g:ale_java_javac_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -Xlint' + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should include discovered classpaths): + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \], {}) + + AssertEqual + \ g:prefix + \ . ' -cp ' + \ . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + +Execute(The javac callback should combine discovered classpaths and manual ones): + let g:ale_java_javac_classpath = 'configured.jar' + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \], {}) + + AssertEqual + \ g:prefix + \ . ' -cp ' + \ . ale#Escape(join( + \ [ + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \ 'configured.jar', + \ ], + \ g:cp_sep + \ )) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + + let g:ale_java_javac_classpath = 'configured.jar' . g:cp_sep . 'configured2.jar' + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \], {}) + + AssertEqual + \ g:prefix + \ . ' -cp ' + \ . ale#Escape(join( + \ [ + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \ 'configured.jar', + \ 'configured2.jar', + \ ], + \ g:cp_sep + \ )) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + + let g:ale_java_javac_classpath = ['configured.jar'] + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \], {}) + + AssertEqual + \ g:prefix + \ . ' -cp ' + \ . ale#Escape(join( + \ [ + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \ 'configured.jar', + \ ], + \ g:cp_sep + \ )) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + + let g:ale_java_javac_classpath = ['configured.jar', 'configured2.jar'] + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \], {}) + + AssertEqual + \ g:prefix + \ . ' -cp ' + \ . ale#Escape(join( + \ [ + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \ 'configured.jar', + \ 'configured2.jar', + \ ], + \ g:cp_sep + \ )) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + +Execute(The javac callback should use string type g:ale_java_javac_sourcepath correctly): + let g:ale_java_javac_sourcepath = '../test-files/java/with_main/build/gen/main' + + AssertLinter 'javac', + \ g:prefix + \ . ' -sourcepath ' . ale#Escape( + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/') + \ ) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should use list type g:ale_java_javac_sourcepath correctly): + let g:ale_java_javac_sourcepath = ['../test-files/java/with_main/build/gen/main'] + + AssertLinter 'javac', + \ g:prefix + \ . ' -sourcepath ' . ale#Escape( + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/') + \ ) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback shouldn't add -sourcepath when g:ale_java_javac_sourcepath variable path doesn't exist): + let g:ale_java_javac_sourcepath = '../test-files/java/with_main/build/gen3/main' + + AssertLinter 'javac', + \ g:prefix + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should combine discovered sourcepath and manual ones): + call ale#engine#Cleanup(bufnr('')) + call ale#test#SetFilename('../test-files/java/with_main/src/main/java/com/something/dummy.java') + call ale#engine#InitBufferInfo(bufnr('')) + + let g:ale_java_javac_sourcepath = '../test-files/java/with_main/build/gen/main' + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {}) + + AssertEqual + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/'), + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + + let g:ale_java_javac_sourcepath = '../test-files/java/with_main/build/gen/main' + \ . g:cp_sep . '../test-files/java/with_main/build/gen2/main' + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {}) + + AssertEqual + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen2/main/') + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + + let g:ale_java_javac_sourcepath = ['../test-files/java/with_main/build/gen/main'] + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {}) + + AssertEqual + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/') + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + + let g:ale_java_javac_sourcepath = [ + \ '../test-files/java/with_main/build/gen/main', + \ '../test-files/java/with_main/build/gen2/main' + \ ] + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {}) + + AssertEqual + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen/main/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/build/gen2/main/') + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + +Execute(The javac callback should detect source directories): + call ale#engine#Cleanup(bufnr('')) + noautocmd e! ../test-files/java/with_main/src/main/java/com/something/dummy + call ale#engine#InitBufferInfo(bufnr('')) + + AssertLinter 'javac', + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape( + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/') + \ ) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should combine detected source directories and classpaths): + call ale#engine#Cleanup(bufnr('')) + call ale#test#SetFilename('../test-files/java/with_main/src/main/java/com/something/dummy.java') + call ale#engine#InitBufferInfo(bufnr('')) + + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \], {}) + + AssertEqual + \ ale#Escape('javac') . ' -Xlint' + \ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep)) + \ . ' -sourcepath ' . ale#Escape( + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/') + \ ) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t', + \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g') + +Execute(The javac callback should use g:ale_java_javac_options correctly): + let g:ale_java_javac_options = '--anything --else' + + AssertLinter 'javac', + \ g:prefix . ' -d ' . ale#Escape('TEMP_DIR') . ' --anything --else %t' + +Execute(The javac callback should include src/test/java for test paths): + call ale#engine#Cleanup(bufnr('')) + " The test path is only included for test files. + " Regular Java files shouldn't import from tests. + noautocmd e! ../test-files/java/with_main/src/test/java/com/something/dummy + call ale#engine#InitBufferInfo(bufnr('')) + + AssertLinter 'javac', + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/main/java/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_main/src/test/java/'), + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should include src/main/jaxb when available): + call ale#engine#Cleanup(bufnr('')) + noautocmd e! ../test-files/java/with_jaxb/src/main/java/com/something/dummy + call ale#engine#InitBufferInfo(bufnr('')) + + AssertLinter 'javac', + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/../test-files/java/with_jaxb/src/main/java/'), + \ ale#path#Simplify(g:dir . '/../test-files/java/with_jaxb/src/main/jaxb/'), + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' + +Execute(The javac callback should add -sourcepath even if src/java/main doesn't exist): + call ale#engine#Cleanup(bufnr('')) + call ale#test#SetFilename('../test-files/java/no_main/src/test/java/com/something/dummy.java') + call ale#engine#InitBufferInfo(bufnr('')) + + AssertLinter 'javac', + \ ale#Escape('javac') . ' -Xlint' + \ . ' -sourcepath ' . ale#Escape(join([ + \ ale#path#Simplify(g:dir . '/../test-files/java/no_main/src/test/java/'), + \ ], g:cp_sep)) + \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_javalsp.vader b/sources_non_forked/ale/test/linter/test_javalsp.vader new file mode 100644 index 00000000..122f409b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_javalsp.vader @@ -0,0 +1,80 @@ + +Before: + call ale#assert#SetUpLinterTest('java', 'javalsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The javalsp callback should return the correct default value): + AssertLinter '', ale#Escape('') + +Execute(The javalsp java executable should be configurable): + let b:ale_java_javalsp_executable = '/bin/foobar' + + AssertLinter '/bin/foobar', ale#Escape('/bin/foobar') + +Execute(The javalsp callback should return backward compatible value): + let b:ale_java_javalsp_executable = '/bin/java' + let cmd = [ + \ ale#Escape('/bin/java'), + \ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs', + \ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs', + \ '-m javacs/org.javacs.Main', + \] + AssertLinter '/bin/java', join(cmd, ' ') + +Execute(The javalsp should have default config): + AssertEqual + \ { + \ 'java': { + \ 'classPath': [], + \ 'externalDependencies': [] + \ } + \ }, + \ ale_linters#java#javalsp#Config(bufnr('')) + +Execute(The javalsp should have default config if user sets empty hash): + let b:ale_java_javalsp_config = {} + + AssertEqual + \ { + \ 'java': { + \ 'classPath': [], + \ 'externalDependencies': [] + \ } + \ }, + \ ale_linters#java#javalsp#Config(bufnr('')) + +Execute(The javalsp should have add missing config): + let b:ale_java_javalsp_config = { 'java': { 'classPath': ['aaa.jar'] } } + + AssertEqual + \ { + \ 'java': { + \ 'classPath': ['aaa.jar'], + \ 'externalDependencies': [] + \ } + \ }, + \ ale_linters#java#javalsp#Config(bufnr('')) + + let b:ale_java_javalsp_config = + \ { + \ 'java': { + \ 'externalDependencies': ['unit-test:2.0.0'] + \ } + \ } + + AssertEqual + \ { + \ 'java': { + \ 'classPath': [], + \ 'externalDependencies': ['unit-test:2.0.0'] + \ } + \ }, + \ ale_linters#java#javalsp#Config(bufnr('')) diff --git a/sources_non_forked/ale/test/linter/test_javascript_deno_lsp.vader b/sources_non_forked/ale/test/linter/test_javascript_deno_lsp.vader new file mode 100644 index 00000000..965ce600 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_javascript_deno_lsp.vader @@ -0,0 +1,79 @@ +Before: + let g:ale_deno_importMap = 'import_map.json' + let g:ale_deno_unstable = 0 + let g:ale_deno_executable = 'deno' + let g:ale_deno_lsp_project_root = '' + + runtime autoload/ale/handlers/deno.vim + call ale#assert#SetUpLinterTest('javascript', 'deno') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Should set deno lsp for JavaScript projects using stable Deno API): + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': '' + \} + +Execute(Should set deno lsp using unstable Deno API if enabled by user): + let g:ale_deno_unstable = 1 + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:true, + \ 'importMap': '' + \} + +Execute(Should set the default importMap filepath): + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/javascript_deno/import_map.json') + \} + +Execute(Should set the importMap filepath from user defined importMap): + let g:ale_deno_importMap = 'custom_import_map.json' + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/javascript_deno/custom_import_map.json') + \} + +Execute(Should set the importMap filepath from user defined importMap with unstable API): + let g:ale_deno_importMap = 'custom_import_map.json' + let g:ale_deno_unstable = 1 + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:true, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/javascript_deno/custom_import_map.json') + \} + +Execute(Should find project root containing tsconfig.json): + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPLanguage 'javascript' + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/javascript_deno') + +Execute(Should use user-specified project root): + let g:ale_deno_lsp_project_root = '/' + + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPLanguage 'javascript' + AssertLSPProject '/' + +Execute(Check Deno LSP command): + AssertLinter 'deno', ale#Escape('deno') . ' lsp' diff --git a/sources_non_forked/ale/test/linter/test_javascript_tsserver.vader b/sources_non_forked/ale/test/linter/test_javascript_tsserver.vader new file mode 100644 index 00000000..1c29c8fd --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_javascript_tsserver.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'tsserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'tsserver', ale#Escape('tsserver') + +Execute(should resolve correct path when nested 1): + call ale#test#SetFilename('../test-files/tsserver/src/level-1/level-2/file3.ts') + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/tsserver/src/level-1') + +Execute(should resolve correct path when nested 2): + call ale#test#SetFilename('../test-files/tsserver/src/file1.ts') + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/tsserver') diff --git a/sources_non_forked/ale/test/linter/test_jq.vader b/sources_non_forked/ale/test/linter/test_jq.vader new file mode 100644 index 00000000..20c3db5b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_jq.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('json', 'jq') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'jq', ale#Escape('jq') diff --git a/sources_non_forked/ale/test/linter/test_jscs.vader b/sources_non_forked/ale/test/linter/test_jscs.vader new file mode 100644 index 00000000..7cdf5467 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_jscs.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'jscs') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Should return the correct default values): + AssertLinter 'jscs', + \ ale#Escape('jscs') . ' --reporter inline --no-colors -' + +Execute(Should allow using a custom executable): + let g:ale_javascript_jscs_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' --reporter inline --no-colors -' diff --git a/sources_non_forked/ale/test/linter/test_jshint.vader b/sources_non_forked/ale/test/linter/test_jshint.vader new file mode 100644 index 00000000..517c957c --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_jshint.vader @@ -0,0 +1,17 @@ +Before: + Save g:ale_jshint_config_loc + + unlet! g:ale_jshint_config_loc + + call ale#assert#SetUpLinterTest('javascript', 'jshint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'jshint', ale#Escape('jshint') . ' --reporter unix --extract auto --filename %s -' + +Execute(Setting a config location should add the config parameter): + let g:ale_jshint_config_loc = '/some/file' + + AssertLinter 'jshint', ale#Escape('jshint') . ' --reporter unix --extract auto --config ' . ale#Escape('/some/file') . ' --filename %s -' diff --git a/sources_non_forked/ale/test/linter/test_jsonnet_lint.vader b/sources_non_forked/ale/test/linter/test_jsonnet_lint.vader new file mode 100644 index 00000000..529ae008 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_jsonnet_lint.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('jsonnet', 'jsonnet_lint') + call ale#test#SetFilename('../jsonnet_files/testfile.jsonnet') + +After: + Restore + + call ale#assert#TearDownLinterTest() + +Execute(The default jsonnet-lint command should be correct): + AssertLinter 'jsonnet-lint', + \ ale#Escape('jsonnet-lint') . ' %t' + +Execute(jsonnet-lint command and options should be customizable): + let g:ale_jsonnet_jsonnet_lint_executable = 'jsonnet' + let g:ale_jsonnet_jsonnet_lint_options = 'fmt' + + AssertLinter 'jsonnet', + \ ale#Escape('jsonnet') . ' fmt %t' diff --git a/sources_non_forked/ale/test/linter/test_jsonnetfmt.vader b/sources_non_forked/ale/test/linter/test_jsonnetfmt.vader new file mode 100644 index 00000000..d070cd9f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_jsonnetfmt.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('jsonnet', 'jsonnetfmt') + call ale#test#SetFilename('../jsonnet_files/testfile.jsonnet') + +After: + Restore + + call ale#assert#TearDownLinterTest() + +Execute(The default jsonnetfmt command should be correct): + AssertLinter 'jsonnetfmt', + \ ale#Escape('jsonnetfmt') . ' %t' + +Execute(jsonnetfmt command and options should be customizable): + let g:ale_jsonnet_jsonnetfmt_executable = 'jsonnet' + let g:ale_jsonnet_jsonnetfmt_options = 'fmt' + + AssertLinter 'jsonnet', + \ ale#Escape('jsonnet') . ' fmt %t' diff --git a/sources_non_forked/ale/test/linter/test_julia_languageserver.vader b/sources_non_forked/ale/test/linter/test_julia_languageserver.vader new file mode 100644 index 00000000..d75665a0 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_julia_languageserver.vader @@ -0,0 +1,30 @@ +Before: + Save g:ale_julia_executable + + call ale#assert#SetUpLinterTest('julia', 'languageserver') + +After: + Restore + + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'julia', + \ ale#Escape('julia') . + \' --project=@. --startup-file=no --history-file=no -e ' . + \ ale#Escape('using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);') + +Execute(The executable should be configurable): + let g:ale_julia_executable = 'julia-new' + + AssertLinter 'julia-new', + \ ale#Escape('julia-new') . + \' --project=@. --startup-file=no --history-file=no -e ' . + \ ale#Escape('using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);') + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/julia/test.jl') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/julia') diff --git a/sources_non_forked/ale/test/linter/test_kotlin_languageserver.vader b/sources_non_forked/ale/test/linter/test_kotlin_languageserver.vader new file mode 100644 index 00000000..97b867ab --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_kotlin_languageserver.vader @@ -0,0 +1,23 @@ +Before: + call ale#assert#SetUpLinterTest('kotlin', 'languageserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'kotlin-language-server', ale#Escape('kotlin-language-server') + +Execute(Gradle project roots with build.gradle should be detected correctly): + call ale#test#SetFilename('../test-files/gradle/build-gradle-project/src/main/kotlin/dummy.kt') + + AssertLSPProject ale#test#GetFilename('../test-files/gradle/build-gradle-project') + +Execute(Maven project roots with pom.xml should be detected correctly): + call ale#test#SetFilename('../test-files/maven/maven-kotlin-project/src/main/kotlin/dummy.kt') + + AssertLSPProject ale#test#GetFilename('../test-files/maven/maven-kotlin-project') + +Execute(No root should be detected if configuration files can't be found): + call ale#test#SetFilename('../test-files/gradle/non-gradle-project/src/main/kotlin/dummy.kt') + + AssertLSPProject '' diff --git a/sources_non_forked/ale/test/linter/test_kotlinc.vader b/sources_non_forked/ale/test/linter/test_kotlinc.vader new file mode 100644 index 00000000..fe94bffa --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_kotlinc.vader @@ -0,0 +1,9 @@ +Before: + call ale#assert#SetUpLinterTest('kotlin', 'kotlinc') + call ale#test#SetFilename('test.kt') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'kotlinc', 'kotlinc ' . ale#Escape(expand('%:p')) diff --git a/sources_non_forked/ale/test/linter/test_languagetool.vader b/sources_non_forked/ale/test/linter/test_languagetool.vader new file mode 100644 index 00000000..ff6b2064 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_languagetool.vader @@ -0,0 +1,22 @@ +Before: + call ale#assert#SetUpLinterTest('text', 'languagetool') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'languagetool', ale#Escape('languagetool') + \ . ' --autoDetect %s' + +Execute(Should be able to set a custom executable): + let g:ale_languagetool_executable = 'foobar' + + AssertLinter 'foobar' , ale#Escape('foobar') + \ . ' --autoDetect %s' + +Execute(Should be able to include custom languagetool options): + let g:ale_languagetool_options = '--language en' + + " is now 'foobar' based on above global + AssertLinter 'foobar', ale#Escape('foobar') + \ . ' --language en %s' diff --git a/sources_non_forked/ale/test/linter/test_less_stylelint.vader b/sources_non_forked/ale/test/linter/test_less_stylelint.vader new file mode 100644 index 00000000..c27af79e --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_less_stylelint.vader @@ -0,0 +1,32 @@ +Before: + call ale#assert#SetUpLinterTest('less', 'stylelint') + unlet! b:executable + +After: + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(node_modules directories should be discovered): + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.less') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/stylelint/node_modules/.bin/stylelint' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin-filename %s' + +Execute(The global override should work): + let b:ale_less_stylelint_executable = 'foobar' + let b:ale_less_stylelint_use_global = 1 + + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.less') + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin-filename %s' + +Execute(Extra options should be configurable): + let b:ale_less_stylelint_options = '--whatever' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'stylelint', + \ ale#Escape('stylelint') . ' --whatever --stdin-filename %s' diff --git a/sources_non_forked/ale/test/linter/test_lessc.vader b/sources_non_forked/ale/test/linter/test_lessc.vader new file mode 100644 index 00000000..b7d664c6 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_lessc.vader @@ -0,0 +1,46 @@ +Before: + call ale#assert#SetUpLinterTest('less', 'lessc') + call ale#test#SetFilename('testfile.less') + + unlet! b:executable + +After: + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(node_modules directories should be discovered): + call ale#test#SetFilename('../test-files/lessc/nested/testfile.less') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/lessc/node_modules/.bin/lessc' + \) + + AssertLinter b:executable, ale#Escape(b:executable) + \ . ' --no-color --lint' + \ . ' --include-path=' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/lessc/nested')) + \ . ' -' + +Execute(The global override should work): + let b:ale_less_lessc_executable = 'foobar' + let b:ale_less_lessc_use_global = 1 + + call ale#test#SetFilename('../test-files/lessc/nested/testfile.less') + + AssertLinter 'foobar', ale#Escape('foobar') + \ . ' --no-color --lint' + \ . ' --include-path=' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/lessc/nested')) + \ . ' -' + +Execute(Extra options should be configurable): + let b:ale_less_lessc_options = '--whatever' + + AssertLinter 'lessc', ale#Escape('lessc') + \ . ' --no-color --lint' + \ . ' --include-path=' + \ . ale#Escape(ale#path#Simplify(g:dir)) + \ . ' --whatever' + \ . ' -' diff --git a/sources_non_forked/ale/test/linter/test_lintr.vader b/sources_non_forked/ale/test/linter/test_lintr.vader new file mode 100644 index 00000000..8f6fb88f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_lintr.vader @@ -0,0 +1,34 @@ +Before: + call ale#assert#SetUpLinterTest('r', 'lintr') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default lintr command should be correct): + AssertLinterCwd '%s:h' + AssertLinter 'Rscript', + \ 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' + \ . ale#Escape('suppressPackageStartupMessages(library(lintr));' + \ . 'lint(cache = FALSE, commandArgs(TRUE), ' + \ . 'with_defaults())') + \ . ' %t' + +Execute(The lintr options should be configurable): + let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)' + + AssertLinter 'Rscript', + \ 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' + \ . ale#Escape('suppressPackageStartupMessages(library(lintr));' + \ . 'lint(cache = FALSE, commandArgs(TRUE), ' + \ . 'with_defaults(object_usage_linter = NULL))') + \ . ' %t' + +Execute(If the lint_package flag is set, lintr::lint_package should be called): + let b:ale_r_lintr_lint_package = 1 + + AssertLinter 'Rscript', + \ 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' + \ . ale#Escape('suppressPackageStartupMessages(library(lintr));' + \ . 'lint_package(cache = FALSE, ' + \ . 'linters = with_defaults())') + \ . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_llc.vader b/sources_non_forked/ale/test/linter/test_llc.vader new file mode 100644 index 00000000..a0caaa48 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_llc.vader @@ -0,0 +1,21 @@ +Before: + call ale#assert#SetUpLinterTest('llvm', 'llc') + + function! AssertHasPrefix(str, prefix) abort + let msg = printf("'%s' is expected to be prefixed with '%s'", a:str, a:prefix) + AssertEqual stridx(a:str, a:prefix), 0, msg + endfunction + +After: + delfunction AssertHasPrefix + + call ale#assert#TearDownLinterTest() + +Execute(The llc command should be customizable): + AssertLinter 'llc', + \ ale#Escape('llc') . ' -filetype=null -o=' . g:ale#util#nul_file + + let g:ale_llvm_llc_executable = 'llc-5.0' + + AssertLinter 'llc-5.0', + \ ale#Escape('llc-5.0') . ' -filetype=null -o=' . g:ale#util#nul_file diff --git a/sources_non_forked/ale/test/linter/test_lua_selene.vader b/sources_non_forked/ale/test/linter/test_lua_selene.vader new file mode 100644 index 00000000..7387bace --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_lua_selene.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('lua', 'selene') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The lua selene command callback should return the correct default string): + AssertLinter 'selene', ale#Escape('selene') . ' --display-style=json -' + +Execute(The lua selene command callback should let you set options): + let g:ale_lua_selene_options = '--num-threads 2' + + AssertLinter 'selene', + \ ale#Escape('selene') . ' --num-threads 2 --display-style=json -' + +Execute(The selene executable should be configurable): + let g:ale_lua_selene_executable = 'selene.sh' + + AssertLinter 'selene.sh', ale#Escape('selene.sh') . ' --display-style=json -' diff --git a/sources_non_forked/ale/test/linter/test_luac.vader b/sources_non_forked/ale/test/linter/test_luac.vader new file mode 100644 index 00000000..55f39cba --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_luac.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('lua', 'luac') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'luac', ale#Escape('luac') . ' -p -' + +Execute(The luac executable should be configurable): + let g:ale_lua_luac_executable = 'luac.sh' + + AssertLinter 'luac.sh', ale#Escape('luac.sh') . ' -p -' diff --git a/sources_non_forked/ale/test/linter/test_luacheck.vader b/sources_non_forked/ale/test/linter/test_luacheck.vader new file mode 100644 index 00000000..f0ef221c --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_luacheck.vader @@ -0,0 +1,23 @@ +Before: + call ale#assert#SetUpLinterTest('lua', 'luacheck') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The lua luacheck command callback should return the correct default string): + AssertLinter 'luacheck', + \ ale#Escape('luacheck') . ' --formatter plain --codes --filename %s -' + +Execute(The lua luacheck command callback should let you set options): + let g:ale_lua_luacheck_options = '--config filename' + + AssertLinter 'luacheck', + \ ale#Escape('luacheck') + \ . ' --config filename' + \ . ' --formatter plain --codes --filename %s -' + +Execute(The luacheck executable should be configurable): + let g:ale_lua_luacheck_executable = 'luacheck.sh' + + AssertLinter 'luacheck.sh', + \ ale#Escape('luacheck.sh') . ' --formatter plain --codes --filename %s -' diff --git a/sources_non_forked/ale/test/linter/test_markdown_markdownlint.vader b/sources_non_forked/ale/test/linter/test_markdown_markdownlint.vader new file mode 100644 index 00000000..12766cfd --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_markdown_markdownlint.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('markdown', 'markdownlint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s' + +Execute(The options should be configurable): + let g:ale_markdown_markdownlint_options = '--config ~/custom/.markdownlintrc' + + AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' --config ~/custom/.markdownlintrc %s' diff --git a/sources_non_forked/ale/test/linter/test_markdown_mdl.vader b/sources_non_forked/ale/test/linter/test_markdown_mdl.vader new file mode 100644 index 00000000..1ce4db1a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_markdown_mdl.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('markdown', 'mdl') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'mdl', ale#Escape('mdl') . ' -j' + +Execute(The executable and options should be configurable): + let g:ale_markdown_mdl_executable = 'foo bar' + let g:ale_markdown_mdl_options = '--wat' + + AssertLinter 'foo bar', ale#Escape('foo bar') . ' -j --wat' + +Execute(Setting bundle appends 'exec mdl'): + let g:ale_markdown_mdl_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') . ' exec mdl -j' diff --git a/sources_non_forked/ale/test/linter/test_markdown_vale.vader b/sources_non_forked/ale/test/linter/test_markdown_vale.vader new file mode 100644 index 00000000..5300805b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_markdown_vale.vader @@ -0,0 +1,32 @@ +Before: + call ale#assert#SetUpLinterTest('markdown', 'vale') + call ale#test#SetFilename('dummy.md') + + let g:ale_markdown_vale_executable = 'vale' + let g:ale_markdown_vale_input_file = '%t' + let g:ale_markdown_vale_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to vale): + AssertLinter 'vale', ale#Escape('vale') + \ . ' --output=JSON %t' + +Execute(Should be able to set a custom executable): + let g:ale_markdown_vale_executable = 'bin/vale' + + AssertLinter 'bin/vale' , ale#Escape('bin/vale') + \ . ' --output=JSON %t' + +Execute(Should be able to set custom options): + let g:ale_markdown_vale_options = '--foo --bar' + + AssertLinter 'vale', ale#Escape('vale') + \ . ' --output=JSON --foo --bar %t' + +Execute(Should be able to set a custom input file): + let g:ale_markdown_vale_input_file = '%s' + + AssertLinter 'vale', ale#Escape('vale') + \ . ' --output=JSON %s' diff --git a/sources_non_forked/ale/test/linter/test_mercury_mmc.vader b/sources_non_forked/ale/test/linter/test_mercury_mmc.vader new file mode 100644 index 00000000..5ab5e74f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_mercury_mmc.vader @@ -0,0 +1,22 @@ +Before: + call ale#assert#SetUpLinterTest('mercury', 'mmc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinterCwd '%s:h' + AssertLinter 'mmc', + \ ale#Escape('mmc') . ' --errorcheck-only --make --output-compile-error-lines 100 %s:t:r' + +Execute(The executable should be configurable): + let b:ale_mercury_mmc_executable = 'foo' + + AssertLinter 'foo', + \ ale#Escape('foo') . ' --errorcheck-only --make --output-compile-error-lines 100 %s:t:r' + +Execute(The options should be configurable): + let b:ale_mercury_mmc_options = '--bar' + + AssertLinter 'mmc', + \ ale#Escape('mmc') . ' --errorcheck-only --bar %s:t:r' diff --git a/sources_non_forked/ale/test/linter/test_mypy.vader b/sources_non_forked/ale/test/linter/test_mypy.vader new file mode 100644 index 00000000..bac59d92 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_mypy.vader @@ -0,0 +1,106 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'mypy') + call ale#test#SetFilename('test.py') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(The mypy callbacks should return the correct default values): + AssertLinterCwd g:dir + AssertLinter 'mypy', + \ ale#Escape('mypy') + \ . ' --show-column-numbers' + \ . ' --shadow-file %s %t %s' + +Execute(The mypy executable should be configurable, and escaped properly): + let g:ale_python_mypy_executable = 'executable with spaces' + + AssertLinter 'executable with spaces', + \ ale#Escape('executable with spaces') + \ . ' --show-column-numbers' + \ . ' --shadow-file %s %t %s' + +Execute(The mypy command callback should let you set options): + let g:ale_python_mypy_options = '--some-option' + + AssertLinter 'mypy', + \ ale#Escape('mypy') + \ . ' --some-option' + \ . ' --show-column-numbers' + \ . ' --shadow-file %s %t %s' + +Execute(The mypy command should switch directories to the detected project root): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir') + AssertLinter 'mypy', + \ ale#Escape('mypy') + \ . ' --show-column-numbers' + \ . ' --shadow-file %s %t %s' + +Execute(The mypy callbacks should detect virtualenv directories and switch to the project root): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/mypy') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir') + AssertLinter b:executable, + \ ale#Escape(b:executable) + \ . ' --show-column-numbers' + \ . ' --shadow-file %s %t %s' + +Execute(The mypy callbacks should cd to directory containing mypy.ini if found): + call ale#test#SetFilename('../test-files/python/with_mypy_ini_and_pytest_ini/tests/testsubfolder/my_tests.py') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_mypy_ini_and_pytest_ini') + AssertLinter 'mypy', + \ ale#Escape('mypy') + \ . ' --show-column-numbers' + \ . ' --shadow-file %s %t %s' + +Execute(You should able able to use the global mypy instead): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + let g:ale_python_mypy_use_global = 1 + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir') + AssertLinter 'mypy', + \ ale#Escape('mypy') + \ . ' --show-column-numbers' + \ . ' --shadow-file %s %t %s' + +Execute(Setting executable to 'pipenv' appends 'run mypy'): + let g:ale_python_mypy_executable = 'path/to/pipenv' + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run mypy' + \ . ' --show-column-numbers --shadow-file %s %t %s' + +Execute(Pipenv is detected when python_mypy_auto_pipenv is set): + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + let g:ale_python_mypy_auto_pipenv = 1 + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run mypy --show-column-numbers --shadow-file %s %t %s' + +Execute(Setting executable to 'poetry' appends 'run mypy'): + let g:ale_python_mypy_executable = 'path/to/poetry' + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run mypy' + \ . ' --show-column-numbers --shadow-file %s %t %s' + +Execute(Poetry is detected when python_mypy_auto_poetry is set): + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + let g:ale_python_mypy_auto_poetry = 1 + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run mypy --show-column-numbers --shadow-file %s %t %s' diff --git a/sources_non_forked/ale/test/linter/test_naga.vader b/sources_non_forked/ale/test/linter/test_naga.vader new file mode 100644 index 00000000..bf91604b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_naga.vader @@ -0,0 +1,10 @@ +Before: + call ale#assert#SetUpLinterTest('wgsl', 'naga') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The naga command should be customizable): + let g:ale_wgsl_naga_executable = '/path/to/naga' + AssertLinter '/path/to/naga', + \ ale#Escape('/path/to/naga') . ' --stdin-file-path %s' diff --git a/sources_non_forked/ale/test/linter/test_nagelfar.vader b/sources_non_forked/ale/test/linter/test_nagelfar.vader new file mode 100644 index 00000000..94bb1d53 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_nagelfar.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('tcl', 'nagelfar') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' %s' + + let b:ale_tcl_nagelfar_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %s' + +Execute(The options should be configurable): + let b:ale_tcl_nagelfar_options = '--something' + + AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' --something %s' diff --git a/sources_non_forked/ale/test/linter/test_nasm_nasm.vader b/sources_non_forked/ale/test/linter/test_nasm_nasm.vader new file mode 100644 index 00000000..2bfe2b0d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_nasm_nasm.vader @@ -0,0 +1,32 @@ +Before: + call ale#assert#SetUpLinterTest('nasm', 'nasm') + + let b:command_tail = + \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null') + let b:command_tail_opt = + \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null') + +After: + unlet! b:command_tail + unlet! b:command_tail_opt + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail, + + let b:ale_nasm_nasm_executable = '~/nasm' + + AssertLinter '~/nasm', ale#Escape('~/nasm') . b:command_tail + +Execute(The options should be configurable): + let b:ale_nasm_nasm_options = '-w-macro-params' + + AssertLinter 'nasm', ale#Escape('nasm') + \ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') + \ . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null') + +Execute(The options should be used in command): + let b:ale_nasm_nasm_options = '-w+orphan-labels' + + AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail_opt diff --git a/sources_non_forked/ale/test/linter/test_nimlsp.vader b/sources_non_forked/ale/test/linter/test_nimlsp.vader new file mode 100644 index 00000000..c109deef --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_nimlsp.vader @@ -0,0 +1,12 @@ +Before: + call ale#assert#SetUpLinterTest('nim', 'nimlsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(It does not set nim sources by default): + AssertLinter 'nimlsp', ale#Escape('nimlsp') + +Execute(Sets nimlsp and escapes sources from g:ale_nim_nimlsp_nim_sources): + let g:ale_nim_nimlsp_nim_sources = '/path/to /Nim' + AssertLinter 'nimlsp', ale#Escape('nimlsp') . ' ' . ale#Escape('/path/to /Nim') diff --git a/sources_non_forked/ale/test/linter/test_nix_statix.vader b/sources_non_forked/ale/test/linter/test_nix_statix.vader new file mode 100644 index 00000000..8ee4c027 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_nix_statix.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('nix', 'statix') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The statix command should be correct): + AssertLinter 'statix', ale#Escape('statix') . ' check -o errfmt --stdin' + +Execute(Additional statix options should be configurable): + let g:ale_nix_statix_check_options = '--foobar' + + AssertLinter 'statix', + \ ale#Escape('statix') . ' check -o errfmt --stdin --foobar' + +Execute(The statix command should be configurable): + let g:ale_nix_statix_check_executable = 'foo/bar' + + AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' check -o errfmt --stdin' diff --git a/sources_non_forked/ale/test/linter/test_objc_ccls.vader b/sources_non_forked/ale/test/linter/test_objc_ccls.vader new file mode 100644 index 00000000..58d824c5 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_objc_ccls.vader @@ -0,0 +1,66 @@ +Before: + call ale#assert#SetUpLinterTest('objc', 'ccls') + + Save b:ale_c_build_dir_names + Save b:ale_objc_ccls_executable + Save b:ale_objc_ccls_init_options + +After: + call ale#assert#TearDownLinterTest() + +Execute(The project root should be detected correctly using compile_commands.json file): + call ale#test#SetFilename(tempname() . '/dummy.m') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.m') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') + +Execute(The project root should be detected correctly using .ccls file): + call ale#test#SetFilename(tempname() . '/dummy.m') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.m') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls') + +Execute(The project root should be detected correctly using .ccls-root file): + call ale#test#SetFilename(tempname() . '/dummy.m') + + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ccls/with_ccls-root/dummy.m') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls-root') + +Execute(The executable should be configurable): + AssertLinter 'ccls', ale#Escape('ccls') + + let b:ale_objc_ccls_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(The initialization options should be configurable): + AssertLSPOptions {} + + let b:ale_objc_ccls_init_options = { 'cacheDirectory': '/tmp/ccls' } + + AssertLSPOptions { 'cacheDirectory': '/tmp/ccls' } + +Execute(The compile command database should be detected correctly): + call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c') + + AssertLSPOptions {} + + call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c') + + AssertLSPOptions { 'compilationDatabaseDirectory': + \ ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') } + + call ale#test#SetFilename('../test-files/ccls/with_build_dir/dummy.c') + let b:ale_c_build_dir_names = ['unusual_build_dir_name'] + + AssertLSPOptions { 'compilationDatabaseDirectory': + \ ale#path#Simplify(g:dir . '/../test-files/ccls/with_build_dir/unusual_build_dir_name') } diff --git a/sources_non_forked/ale/test/linter/test_ocaml_ocamllsp.vader b/sources_non_forked/ale/test/linter/test_ocaml_ocamllsp.vader new file mode 100644 index 00000000..4f33af18 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ocaml_ocamllsp.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('ocaml', 'ocamllsp') + + Save &filetype + let &filetype = 'ocaml' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'ocaml' + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ocamllsp/file.ml') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ocamllsp') + +Execute(The executable should be run using opam exec by default): + call ale#test#SetFilename('../test-files/ocamllsp/file.ml') + + AssertLinter 'ocamllsp', 'opam config exec -- ocamllsp' + +Execute(The executable should be run directly if use_opam flag is disabled): + let g:ale_ocaml_ocamllsp_use_opam = 0 + call ale#test#SetFilename('../test-files/ocamllsp/file.ml') + + AssertLinter 'ocamllsp', 'ocamllsp' diff --git a/sources_non_forked/ale/test/linter/test_ocaml_ols.vader b/sources_non_forked/ale/test/linter/test_ocaml_ols.vader new file mode 100644 index 00000000..89734dce --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ocaml_ols.vader @@ -0,0 +1,41 @@ +Before: + call ale#assert#SetUpLinterTest('ocaml', 'ols') + + Save &filetype + let &filetype = 'ocaml' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'ocaml' + +Execute(The default executable should be correct): + AssertLinter 'ocaml-language-server', + \ ale#Escape('ocaml-language-server') . ' --stdio' + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ols/file.ml') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ols') + +Execute(The local executable should be used when available): + call ale#test#SetFilename('../test-files/ols/file.ml') + + AssertLinter ale#path#Simplify(g:dir . '/../test-files/ols/node_modules/.bin/ocaml-language-server'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ols/node_modules/.bin/ocaml-language-server')) . ' --stdio' + +Execute(The gloabl executable should always be used when use_global is set): + let g:ale_ocaml_ols_use_global = 1 + call ale#test#SetFilename('../test-files/ols/file.ml') + + AssertLinter 'ocaml-language-server', + \ ale#Escape('ocaml-language-server') . ' --stdio' + +Execute(The executable should be configurable): + let g:ale_ocaml_ols_executable = 'foobar' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio' diff --git a/sources_non_forked/ale/test/linter/test_ocamlinterface_ocamllsp.vader b/sources_non_forked/ale/test/linter/test_ocamlinterface_ocamllsp.vader new file mode 100644 index 00000000..aa0b2100 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ocamlinterface_ocamllsp.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('ocamlinterface', 'ocamllsp') + + Save &filetype + let &filetype = 'ocamlinterface' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'ocaml.interface' + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ocamllsp/file.ml') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ocamllsp') + +Execute(The executable should be run using opam exec by default): + call ale#test#SetFilename('../test-files/ocamllsp/file.ml') + + AssertLinter 'ocamllsp', 'opam config exec -- ocamllsp' + +Execute(The executable should be run directly if use_opam flag is disabled): + let g:ale_ocaml_ocamllsp_use_opam = 0 + call ale#test#SetFilename('../test-files/ocamllsp/file.ml') + + AssertLinter 'ocamllsp', 'ocamllsp' diff --git a/sources_non_forked/ale/test/linter/test_perl.vader b/sources_non_forked/ale/test/linter/test_perl.vader new file mode 100644 index 00000000..3c4b661c --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_perl.vader @@ -0,0 +1,14 @@ +Before: + call ale#assert#SetUpLinterTest('perl', 'perl') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default Perl command callback should be correct): + AssertLinter 'perl', ale#Escape('perl') . ' -c -Mwarnings -Ilib %t' + +Execute(Overriding the executable and command should work): + let b:ale_perl_perl_executable = 'foobar' + let b:ale_perl_perl_options = '-w' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -w %t' diff --git a/sources_non_forked/ale/test/linter/test_perl6.vader b/sources_non_forked/ale/test/linter/test_perl6.vader new file mode 100644 index 00000000..d3ec6e17 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_perl6.vader @@ -0,0 +1,14 @@ +Before: + call ale#assert#SetUpLinterTest('perl6', 'perl6') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default Perl6 command callback should be correct): + AssertLinter 'perl6', 'perl6' . ' -c -Ilib %t' + +Execute(Overriding the executable and command should work): + let b:ale_perl6_perl6_executable = 'foobar' + let b:ale_perl6_perl6_options = '-w' + + AssertLinter 'foobar', 'foobar' . ' -w %t' diff --git a/sources_non_forked/ale/test/linter/test_perlcritic.vader b/sources_non_forked/ale/test/linter/test_perlcritic.vader new file mode 100644 index 00000000..0f1e2856 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_perlcritic.vader @@ -0,0 +1,36 @@ +Before: + call ale#assert#SetUpLinterTest('perl', 'perlcritic') + call ale#test#SetFilename('test.pl') + let g:ale_perl_perlcritic_profile = '' + +After: + unlet! b:readme_path + call ale#assert#TearDownLinterTest() + +Execute(The command should be correct with g:ale_perl_perlcritic_showrules off): + let b:ale_perl_perlcritic_showrules = 0 + + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor' + +Execute(The command should be correct with g:ale_perl_perlcritic_showrules on): + let b:ale_perl_perlcritic_showrules = 1 + + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m [%p]\n') . ' --nocolor' + +Execute(The command search for the profile file when set): + let b:ale_perl_perlcritic_profile = 'README.md' + + let b:readme_path = ale#path#Simplify(expand('%:p:h:h:h') . '/README.md') + + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor' + \ . ' --profile ' . ale#Escape(b:readme_path) + +Execute(Extra options should be set appropriately): + let b:ale_perl_perlcritic_options = 'beep boop' + + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor' + \ . ' beep boop' diff --git a/sources_non_forked/ale/test/linter/test_php.vader b/sources_non_forked/ale/test/linter/test_php.vader new file mode 100644 index 00000000..670d7196 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_php.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'php') + let b:command_tail = ' -l -d error_reporting=E_ALL -d display_errors=1' + \ . ' -d log_errors=0 --' + +After: + unlet! b:command_tail + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'php', ale#Escape('php') . b:command_tail + + let b:ale_php_php_executable = '/path/to/php' + + AssertLinter '/path/to/php', ale#Escape('/path/to/php') . b:command_tail diff --git a/sources_non_forked/ale/test/linter/test_php_intelephense.vader b/sources_non_forked/ale/test/linter/test_php_intelephense.vader new file mode 100644 index 00000000..d6e2469d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_php_intelephense.vader @@ -0,0 +1,26 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'intelephense') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'intelephense', + \ ale#Escape('intelephense') . ' --stdio' + +Execute(The project path should be correct for .git directories): + call ale#test#SetFilename('../test-files/php/with-git/test.php') + silent! call mkdir('../test-files/php/with-git/.git', 'p') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-git') + +Execute(The project path should be correct for composer.json file): + call ale#test#SetFilename('../test-files/php/with-composer/test.php') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-composer') + +Execute(The project cache should be saved in a temp dir): + call ale#test#SetFilename('../test-files/php/with-composer/test.php') + let g:ale_php_intelephense_config = { 'storagePath': '/tmp/intelephense' } + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-composer') diff --git a/sources_non_forked/ale/test/linter/test_php_langserver.vader b/sources_non_forked/ale/test/linter/test_php_langserver.vader new file mode 100644 index 00000000..28741713 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_php_langserver.vader @@ -0,0 +1,32 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'langserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'php-language-server.php', + \ 'php ' . ale#Escape('php-language-server.php') + +Execute(Vendor executables should be detected): + call ale#test#SetFilename('../test-files/php/test.php') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/php/vendor/bin/php-language-server.php'), + \ 'php ' . ale#Escape(ale#path#Simplify( + \ g:dir + \ . '/../test-files/php/vendor/bin/php-language-server.php' + \ )) + +Execute(The project path should be correct for .git directories): + call ale#test#SetFilename('../test-files/php/with-git/test.php') + silent! call mkdir('../test-files/php/with-git/.git') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-git') + +Execute(The project path should be correct for composer.json file): + call ale#test#SetFilename('../test-files/php/with-composer/test.php') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-composer') diff --git a/sources_non_forked/ale/test/linter/test_phpactor.vader b/sources_non_forked/ale/test/linter/test_phpactor.vader new file mode 100644 index 00000000..8968bba1 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_phpactor.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'phpactor') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'phpactor', + \ ale#Escape('phpactor') . ' language-server' + +Execute(The project path should be correct for .git directories): + call ale#test#SetFilename('../test-files/php/with-git/test.php') + silent! call mkdir('../test-files/php/with-git/.git') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-git') + +Execute(The project path should be correct for composer.json file): + call ale#test#SetFilename('../test-files/php/with-composer/test.php') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-composer') diff --git a/sources_non_forked/ale/test/linter/test_phpcs.vader b/sources_non_forked/ale/test/linter/test_phpcs.vader new file mode 100644 index 00000000..afb88e32 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_phpcs.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'phpcs') + +After: + unlet! g:executable + + call ale#assert#TearDownLinterTest() + +Execute(The local phpcs executable should be used): + call ale#test#SetFilename('../test-files/phpcs/project-with-phpcs/foo/test.php') + + let g:executable = ale#path#Simplify(g:dir . '/../test-files/phpcs/project-with-phpcs/vendor/bin/phpcs') + + AssertLinterCwd '%s:h' + AssertLinter g:executable, ale#Escape(g:executable) + \ . ' -s --report=emacs --stdin-path=%s' + +Execute(use_global should override local executable detection): + let g:ale_php_phpcs_use_global = 1 + + call ale#test#SetFilename('../test-files/phpcs/project-with-phpcs/foo/test.php') + + AssertLinter 'phpcs', ale#Escape('phpcs') + \ . ' -s --report=emacs --stdin-path=%s' + +Execute(Projects without local executables should use the global one): + call ale#test#SetFilename('../test-files/phpcs/project-without-phpcs/foo/test.php') + + AssertLinter 'phpcs', ale#Escape('phpcs') + \ . ' -s --report=emacs --stdin-path=%s' + +Execute(User provided options should be used): + let g:ale_php_phpcs_options = '--my-user-provided-option my-value' + + AssertLinter 'phpcs', ale#Escape('phpcs') + \ . ' -s --report=emacs --stdin-path=%s --my-user-provided-option my-value' + +Execute(The _standard option should be used): + let g:ale_php_phpcs_standard = 'foobar' + + AssertLinter 'phpcs', ale#Escape('phpcs') + \ . ' -s --report=emacs --stdin-path=%s --standard=' . ale#Escape('foobar') diff --git a/sources_non_forked/ale/test/linter/test_phpmd.vader b/sources_non_forked/ale/test/linter/test_phpmd.vader new file mode 100644 index 00000000..64922820 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_phpmd.vader @@ -0,0 +1,12 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'phpmd') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Custom executables should be used for the executable and command): + let g:ale_php_phpmd_executable = 'phpmd_test' + + AssertLinter 'phpmd_test', + \ ale#Escape('phpmd_test') + \ . ' %s text cleancode,codesize,controversial,design,naming,unusedcode --ignore-violations-on-exit %t' diff --git a/sources_non_forked/ale/test/linter/test_phpstan.vader b/sources_non_forked/ale/test/linter/test_phpstan.vader new file mode 100644 index 00000000..dbeb1bd1 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_phpstan.vader @@ -0,0 +1,121 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'phpstan') + + let g:old_dir = g:dir + + " Create a temporary directory and work within it, otherwise these tests + " cannot be run in parallel. + let g:dir = tempname() + call mkdir(g:dir, '', 0750) + silent! execute 'cd ' . fnameescape(g:dir) + silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(g:dir . '/test.php')) + + call delete('./phpstan.neon') + + GivenCommandOutput ['0.10.2'] + +After: + silent! execute 'cd ' . fnameescape(g:old_dir) + call delete(g:dir, 'rf') + let g:dir = g:old_dir + unlet! g:old_dir + call ale#assert#TearDownLinterTest() + +Execute(The local phpstan executable should be used): + call mkdir('vendor/bin', 'p', 0750) + call writefile([''], 'vendor/bin/phpstan') + call ale#test#SetFilename('phpstan-test-files/foo/test.php') + + let g:executable = ale#path#Simplify(g:dir . '/vendor/bin/phpstan') + + AssertLinter g:executable, + \ ale#Escape(g:executable) . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('4') . ' %s' + +Execute(use_global should override local executable detection): + let g:ale_php_phpstan_use_global = 1 + + call mkdir('vendor/bin', 'p', 0750) + call writefile([''], 'vendor/bin/phpstan') + call ale#test#SetFilename('phpstan-test-files/foo/test.php') + + AssertLinter 'phpstan', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('4') . ' %s' + +Execute(Custom executables should be used for the executable and command): + let g:ale_php_phpstan_executable = 'phpstan_test' + + AssertLinter 'phpstan_test', + \ ale#Escape('phpstan_test') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('4') . ' %s' + +Execute(project with level set to 3): + call ale#test#SetFilename('phpstan-test-files/foo/test.php') + let g:ale_php_phpstan_level = 3 + + AssertLinter 'phpstan', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('3') . ' %s' + +Execute(Custom phpstan configuration file): + let g:ale_php_phpstan_configuration = 'phpstan_config' + + AssertLinter 'phpstan', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -c ' . ale#Escape('phpstan_config') . ' -l ' . ale#Escape('4') . ' %s' + +Execute(Choose the right format for error format param): + GivenCommandOutput ['0.10.3'] + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --error-format json -l ' . ale#Escape('4') . ' %s' + \ ] + +Execute(Configuration file exists in current directory): + call writefile(['parameters:', ' level: 7'], './phpstan.neon') + let g:ale_php_phpstan_level = '' + let g:ale_php_phpstan_configuration = '' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json %s' + \ ] + +Execute(Configuration dist file exists in current directory): + call writefile(['parameters:', ' level: 7'], './phpstan.neon.dist') + let g:ale_php_phpstan_level = '' + let g:ale_php_phpstan_configuration = '' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json %s' + \ ] + +Execute(Configuration file exists in current directory, but force phpstan level): + call writefile(['parameters:', ' level: 7'], './phpstan.neon') + let g:ale_php_phpstan_configuration = '' + let g:ale_php_phpstan_level = '7' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('7') . ' %s' + \ ] + +Execute(Configuration file exists in current directory, but force phpstan configuration): + call writefile(['parameters:', ' level: 7'], './phpstan.neon') + let g:ale_php_phpstan_level = '' + let g:ale_php_phpstan_configuration = 'phpstan.custom.neon' + + AssertLinter 'phpstan', [ + \ ale#Escape('phpstan') . ' --version', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -c ' . ale#Escape('phpstan.custom.neon') . ' %s' + \ ] + +Execute(Autoload parameter is added to the command): + let g:ale_php_phpstan_autoload = 'autoload.php' + + AssertLinter 'phpstan', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -a ' . ale#Escape('autoload.php') . ' -l ' . ale#Escape('4') . ' %s' + +Execute(Memory limit parameter is added to the command): + let g:ale_php_phpstan_memory_limit = '500M' + + AssertLinter 'phpstan', + \ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('4') . ' --memory-limit ' . ale#Escape('500M') . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_pony_ponyc.vader b/sources_non_forked/ale/test/linter/test_pony_ponyc.vader new file mode 100644 index 00000000..3a3b32ec --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pony_ponyc.vader @@ -0,0 +1,12 @@ +Before: + call ale#assert#SetUpLinterTest('pony', 'ponyc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The options should be used in the command): + AssertLinter 'ponyc', ale#Escape('ponyc') . ' --pass paint' + + let b:ale_pony_ponyc_options = 'foobar' + + AssertLinter 'ponyc', ale#Escape('ponyc') . ' foobar' diff --git a/sources_non_forked/ale/test/linter/test_prospector.vader b/sources_non_forked/ale/test/linter/test_prospector.vader new file mode 100644 index 00000000..82e1596d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_prospector.vader @@ -0,0 +1,35 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'prospector') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Setting executable to 'pipenv' appends 'run prospector'): + let g:ale_python_prospector_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run prospector' + \ . ' --messages-only --absolute-paths --zero-exit --output-format json %s' + +Execute(Pipenv is detected when python_prospector_auto_pipenv is set): + let g:ale_python_prospector_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run prospector' + \ . ' --messages-only --absolute-paths --zero-exit --output-format json %s' + +Execute(Setting executable to 'poetry' appends 'run prospector'): + let g:ale_python_prospector_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run prospector' + \ . ' --messages-only --absolute-paths --zero-exit --output-format json %s' + +Execute(Poetry is detected when python_prospector_auto_poetry is set): + let g:ale_python_prospector_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run prospector' + \ . ' --messages-only --absolute-paths --zero-exit --output-format json %s' diff --git a/sources_non_forked/ale/test/linter/test_proto.vader b/sources_non_forked/ale/test/linter/test_proto.vader new file mode 100644 index 00000000..726588c0 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_proto.vader @@ -0,0 +1,16 @@ +Before: + call ale#assert#SetUpLinterTest('proto', 'protoc_gen_lint') + call ale#test#SetFilename('test.proto') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'protoc', + \ 'protoc' . ' -I ' . ale#Escape(getcwd()) . ' --lint_out=. ' . '%s' + +Execute(The callback should include any additional options): + let b:ale_proto_protoc_gen_lint_options = '--some-option' + + AssertLinter 'protoc', + \ 'protoc' . ' -I ' . ale#Escape(getcwd()) . ' --some-option --lint_out=. ' . '%s' diff --git a/sources_non_forked/ale/test/linter/test_protolint.vader b/sources_non_forked/ale/test/linter/test_protolint.vader new file mode 100644 index 00000000..4463b629 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_protolint.vader @@ -0,0 +1,24 @@ +Before: + call ale#assert#SetUpLinterTest('proto', 'protolint') + call ale#test#SetFilename('test.proto') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'protolint', + \ ale#Escape('protolint') + \ . ' lint' + \ . ' -reporter=unix' + \ . ' %s' + +Execute(The callback should include any additional options): + let b:ale_proto_protolint_executable = '/tmp/protolint' + let b:ale_proto_protolint_config = '/tmp/protolint.yaml' + + AssertLinter '/tmp/protolint', + \ ale#Escape('/tmp/protolint') + \ . ' lint' + \ . ' -config_path=' . ale#Escape('/tmp/protolint.yaml') + \ . ' -reporter=unix' + \ . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_psalm.vader b/sources_non_forked/ale/test/linter/test_psalm.vader new file mode 100644 index 00000000..94e718d4 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_psalm.vader @@ -0,0 +1,44 @@ +Before: + call ale#assert#SetUpLinterTest('php', 'psalm') + +After: + unlet! g:i + unlet! g:matched + + if isdirectory(g:dir . '/.git') + call delete(g:dir . '/.git', 'd') + endif + + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'psalm', + \ ale#Escape('psalm') . ' --language-server' + +Execute(Vendor executables should be detected): + call ale#test#SetFilename('../test-files/psalm/test.php') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/psalm/vendor/bin/psalm'), + \ ale#Escape(ale#path#Simplify( + \ g:dir + \ . '/../test-files/psalm/vendor/bin/psalm' + \ )) . ' --language-server' + + let g:ale_php_psalm_use_global = 1 + + AssertLinter 'psalm', + \ ale#Escape('psalm') . ' --language-server' + +Execute(User provided options should be used): + let g:ale_php_psalm_options = '--my-user-provided-option my-value' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'psalm', + \ ale#Escape('psalm') + \ . ' --language-server --my-user-provided-option my-value' + +Execute(The project path should be correct for composer.json file): + call ale#test#SetFilename('../test-files/php/with-composer/test.php') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/php/with-composer') diff --git a/sources_non_forked/ale/test/linter/test_puglint.vader b/sources_non_forked/ale/test/linter/test_puglint.vader new file mode 100644 index 00000000..8a445408 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_puglint.vader @@ -0,0 +1,48 @@ +Before: + call ale#assert#SetUpLinterTest('pug', 'puglint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(puglint should detect local executables and package.json): + call ale#test#SetFilename('../test-files/puglint/test.pug') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/package.json')) + \ . ' -r inline %t' + +Execute(puglint should use global executables if configured): + let g:ale_pug_puglint_use_global = 1 + + call ale#test#SetFilename('../test-files/puglint/test.pug') + + AssertLinter 'pug-lint', + \ ale#Escape('pug-lint') + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/package.json')) + \ . ' -r inline %t' + +Execute(puglint should detect .pug-lintrc): + call ale#test#SetFilename('../test-files/puglint/puglint_rc_dir/subdir/test.pug') + + AssertLinter ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/puglint_rc_dir/.pug-lintrc')) + \ . ' -r inline %t' + +Execute(puglint should detect .pug-lintrc.js): + call ale#test#SetFilename('../test-files/puglint/puglint_rc_js_dir/subdir/test.pug') + + AssertLinter ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/puglint_rc_js_dir/.pug-lintrc.js')) + \ . ' -r inline %t' + +Execute(puglint should detect .pug-lintrc.json): + call ale#test#SetFilename('../test-files/puglint/puglint_rc_json_dir/subdir/test.pug') + + AssertLinter ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/node_modules/.bin/pug-lint')) + \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/puglint/puglint_rc_json_dir/.pug-lintrc.json')) + \ . ' -r inline %t' diff --git a/sources_non_forked/ale/test/linter/test_purescript_ls.vader b/sources_non_forked/ale/test/linter/test_purescript_ls.vader new file mode 100644 index 00000000..3ef9707a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_purescript_ls.vader @@ -0,0 +1,31 @@ +Before: + call ale#assert#SetUpLinterTest('purescript', 'ls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'purescript-language-server', ale#Escape('purescript-language-server') . ' --stdio' + +Execute(should set correct LSP values): + call ale#test#SetFilename('../test-files/purescript/spago/Foo.purs') + + AssertLSPLanguage 'purescript' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/purescript/spago') + +Execute(should set correct project for bower): + call ale#test#SetFilename('../test-files/purescript/bower/Foo.purs') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/purescript/bower') + +Execute(should set correct project for psc-package): + call ale#test#SetFilename('../test-files/purescript/psc-package/Foo.purs') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/purescript/psc-package') + +Execute(should accept configuration settings): + AssertLSPConfig {} + let b:ale_purescript_ls_config = {'purescript': {'addSpagoSources': v:true}} + AssertLSPConfig {'purescript': {'addSpagoSources': v:true}} diff --git a/sources_non_forked/ale/test/linter/test_pycodestyle.vader b/sources_non_forked/ale/test/linter/test_pycodestyle.vader new file mode 100644 index 00000000..fac53d9f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pycodestyle.vader @@ -0,0 +1,46 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pycodestyle') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The pycodestyle command callback should return default string): + AssertLinter 'pycodestyle', ale#Escape('pycodestyle') . ' -' + +Execute(The pycodestyle command callback should allow options): + let g:ale_python_pycodestyle_options = '--exclude=test*.py' + + AssertLinter 'pycodestyle', + \ ale#Escape('pycodestyle') . ' --exclude=test*.py -' + +Execute(The pycodestyle executable should be configurable): + let g:ale_python_pycodestyle_executable = '~/.local/bin/pycodestyle' + + AssertLinter '~/.local/bin/pycodestyle', + \ ale#Escape('~/.local/bin/pycodestyle') . ' -' + +Execute(Setting executable to 'pipenv' appends 'run pycodestyle'): + let g:ale_python_pycodestyle_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run pycodestyle -' + +Execute(Pipenv is detected when python_pycodestyle_auto_pipenv is set): + let g:ale_python_pycodestyle_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run pycodestyle -' + +Execute(Setting executable to 'poetry' appends 'run pycodestyle'): + let g:ale_python_pycodestyle_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run pycodestyle -' + +Execute(Poetry is detected when python_pycodestyle_auto_poetry is set): + let g:ale_python_pycodestyle_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run pycodestyle -' diff --git a/sources_non_forked/ale/test/linter/test_pydocstyle.vader b/sources_non_forked/ale/test/linter/test_pydocstyle.vader new file mode 100644 index 00000000..fc7fbbf2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pydocstyle.vader @@ -0,0 +1,45 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pydocstyle') + call ale#test#SetFilename('example/test.py') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The pydocstyle command callback should return default string): + AssertLinterCwd '%s:h' + AssertLinter 'pydocstyle', ale#Escape('pydocstyle') . ' %s' + +Execute(The pydocstyle command callback should allow options): + let g:ale_python_pydocstyle_options = '--verbose' + + AssertLinter 'pydocstyle', ale#Escape('pydocstyle') . ' --verbose %s' + +Execute(The pydocstyle executable should be configurable): + let g:ale_python_pydocstyle_executable = '~/.local/bin/pydocstyle' + + AssertLinter '~/.local/bin/pydocstyle', + \ ale#Escape('~/.local/bin/pydocstyle') . ' %s' + +Execute(Setting executable to 'pipenv' appends 'run pydocstyle'): + let g:ale_python_pydocstyle_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run pydocstyle %s' + +Execute(Pipenv is detected when python_pydocstyle_auto_pipenv is set): + let g:ale_python_pydocstyle_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pydocstyle %s' + +Execute(Setting executable to 'poetry' appends 'run pydocstyle'): + let g:ale_python_pydocstyle_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run pydocstyle %s' + +Execute(Poetry is detected when python_pydocstyle_auto_poetry is set): + let g:ale_python_pydocstyle_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', ale#Escape('poetry') . ' run pydocstyle %s' diff --git a/sources_non_forked/ale/test/linter/test_pyflakes.vader b/sources_non_forked/ale/test/linter/test_pyflakes.vader new file mode 100644 index 00000000..61aee562 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pyflakes.vader @@ -0,0 +1,60 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pyflakes') + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(The pyflakes command callback should return default string): + AssertLinter 'pyflakes', ale#Escape('pyflakes') . ' %t' + +Execute(The pyflakes executable should be configurable): + let g:ale_python_pyflakes_executable = '~/.local/bin/pyflakes' + + AssertLinter '~/.local/bin/pyflakes', + \ ale#Escape('~/.local/bin/pyflakes') . ' %t' + +Execute(The pyflakes executable should be run from the virtualenv path): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pyflakes' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' %t' + +Execute(You should be able to override the pyflakes virtualenv lookup): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let g:ale_python_pyflakes_use_global = 1 + + AssertLinter 'pyflakes', ale#Escape('pyflakes') . ' %t' + +Execute(Setting executable to 'pipenv' appends 'run pyflakes'): + let g:ale_python_pyflakes_executable = 'path/to/pipenv' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run pyflakes %t', + +Execute(Pipenv is detected when python_pyflakes_auto_pipenv is set): + let g:ale_python_pyflakes_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run pyflakes %t' + +Execute(Setting executable to 'poetry' appends 'run pyflakes'): + let g:ale_python_pyflakes_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run pyflakes %t', + +Execute(Poetry is detected when python_pyflakes_auto_poetry is set): + let g:ale_python_pyflakes_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run pyflakes %t' diff --git a/sources_non_forked/ale/test/linter/test_pylama.vader b/sources_non_forked/ale/test/linter/test_pylama.vader new file mode 100644 index 00000000..3c6a6efa --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pylama.vader @@ -0,0 +1,88 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pylama') + call ale#test#SetFilename('test.py') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + let b:command_tail = ' %s' + +After: + unlet! b:bin_dir + unlet! b:executable + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The default pylama command should be correct): + AssertLinterCwd ale#path#Simplify(g:dir) + AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail + +Execute(The option for disabling changing directories should work): + let g:ale_python_pylama_change_directory = 0 + + AssertLinterCwd '' + AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail + +Execute(The pylama executable should be configurable, and escaped properly): + let g:ale_python_pylama_executable = 'executable with spaces' + + AssertLinterCwd ale#path#Simplify(g:dir) + AssertLinter 'executable with spaces', + \ ale#Escape('executable with spaces') . b:command_tail + +Execute(The pylama command callback should let you set options): + let g:ale_python_pylama_options = '--some-option' + + AssertLinterCwd ale#path#Simplify(g:dir) + AssertLinter 'pylama', ale#Escape('pylama') . ' --some-option' . b:command_tail + +Execute(The pylama command callback should switch directories to the detected project root): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir') + AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail + +Execute(The pylama command callback shouldn't detect virtualenv directories where they don't exist): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir') + AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail + +Execute(The pylama command callback should detect virtualenv directories and switch to the project root): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pylama' + \) + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir') + AssertLinter b:executable, ale#Escape(b:executable) . b:command_tail + +Execute(You should able able to use the global pylama instead): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + let g:ale_python_pylama_use_global = 1 + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir') + AssertLinter 'pylama', ale#Escape('pylama') . b:command_tail + +Execute(Setting executable to 'pipenv' appends 'run pylama'): + let g:ale_python_pylama_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run pylama' . b:command_tail + +Execute(Pipenv is detected when python_pylama_auto_pipenv is set): + let g:ale_python_pylama_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pylama' . b:command_tail + +Execute(Setting executable to 'poetry' appends 'run pylama'): + let g:ale_python_pylama_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run pylama' . b:command_tail + +Execute(poetry is detected when python_pylama_auto_poetry is set): + let g:ale_python_pylama_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', ale#Escape('poetry') . ' run pylama' . b:command_tail diff --git a/sources_non_forked/ale/test/linter/test_pylint.vader b/sources_non_forked/ale/test/linter/test_pylint.vader new file mode 100644 index 00000000..d15161e6 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pylint.vader @@ -0,0 +1,96 @@ +Before: + Save g:ale_python_auto_pipenv + + let g:ale_python_auto_pipenv = 0 + + call ale#assert#SetUpLinterTest('python', 'pylint') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' + + GivenCommandOutput ['pylint 2.3.0'] + +After: + unlet! b:bin_dir + unlet! b:executable + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The pylint callbacks should return the correct default values): + AssertLinterCwd expand('%:p:h') + AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail + +Execute(Pylint should run with the --from-stdin in new enough versions): + GivenCommandOutput ['pylint 2.4.0'] + + AssertLinterCwd expand('%:p:h') + AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail[:-3] . '--from-stdin %s' + +Execute(The option for disabling changing directories should work): + let g:ale_python_pylint_change_directory = 0 + + AssertLinterCwd '' + AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail + +Execute(The pylint executable should be configurable, and escaped properly): + let g:ale_python_pylint_executable = 'executable with spaces' + + AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . b:command_tail + +Execute(The pylint command callback should let you set options): + let g:ale_python_pylint_options = '--some-option' + + AssertLinter 'pylint', ale#Escape('pylint') . ' --some-option' . b:command_tail + +Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir') + AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail + +Execute(The pylint callbacks should detect virtualenv directories): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pylint' + \) + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir') + AssertLinter b:executable, ale#Escape(b:executable) . b:command_tail + +Execute(You should able able to use the global pylint instead): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + let g:ale_python_pylint_use_global = 1 + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir') + AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail + +Execute(Setting executable to 'pipenv' appends 'run pylint'): + let g:ale_python_pylint_executable = 'path/to/pipenv' + let g:ale_python_pylint_use_global = 1 + + AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run pylint' + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' + +Execute(Pipenv is detected when python_pylint_auto_pipenv is set): + let g:ale_python_pylint_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinterCwd expand('%:p:h') + AssertLinter 'pipenv', ale#Escape('pipenv') . ' run pylint' + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' + +Execute(Setting executable to 'poetry' appends 'run pylint'): + let g:ale_python_pylint_executable = 'path/to/poetry' + let g:ale_python_pylint_use_global = 1 + + AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run pylint' + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' + +Execute(poetry is detected when python_pylint_auto_poetry is set): + let g:ale_python_pylint_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinterCwd expand('%:p:h') + AssertLinter 'poetry', ale#Escape('poetry') . ' run pylint' + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' diff --git a/sources_non_forked/ale/test/linter/test_pylsp.vader b/sources_non_forked/ale/test/linter/test_pylsp.vader new file mode 100644 index 00000000..290fdbf3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pylsp.vader @@ -0,0 +1,70 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pylsp') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(The pylsp command callback should return default string): + AssertLinter 'pylsp', ale#Escape('pylsp') + +Execute(The pylsp executable should be configurable): + let g:ale_python_pylsp_executable = '~/.local/bin/pylsp' + + AssertLinter '~/.local/bin/pylsp' , ale#Escape('~/.local/bin/pylsp') + +Execute(The pylsp command callback should let you set options): + let g:ale_python_pylsp_options = '--some-option' + + AssertLinter 'pylsp', ale#Escape('pylsp') . ' --some-option' + +Execute(The pylsp executable should be run from the virtualenv path): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pylsp' + \) + + AssertEqual ale#Escape(b:executable), + \ ale_linters#python#pylsp#GetCommand(bufnr('')) + +Execute(You should be able to override the pylsp virtualenv lookup): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let g:ale_python_pylsp_use_global = 1 + + AssertLinter 'pylsp', ale#Escape('pylsp') + +Execute(Setting executable to 'pipenv' appends 'run pylsp'): + let g:ale_python_pylsp_executable = 'path/to/pipenv' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run pylsp' + +Execute(Pipenv is detected when python_pylsp_auto_pipenv is set): + let g:ale_python_pylsp_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run pylsp' + +Execute(Setting executable to 'poetry' appends 'run pylsp'): + let g:ale_python_pylsp_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run pylsp' + +Execute(poetry is detected when python_pylsp_auto_poetry is set): + let g:ale_python_pylsp_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run pylsp' + +Execute(Should accept configuration settings): + AssertLSPConfig {} + let b:ale_python_pylsp_config = {'pylsp': {'plugins': {'preload': {'enabled': v:false}}}} + AssertLSPConfig {'pylsp': {'plugins': {'preload': {'enabled': v:false}}}} diff --git a/sources_non_forked/ale/test/linter/test_pyre.vader b/sources_non_forked/ale/test/linter/test_pyre.vader new file mode 100644 index 00000000..331d97ed --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pyre.vader @@ -0,0 +1,67 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pyre') + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(The pyre command callback should return default string): + AssertLinter 'pyre', ale#Escape('pyre') . ' persistent' + +Execute(The pyre executable should be configurable): + let g:ale_python_pyre_executable = '~/.local/bin/pyre' + + AssertLinter '~/.local/bin/pyre', + \ ale#Escape('~/.local/bin/pyre') . ' persistent' + +Execute(The pyre executable should be run from the virtualenv path): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pyre' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' persistent' + +Execute(You should be able to override the pyre virtualenv lookup): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let g:ale_python_pyre_use_global = 1 + + AssertLinter 'pyre', ale#Escape('pyre') . ' persistent' + +Execute(Setting executable to 'pipenv' appends 'run pyre'): + let g:ale_python_pyre_executable = 'path/to/pipenv' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'path/to/pipenv', + \ ale#Escape('path/to/pipenv') . ' run pyre persistent' + +Execute(Pipenv is detected when python_pyre_auto_pipenv is set): + let g:ale_python_pyre_auto_pipenv = 1 + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + + AssertLinter 'pipenv', + \ ale#Escape('pipenv') . ' run pyre persistent' + +Execute(Setting executable to 'poetry' appends 'run pyre'): + let g:ale_python_pyre_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', + \ ale#Escape('path/to/poetry') . ' run pyre persistent' + +Execute(Poetry is detected when python_pyre_auto_poetry is set): + let g:ale_python_pyre_auto_poetry = 1 + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + + AssertLinter 'poetry', + \ ale#Escape('poetry') . ' run pyre persistent' + +Execute(The FindProjectRoot should detect the project root directory for namespace package via .pyre_configuration.local): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/pyre_configuration_dir/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/pyre_configuration_dir'), + \ ale#python#FindProjectRoot(bufnr('')) diff --git a/sources_non_forked/ale/test/linter/test_pyrex_cython.vader b/sources_non_forked/ale/test/linter/test_pyrex_cython.vader new file mode 100644 index 00000000..af86366a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pyrex_cython.vader @@ -0,0 +1,30 @@ +Before: + call ale#assert#SetUpLinterTest('pyrex', 'cython') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default cython command should be correct): + AssertLinter 'cython', ale#Escape('cython') + \ . ' --working %s:h' + \ . ' --include-dir %s:h' + \ . ' --warning-extra' + \ . ' --output-file ' . g:ale#util#nul_file . ' %t' + +Execute(The cython executable should be configurable): + let b:ale_pyrex_cython_executable = 'cython_foobar' + + AssertLinter 'cython_foobar', ale#Escape('cython_foobar') + \ . ' --working %s:h' + \ . ' --include-dir %s:h' + \ . ' --warning-extra' + \ . ' --output-file ' . g:ale#util#nul_file . ' %t' + +Execute(Additional cython options should be configurable): + let b:ale_pyrex_cython_options = '--foobar' + + AssertLinter 'cython', ale#Escape('cython') + \ . ' --working %s:h' + \ . ' --include-dir %s:h' + \ . ' --foobar' + \ . ' --output-file ' . g:ale#util#nul_file . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_pyright.vader b/sources_non_forked/ale/test/linter/test_pyright.vader new file mode 100644 index 00000000..51510cf2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_pyright.vader @@ -0,0 +1,116 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'pyright') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(The command callback should return the correct default string): + AssertLinter + \ 'pyright-langserver', + \ ale#Escape('pyright-langserver') . ' --stdio' + +Execute(The executable should be configurable): + let g:ale_python_pyright_executable = '/bin/foo-bar' + + AssertLinter + \ '/bin/foo-bar', + \ ale#Escape('/bin/foo-bar') . ' --stdio' + +Execute(The default configuration should be mostly empty): + " The default configuration needs to have at least one key in it, + " or the server won't start up properly. + AssertLSPConfig {'python': {}} + + let b:ale_python_pyright_config = {} + + AssertLSPConfig {'python': {}} + +Execute(virtualenv paths should be set in configuration by default): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + AssertLSPConfig { + \ 'python': { + \ 'pythonPath': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/python'), + \ 'venvPath': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env'), + \ }, + \} + +Execute(The pythonPath should be set based on whatever the ovveride for the venvPath is set to): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + " This overrides the default detection of the path. + let b:ale_python_pyright_config = { + \ 'python': { + \ 'venvPath': '/foo/bar', + \ }, + \} + + AssertLSPConfig { + \ 'python': { + \ 'pythonPath': ale#path#Simplify('/foo/bar/' . b:bin_dir . '/python'), + \ 'venvPath': '/foo/bar', + \ }, + \} + +Execute(You should be able to override pythonPath when venvPath is detected): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + " This overrides the default detection of the path. + let b:ale_python_pyright_config = { + \ 'python': { + \ 'pythonPath': '/bin/python', + \ }, + \} + + AssertLSPConfig { + \ 'python': { + \ 'pythonPath': '/bin/python', + \ 'venvPath': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env'), + \ }, + \} + +Execute(You should be able to override both pythonPath and venvPath): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + " This overrides the default detection of the path. + let b:ale_python_pyright_config = { + \ 'python': { + \ 'pythonPath': '/bin/python', + \ 'venvPath': '/other/dir', + \ }, + \} + + AssertLSPConfig { + \ 'python': { + \ 'pythonPath': '/bin/python', + \ 'venvPath': '/other/dir', + \ }, + \} + +Execute(You should be able to define other settings): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:ale_python_pyright_config = { + \ 'python': { + \ 'analysis': {'logLevel': 'warning'}, + \ }, + \ 'pyright': { + \ 'disableLanguageServices': v:true, + \ }, + \} + + AssertLSPConfig { + \ 'python': { + \ 'analysis': {'logLevel': 'warning'}, + \ 'pythonPath': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/python'), + \ 'venvPath': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env'), + \ }, + \ 'pyright': { + \ 'disableLanguageServices': v:true, + \ }, + \} diff --git a/sources_non_forked/ale/test/linter/test_qmlfmt.vader b/sources_non_forked/ale/test/linter/test_qmlfmt.vader new file mode 100644 index 00000000..53502f4d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_qmlfmt.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('qml', 'qmlfmt') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The qml qmlfmt command callback should return the correct default string): + AssertLinter 'qmlfmt', ale#Escape('qmlfmt') . ' -e', + +Execute(The qmlfmt executable should be configurable): + let g:ale_qml_qmlfmt_executable = '~/.local/bin/qmlfmt' + + AssertLinter '~/.local/bin/qmlfmt', ale#Escape('~/.local/bin/qmlfmt') . ' -e' diff --git a/sources_non_forked/ale/test/linter/test_r_languageserver.vader b/sources_non_forked/ale/test/linter/test_r_languageserver.vader new file mode 100644 index 00000000..1a6fe851 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_r_languageserver.vader @@ -0,0 +1,22 @@ +Before: + call ale#assert#SetUpLinterTest('r', 'languageserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'Rscript', 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape('languageserver::run()') + +Execute(The project root should be detected correctly): + AssertLSPProject '.' + + call ale#test#SetFilename('../test-files/r/dummy/test.R') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/r') + +Execute(Should accept configuration settings): + AssertLSPConfig {} + + let b:ale_r_languageserver_config = {'r': {'lsp': {'debug': 'true', 'diagnostics': 'true'}}} + + AssertLSPConfig {'r': {'lsp': {'debug': 'true', 'diagnostics': 'true'}}} diff --git a/sources_non_forked/ale/test/linter/test_racket_langserver.vader b/sources_non_forked/ale/test/linter/test_racket_langserver.vader new file mode 100644 index 00000000..021eb565 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_racket_langserver.vader @@ -0,0 +1,45 @@ +" Author: D. Ben Knoble +" Description: Tests for racket-langserver lsp linter. +Before: + call ale#assert#SetUpLinterTest('racket', 'langserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(command callback should return default string): + AssertLinter 'racket', ale#Escape('racket').' -l racket-langserver' + +Execute(should set racket-langserver for deep module 3): + call ale#test#SetFilename('../test-files/racket/many-inits/a/b/c/foo.rkt') + AssertLSPLanguage 'racket' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits') + +Execute(should set racket-langserver for deep module 2): + call ale#test#SetFilename('../test-files/racket/many-inits/a/b/foo.rkt') + AssertLSPLanguage 'racket' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits') + +Execute(should set racket-langserver for deep module 1): + call ale#test#SetFilename('../test-files/racket/many-inits/a/foo.rkt') + AssertLSPLanguage 'racket' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits') + +Execute(should set racket-langserver for top-level module): + call ale#test#SetFilename('../test-files/racket/many-inits/foo.rkt') + AssertLSPLanguage 'racket' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits') + +Execute(should set racket-langserver for non-package module or script): + call ale#test#SetFilename('../test-files/racket/simple-script/foo.rkt') + AssertLSPLanguage 'racket' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#test#GetFilename('../test-files/racket/simple-script') diff --git a/sources_non_forked/ale/test/linter/test_racket_raco.vader b/sources_non_forked/ale/test/linter/test_racket_raco.vader new file mode 100644 index 00000000..fb83ffa1 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_racket_raco.vader @@ -0,0 +1,10 @@ +Before: + call ale#assert#SetUpLinterTest('racket', 'raco') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command and executable should be correct): + AssertLinter 'raco', 'raco expand %s' + + diff --git a/sources_non_forked/ale/test/linter/test_rails_best_practices.vader b/sources_non_forked/ale/test/linter/test_rails_best_practices.vader new file mode 100644 index 00000000..6a6f7a53 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rails_best_practices.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'rails_best_practices') + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb') + + let b:args = '--silent -f json' + \ . ' --output-file ' . (has('win32') ? '%t' : '/dev/stdout') + let b:app_path = ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app') + let b:suffix = has('win32') ? '; type %t' : '' + +After: + unlet! b:args + unlet! b:app_path + unlet! b:suffix + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to rails_best_practices): + AssertLinter 'rails_best_practices', ale#Escape('rails_best_practices') + \ . ' ' . b:args + \ . ' ' . ale#Escape(b:app_path) + \ . b:suffix + +Execute(Should be able to set a custom executable): + let g:ale_ruby_rails_best_practices_executable = 'bin/rails_best_practices' + + AssertLinter 'bin/rails_best_practices', ale#Escape('bin/rails_best_practices') + \ . ' ' . b:args + \ . ' ' . ale#Escape(b:app_path) + \ . b:suffix + +Execute(Setting bundle appends 'exec rails_best_practices'): + let g:ale_ruby_rails_best_practices_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + \ . ' exec rails_best_practices' + \ . ' ' . b:args + \ . ' ' . ale#Escape(b:app_path) + \ . b:suffix + +Execute(Command callback should be empty when not in a valid Rails app): + call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/test.rb') + + AssertLinter 'rails_best_practices', '' diff --git a/sources_non_forked/ale/test/linter/test_reason_ls.vader b/sources_non_forked/ale/test/linter/test_reason_ls.vader new file mode 100644 index 00000000..57ea7302 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_reason_ls.vader @@ -0,0 +1,21 @@ +Before: + call ale#assert#SetUpLinterTest('reason', 'ls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The linter should not be run by default): + AssertLinterNotExecuted + +Execute(The executable should be configurable): + let b:ale_reason_ls_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(There should be no default project root): + AssertLSPProject '' + +Execute(The project root should be detected using bsconfig.json): + call ale#test#SetFilename('../test-files/reasonml/test.ml') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/reasonml') diff --git a/sources_non_forked/ale/test/linter/test_reason_ols.vader b/sources_non_forked/ale/test/linter/test_reason_ols.vader new file mode 100644 index 00000000..fb90e36f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_reason_ols.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('reason', 'ols') + + Save &filetype + let &filetype = 'reason' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'reason' + +Execute(The default executable should be correct): + AssertLinter 'ocaml-language-server', + \ ale#Escape('ocaml-language-server') . ' --stdio' + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/ols/file.re') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ols') + +Execute(The local executable should be used when available): + call ale#test#SetFilename('../test-files/ols/file.re') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/ols/node_modules/.bin/ocaml-language-server'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ols/node_modules/.bin/ocaml-language-server')) . ' --stdio' + +Execute(The gloabl executable should always be used when use_global is set): + let g:ale_reason_ols_use_global = 1 + call ale#test#SetFilename('../test-files/ols/file.re') + + AssertLinter 'ocaml-language-server', + \ ale#Escape('ocaml-language-server') . ' --stdio' + +Execute(The executable should be configurable): + let g:ale_reason_ols_executable = 'foobar' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio' diff --git a/sources_non_forked/ale/test/linter/test_reek.vader b/sources_non_forked/ale/test/linter/test_reek.vader new file mode 100644 index 00000000..798c3314 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_reek.vader @@ -0,0 +1,49 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'reek') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The reek callbacks should return the correct default values): + GivenCommandOutput ['reek 5.0.0'] + AssertLinter 'reek', [ + \ ale#Escape('reek') . ' --version', + \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', + \] + + " Try with older versions. + call ale#semver#ResetVersionCache() + + GivenCommandOutput ['reek 4.8.2'] + AssertLinter 'reek', [ + \ ale#Escape('reek') . ' --version', + \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion', + \] + +Execute(Setting bundle appends 'exec reek'): + let g:ale_ruby_reek_executable = 'bundle' + + GivenCommandOutput ['reek 5.0.0'] + AssertLinter 'bundle', ale#Escape('bundle') + \ . ' exec reek' + \ . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', + + " Try with older versions. + call ale#semver#ResetVersionCache() + + GivenCommandOutput ['reek 4.8.2'] + AssertLinter 'bundle', ale#Escape('bundle') + \ . ' exec reek' + \ . ' -f json --no-progress --no-color --force-exclusion' + +Execute(The reek version check should be cached): + GivenCommandOutput ['reek 5.0.0'] + AssertLinter 'reek', [ + \ ale#Escape('reek') . ' --version', + \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', + \] + + GivenCommandOutput [] + AssertLinter 'reek', [ + \ ale#Escape('reek') . ' -f json --no-progress --no-color --force-exclusion --stdin-filename %s', + \] diff --git a/sources_non_forked/ale/test/linter/test_rego_opacheck.vader b/sources_non_forked/ale/test/linter/test_rego_opacheck.vader new file mode 100644 index 00000000..886a9339 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rego_opacheck.vader @@ -0,0 +1,16 @@ + +" Based upon :help ale-development +Before: + call ale#assert#SetUpLinterTest('rego', 'opacheck') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'opa', + \ ale#Escape('opa') . ' check %s --format json ' + +Execute(The default command should be overriden): + let b:ale_rego_opacheck_executable = '/bin/other/opa' + AssertLinter '/bin/other/opa', + \ ale#Escape('/bin/other/opa') . ' check %s --format json ' diff --git a/sources_non_forked/ale/test/linter/test_remark_lint.vader b/sources_non_forked/ale/test/linter/test_remark_lint.vader new file mode 100644 index 00000000..a34f0a90 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_remark_lint.vader @@ -0,0 +1,37 @@ +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('markdown', 'remark_lint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'remark', + \ ale#Escape('remark') . ' --no-stdout --no-color' + +Execute(The executable should be configurable): + let b:ale_markdown_remark_lint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' --no-stdout --no-color' + +Execute(The options should be configurable): + let b:ale_markdown_remark_lint_options = '--something' + + AssertLinter 'remark', + \ ale#Escape('remark') . ' --something --no-stdout --no-color' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('../test-files/remark_lint/with_bin_path/foo.md') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/remark_lint/with_bin_path/node_modules/.bin/remark'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/remark_lint/with_bin_path/node_modules/.bin/remark')) + \ . ' --no-stdout --no-color' + +Execute(The global executable should be uesd if the option is set): + let b:ale_markdown_remark_lint_use_global = 1 + call ale#test#SetFilename('../test-files/remark_lint/with_bin_path/foo.md') + + AssertLinter 'remark', ale#Escape('remark') + \ . ' --no-stdout --no-color' diff --git a/sources_non_forked/ale/test/linter/test_revive.vader b/sources_non_forked/ale/test/linter/test_revive.vader new file mode 100644 index 00000000..172294f3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_revive.vader @@ -0,0 +1,30 @@ +Before: + Save g:ale_go_go111module + + call ale#assert#SetUpLinterTest('go', 'revive') + +After: + Restore + + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The default revive command should be correct): + AssertLinter 'revive', ale#Escape('revive') . ' %t' + +Execute(The revive executable should be configurable): + let b:ale_go_revive_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %t' + +Execute(The revive options should be configurable): + let b:ale_go_revive_options = '--foo' + + AssertLinter 'revive', ale#Escape('revive') . ' --foo %t' + +Execute(The revive command should support Go environment variables): + let b:ale_go_go111module = 'on' + + AssertLinter 'revive', + \ ale#Env('GO111MODULE', 'on') . ale#Escape('revive') . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_rflint.vader b/sources_non_forked/ale/test/linter/test_rflint.vader new file mode 100644 index 00000000..0ee97b30 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rflint.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('robot', 'rflint') + let b:rflint_format = ' --format' + \ . ' "{filename}:{severity}:{linenumber}:{char}:{rulename}:{message}" %s' + +After: + call ale#assert#TearDownLinterTest() + unlet! b:rflint_format + +Execute(The rflint command callback should return default string): + AssertLinter 'rflint', + \ 'rflint' + \ . b:rflint_format + +Execute(The rflint executable should be configurable): + let g:ale_robot_rflint_executable = '~/.local/bin/rflint' + + AssertLinter '~/.local/bin/rflint', + \ '~/.local/bin/rflint' + \ . b:rflint_format diff --git a/sources_non_forked/ale/test/linter/test_rnix.vader b/sources_non_forked/ale/test/linter/test_rnix.vader new file mode 100644 index 00000000..8970ee99 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rnix.vader @@ -0,0 +1,12 @@ +" Author: jD91mZM2 +" Description: Tests for rnix-lsp language client +Before: + call ale#assert#SetUpLinterTest('nix', 'rnix_lsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should start rnix-lsp): + AssertLSPLanguage 'nix' + AssertLSPOptions {} + AssertLSPProject ale#path#Simplify('.') diff --git a/sources_non_forked/ale/test/linter/test_rst_textlint.vader b/sources_non_forked/ale/test/linter/test_rst_textlint.vader new file mode 100644 index 00000000..b2d99636 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rst_textlint.vader @@ -0,0 +1,65 @@ +" Author: januswel, w0rp + +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('rst', 'textlint') + + " The configuration is shared between many languages. + Save g:ale_textlint_executable + Save g:ale_textlint_use_global + Save g:ale_textlint_options + + let g:ale_textlint_executable = 'textlint' + let g:ale_textlint_use_global = 0 + let g:ale_textlint_options = '' + + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + +After: + unlet! b:command_tail + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' + +Execute(The executable should be configurable): + let b:ale_textlint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' + +Execute(The options should be configurable): + let b:ale_textlint_options = '--something' + + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint')) + \ . ' -f json --stdin --stdin-filename %s' + +Execute(The local executable from textlint/bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_textlint_bin_path/foo.txt') + + if has('win32') + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + else + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + endif diff --git a/sources_non_forked/ale/test/linter/test_rubocop.vader b/sources_non_forked/ale/test/linter/test_rubocop.vader new file mode 100644 index 00000000..e7cc32e8 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rubocop.vader @@ -0,0 +1,26 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'rubocop') + call ale#test#SetFilename('dummy.rb') + + let g:ale_ruby_rubocop_executable = 'rubocop' + let g:ale_ruby_rubocop_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to rubocop): + AssertLinter 'rubocop', ale#Escape('rubocop') + \ . ' --format json --force-exclusion --stdin %s' + +Execute(Should be able to set a custom executable): + let g:ale_ruby_rubocop_executable = 'bin/rubocop' + + AssertLinter 'bin/rubocop' , ale#Escape('bin/rubocop') + \ . ' --format json --force-exclusion --stdin %s' + +Execute(Setting bundle appends 'exec rubocop'): + let g:ale_ruby_rubocop_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + \ . ' exec rubocop' + \ . ' --format json --force-exclusion --stdin %s' diff --git a/sources_non_forked/ale/test/linter/test_ruby.vader b/sources_non_forked/ale/test/linter/test_ruby.vader new file mode 100644 index 00000000..d957079d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ruby.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'ruby') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'ruby', ale#Escape('ruby') . ' -w -c %t' + +Execute(The executable should be configurable): + let g:ale_ruby_ruby_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -w -c %t' diff --git a/sources_non_forked/ale/test/linter/test_ruby_debride.vader b/sources_non_forked/ale/test/linter/test_ruby_debride.vader new file mode 100644 index 00000000..f7628432 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ruby_debride.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'debride') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'debride', ale#Escape('debride') . ' %s' diff --git a/sources_non_forked/ale/test/linter/test_ruby_solargraph.vader b/sources_non_forked/ale/test/linter/test_ruby_solargraph.vader new file mode 100644 index 00000000..1ae67f50 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ruby_solargraph.vader @@ -0,0 +1,43 @@ +" Author: Horacio Sanson +" Description: Tests for solargraph lsp linter. +Before: + call ale#assert#SetUpLinterTest('ruby', 'solargraph') + +After: + call ale#assert#TearDownLinterTest() + +Execute(command callback should return default string): + AssertLinter 'solargraph', ale#Escape('solargraph') . ' stdio' + +Execute(command callback executable can be overridden): + let g:ale_ruby_solargraph_executable = 'foobar' + AssertLinter 'foobar', ale#Escape('foobar') . ' stdio' + +Execute(should set solargraph for rails app): + call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/models/thing.rb') + AssertLSPLanguage 'ruby' + AssertLSPOptions {} + AssertLSPProject ale#test#GetFilename('../test-files/ruby/valid_rails_app') + +Execute(should set solargraph for ruby app1): + call ale#test#SetFilename('../test-files/ruby/valid_ruby_app1/lib/file.rb') + AssertLSPLanguage 'ruby' + AssertLSPOptions {} + AssertLSPProject ale#test#GetFilename('../test-files/ruby/valid_ruby_app1') + +Execute(should set solargraph for ruby app2): + call ale#test#SetFilename('../test-files/ruby/valid_ruby_app2/lib/file.rb') + AssertLSPLanguage 'ruby' + AssertLSPOptions {} + AssertLSPProject ale#test#GetFilename('../test-files/ruby/valid_ruby_app2') + +Execute(should set solargraph for ruby app3): + call ale#test#SetFilename('../test-files/ruby/valid_ruby_app3/lib/file.rb') + AssertLSPLanguage 'ruby' + AssertLSPOptions {} + AssertLSPProject ale#test#GetFilename('../test-files/ruby/valid_ruby_app3') + +Execute(should accept initialization options): + AssertLSPOptions {} + let b:ale_ruby_solargraph_options = { 'diagnostics': 'true' } + AssertLSPOptions { 'diagnostics': 'true' } diff --git a/sources_non_forked/ale/test/linter/test_rust_analyzer.vader b/sources_non_forked/ale/test/linter/test_rust_analyzer.vader new file mode 100644 index 00000000..1dd2c780 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rust_analyzer.vader @@ -0,0 +1,28 @@ +Before: + call ale#assert#SetUpLinterTest('rust', 'analyzer') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'rust-analyzer', ale#Escape('rust-analyzer') + +Execute(The project root should be detected correctly in cargo projects): + call ale#test#SetFilename('../test-files/rust/cargo/testfile.rs') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust/cargo') + +Execute(The project root should be detected correctly in non-cargo projects): + call ale#test#SetFilename('../test-files/rust/rust-project/testfile.rs') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust/rust-project') + +Execute(The project root should be empty when no project files can be detected): + call ale#test#SetFilename('../test-files/dummy') + + AssertLSPProject '' + +Execute(Should accept configuration settings): + AssertLSPConfig {} + let b:ale_rust_analyzer_config = {'diagnostics': {'disabled': ['unresolved-import']}} + AssertLSPOptions {'diagnostics': {'disabled': ['unresolved-import']}} diff --git a/sources_non_forked/ale/test/linter/test_rust_rls.vader b/sources_non_forked/ale/test/linter/test_rust_rls.vader new file mode 100644 index 00000000..62c90d61 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rust_rls.vader @@ -0,0 +1,33 @@ +Before: + call ale#assert#SetUpLinterTest('rust', 'rls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'rls', ale#Escape('rls') + +Execute(The toolchain should be configurable): + let g:ale_rust_rls_toolchain = 'stable' + + AssertLinter 'rls', ale#Escape('rls') . ' +' . ale#Escape('stable') + +Execute(The toolchain should be ommitted if not given): + let g:ale_rust_rls_toolchain = '' + + AssertLinter 'rls', ale#Escape('rls') + +Execute(The project root should be detected correctly for cargo projects): + call ale#test#SetFilename('../test-files/rust/cargo/testfile.rs') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust/cargo') + +Execute(The project root should be empty when no project files can be detected): + call ale#test#SetFilename('../test-files/dummy') + + AssertLSPProject '' + +Execute(Should accept configuration settings): + AssertLSPConfig {} + let b:ale_rust_rls_config = {'rust': {'clippy_preference': 'on'}} + AssertLSPConfig {'rust': {'clippy_preference': 'on'}} diff --git a/sources_non_forked/ale/test/linter/test_rustc.vader b/sources_non_forked/ale/test/linter/test_rustc.vader new file mode 100644 index 00000000..92d9fa14 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_rustc.vader @@ -0,0 +1,25 @@ +Before: + call ale#assert#SetUpLinterTest('rust', 'rustc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'rustc', 'rustc --error-format=json --emit=mir -o /dev/null -' + +Execute(The options should be configurable): + call ale#test#SetFilename('../test-files/dummy') + + let b:ale_rust_rustc_options = '--foo' + + AssertLinter 'rustc', 'rustc --error-format=json --foo -' + +Execute(Some default paths should be included when the project is a Cargo project): + call ale#test#SetFilename('../test-files/rust/cargo/testfile.rs') + + AssertLinter 'rustc', 'rustc --error-format=json --emit=mir -o /dev/null' + \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, '../test-files/rust/cargo/target/debug/deps')) + \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, '../test-files/rust/cargo/target/release/deps')) + \ . ' -' diff --git a/sources_non_forked/ale/test/linter/test_ruumba.vader b/sources_non_forked/ale/test/linter/test_ruumba.vader new file mode 100644 index 00000000..9fa48903 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_ruumba.vader @@ -0,0 +1,26 @@ +Before: + call ale#assert#SetUpLinterTest('eruby', 'ruumba') + call ale#test#SetFilename('dummy.html.erb') + + let g:ale_eruby_ruumba_executable = 'ruumba' + let g:ale_eruby_ruumba_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to ruumba): + AssertLinter 'ruumba', ale#Escape('ruumba') + \ . ' --format json --force-exclusion --stdin %s' + +Execute(Should be able to set a custom executable): + let g:ale_eruby_ruumba_executable = 'bin/ruumba' + + AssertLinter 'bin/ruumba' , ale#Escape('bin/ruumba') + \ . ' --format json --force-exclusion --stdin %s' + +Execute(Setting bundle appends 'exec ruumba'): + let g:ale_eruby_ruumba_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + \ . ' exec ruumba' + \ . ' --format json --force-exclusion --stdin %s' diff --git a/sources_non_forked/ale/test/linter/test_sass_sasslint.vader b/sources_non_forked/ale/test/linter/test_sass_sasslint.vader new file mode 100644 index 00000000..87f0c8ad --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_sass_sasslint.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('sass', 'sasslint') + call ale#test#SetFilename('test.sass') + unlet! b:executable + +After: + call ale#assert#TearDownLinterTest() + +Execute(should default to source, bin/sass-lint.js): + call ale#test#SetFilename('../test-files/sasslint/with-source/test.sass') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/sasslint/with-source/node_modules/sass-lint/bin/sass-lint.js' + \) + + AssertLinter b:executable, + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(b:executable) + \ . ' -v -q -f compact %t' + +Execute(should fallback to bin, .bin/sass-lint): + call ale#test#SetFilename('../test-files/sasslint/with-bin/test.sass') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/sasslint/with-bin/node_modules/.bin/sass-lint' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' -v -q -f compact %t' + +Execute(should fallback to global bin): + AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' -v -q -f compact %t' + +Execute(The global executable should be configurable): + let b:ale_sass_sasslint_executable = 'foo' + + AssertLinter 'foo', ale#Escape('foo') . ' -v -q -f compact %t' + +Execute(The options should be configurable): + let b:ale_sass_sasslint_options = '--bar' + + AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' --bar -v -q -f compact %t' diff --git a/sources_non_forked/ale/test/linter/test_scala_metals.vader b/sources_non_forked/ale/test/linter/test_scala_metals.vader new file mode 100644 index 00000000..b14e3e02 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_scala_metals.vader @@ -0,0 +1,21 @@ +" Author: Jeffrey Lau https://github.com/zoonfafer +" Description: Tests for the Scala Metals linter +Before: + call ale#assert#SetUpLinterTest('scala', 'metals') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should set metals for sbt project with build.sbt): + call ale#test#SetFilename('../test-files/scala/valid_sbt_project/Main.scala') + AssertLSPLanguage 'scala' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#test#GetFilename('../test-files/scala/valid_sbt_project') + +Execute(should not set metals for sbt project without build.sbt): + call ale#test#SetFilename('../test-files/scala/invalid_sbt_project/Main.scala') + AssertLSPLanguage 'scala' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject '' diff --git a/sources_non_forked/ale/test/linter/test_scala_sbtserver.vader b/sources_non_forked/ale/test/linter/test_scala_sbtserver.vader new file mode 100644 index 00000000..118e090f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_scala_sbtserver.vader @@ -0,0 +1,23 @@ +" Author: ophirr33 +" Description: Tests for the sbt Server lsp linter +Before: + call ale#assert#SetUpLinterTest('scala', 'sbtserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should set sbtserver for sbt project with build.sbt): + call ale#test#SetFilename('../test-files/scala/valid_sbt_project/Main.scala') + AssertLSPLanguage 'scala' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#test#GetFilename('../test-files/scala/valid_sbt_project') + AssertLSPAddress '127.0.0.1:4273' + +Execute(should not set sbtserver for sbt project without build.sbt): + call ale#test#SetFilename('../test-files/scala/invalid_sbt_project/Main.scala') + AssertLSPLanguage 'scala' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject '' + AssertLSPAddress '127.0.0.1:4273' diff --git a/sources_non_forked/ale/test/linter/test_scalac.vader b/sources_non_forked/ale/test/linter/test_scalac.vader new file mode 100644 index 00000000..ea5ae109 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_scalac.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('scala', 'scalac') + +After: + call ale#assert#TearDownLinterTest() + +Given scala(An empty Scala file): +Execute(The default executable and command should be correct): + AssertLinter 'scalac', ale#Escape('scalac') . ' -Ystop-after:parser %t' + +Given scala.sbt(An empty SBT file): +Execute(scalac should not be run for sbt files): + AssertLinterNotExecuted diff --git a/sources_non_forked/ale/test/linter/test_scalastyle.vader b/sources_non_forked/ale/test/linter/test_scalastyle.vader new file mode 100644 index 00000000..3c28f7a3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_scalastyle.vader @@ -0,0 +1,34 @@ +Before: + call ale#assert#SetUpLinterTest('scala', 'scalastyle') + +After: + unlet! g:ale_scalastyle_config_loc + call ale#linter#Reset() + +Execute(Should return the correct default command): + AssertLinter 'scalastyle', 'scalastyle %t' + +Execute(Should allow using a custom config file): + let b:ale_scala_scalastyle_config = '/dooper/config.xml' + + AssertLinter 'scalastyle', 'scalastyle' + \ . ' --config ' . ale#Escape('/dooper/config.xml') + \ . ' %t' + +Execute(Should support a legacy option for the scalastyle config): + unlet! g:ale_scala_scalastyle_config + let g:ale_scalastyle_config_loc = '/dooper/config.xml' + + call ale#linter#Reset() + runtime ale_linters/scala/scalastyle.vim + + AssertLinter 'scalastyle', 'scalastyle' + \ . ' --config ' . ale#Escape('/dooper/config.xml') + \ . ' %t' + +Execute(Should allow using custom options): + let b:ale_scala_scalastyle_options = '--warnings false --quiet true' + + AssertLinter 'scalastyle', 'scalastyle' + \ . ' --warnings false --quiet true' + \ . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_scss_sasslint.vader b/sources_non_forked/ale/test/linter/test_scss_sasslint.vader new file mode 100644 index 00000000..839761c2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_scss_sasslint.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('scss', 'sasslint') + call ale#test#SetFilename('test.scss') + unlet! b:executable + +After: + call ale#assert#TearDownLinterTest() + +Execute(should default to source, bin/sass-lint.js): + call ale#test#SetFilename('../test-files/sasslint/with-source/test.scss') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/sasslint/with-source/node_modules/sass-lint/bin/sass-lint.js' + \) + + AssertLinter b:executable, + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(b:executable) + \ . ' -v -q -f compact %t' + +Execute(should fallback to bin, .bin/sass-lint): + call ale#test#SetFilename('../test-files/sasslint/with-bin/test.scss') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/sasslint/with-bin/node_modules/.bin/sass-lint' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' -v -q -f compact %t' + +Execute(should fallback to global bin): + AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' -v -q -f compact %t' + +Execute(The global executable should be configurable): + let b:ale_scss_sasslint_executable = 'foo' + + AssertLinter 'foo', ale#Escape('foo') . ' -v -q -f compact %t' + +Execute(The options should be configurable): + let b:ale_scss_sasslint_options = '--bar' + + AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' --bar -v -q -f compact %t' diff --git a/sources_non_forked/ale/test/linter/test_scss_stylelint.vader b/sources_non_forked/ale/test/linter/test_scss_stylelint.vader new file mode 100644 index 00000000..bf45ccd0 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_scss_stylelint.vader @@ -0,0 +1,33 @@ +Before: + call ale#assert#SetUpLinterTest('scss', 'stylelint') + unlet! b:executable + +After: + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(node_modules directories should be discovered): + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.scss') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/stylelint/node_modules/.bin/stylelint' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin-filename %s' + +Execute(The global override should work): + let b:ale_scss_stylelint_executable = 'foobar' + let b:ale_scss_stylelint_use_global = 1 + + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.scss') + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin-filename %s' + +Execute(Extra options should be configurable): + call ale#test#SetFilename('../test-files/dummy') + + let b:ale_scss_stylelint_options = '--configFile ''/absolute/path/to/file''' + + AssertLinter 'stylelint', + \ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --stdin-filename %s' diff --git a/sources_non_forked/ale/test/linter/test_shellcheck.vader b/sources_non_forked/ale/test/linter/test_shellcheck.vader new file mode 100644 index 00000000..40995755 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_shellcheck.vader @@ -0,0 +1,106 @@ +Before: + call ale#assert#SetUpLinterTest('sh', 'shellcheck') + call ale#test#SetFilename('test.sh') + + let b:suffix = ' -f gcc -' + +After: + unlet! b:is_bash + unlet! b:suffix + call ale#assert#TearDownLinterTest() + +Execute(The default shellcheck command should be correct): + AssertLinterCwd '%s:h' + AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix + +Execute(The option disabling changing directories should work): + let g:ale_sh_shellcheck_change_directory = 0 + + AssertLinterCwd '' + AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix + +Execute(The shellcheck command should accept options): + let b:ale_sh_shellcheck_options = '--foobar' + + AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' --foobar' . b:suffix + +Execute(The shellcheck command should accept options and exclusions): + let b:ale_sh_shellcheck_options = '--foobar' + let b:ale_sh_shellcheck_exclusions = 'foo,bar' + + AssertLinter 'shellcheck', + \ ale#Escape('shellcheck') . ' --foobar -e foo,bar' . b:suffix + +Execute(The shellcheck command should include the dialect): + let b:is_bash = 1 + + AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' -s bash' . b:suffix + +Execute(The shellcheck command should use ale_sh_shellcheck_dialect): + let b:ale_sh_shellcheck_dialect = 'ksh93' + + AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' -s ksh93' . b:suffix + +Execute(The shellcheck command should allow unspecified dialect): + let b:ale_sh_shellcheck_dialect = '' + + AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix + +Execute(The shellcheck command should include the dialect before options and exclusions): + let b:is_bash = 1 + let b:ale_sh_shellcheck_options = '--foobar' + let b:ale_sh_shellcheck_exclusions = 'foo,bar' + + AssertLinter 'shellcheck', ale#Escape('shellcheck') + \ . ' -s bash --foobar -e foo,bar' + \ . b:suffix + +Execute(The -x option should be added when the version is new enough): + AssertLinter 'shellcheck', [ + \ ale#Escape('shellcheck') . ' --version', + \ ale#Escape('shellcheck') . b:suffix, + \] + + GivenCommandOutput [ + \ 'ShellCheck - shell script analysis tool', + \ 'version: 0.4.4', + \ 'license: GNU General Public License, version 3', + \ 'website: http://www.shellcheck.net', + \] + AssertLinter 'shellcheck', [ + \ ale#Escape('shellcheck') . ' --version', + \ ale#Escape('shellcheck') . ' -x' . b:suffix, + \] + + " We should cache the version check + GivenCommandOutput [] + AssertLinter 'shellcheck', [ + \ ale#Escape('shellcheck') . ' -x' . b:suffix, + \] + +Execute(The -x option should not be added when the version is too old): + GivenCommandOutput [ + \ 'ShellCheck - shell script analysis tool', + \ 'version: 0.3.9', + \ 'license: GNU General Public License, version 3', + \ 'website: http://www.shellcheck.net', + \] + AssertLinter 'shellcheck', [ + \ ale#Escape('shellcheck') . ' --version', + \ ale#Escape('shellcheck') . b:suffix, + \] + +Execute(The version check shouldn't be run again for old versions): + GivenCommandOutput [ + \ 'ShellCheck - shell script analysis tool', + \ 'version: 0.3.9', + \ 'license: GNU General Public License, version 3', + \ 'website: http://www.shellcheck.net', + \] + AssertLinter 'shellcheck', [ + \ ale#Escape('shellcheck') . ' --version', + \ ale#Escape('shellcheck') . b:suffix, + \] + AssertLinter 'shellcheck', [ + \ ale#Escape('shellcheck') . b:suffix, + \] diff --git a/sources_non_forked/ale/test/linter/test_slimlint.vader b/sources_non_forked/ale/test/linter/test_slimlint.vader new file mode 100644 index 00000000..33df9ac0 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_slimlint.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('slim', 'slimlint') + let g:default_command = 'slim-lint %t' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'slim-lint', 'slim-lint %t' + +Execute(The command should have the .rubocop.yml prepended as an env var if one exists): + call ale#test#SetFilename('../test-files/slimlint/subdir/file.slim') + + AssertLinter 'slim-lint', + \ ale#Env( + \ 'SLIM_LINT_RUBOCOP_CONF', + \ ale#path#Simplify(g:dir . '/../test-files/slimlint/.rubocop.yml') + \ ) + \ . 'slim-lint %t' diff --git a/sources_non_forked/ale/test/linter/test_solc.vader b/sources_non_forked/ale/test/linter/test_solc.vader new file mode 100644 index 00000000..23521f6a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_solc.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('solidity', 'solc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'solc', 'solc %s' + +Execute(The options should be configurable): + let g:ale_solidity_solc_options = '--foobar' + + AssertLinter 'solc', 'solc --foobar %s' diff --git a/sources_non_forked/ale/test/linter/test_solc_commit.vader b/sources_non_forked/ale/test/linter/test_solc_commit.vader new file mode 100644 index 00000000..e25c47e7 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_solc_commit.vader @@ -0,0 +1,14 @@ +Before: + call ale#assert#SetUpLinterTest('solidity', 'solc') + let g:ale_solidity_solc_executable = 'solc-v0.8.4+commit.c7e474f2' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The executable command should be configurable): + AssertLinter 'solc-v0.8.4+commit.c7e474f2', 'solc-v0.8.4+commit.c7e474f2 %s' + +Execute(The options should be configurable): + let g:ale_solidity_solc_options = '--foobar' + + AssertLinter 'solc-v0.8.4+commit.c7e474f2', 'solc-v0.8.4+commit.c7e474f2 --foobar %s' diff --git a/sources_non_forked/ale/test/linter/test_solhint.vader b/sources_non_forked/ale/test/linter/test_solhint.vader new file mode 100644 index 00000000..fc5afa9b --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_solhint.vader @@ -0,0 +1,28 @@ +Before: + call ale#assert#SetUpLinterTest('solidity', 'solhint') + runtime autoload/ale/handlers/solhint.vim + + let b:args = ' --formatter compact %s' + +After: + unlet! b:args + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinterCwd '' + AssertLinter 'solhint', ale#Escape('solhint') . b:args + +Execute(The options should be configurable): + let g:ale_solidity_solhint_options = '--foobar' + + AssertLinter 'solhint', ale#Escape('solhint') . ' --foobar' . b:args + + +Execute(solhint should be run from a containing project with solhint executable): + call ale#test#SetFilename('../test-files/solhint/Contract.sol') + + let b:executable = ale#path#Simplify(g:dir . '/../test-files/solhint/node_modules/.bin/solhint') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/solhint') + AssertLinter b:executable, ale#Escape(b:executable) . b:args diff --git a/sources_non_forked/ale/test/linter/test_sorbet.vader b/sources_non_forked/ale/test/linter/test_sorbet.vader new file mode 100644 index 00000000..fe758635 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_sorbet.vader @@ -0,0 +1,34 @@ + +Before: + call ale#assert#SetUpLinterTest('ruby', 'sorbet') + call ale#test#SetFilename('dummy.rb') + + let g:ale_ruby_sorbet_executable = 'srb' + let g:ale_ruby_sorbet_options = '' + let g:ale_ruby_sorbet_enable_watchman = 0 + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to srb): + AssertLinter 'srb', ale#Escape('srb') + \ . ' tc --lsp --disable-watchman' + +Execute(Able to enable watchman): + let g:ale_ruby_sorbet_enable_watchman = 1 + + AssertLinter 'srb', ale#Escape('srb') + \ . ' tc --lsp' + +Execute(Should be able to set a custom executable): + let g:ale_ruby_sorbet_executable = 'bin/srb' + + AssertLinter 'bin/srb' , ale#Escape('bin/srb') + \ . ' tc --lsp --disable-watchman' + +Execute(Setting bundle appends 'exec srb tc'): + let g:ale_ruby_sorbet_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + \ . ' exec srb' + \ . ' tc --lsp --disable-watchman' diff --git a/sources_non_forked/ale/test/linter/test_spectral.vader b/sources_non_forked/ale/test/linter/test_spectral.vader new file mode 100644 index 00000000..cfcf0987 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_spectral.vader @@ -0,0 +1,31 @@ +Before: + call ale#assert#SetUpLinterTest('yaml', 'spectral') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The yaml spectral command callback should return the correct default string): + AssertLinter 'spectral', ale#Escape('spectral') . ' lint --ignore-unknown-format -q -f text %t' + +Execute(The yaml spectral command callback should be configurable): + let g:ale_yaml_spectral_executable = '~/.local/bin/spectral' + + AssertLinter '~/.local/bin/spectral', + \ ale#Escape('~/.local/bin/spectral') + \ . ' lint --ignore-unknown-format -q -f text %t' + +Execute(The yaml spectral command callback should allow a global installation to be used): + let g:ale_yaml_spectral_executable = '/usr/local/bin/spectral' + let g:ale_yaml_spectral_use_global = 1 + + AssertLinter '/usr/local/bin/spectral', + \ ale#Escape('/usr/local/bin/spectral') + \ . ' lint --ignore-unknown-format -q -f text %t' + +Execute(The yaml spectral command callback should allow a local installation to be used): + call ale#test#SetFilename('../test-files/spectral/openapi.yaml') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/spectral/node_modules/.bin/spectral'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/spectral/node_modules/.bin/spectral')) + \ . ' lint --ignore-unknown-format -q -f text %t' diff --git a/sources_non_forked/ale/test/linter/test_sqllint.vader b/sources_non_forked/ale/test/linter/test_sqllint.vader new file mode 100644 index 00000000..eea9b4e0 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_sqllint.vader @@ -0,0 +1,12 @@ +Before: + " Load the linter and set up a series of commands, reset linter variables, + " clear caches, etc. + " + " Vader's 'Save' command will be called here for linter variables. + call ale#assert#SetUpLinterTest('sql', 'sqllint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'sql-lint', ['sql-lint'] diff --git a/sources_non_forked/ale/test/linter/test_standard.vader b/sources_non_forked/ale/test/linter/test_standard.vader new file mode 100644 index 00000000..4722cd4a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_standard.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'standard') + call ale#test#SetFilename('testfile.js') + unlet! b:executable + +After: + call ale#assert#TearDownLinterTest() + +Execute(bin/cmd.js paths should be preferred): + call ale#test#SetFilename('../test-files/standard/with-cmd/testfile.js') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/standard/with-cmd/node_modules/standard/bin/cmd.js' + \) + + AssertLinter b:executable, + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(b:executable) + \ . ' --stdin %s' + +Execute(.bin directories should be used too): + call ale#test#SetFilename('../test-files/standard/with-bin/testfile.js') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/standard/with-bin/node_modules/.bin/standard' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin %s' + +Execute(The global executable should be used otherwise): + AssertLinter 'standard', ale#Escape('standard') . ' --stdin %s' + +Execute(The global executable should be configurable): + let b:ale_javascript_standard_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin %s' + +Execute(The options should be configurable): + let b:ale_javascript_standard_options = '--wat' + + AssertLinter 'standard', ale#Escape('standard') . ' --wat --stdin %s' diff --git a/sources_non_forked/ale/test/linter/test_standardrb.vader b/sources_non_forked/ale/test/linter/test_standardrb.vader new file mode 100644 index 00000000..108dd870 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_standardrb.vader @@ -0,0 +1,26 @@ +Before: + call ale#assert#SetUpLinterTest('ruby', 'standardrb') + call ale#test#SetFilename('dummy.rb') + + let g:ale_ruby_standardrb_executable = 'standardrb' + let g:ale_ruby_standardrb_options = '' + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to standardrb): + AssertLinter 'standardrb', ale#Escape('standardrb') + \ . ' --format json --force-exclusion --stdin %s' + +Execute(Should be able to set a custom executable): + let g:ale_ruby_standardrb_executable = 'bin/standardrb' + + AssertLinter 'bin/standardrb' , ale#Escape('bin/standardrb') + \ . ' --format json --force-exclusion --stdin %s' + +Execute(Setting bundle appends 'exec standardrb'): + let g:ale_ruby_standardrb_executable = 'path to/bundle' + + AssertLinter 'path to/bundle', ale#Escape('path to/bundle') + \ . ' exec standardrb' + \ . ' --format json --force-exclusion --stdin %s' diff --git a/sources_non_forked/ale/test/linter/test_standardts.vader b/sources_non_forked/ale/test/linter/test_standardts.vader new file mode 100644 index 00000000..33ca8b25 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_standardts.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('typescript', 'standard') + call ale#test#SetFilename('testfile.js') + unlet! b:executable + +After: + call ale#assert#TearDownLinterTest() + +Execute(bin/cmd.js paths should be preferred): + call ale#test#SetFilename('../test-files/standard/with-cmd/testfile.js') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/standard/with-cmd/node_modules/standard/bin/cmd.js' + \) + + AssertLinter b:executable, + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(b:executable) + \ . ' --stdin %s' + +Execute(.bin directories should be used too): + call ale#test#SetFilename('../test-files/standard/with-bin/testfile.js') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/standard/with-bin/node_modules/.bin/standard' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin %s' + +Execute(The global executable should be used otherwise): + AssertLinter 'standard', ale#Escape('standard') . ' --stdin %s' + +Execute(The global executable should be configurable): + let b:ale_typescript_standard_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin %s' + +Execute(The options should be configurable): + let b:ale_typescript_standard_options = '--wat' + + AssertLinter 'standard', ale#Escape('standard') . ' --wat --stdin %s' diff --git a/sources_non_forked/ale/test/linter/test_staticcheck.vader b/sources_non_forked/ale/test/linter/test_staticcheck.vader new file mode 100644 index 00000000..94f24a54 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_staticcheck.vader @@ -0,0 +1,49 @@ +Before: + Save g:ale_go_go111module + Save $GOPATH + + let $GOPATH = '/non/existent/directory' + + call ale#assert#SetUpLinterTest('go', 'staticcheck') + call ale#test#SetFilename('test.go') + +After: + unlet! b:ale_go_go111module + + call ale#assert#TearDownLinterTest() + +Execute(The staticcheck callback should return the right defaults): + AssertLinterCwd '%s:h' + AssertLinter 'staticcheck', ale#Escape('staticcheck') . ' .' + +Execute(staticcheck should be found in GOPATH): + " This is a directory with a fake executable + let $GOPATH = ale#test#GetFilename('../test-files/go/gopath') + + AssertLinter + \ ale#test#GetFilename('../test-files/go/gopath/bin/staticcheck'), + \ ale#Escape(ale#test#GetFilename('../test-files/go/gopath/bin/staticcheck')) + \ . ' .' + +Execute(The staticcheck callback should use configured options): + let b:ale_go_staticcheck_options = '-test' + + AssertLinter 'staticcheck', ale#Escape('staticcheck') . ' -test .' + +Execute(Unset the staticcheck `lint_package` option should use the correct command): + let b:ale_go_staticcheck_lint_package = 0 + + AssertLinterCwd '%s:h' + AssertLinter 'staticcheck', ale#Escape('staticcheck') . ' %s:t' + +Execute(The staticcheck callback should use the `GO111MODULE` option if set): + let b:ale_go_go111module = 'off' + + AssertLinter 'staticcheck', + \ ale#Env('GO111MODULE', 'off') . ale#Escape('staticcheck') . ' .' + + " Test with lint_package option set + let b:ale_go_staticcheck_lint_package = 0 + + AssertLinter 'staticcheck', + \ ale#Env('GO111MODULE', 'off') . ale#Escape('staticcheck') . ' %s:t' diff --git a/sources_non_forked/ale/test/linter/test_sugarss_stylelint.vader b/sources_non_forked/ale/test/linter/test_sugarss_stylelint.vader new file mode 100644 index 00000000..c6000a9a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_sugarss_stylelint.vader @@ -0,0 +1,33 @@ +Before: + call ale#assert#SetUpLinterTest('sugarss', 'stylelint') + unlet! b:executable + +After: + unlet! b:executable + call ale#assert#TearDownLinterTest() + +Execute(node_modules directories should be discovered): + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.sss') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/../test-files/stylelint/node_modules/.bin/stylelint' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' --syntax=sugarss --stdin-filename %s' + +Execute(The global override should work): + let b:ale_sugarss_stylelint_executable = 'foobar' + let b:ale_sugarss_stylelint_use_global = 1 + + call ale#test#SetFilename('../test-files/stylelint/nested/testfile.sss') + + AssertLinter 'foobar', ale#Escape('foobar') . ' --syntax=sugarss --stdin-filename %s' + +Execute(Extra options should be configurable): + call ale#test#SetFilename('../test-files/dummy') + + let b:ale_sugarss_stylelint_options = '--configFile ''/absolute/path/to/file''' + + AssertLinter 'stylelint', + \ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --syntax=sugarss --stdin-filename %s' diff --git a/sources_non_forked/ale/test/linter/test_svelteserver.vader b/sources_non_forked/ale/test/linter/test_svelteserver.vader new file mode 100644 index 00000000..c09f1682 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_svelteserver.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('svelte', 'svelteserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'svelteserver', ale#Escape('svelteserver') . ' --stdio' diff --git a/sources_non_forked/ale/test/linter/test_swaglint.vader b/sources_non_forked/ale/test/linter/test_swaglint.vader new file mode 100644 index 00000000..98f0c594 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_swaglint.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('yaml', 'swaglint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The yaml swaglint command callback should return the correct default string): + AssertLinter 'swaglint', ale#Escape('swaglint') . ' -r compact --stdin' + +Execute(The yaml swaglint command callback should be configurable): + let g:ale_yaml_swaglint_executable = '~/.local/bin/swaglint' + + AssertLinter '~/.local/bin/swaglint', + \ ale#Escape('~/.local/bin/swaglint') . ' -r compact --stdin' + +Execute(The yaml swaglint command callback should allow a global installation to be used): + let g:ale_yaml_swaglint_executable = '/usr/local/bin/swaglint' + let g:ale_yaml_swaglint_use_global = 1 + + AssertLinter '/usr/local/bin/swaglint', + \ ale#Escape('/usr/local/bin/swaglint') . ' -r compact --stdin' + +Execute(The yaml swaglint command callback should allow a local installation to be used): + call ale#test#SetFilename('../test-files/swaglint/docs/swagger.yaml') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/swaglint/node_modules/.bin/swaglint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/swaglint/node_modules/.bin/swaglint')) + \ . ' -r compact --stdin' diff --git a/sources_non_forked/ale/test/linter/test_swift_appleswiftformat.vader b/sources_non_forked/ale/test/linter/test_swift_appleswiftformat.vader new file mode 100644 index 00000000..3dbae8ff --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_swift_appleswiftformat.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('swift', 'appleswiftformat') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Should use default command when use_swiftpm is not set): + call ale#test#SetFilename('../test-files/swift/non-swift-package-project/src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_executable = 'swift-format' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertLinter 'swift-format', ale#Escape('swift-format') . ' lint %t' + +Execute(Should use default command and available configuration when use_swiftpm is not set): + call ale#test#SetDirectory('/testplugin/test/test-files/swift/swift-package-project-with-config') + call ale#test#SetFilename('src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_executable = 'swift-format' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertLinter 'swift-format', + \ ale#Escape('swift-format') . ' lint %t ' . '--configuration ' + \ . glob(g:dir . '/.swift-format') + + call ale#test#RestoreDirectory() + +Execute(Should use swift run when use_swiftpm is set to 1): + call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_use_swiftpm = 1 + + AssertLinter 'swift', ale#Escape('swift') . ' run swift-format lint %t' + +Execute(Should use the provided global executable): + call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_executable = '/path/to/custom/swift-format' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertLinter '/path/to/custom/swift-format', + \ ale#Escape('/path/to/custom/swift-format') . ' lint %t' diff --git a/sources_non_forked/ale/test/linter/test_swift_sourcekitlsp.vader b/sources_non_forked/ale/test/linter/test_swift_sourcekitlsp.vader new file mode 100644 index 00000000..1040d590 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_swift_sourcekitlsp.vader @@ -0,0 +1,21 @@ +Before: + call ale#assert#SetUpLinterTest('swift', 'sourcekitlsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift') + + AssertLinter 'sourcekit-lsp', ale#Escape('sourcekit-lsp') + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift') + + let g:ale_sourcekit_lsp_executable = '/path/to/custom/sourcekitlsp' + + AssertLinter '/path/to/custom/sourcekitlsp', + \ ale#Escape('/path/to/custom/sourcekitlsp') + +Execute(The language should be correct): + AssertLSPLanguage 'swift' diff --git a/sources_non_forked/ale/test/linter/test_swiftlint.vader b/sources_non_forked/ale/test/linter/test_swiftlint.vader new file mode 100644 index 00000000..d2442b0a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_swiftlint.vader @@ -0,0 +1,43 @@ +Before: + call ale#assert#SetUpLinterTest('swift', 'swiftlint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Global installation should be the default executable): + call ale#test#SetFilename('../test-files/swiftlint/global/testfile.swift') + + AssertEqual + \ 'swiftlint', + \ ale_linters#swift#swiftlint#GetExecutable(bufnr('')) + +Execute(React Native apps using CocoaPods should take precedence over the default executable): + call ale#test#SetFilename('../test-files/swiftlint/react-native/testfile.swift') + + AssertEqual + \ tolower(ale#test#GetFilename('../test-files/swiftlint/react-native/ios/Pods/SwiftLint/swiftlint')), + \ tolower(ale_linters#swift#swiftlint#GetExecutable(bufnr(''))) + +Execute(CocoaPods installation should take precedence over the default executable): + call ale#test#SetFilename('../test-files/swiftlint/cocoapods/testfile.swift') + + AssertEqual + \ tolower(ale#test#GetFilename('../test-files/swiftlint/cocoapods/Pods/SwiftLint/swiftlint')), + \ tolower(ale_linters#swift#swiftlint#GetExecutable(bufnr(''))) + +Execute(Top level CocoaPods installation should take precedence over React Native installation): + call ale#test#SetFilename('../test-files/swiftlint/cocoapods-and-react-native/testfile.swift') + + AssertEqual + \ tolower(ale#test#GetFilename('../test-files/swiftlint/cocoapods-and-react-native/Pods/SwiftLint/swiftlint')), + \ tolower(ale_linters#swift#swiftlint#GetExecutable(bufnr(''))) + +Execute(use-global should override other versions): + let g:ale_swift_swiftlint_use_global = 1 + let g:ale_swift_swiftlint_executable = 'swiftlint_d' + + call ale#test#SetFilename('../test-files/swiftlint/cocoapods-and-react-native/testfile.swift') + + AssertEqual + \ 'swiftlint_d', + \ ale_linters#swift#swiftlint#GetExecutable(bufnr('')) diff --git a/sources_non_forked/ale/test/linter/test_systemd_analyze.vader b/sources_non_forked/ale/test/linter/test_systemd_analyze.vader new file mode 100644 index 00000000..d97c87be --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_systemd_analyze.vader @@ -0,0 +1,9 @@ +Before: + call ale#assert#SetUpLinterTest('systemd', 'systemd_analyze') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'systemd-analyze', + \ 'SYSTEMD_LOG_COLOR=0 ' . ale#Escape('systemd-analyze') . ' --user verify %s' diff --git a/sources_non_forked/ale/test/linter/test_terraform_ls.vader b/sources_non_forked/ale/test/linter/test_terraform_ls.vader new file mode 100644 index 00000000..983bc104 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_terraform_ls.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('terraform', 'terraform_ls') + +After: + unlet! b:ale_terraform_terraform_executable + unlet! b:ale_terraform_ls_executable + unlet! b:ale_terraform_ls_options + + call ale#assert#TearDownLinterTest() + +Execute(Should send correct LSP language): + AssertLSPLanguage 'terraform' + +Execute(Should load default executable): + AssertLinter 'terraform-ls', + \ ale#Escape('terraform-ls') . ' serve' + +Execute(Should configure custom executable): + let b:ale_terraform_ls_executable = 'foo' + AssertLinter 'foo', + \ ale#Escape('foo') . ' serve' + +Execute(Should ignore non-absolute custom terraform executable): + let b:ale_terraform_terraform_executable = 'terraform' + AssertLinter 'terraform-ls', + \ ale#Escape('terraform-ls') . ' serve' + +Execute(Should set absolute custom terraform executable): + let b:ale_terraform_terraform_executable = '/bin/terraform' + AssertLinter 'terraform-ls', + \ ale#Escape('terraform-ls') . ' serve -tf-exec /bin/terraform' + +Execute(Should set custom options): + let b:ale_terraform_ls_options = '--bar' + + AssertLinter 'terraform-ls', + \ ale#Escape('terraform-ls') . ' serve --bar' + +Execute(Should return nearest directory with .terraform if found in parent directory): + call ale#test#SetFilename('../test-files/terraform/main.tf') + + AssertLSPProject ale#test#GetFilename('../test-files/terraform') diff --git a/sources_non_forked/ale/test/linter/test_terraform_lsp.vader b/sources_non_forked/ale/test/linter/test_terraform_lsp.vader new file mode 100644 index 00000000..27f27ffb --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_terraform_lsp.vader @@ -0,0 +1,29 @@ +Before: + call ale#assert#SetUpLinterTest('terraform', 'terraform_lsp') + +After: + unlet! b:ale_terraform_langserver_executable + unlet! b:ale_terraform_langserver_options + + call ale#assert#TearDownLinterTest() + +Execute(Should send correct LSP language): + AssertLSPLanguage 'terraform' + +Execute(Should load default executable): + AssertLinter 'terraform-lsp', ale#Escape('terraform-lsp') + +Execute(Should configure custom executable): + let b:ale_terraform_langserver_executable = 'foo' + AssertLinter 'foo', ale#Escape('foo') + +Execute(Should set custom options): + let b:ale_terraform_langserver_options = '--bar' + + AssertLinter 'terraform-lsp', + \ ale#Escape('terraform-lsp') . ' --bar' + +Execute(Should return nearest directory with .terraform if found in parent directory): + call ale#test#SetFilename('../test-files/terraform/main.tf') + + AssertLSPProject ale#test#GetFilename('../test-files/terraform') diff --git a/sources_non_forked/ale/test/linter/test_terraform_terraform.vader b/sources_non_forked/ale/test/linter/test_terraform_terraform.vader new file mode 100644 index 00000000..25ca652a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_terraform_terraform.vader @@ -0,0 +1,15 @@ +" Based upon :help ale-development +Before: + call ale#assert#SetUpLinterTest('terraform', 'terraform') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'terraform', + \ ale#Escape('terraform') . ' validate -no-color -json ' + +Execute(The default command should be overriden): + let b:ale_terraform_terraform_executable = '/bin/other/terraform' + AssertLinter '/bin/other/terraform', + \ ale#Escape('/bin/other/terraform') . ' validate -no-color -json ' diff --git a/sources_non_forked/ale/test/linter/test_terraform_tflint.vader b/sources_non_forked/ale/test/linter/test_terraform_tflint.vader new file mode 100644 index 00000000..b1963a77 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_terraform_tflint.vader @@ -0,0 +1,28 @@ +Before: + call ale#assert#SetUpLinterTest('terraform', 'tflint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'tflint', ale#Escape('tflint') . ' -f json' + +Execute(The default executable should be configurable): + let b:ale_terraform_tflint_executable = 'asdf' + + AssertLinter 'asdf', ale#Escape('asdf') . ' -f json' + +Execute(Overriding options should work): + let g:ale_terraform_tflint_executable = 'fnord' + let g:ale_terraform_tflint_options = '--whatever' + + AssertLinter 'fnord', ale#Escape('fnord') . ' --whatever -f json' + +Execute(Configuration files should be found): + call ale#test#SetFilename('../test-files/tflint/foo/bar.tf') + + AssertLinter 'tflint', + \ ale#Escape('tflint') + \ . ' --config ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/tflint/foo/.tflint.hcl')) + \ . ' -f json' diff --git a/sources_non_forked/ale/test/linter/test_tex_lacheck.vader b/sources_non_forked/ale/test/linter/test_tex_lacheck.vader new file mode 100644 index 00000000..b404cc78 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_tex_lacheck.vader @@ -0,0 +1,13 @@ +Before: + call ale#assert#SetUpLinterTest('tex', 'lacheck') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Executable should default to lacheck): + AssertLinter 'lacheck', ale#Escape('lacheck') . ' %t' + +Execute(Should be able to set a custom executable): + let g:ale_tex_lacheck_executable = 'bin/foo' + + AssertLinter 'bin/foo' , ale#Escape('bin/foo') . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_tex_textlint.vader b/sources_non_forked/ale/test/linter/test_tex_textlint.vader new file mode 100644 index 00000000..f99e0fd0 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_tex_textlint.vader @@ -0,0 +1,65 @@ +" Author: januswel, w0rp + +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('tex', 'textlint') + + " The configuration is shared between many languages. + Save g:ale_textlint_executable + Save g:ale_textlint_use_global + Save g:ale_textlint_options + + let g:ale_textlint_executable = 'textlint' + let g:ale_textlint_use_global = 0 + let g:ale_textlint_options = '' + + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + +After: + unlet! b:command_tail + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' + +Execute(The executable should be configurable): + let b:ale_textlint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' + +Execute(The options should be configurable): + let b:ale_textlint_options = '--something' + + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint')) + \ . ' -f json --stdin --stdin-filename %s' + +Execute(The local executable from textlint/bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_textlint_bin_path/foo.txt') + + if has('win32') + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + else + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + endif diff --git a/sources_non_forked/ale/test/linter/test_texlab.vader b/sources_non_forked/ale/test/linter/test_texlab.vader new file mode 100644 index 00000000..72b78745 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_texlab.vader @@ -0,0 +1,35 @@ +Before: + call ale#assert#SetUpLinterTest('tex', 'texlab') + + Save &filetype + let &filetype = 'tex' + +After: + call ale#assert#TearDownLinterTest() + +Execute(The language string should be correct): + AssertLSPLanguage 'tex' + +Execute(The default executable path should be correct): + AssertLinter 'texlab', ale#Escape('texlab') + +Execute(The project root should be detected correctly): + call ale#test#SetFilename('../test-files/tex/sample1.tex') + silent! call mkdir('../test-files/tex/.git') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/tex') + +Execute(The executable should be configurable): + let b:ale_tex_texlab_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + +Execute(The options should be configurable): + let b:ale_tex_texlab_options = '-v' + + AssertLinter 'texlab', ale#Escape('texlab') . ' ' . b:ale_tex_texlab_options + +Execute(Should accpet configuration settings): + AssertLSPConfig {} + let b:ale_tex_texlab_config = {'build':{'onSave':v:true}} + AssertLSPConfig {'build':{'onSave':v:true}} diff --git a/sources_non_forked/ale/test/linter/test_textlint.vader b/sources_non_forked/ale/test/linter/test_textlint.vader new file mode 100644 index 00000000..6ec42b2d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_textlint.vader @@ -0,0 +1,65 @@ +" Author: januswel, w0rp + +Before: + " This is just one language for the linter. + call ale#assert#SetUpLinterTest('markdown', 'textlint') + + " The configuration is shared between many languages. + Save g:ale_textlint_executable + Save g:ale_textlint_use_global + Save g:ale_textlint_options + + let g:ale_textlint_executable = 'textlint' + let g:ale_textlint_use_global = 0 + let g:ale_textlint_options = '' + + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + +After: + unlet! b:command_tail + unlet! b:ale_textlint_executable + unlet! b:ale_textlint_use_global + unlet! b:ale_textlint_options + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' + +Execute(The executable should be configurable): + let b:ale_textlint_executable = 'foobar' + + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' + +Execute(The options should be configurable): + let b:ale_textlint_options = '--something' + + AssertLinter 'textlint', + \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + +Execute(The local executable from .bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint')) + \ . ' -f json --stdin --stdin-filename %s' + +Execute(The local executable from textlint/bin should be used if available): + call ale#test#SetFilename('../test-files/textlint/with_textlint_bin_path/foo.txt') + + if has('win32') + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + else + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js')) + \ . ' -f json --stdin --stdin-filename %s' + endif diff --git a/sources_non_forked/ale/test/linter/test_thrift.vader b/sources_non_forked/ale/test/linter/test_thrift.vader new file mode 100644 index 00000000..cbada818 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_thrift.vader @@ -0,0 +1,53 @@ +Before: + call ale#assert#SetUpLinterTest('thrift', 'thrift') + let b:suffix = ' -out ' . ale#Escape('TEMP_DIR') . ' %t' + + function! GetCommand(buffer) abort + call ale#engine#InitBufferInfo(a:buffer) + let l:command = ale_linters#thrift#thrift#GetCommand(a:buffer) + call ale#engine#Cleanup(a:buffer) + + let l:split_command = split(l:command) + let l:index = index(l:split_command, '-out') + + if l:index >= 0 + let l:split_command[l:index + 1] = 'TEMP' + endif + + return join(l:split_command) + endfunction + +After: + unlet! b:suffix + delfunction GetCommand + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix + +Execute(The executable should be configurable): + let b:ale_thrift_thrift_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --gen cpp -I . -strict' . b:suffix + +Execute(The list of generators should be configurable): + let b:ale_thrift_thrift_generators = ['java', 'py:dynamic'] + + AssertLinter 'thrift', ale#Escape('thrift') + \ . ' --gen java --gen py:dynamic -I . -strict' . b:suffix + + let b:ale_thrift_thrift_generators = [] + + AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix + +Execute(The list of include paths should be configurable): + let b:ale_thrift_thrift_includes = ['included/path'] + + AssertLinter 'thrift', ale#Escape('thrift') + \ . ' --gen cpp -I included/path -strict' . b:suffix + +Execute(The string of compiler options should be configurable): + let b:ale_thrift_thrift_options = '-strict --allow-64bit-consts' + + AssertLinter 'thrift', ale#Escape('thrift') + \ . ' --gen cpp -I . -strict --allow-64bit-consts' . b:suffix diff --git a/sources_non_forked/ale/test/linter/test_thriftcheck.vader b/sources_non_forked/ale/test/linter/test_thriftcheck.vader new file mode 100644 index 00000000..0da3bd6d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_thriftcheck.vader @@ -0,0 +1,21 @@ +Before: + call ale#assert#SetUpLinterTest('thrift', 'thriftcheck') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'thriftcheck', ale#Escape('thriftcheck') + \ . ' --stdin-filename %s %t' + +Execute(The executable should be configurable): + let b:ale_thrift_thriftcheck_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') + \ . ' --stdin-filename %s %t' + +Execute(The string of options should be configurable): + let b:ale_thrift_thriftcheck_options = '--errors-only' + + AssertLinter 'thriftcheck', ale#Escape('thriftcheck') + \ . ' --errors-only --stdin-filename %s %t' diff --git a/sources_non_forked/ale/test/linter/test_tslint.vader b/sources_non_forked/ale/test/linter/test_tslint.vader new file mode 100644 index 00000000..1b291d9f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_tslint.vader @@ -0,0 +1,23 @@ +Before: + call ale#assert#SetUpLinterTest('typescript', 'tslint') + call ale#test#SetFilename('test.ts') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default tslint command should be correct): + AssertLinterCwd '%s:h' + AssertLinter 'tslint', ale#Escape('tslint') . ' --format json %t' + +Execute(The rules directory option should be included if set): + let b:ale_typescript_tslint_rules_dir = '/foo/bar' + + AssertLinter 'tslint', + \ ale#Escape('tslint') . ' --format json' + \ . ' -r ' . ale#Escape('/foo/bar') + \ . ' %t' + +Execute(The executable should be configurable and escaped): + let b:ale_typescript_tslint_executable = 'foo bar' + + AssertLinter 'foo bar', ale#Escape('foo bar') . ' --format json %t' diff --git a/sources_non_forked/ale/test/linter/test_typescript_deno_lsp.vader b/sources_non_forked/ale/test/linter/test_typescript_deno_lsp.vader new file mode 100644 index 00000000..944f6a0a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_typescript_deno_lsp.vader @@ -0,0 +1,79 @@ +Before: + let g:ale_deno_importMap = 'import_map.json' + let g:ale_deno_unstable = 0 + let g:ale_deno_executable = 'deno' + let g:ale_deno_lsp_project_root = '' + + runtime autoload/ale/handlers/deno.vim + call ale#assert#SetUpLinterTest('typescript', 'deno') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Should set deno lsp for TypeScript projects using stable Deno API): + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': '' + \} + +Execute(Should set deno lsp using unstable Deno API if enabled by user): + let g:ale_deno_unstable = 1 + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:true, + \ 'importMap': '' + \} + +Execute(Should set the default importMap filepath): + call ale#test#SetFilename('../test-files/typescript/test.ts') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/typescript/import_map.json') + \} + +Execute(Should set the importMap filepath from user defined importMap): + let g:ale_deno_importMap = 'custom_import_map.json' + call ale#test#SetFilename('../test-files/typescript/test.ts') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/typescript/custom_import_map.json') + \} + +Execute(Should set the importMap filepath from user defined importMap with unstable API): + let g:ale_deno_importMap = 'custom_import_map.json' + let g:ale_deno_unstable = 1 + call ale#test#SetFilename('../test-files/typescript/test.ts') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:true, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/typescript/custom_import_map.json') + \} + +Execute(Should find project root containing tsconfig.json): + call ale#test#SetFilename('../test-files/typescript/test.ts') + + AssertLSPLanguage 'typescript' + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/typescript') + +Execute(Should use user-specified project root): + let g:ale_deno_lsp_project_root = '/' + + call ale#test#SetFilename('../test-files/typescript/test.ts') + + AssertLSPLanguage 'typescript' + AssertLSPProject '/' + +Execute(Check Deno LSP command): + AssertLinter 'deno', ale#Escape('deno') . ' lsp' diff --git a/sources_non_forked/ale/test/linter/test_typescript_tsserver.vader b/sources_non_forked/ale/test/linter/test_typescript_tsserver.vader new file mode 100644 index 00000000..719ac184 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_typescript_tsserver.vader @@ -0,0 +1,8 @@ +Before: + call ale#assert#SetUpLinterTest('typescript', 'tsserver') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'tsserver', ale#Escape('tsserver') diff --git a/sources_non_forked/ale/test/linter/test_unimport.vader b/sources_non_forked/ale/test/linter/test_unimport.vader new file mode 100644 index 00000000..a5607ce9 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_unimport.vader @@ -0,0 +1,71 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'unimport') + call ale#test#SetFilename('test.py') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:executable + unlet! b:bin_dir + + call ale#assert#TearDownLinterTest() + +Execute(The unimport callbacks should return the correct default values): + AssertLinter 'unimport', ale#Escape('unimport') . ' --check %t' + +Execute(The unimport executable should be configurable, and escaped properly): + let b:ale_python_unimport_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --check %t' + +Execute(The unimport command callback should let you set options): + let b:ale_python_unimport_options = '--gitignore' + + AssertLinter 'unimport', ale#Escape('unimport') . ' --gitignore --check %t' + +Execute(The unimport command should switch directories to the detected project root): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir') + AssertLinter 'unimport', ale#Escape('unimport') . ' --check %t' + +Execute(The unimport callbacks should detect virtualenv directories and switch to the project root): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/unimport' + \) + + AssertLinter b:executable, ale#Escape(b:executable) . ' --check %t' + +Execute(You should able able to use the global unimport instead): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + let g:ale_python_unimport_use_global = 1 + + AssertLinter 'unimport', ale#Escape('unimport') . ' --check %t' + +Execute(Setting executable to 'pipenv' appends 'run unimport'): + let g:ale_python_unimport_executable = 'path/to/pipenv' + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run unimport --check %t' + +Execute(Pipenv is detected when python_unimport_auto_pipenv is set): + call ale#test#SetFilename('../test-files/python/pipenv/whatever.py') + let g:ale_python_unimport_auto_pipenv = 1 + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'pipenv', ale#Escape('pipenv') . ' run unimport --check %t' + +Execute(Setting executable to 'poetry' appends 'run unimport'): + let g:ale_python_unimport_executable = 'path/to/poetry' + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run unimport --check %t' + +Execute(Poetry is detected when python_unimport_auto_poetry is set): + call ale#test#SetFilename('../test-files/python/poetry/whatever.py') + let g:ale_python_unimport_auto_poetry = 1 + + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'poetry', ale#Escape('poetry') . ' run unimport --check %t' diff --git a/sources_non_forked/ale/test/linter/test_v_command_callback.vader b/sources_non_forked/ale/test/linter/test_v_command_callback.vader new file mode 100644 index 00000000..17f24ad7 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_v_command_callback.vader @@ -0,0 +1,25 @@ +Before: + Save g:ale_v_v_executable + + call ale#assert#SetUpLinterTest('v', 'v') + + GivenCommandOutput ['/foo/bar', '/foo/baz'] + +After: + Restore + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'v', 'v . -o /tmp/vim-ale-v' + +Execute(Extra options should be supported): + let g:ale_v_v_options = '--foo-bar' + + AssertLinter 'v', 'v --foo-bar . -o /tmp/vim-ale-v' + + let g:ale_v_vbuild_options = '' + +Execute(The executable should be configurable): + let g:ale_v_v_executable = 'foobar' + + AssertLinter 'foobar', 'foobar . -o /tmp/vim-ale-v' diff --git a/sources_non_forked/ale/test/linter/test_vcom.vader b/sources_non_forked/ale/test/linter/test_vcom.vader new file mode 100644 index 00000000..77218f74 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_vcom.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('vhdl', 'vcom') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'vcom', ale#Escape('vcom') . ' -2008 -quiet -lint %t' + + let b:ale_vhdl_vcom_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -2008 -quiet -lint %t' + +Execute(The options should be configurable): + let b:ale_vhdl_vcom_options = '--something' + + AssertLinter 'vcom', ale#Escape('vcom') . ' --something %t' diff --git a/sources_non_forked/ale/test/linter/test_verilator.vader b/sources_non_forked/ale/test/linter/test_verilator.vader new file mode 100644 index 00000000..b65f3459 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_verilator.vader @@ -0,0 +1,14 @@ +Before: + call ale#assert#SetUpLinterTest('verilog', 'verilator') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default verilator command should be correct): + AssertLinter 'verilator', 'verilator --lint-only -Wall -Wno-DECLFILENAME -I%s:h %t' + +Execute(verilator options should be configurable): + " Additional args for the linter + let g:ale_verilog_verilator_options = '-sv --default-language "1800-2012"' + + AssertLinter 'verilator', 'verilator --lint-only -Wall -Wno-DECLFILENAME -I%s:h -sv --default-language "1800-2012" %t' diff --git a/sources_non_forked/ale/test/linter/test_vim_vimls.vader b/sources_non_forked/ale/test/linter/test_vim_vimls.vader new file mode 100644 index 00000000..eb9239a2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_vim_vimls.vader @@ -0,0 +1,77 @@ +" Author: Jeffrey Lau https://github.com/zoonfafer +" Description: Tests for the Vim vimls linter + +Before: + call ale#assert#SetUpLinterTest('vim', 'vimls') + +After: + if isdirectory(g:dir . '/.git') + call delete(g:dir . '/.git', 'd') + endif + + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'vim-language-server', ale#Escape('vim-language-server') . ' --stdio' + +Execute(should set correct LSP values): + call ale#test#SetFilename('../test-files/vim/path_with_autoload/test.vim') + AssertLSPLanguage 'vim' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_autoload') + +Execute(should set correct project for .git/): + let b:parent_dir = ale#path#Simplify(g:dir . '/..') + let b:git_dir = b:parent_dir . '/.git' + + call ale#test#SetFilename('../test-files/vim/test.vim') + + if !isdirectory(b:git_dir) + call mkdir(b:git_dir) + endif + + AssertLSPProject ale#path#Simplify(b:parent_dir) + + call delete(b:git_dir, 'd') + unlet! b:git_dir + +Execute(should set correct project for plugin/): + call ale#test#SetFilename('../test-files/vim/path_with_plugin/test.vim') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_plugin') + +Execute(should accept configuration settings): + AssertLSPConfig {} + + let b:ale_vim_vimls_config = {'vim': {'foobar': v:true}} + AssertLSPConfig {'vim': {'foobar': v:true}} + +Execute(should set correct project for .vimrc): + call ale#test#SetFilename('../test-files/vim/path_with_vimrc/.vimrc') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_vimrc') + +Execute(should set correct project for init.vim): + call ale#test#SetFilename('../test-files/vim/path_with_initvim/init.vim') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_initvim') + +Execute(should use the local executable when available): + call ale#test#SetFilename('../test-files/vim/file.vim') + + AssertLinter ale#path#Simplify(g:dir . '/../test-files/vim/node_modules/.bin/vim-language-server'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/vim/node_modules/.bin/vim-language-server')) . ' --stdio' + +Execute(should let the global executable to be used): + let g:ale_vim_vimls_use_global = 1 + call ale#test#SetFilename('../test-files/vim/file.vim') + + AssertLinter 'vim-language-server', + \ ale#Escape('vim-language-server') . ' --stdio' + +Execute(should allow the executable to be configured): + let g:ale_vim_vimls_executable = 'foobar' + call ale#test#SetFilename('../test-files/dummy') + + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio' diff --git a/sources_non_forked/ale/test/linter/test_vint.vader b/sources_non_forked/ale/test/linter/test_vint.vader new file mode 100644 index 00000000..4a224d01 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_vint.vader @@ -0,0 +1,34 @@ +Before: + call ale#assert#SetUpLinterTest('vim', 'vint') + let b:common_flags = (has('nvim') ? ' --enable-neovim' : '') + \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"' + +After: + unlet! b:common_flags + + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'vint', [ + \ ale#Escape('vint') .' --version', + \ ale#Escape('vint') .' -s --no-color' . b:common_flags . ' %t', + \] + +Execute(The executable should be configurable): + let g:ale_vim_vint_executable = 'foobar' + + AssertLinter 'foobar', [ + \ ale#Escape('foobar') .' --version', + \ ale#Escape('foobar') .' -s --no-color' . b:common_flags . ' %t', + \] + +Execute(The --no-color flag should not be used for older Vint versions): + GivenCommandOutput ['v0.3.5'] + + AssertLinter 'vint', ale#Escape('vint') .' -s' . b:common_flags . ' %t' + +Execute(--stdin-display-name should be used in newer versions): + GivenCommandOutput ['v0.4.0'] + + AssertLinter 'vint', ale#Escape('vint') .' -s --no-color' . b:common_flags + \ . ' --stdin-display-name %s -' diff --git a/sources_non_forked/ale/test/linter/test_vlog.vader b/sources_non_forked/ale/test/linter/test_vlog.vader new file mode 100644 index 00000000..a07944f7 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_vlog.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('verilog', 'vlog') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'vlog', ale#Escape('vlog') . ' -quiet -lint %t' + + let b:ale_verilog_vlog_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' -quiet -lint %t' + +Execute(The options should be configurable): + let b:ale_verilog_vlog_options = '--something' + + AssertLinter 'vlog', ale#Escape('vlog') . ' --something %t' diff --git a/sources_non_forked/ale/test/linter/test_volar.vader b/sources_non_forked/ale/test/linter/test_volar.vader new file mode 100644 index 00000000..bef094be --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_volar.vader @@ -0,0 +1,27 @@ +Before: + call ale#assert#SetUpLinterTest('vue', 'volar') + + let g:tsserver_path = '' + let g:actual_path = '' + let g:init_opts = {} + +After: + call ale#assert#TearDownLinterTest() + + unlet g:tsserver_path + unlet g:actual_path + unlet g:init_opts + +Execute(Assert Volar LSP for Vue Project): + call ale#test#SetFilename('../test-files/volar/src/App.vue') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/volar') + +Execute(Assert proper tsserverlibrary for Volar LSP): + call ale#test#SetFilename('../test-files/volar/src/App.vue') + + let g:init_opts = ale_linters#vue#volar#GetInitializationOptions(bufnr('')) + let g:tsserver_path = init_opts.typescript.serverPath + let g:actual_path = ale#path#Simplify(g:dir . '/../test-files/volar/node_modules/typescript/lib/tsserverlibrary.js') + + AssertEqual g:tsserver_path, g:actual_path diff --git a/sources_non_forked/ale/test/linter/test_vulture.vader b/sources_non_forked/ale/test/linter/test_vulture.vader new file mode 100644 index 00000000..78655bd7 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_vulture.vader @@ -0,0 +1,62 @@ +Before: + call ale#assert#SetUpLinterTest('python', 'vulture') + call ale#test#SetFilename('test.py') + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + unlet! b:bin_dir + unlet! b:executable + + call ale#assert#TearDownLinterTest() + +Execute(The vulture command callback should lint file directory by default): + AssertLinterCwd expand('#' . bufnr('') . ':p:h') + AssertLinter 'vulture', ale#Escape('vulture') . ' .' + +Execute(The vulture command callback should lint project root, when present): + call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir') + AssertLinter 'vulture', ale#Escape('vulture') . ' .' + +Execute(The option for disabling change directory works and only lints file): + let g:ale_python_vulture_change_directory = 0 + + AssertLinterCwd '' + AssertLinter 'vulture', ale#Escape('vulture') . ' %s' + +Execute(The vulture executable should be configurable, and escaped properly): + let g:ale_python_vulture_executable = 'executable with spaces' + + AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . ' .' + +Execute(The vulture command callback should let you set options): + let g:ale_python_vulture_options = '--some-option' + + AssertLinter 'vulture', ale#Escape('vulture') . ' --some-option .' + +Execute(The vulture command callback should detect virtualenv directories and switch to the project root): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + + let b:executable = ale#path#Simplify( + \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/vulture' + \) + + AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir') + AssertLinter b:executable, ale#Escape(b:executable) . ' .' + +Execute(You should able able to use the global vulture instead): + call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') + let g:ale_python_vulture_use_global = 1 + + AssertLinter 'vulture', ale#Escape('vulture') . ' .' + +Execute(Setting executable to 'pipenv' appends 'run vulture'): + let g:ale_python_vulture_executable = 'path/to/pipenv' + + AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run vulture' . ' .' +Execute(Setting executable to 'poetry' appends 'run vulture'): + let g:ale_python_vulture_executable = 'path/to/poetry' + + AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run vulture' . ' .' diff --git a/sources_non_forked/ale/test/linter/test_write_good.vader b/sources_non_forked/ale/test/linter/test_write_good.vader new file mode 100644 index 00000000..8958dd6a --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_write_good.vader @@ -0,0 +1,55 @@ +Before: + " This is just one example of a language using the linter. + call ale#assert#SetUpLinterTest('markdown', 'writegood') + + " The options are shared between many languages. + Save g:ale_writegood_options + Save g:ale_writegood_executable + Save g:ale_writegood_use_global + + unlet! g:ale_writegood_options + unlet! g:ale_writegood_executable + unlet! g:ale_writegood_use_global + + call ale#test#SetFilename('testfile.txt') + call ale#handlers#writegood#ResetOptions() + +After: + call ale#assert#TearDownLinterTest() + +Execute(The global executable should be used when the local one cannot be found): + AssertLinter + \ 'write-good', + \ ale#Escape('write-good') . ' %t', + +Execute(The options should be used in the command): + let g:ale_writegood_options = '--foo --bar' + + AssertLinter + \ 'write-good', + \ ale#Escape('write-good') . ' --foo --bar %t', + +Execute(Should use the node_modules/.bin executable, if available): + call ale#test#SetFilename('../test-files/write-good/node-modules/test.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/write-good/node-modules/node_modules/.bin/write-good'), + \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/write-good/node-modules/node_modules/.bin/write-good')) + \ . ' %t', + +Execute(Should use the node_modules/write-good executable, if available): + call ale#test#SetFilename('../test-files/write-good/node-modules-2/test.txt') + + AssertLinter + \ ale#path#Simplify(g:dir . '/../test-files/write-good/node-modules-2/node_modules/write-good/bin/write-good.js'), + \ (has('win32') ? 'node.exe ' : '') + \ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/write-good/node-modules-2/node_modules/write-good/bin/write-good.js')) + \ . ' %t', + +Execute(Should let users configure a global executable and override local paths): + call ale#test#SetFilename('../test-files/write-good/node-modules-2/test.txt') + + let g:ale_writegood_executable = 'foo-bar' + let g:ale_writegood_use_global = 1 + + AssertLinter 'foo-bar', ale#Escape('foo-bar') . ' %t' diff --git a/sources_non_forked/ale/test/linter/test_xmllint.vader b/sources_non_forked/ale/test/linter/test_xmllint.vader new file mode 100644 index 00000000..5a2377c2 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_xmllint.vader @@ -0,0 +1,20 @@ +Before: + call ale#assert#SetUpLinterTest('xml', 'xmllint') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The xml xmllint command callback should return the correct default string): + AssertLinter 'xmllint', ale#Escape('xmllint') . ' --noout -' + +Execute(The xml xmllint command callback should let you set options): + let g:ale_xml_xmllint_options = '--xinclude --postvalid' + + AssertLinter 'xmllint', + \ ale#Escape('xmllint') . ' --xinclude --postvalid --noout -' + +Execute(The xmllint executable should be configurable): + let g:ale_xml_xmllint_executable = '~/.local/bin/xmllint' + + AssertLinter '~/.local/bin/xmllint', + \ ale#Escape('~/.local/bin/xmllint') . ' --noout -' diff --git a/sources_non_forked/ale/test/linter/test_xo.vader b/sources_non_forked/ale/test/linter/test_xo.vader new file mode 100644 index 00000000..1aa4c3f1 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_xo.vader @@ -0,0 +1,23 @@ +Before: + call ale#assert#SetUpLinterTest('javascript', 'xo') + call ale#test#SetFilename('testfile.jsx') + unlet! b:executable + + set filetype=javascriptreact + runtime autoload/ale/handlers/xo.vim + +After: + call ale#assert#TearDownLinterTest() + +Execute(The XO executable should be called): + AssertLinter 'xo', ale#Escape('xo') . ' --reporter json --stdin --stdin-filename %s' + +Execute(The XO executable should be configurable): + let b:ale_javascript_xo_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --reporter json --stdin --stdin-filename %s' + +Execute(The XO options should be configurable): + let b:ale_javascript_xo_options = '--wat' + + AssertLinter 'xo', ale#Escape('xo') . ' --wat --reporter json --stdin --stdin-filename %s' diff --git a/sources_non_forked/ale/test/linter/test_xots.vader b/sources_non_forked/ale/test/linter/test_xots.vader new file mode 100644 index 00000000..cc38ff02 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_xots.vader @@ -0,0 +1,23 @@ +Before: + call ale#assert#SetUpLinterTest('typescript', 'xo') + call ale#test#SetFilename('testfile.tsx') + unlet! b:executable + + set filetype=typescriptreact + runtime autoload/ale/handlers/xo.vim + +After: + call ale#assert#TearDownLinterTest() + +Execute(The XO executable should be called): + AssertLinter 'xo', ale#Escape('xo') . ' --reporter json --stdin --stdin-filename %s' + +Execute(The XO executable should be configurable): + let b:ale_typescript_xo_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --reporter json --stdin --stdin-filename %s' + +Execute(The XO options should be configurable): + let b:ale_typescript_xo_options = '--wat' + + AssertLinter 'xo', ale#Escape('xo') . ' --wat --reporter json --stdin --stdin-filename %s' diff --git a/sources_non_forked/ale/test/linter/test_xvhdl.vader b/sources_non_forked/ale/test/linter/test_xvhdl.vader new file mode 100644 index 00000000..86f9a32d --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_xvhdl.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('vhdl', 'xvhdl') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --2008 %t' + + let b:ale_vhdl_xvhdl_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' --2008 %t' + +Execute(The options should be configurable): + let b:ale_vhdl_xvhdl_options = '--something' + + AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --something %t' diff --git a/sources_non_forked/ale/test/linter/test_xvlog.vader b/sources_non_forked/ale/test/linter/test_xvlog.vader new file mode 100644 index 00000000..564ac979 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_xvlog.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('verilog', 'xvlog') + +After: + unlet! b:command_tail + + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'xvlog', ale#Escape('xvlog') . ' %t' + + let b:ale_verilog_xvlog_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') . ' %t' + +Execute(The options should be configurable): + let b:ale_verilog_xvlog_options = '--something' + + AssertLinter 'xvlog', ale#Escape('xvlog') . ' --something %t' diff --git a/sources_non_forked/ale/test/linter/test_yaml_ls.vader b/sources_non_forked/ale/test/linter/test_yaml_ls.vader new file mode 100644 index 00000000..449ce8c3 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_yaml_ls.vader @@ -0,0 +1,21 @@ +Before: + call ale#assert#SetUpLinterTest('yaml', 'ls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'yaml-language-server', ale#Escape('yaml-language-server') . ' --stdio' + +Execute(should set correct LSP values): + call ale#test#SetFilename('../test-files/yaml/test.yaml') + + AssertLSPLanguage 'yaml' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/yaml') + +Execute(should accept configuration settings): + AssertLSPConfig {} + let b:ale_yaml_ls_config = {'yaml': {'hover': v:false, 'completion': v:true}} + AssertLSPConfig {'yaml': {'hover': v:false, 'completion': v:true}} diff --git a/sources_non_forked/ale/test/linter/test_yang_lsp.vader b/sources_non_forked/ale/test/linter/test_yang_lsp.vader new file mode 100644 index 00000000..5be7501f --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_yang_lsp.vader @@ -0,0 +1,12 @@ +Before: + call ale#assert#SetUpLinterTest('yang', 'yang_lsp') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The executable should be configurable): + AssertLinter 'yang-language-server', ale#Escape('yang-language-server') + + let b:ale_yang_lsp_executable = 'foobar' + + AssertLinter 'foobar', ale#Escape('foobar') diff --git a/sources_non_forked/ale/test/linter/test_zeek.vader b/sources_non_forked/ale/test/linter/test_zeek.vader new file mode 100644 index 00000000..af58a414 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_zeek.vader @@ -0,0 +1,17 @@ +Before: + call ale#assert#SetUpLinterTest('zeek', 'zeek') + + let b:command_tail = ' --parse-only %s' + +After: + call ale#assert#TearDownLinterTest() + + unlet! b:command_tail + +Execute(The default command should be correct): + AssertLinter 'zeek', ale#Escape('zeek') . b:command_tail + +Execute(The zeek executable should be configurable, and escaped properly): + let g:ale_zeek_zeek_executable = 'executable with spaces' + + AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . b:command_tail diff --git a/sources_non_forked/ale/test/linter/test_zig_zls.vader b/sources_non_forked/ale/test/linter/test_zig_zls.vader new file mode 100644 index 00000000..6d814be4 --- /dev/null +++ b/sources_non_forked/ale/test/linter/test_zig_zls.vader @@ -0,0 +1,15 @@ +Before: + call ale#assert#SetUpLinterTest('zig', 'zls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default executable path should be correct): + AssertLinter 'zls', ale#Escape('zls') + +Execute(The project root should be detected correctly): + AssertLSPProject '' + + call ale#test#SetFilename('../test-files/zig/main.zig') + + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/zig') diff --git a/sources_non_forked/ale/test/lsp/test_closing_documents.vader b/sources_non_forked/ale/test/lsp/test_closing_documents.vader new file mode 100644 index 00000000..b9f2f824 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_closing_documents.vader @@ -0,0 +1,176 @@ +Before: + runtime autoload/ale/lsp.vim + + let g:message_list = [] + + function! MarkAllConnectionsInitialized() abort + for l:conn in values(ale#lsp#GetConnections()) + let l:conn.initialized = 1 + endfor + endfunction + + function! MarkDocumentOpened() abort + for l:conn in values(ale#lsp#GetConnections()) + let l:conn.open_documents[bufnr('')] = 1 + endfor + endfunction + + function! ale#lsp#Send(conn_id, message) abort + let l:connections = ale#lsp#GetConnections() + + if !l:connections[a:conn_id].initialized + throw 'LSP server not initialized yet!' + endif + + call add(g:message_list, [a:conn_id] + a:message) + endfunction + + call ale#lsp#ResetConnections() + +After: + unlet! g:message_list + delfunction MarkAllConnectionsInitialized + delfunction MarkDocumentOpened + + call ale#lsp#ResetConnections() + + runtime autoload/ale/lsp.vim + +Execute(No errors should be thrown if the connection is not initialized): + call ale#lsp#Register('command', '/foo', {}) + call MarkDocumentOpened() + + call ale#engine#Cleanup(bufnr('')) + AssertEqual [], g:message_list + +Execute(No messages should be sent if the document wasn't opened): + call ale#lsp#Register('command', '/foo', {}) + call MarkAllConnectionsInitialized() + + call ale#engine#Cleanup(bufnr('')) + AssertEqual [], g:message_list + +Execute(A message should be sent if the document was opened): + call ale#lsp#Register('command', '/foo', {}) + call MarkAllConnectionsInitialized() + + call ale#lsp#OpenDocument('command:/foo', bufnr(''), 'lang') + call ale#engine#Cleanup(bufnr('')) + " We should only send the message once. + call ale#engine#Cleanup(bufnr('')) + + AssertEqual + \ [ + \ ['command:/foo', 1, 'textDocument/didOpen', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ 'languageId': 'lang', + \ 'text': "\n", + \ }, + \ }], + \ ['command:/foo', 1, 'textDocument/didClose', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ }, + \ }], + \ ], + \ g:message_list + +Execute(A message should be sent if the document was opened for tsserver): + call ale#lsp#Register('command', '/foo', {}) + call ale#lsp#MarkConnectionAsTsserver('command:/foo') + + call ale#lsp#OpenDocument('command:/foo', bufnr(''), 'lang') + call ale#engine#Cleanup(bufnr('')) + " We should only send the message once. + call ale#engine#Cleanup(bufnr('')) + + AssertEqual + \ [ + \ ['command:/foo', 1, 'ts@open', {'file': expand('%:p')}], + \ ['command:/foo', 1, 'ts@close', {'file': expand('%:p')}], + \ ], + \ g:message_list + +Execute(Re-opening and closing the documents should work): + call ale#lsp#Register('command', '/foo', {}) + call MarkAllConnectionsInitialized() + + call ale#lsp#OpenDocument('command:/foo', bufnr(''), 'lang') + call ale#engine#Cleanup(bufnr('')) + call ale#lsp#OpenDocument('command:/foo', bufnr(''), 'lang') + call ale#engine#Cleanup(bufnr('')) + + AssertEqual + \ [ + \ ['command:/foo', 1, 'textDocument/didOpen', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 2, + \ 'languageId': 'lang', + \ 'text': "\n", + \ }, + \ }], + \ ['command:/foo', 1, 'textDocument/didClose', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ }, + \ }], + \ ['command:/foo', 1, 'textDocument/didOpen', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ 'languageId': 'lang', + \ 'text': "\n", + \ }, + \ }], + \ ['command:/foo', 1, 'textDocument/didClose', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ }, + \ }], + \ ], + \ g:message_list + +Execute(Messages for closing documents should be sent to each server): + call ale#lsp#Register('command', '/foo', {}) + call ale#lsp#Register('command', '/bar', {}) + call MarkAllConnectionsInitialized() + + call ale#lsp#OpenDocument('command:/foo', bufnr(''), 'lang') + call ale#lsp#OpenDocument('command:/bar', bufnr(''), 'lang') + call ale#engine#Cleanup(bufnr('')) + " We should only send the message once. + call ale#engine#Cleanup(bufnr('')) + + AssertEqual + \ [ + \ ['command:/foo', 1, 'textDocument/didOpen', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 2, + \ 'languageId': 'lang', + \ 'text': "\n", + \ }, + \ }], + \ ['command:/bar', 1, 'textDocument/didOpen', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ 'languageId': 'lang', + \ 'text': "\n", + \ }, + \ }], + \ ['command:/bar', 1, 'textDocument/didClose', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ }, + \ }], + \ ['command:/foo', 1, 'textDocument/didClose', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ }, + \ }], + \ ], + \ g:message_list diff --git a/sources_non_forked/ale/test/lsp/test_did_save_event.vader b/sources_non_forked/ale/test/lsp/test_did_save_event.vader new file mode 100644 index 00000000..fc73c4d6 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_did_save_event.vader @@ -0,0 +1,147 @@ +Before: + Save g:ale_lint_on_save + Save g:ale_enabled + Save g:ale_linters + Save g:ale_run_synchronously + Save g:ale_disable_lsp + + call ale#test#SetDirectory('/testplugin/test/completion') + call ale#test#SetFilename('dummy.txt') + + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + + let g:ale_disable_lsp = 0 + unlet! b:ale_disable_lsp + let g:ale_lint_on_save = 1 + let b:ale_enabled = 1 + let g:ale_lsp_next_message_id = 1 + let g:ale_run_synchronously = 1 + let g:conn_id = v:null + let g:message_list = [] + + function! LanguageCallback() abort + return 'foobar' + endfunction + + function! ProjectRootCallback() abort + return expand('.') + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'dummy_linter', + \ 'lsp': 'stdio', + \ 'command': 'cat - > /dev/null', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'language': function('LanguageCallback'), + \ 'project_root': function('ProjectRootCallback'), + \ }) + let g:ale_linters = {'foobar': ['dummy_linter']} + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + let l:details = { + \ 'command': 'foobar', + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \} + + call a:Callback(a:linter, l:details) + + return 1 + endfunction + + " Replace the Send function for LSP, so we can monitor calls to it. + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + endfunction + +After: + Restore + + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + unlet! b:ale_enabled + unlet! b:ale_linters + unlet! g:message_list + unlet! b:ale_save_event_fired + + delfunction LanguageCallback + delfunction ProjectRootCallback + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + " Stop any timers we left behind. + " This stops the tests from failing randomly. + call ale#completion#StopTimer() + + runtime autoload/ale/completion.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + +Given foobar (Some imaginary filetype): + + +Execute(Server should be notified on save): + call ale#events#SaveEvent(bufnr('')) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}], + \ }], + \ ], + \ g:message_list + +Execute(Server should be notified on save with didSave is supported by server): + + " Replace has capability function to simulate didSave server capability + function! ale#lsp#HasCapability(conn_id, capability) abort + if a:capability == 'did_save' + return 1 + endif + return 0 + endfunction + + call ale#events#SaveEvent(bufnr('')) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}], + \ }], + \ [1, 'textDocument/didSave', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ }, + \ }], + \ ], + \ g:message_list + +Execute(Server should be notified on change): + call ale#events#FileChangedEvent(bufnr('')) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}], + \ }], + \ ], + \ g:message_list diff --git a/sources_non_forked/ale/test/lsp/test_engine_lsp_response_handling.vader b/sources_non_forked/ale/test/lsp/test_engine_lsp_response_handling.vader new file mode 100644 index 00000000..50ceef4d --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_engine_lsp_response_handling.vader @@ -0,0 +1,428 @@ +Before: + Save g:ale_set_lists_synchronously + Save g:ale_buffer_info + Save g:ale_lsp_error_messages + Save g:ale_set_loclist + Save g:ale_set_signs + Save g:ale_set_quickfix + Save g:ale_set_highlights + Save g:ale_echo_cursor + Save g:ale_disable_lsp + Save g:ale_history_enabled + Save g:ale_history_log_output + + let g:ale_disable_lsp = 0 + let g:ale_set_lists_synchronously = 1 + let g:ale_buffer_info = {} + let g:ale_set_loclist = 1 + " Disable features we don't need for these tests. + let g:ale_set_signs = 0 + let g:ale_set_quickfix = 0 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + let g:ale_history_enabled = 1 + let g:ale_history_log_output = 1 + + unlet! g:ale_lsp_error_messages + unlet! b:ale_linters + unlet! b:ale_disable_lsp + + call ale#linter#Reset() + call ale#test#SetDirectory('/testplugin/test') + call setloclist(0, []) + +After: + Restore + + unlet! b:ale_linters + + call setloclist(0, []) + call ale#test#RestoreDirectory() + call ale#linter#Reset() + call ale#lsp_linter#ClearLSPData() + +Given foobar(An empty file): +Execute(tsserver syntax error responses should be handled correctly): + runtime ale_linters/typescript/tsserver.vim + + if has('win32') + call ale#test#SetFilename('filename,[]^$.ts') + else + call ale#test#SetFilename('filename*?,{}[]^$.ts') + endif + + call ale#engine#InitBufferInfo(bufnr('')) + + if has('win32') + AssertEqual 'filename,[]^$.ts', expand('%:p:t') + else + AssertEqual 'filename*?,{}[]^$.ts', expand('%:p:t') + endif + + " When we get syntax errors and no semantic errors, we should keep the + " syntax errors. + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'syntaxDiag', + \ 'body': { + \ 'file': expand('%:p'), + \ 'diagnostics':[ + \ { + \ 'start': { + \ 'line':2, + \ 'offset':14, + \ }, + \ 'end': { + \ 'line':2, + \ 'offset':15, + \ }, + \ 'text': ''','' expected.', + \ "code":1005 + \ }, + \ ], + \ }, + \}) + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'semanticDiag', + \ 'body': { + \ 'file': expand('%:p'), + \ 'diagnostics':[ + \ ], + \ }, + \}) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 14, + \ 'vcol': 0, + \ 'nr': 1005, + \ 'type': 'E', + \ 'text': '1005: '','' expected.', + \ 'valid': 1, + \ 'pattern': '', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + + " After we get empty syntax errors, we should clear them. + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'syntaxDiag', + \ 'body': { + \ 'file': expand('%:p'), + \ 'diagnostics':[ + \ ], + \ }, + \}) + + AssertEqual + \ [ + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + + " Syntax errors on the project root should not populate the LocList. + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'syntaxDiag', + \ 'body': { + \ 'file': g:dir, + \ 'diagnostics':[ + \ { + \ 'start': { + \ 'line':2, + \ 'offset':14, + \ }, + \ 'end': { + \ 'line':2, + \ 'offset':15, + \ }, + \ 'text': ''','' expected.', + \ "code":1005 + \ }, + \ ], + \ }, + \}) + + AssertEqual + \ [ + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(tsserver semantic error responses should be handled correctly): + runtime ale_linters/typescript/tsserver.vim + + if has('win32') + call ale#test#SetFilename('filename,[]^$.ts') + else + call ale#test#SetFilename('filename*?,{}[]^$.ts') + endif + + call ale#engine#InitBufferInfo(bufnr('')) + + if has('win32') + AssertEqual 'filename,[]^$.ts', expand('%:p:t') + else + AssertEqual 'filename*?,{}[]^$.ts', expand('%:p:t') + endif + + " When we get syntax errors and no semantic errors, we should keep the + " syntax errors. + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'syntaxDiag', + \ 'body': { + \ 'file': expand('%:p'), + \ 'diagnostics':[ + \ ], + \ }, + \}) + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'semanticDiag', + \ 'body': { + \ 'file': expand('%:p'), + \ 'diagnostics':[ + \ { + \ 'start': { + \ 'line':2, + \ 'offset':14, + \ }, + \ 'end': { + \ 'line':2, + \ 'offset':15, + \ }, + \ 'text': 'Some semantic error', + \ "code":1005 + \ }, + \ ], + \ }, + \}) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 14, + \ 'vcol': 0, + \ 'nr': 1005, + \ 'type': 'E', + \ 'text': '1005: Some semantic error', + \ 'valid': 1, + \ 'pattern': '', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + + " After we get empty syntax errors, we should clear them. + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'semanticDiag', + \ 'body': { + \ 'file': expand('%:p'), + \ 'diagnostics':[ + \ ], + \ }, + \}) + + AssertEqual + \ [ + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + + " Semantic errors on the project root should not populate the LocList. + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'semanticDiag', + \ 'body': { + \ 'file': g:dir, + \ 'diagnostics':[ + \ { + \ 'start': { + \ 'line':2, + \ 'offset':14, + \ }, + \ 'end': { + \ 'line':2, + \ 'offset':15, + \ }, + \ 'text': 'Some semantic error', + \ "code":1005 + \ }, + \ ], + \ }, + \}) + + AssertEqual + \ [ + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(tsserver errors should mark tsserver no longer active): + let b:ale_linters = ['tsserver'] + runtime ale_linters/typescript/tsserver.vim + call ale#test#SetFilename('filename.ts') + call ale#engine#InitBufferInfo(bufnr('')) + + let g:ale_buffer_info[bufnr('')].active_linter_list = ale#linter#Get('typescript') + Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list) + + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'semanticDiag', + \ 'body': { + \ 'file': g:dir . '/filename.ts', + \ 'diagnostics':[], + \ }, + \}) + + AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list + +Execute(LSP diagnostics responses should be handled correctly): + let b:ale_linters = ['eclipselsp'] + runtime ale_linters/java/eclipselsp.vim + + if has('win32') + call ale#test#SetFilename('filename,[]^$.ts') + else + call ale#test#SetFilename('filename*?,{}[]^$.java') + endif + + call ale#engine#InitBufferInfo(bufnr('')) + call ale#lsp_linter#SetLSPLinterMap({'1': 'eclipselsp'}) + + if has('win32') + AssertEqual 'filename,[]^$.ts', expand('%:p:t') + else + AssertEqual 'filename*?,{}[]^$.java', expand('%:p:t') + endif + + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'jsonrpc':'2.0', + \ 'method':'textDocument/publishDiagnostics', + \ 'params': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'diagnostics': [ + \ { + \ 'range': { + \ 'start': { + \ 'line': 0, + \ 'character':0 + \ }, + \ 'end': { + \ 'line': 0, + \ 'character':0 + \ } + \ }, + \ 'severity': 2, + \ 'code': "", + \ 'source': 'Java', + \ 'message': 'Missing JRE 1-8' + \ } + \ ] + \ } + \}) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'pattern': '', + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': -1, + \ 'type': 'W', + \ 'text': 'Missing JRE 1-8' + \ } + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(LSP diagnostics responses on project root should not populate loclist): + let b:ale_linters = ['eclipselsp'] + runtime ale_linters/java/eclipselsp.vim + call ale#test#SetFilename('filename.java') + call ale#engine#InitBufferInfo(bufnr('')) + call ale#lsp_linter#SetLSPLinterMap({'1': 'eclipselsp'}) + + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'jsonrpc':'2.0', + \ 'method':'textDocument/publishDiagnostics', + \ 'params': { + \ 'uri':'file://' . g:dir, + \ 'diagnostics': [ + \ { + \ 'range': { + \ 'start': { + \ 'line': 0, + \ 'character':0 + \ }, + \ 'end': { + \ 'line': 0, + \ 'character':0 + \ } + \ }, + \ 'severity': 2, + \ 'code': "", + \ 'source': 'Java', + \ 'message': 'Missing JRE 1-8' + \ } + \ ] + \ } + \}) + + AssertEqual + \ [ + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(LSP errors should mark linters no longer active): + let b:ale_linters = ['pylsp'] + runtime ale_linters/python/pylsp.vim + call ale#test#SetFilename('filename.py') + call ale#engine#InitBufferInfo(bufnr('')) + call ale#lsp_linter#SetLSPLinterMap({1: 'pylsp'}) + + let g:ale_buffer_info[bufnr('')].active_linter_list = ale#linter#Get('python') + Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list) + + call ale#lsp_linter#HandleLSPResponse(1, { + \ 'method': 'textDocument/publishDiagnostics', + \ 'params': { + \ 'uri': ale#path#ToFileURI(g:dir . '/filename.py'), + \ 'diagnostics': [], + \ }, + \}) + + AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list + +Execute(LSP errors should be logged in the history): + call ale#lsp_linter#SetLSPLinterMap({'347': 'foobar'}) + call ale#lsp_linter#HandleLSPResponse(347, { + \ 'jsonrpc': '2.0', + \ 'error': { + \ 'code': -32602, + \ 'message': 'xyz', + \ 'data': { + \ 'traceback': ['123', '456'], + \ }, + \ }, + \}) + + AssertEqual + \ {'foobar': ["xyz\n123\n456"]}, + \ get(g:, 'ale_lsp_error_messages', {}) diff --git a/sources_non_forked/ale/test/lsp/test_handling_window_requests.vader b/sources_non_forked/ale/test/lsp/test_handling_window_requests.vader new file mode 100644 index 00000000..551d5975 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_handling_window_requests.vader @@ -0,0 +1,94 @@ +Before: + let g:expr_list = [] + let g:linter_name = 'some_linter' + let g:format = '%severity%:%linter%: %s' + " Get the default value to restore it + let g:default_severity = g:ale_lsp_show_message_severity + let g:ale_lsp_show_message_severity = 'information' + + function! ale#util#ShowMessage(expr) abort + call add(g:expr_list, a:expr) + endfunction + +After: + unlet! g:expr_list + unlet! g:linter_name + unlet! g:format + let g:ale_lsp_show_message_severity = g:default_severity + unlet! g:default_severity + +Execute(ale#lsp_window#HandleShowMessage() should only show errors when severity is set to "error"): + let g:ale_lsp_show_message_severity = 'error' + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) + AssertEqual ['Error:some_linter: an error'], g:expr_list + +Execute(ale#lsp_window#HandleShowMessage() should only show errors and warnings when severity is set to "warning"): + let g:ale_lsp_show_message_severity = 'warning' + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) + AssertEqual ['Error:some_linter: an error', 'Warning:some_linter: a warning'], g:expr_list + +Execute(ale#lsp_window#HandleShowMessage() should only show errors, warnings and infos when severity is set to "information"): + let g:ale_lsp_show_message_severity = 'information' + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) + AssertEqual [ + \ 'Error:some_linter: an error', + \ 'Warning:some_linter: a warning', + \ 'Info:some_linter: an info'], + \ g:expr_list + +Execute(ale#lsp_window#HandleShowMessage() should only show errors, warnings and infos when severity is set to "info"): + let g:ale_lsp_show_message_severity = 'info' + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) + AssertEqual [ + \ 'Error:some_linter: an error', + \ 'Warning:some_linter: a warning', + \ 'Info:some_linter: an info'], + \ g:expr_list + +Execute(ale#lsp_window#HandleShowMessage() should show all messages is severity is set to "log"): + let g:ale_lsp_show_message_severity = 'log' + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) + AssertEqual [ + \ 'Error:some_linter: an error', + \ 'Warning:some_linter: a warning', + \ 'Info:some_linter: an info', + \ 'Log:some_linter: a log'], + \ g:expr_list + +Execute(ale#lsp_window#HandleShowMessage() should not show anything if severity is configured as disabled): + let g:ale_lsp_show_message_severity = 'disabled' + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) + AssertEqual [], g:expr_list + +Execute(ale#lsp_window#HandleShowMessage() should use "warning" when severity is set to an invalid value): + let g:ale_lsp_show_message_severity = 'foo' + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) + AssertEqual [ + \ 'Error:some_linter: an error', + \ 'Warning:some_linter: a warning'], + \ g:expr_list + +Execute(ale#lsp_window#HandleShowMessage() should escape quotes on messages): + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':"this is an 'info'"}) + AssertEqual ['Info:some_linter: this is an ''info'''], g:expr_list diff --git a/sources_non_forked/ale/test/lsp/test_lsp_client_messages.vader b/sources_non_forked/ale/test/lsp/test_lsp_client_messages.vader new file mode 100644 index 00000000..4d897b51 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_lsp_client_messages.vader @@ -0,0 +1,389 @@ +Before: + let g:ale_lsp_next_version_id = 1 + + call ale#test#SetDirectory('/testplugin/test/lsp') + call ale#test#SetFilename('foo/bar.ts') + +After: + call ale#test#RestoreDirectory() + +Execute(ale#lsp#message#Initialize() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'initialize', + \ { + \ 'processId': getpid(), + \ 'rootPath': '/foo/bar', + \ 'capabilities': {}, + \ 'initializationOptions': {'foo': 'bar'}, + \ 'rootUri': 'file:///foo/bar', + \ } + \ ], + \ ale#lsp#message#Initialize('/foo/bar', {'foo': 'bar'}, {}) + +Execute(ale#lsp#message#Initialized() should return correct messages): + AssertEqual [1, 'initialized', {}], ale#lsp#message#Initialized() + +Execute(ale#lsp#message#Shutdown() should return correct messages): + AssertEqual [0, 'shutdown'], ale#lsp#message#Shutdown() + +Execute(ale#lsp#message#Exit() should return correct messages): + AssertEqual [1, 'exit'], ale#lsp#message#Exit(), + +Given typescript(A TypeScript file with 3 lines): + foo() + bar() + baz() + +Execute(ale#lsp#message#DidOpen() should return correct messages): + let g:ale_lsp_next_version_id = 12 + AssertEqual + \ [ + \ 1, + \ 'textDocument/didOpen', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ 'languageId': 'typescript', + \ 'version': 12, + \ 'text': "foo()\nbar()\nbaz()\n", + \ }, + \ } + \ ], + \ ale#lsp#message#DidOpen(bufnr(''), 'typescript') + +Execute(ale#lsp#message#DidChange() should return correct messages): + let g:ale_lsp_next_version_id = 34 + + AssertEqual + \ [ + \ 1, + \ 'textDocument/didChange', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ 'version': 34, + \ }, + \ 'contentChanges': [{'text': "foo()\nbar()\nbaz()\n"}], + \ } + \ ], + \ ale#lsp#message#DidChange(bufnr('')) + " The version numbers should increment. + AssertEqual + \ 35, + \ ale#lsp#message#DidChange(bufnr(''))[2].textDocument.version + AssertEqual + \ 36, + \ ale#lsp#message#DidChange(bufnr(''))[2].textDocument.version + +Execute(ale#lsp#message#DidSave() should return correct messages): + AssertEqual + \ [ + \ 1, + \ 'textDocument/didSave', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ } + \ ], + \ ale#lsp#message#DidSave(bufnr(''), v:false) + +Execute(ale#lsp#message#DidSave() should return correct message with includeText capability): + AssertEqual + \ [ + \ 1, + \ 'textDocument/didSave', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ 'version': 1, + \ }, + \ 'text': ale#util#GetBufferContents(bufnr('')), + \ } + \ ], + \ ale#lsp#message#DidSave(bufnr(''), v:true) + +Execute(ale#lsp#message#DidClose() should return correct messages): + AssertEqual + \ [ + \ 1, + \ 'textDocument/didClose', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ } + \ ], + \ ale#lsp#message#DidClose(bufnr('')) + +Execute(ale#lsp#message#Completion() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'textDocument/completion', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ 'position': {'line': 11, 'character': 33}, + \ } + \ ], + \ ale#lsp#message#Completion(bufnr(''), 12, 34, '') + +Execute(ale#lsp#message#Completion() should return correct messages with a trigger charaacter): + AssertEqual + \ [ + \ 0, + \ 'textDocument/completion', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ 'position': {'line': 11, 'character': 33}, + \ 'context': {'triggerKind': 2, 'triggerCharacter': '.'}, + \ } + \ ], + \ ale#lsp#message#Completion(bufnr(''), 12, 34, '.') + \ +Execute(ale#lsp#message#Definition() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'textDocument/definition', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ 'position': {'line': 11, 'character': 33}, + \ } + \ ], + \ ale#lsp#message#Definition(bufnr(''), 12, 34) + +Execute(ale#lsp#message#TypeDefinition() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'textDocument/typeDefinition', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ 'position': {'line': 11, 'character': 33}, + \ } + \ ], + \ ale#lsp#message#TypeDefinition(bufnr(''), 12, 34) + +Execute(ale#lsp#message#Implementation() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'textDocument/implementation', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ 'position': {'line': 11, 'character': 33}, + \ } + \ ], + \ ale#lsp#message#Implementation(bufnr(''), 12, 34) + +Execute(ale#lsp#message#References() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'textDocument/references', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ 'position': {'line': 11, 'character': 33}, + \ 'context': {'includeDeclaration': v:false}, + \ } + \ ], + \ ale#lsp#message#References(bufnr(''), 12, 34) + +Execute(ale#lsp#message#Symbol() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'workspace/symbol', + \ { + \ 'query': 'foobar', + \ } + \ ], + \ ale#lsp#message#Symbol('foobar') + +Execute(ale#lsp#message#Hover() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'textDocument/hover', + \ { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(g:dir . '/foo/bar.ts'), + \ }, + \ 'position': {'line': 11, 'character': 33}, + \ } + \ ], + \ ale#lsp#message#Hover(bufnr(''), 12, 34) + +Execute(ale#lsp#message#DidChangeConfiguration() should return correct messages): + let g:ale_lsp_configuration = { + \ 'foo': 'bar' + \ } + AssertEqual + \ [ + \ 1, + \ 'workspace/didChangeConfiguration', + \ { + \ 'settings': { + \ 'foo': 'bar', + \ } + \ } + \ ], + \ ale#lsp#message#DidChangeConfiguration(bufnr(''), g:ale_lsp_configuration) + +Execute(ale#lsp#tsserver_message#Open() should return correct messages): + AssertEqual + \ [ + \ 1, + \ 'ts@open', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ } + \ ], + \ ale#lsp#tsserver_message#Open(bufnr('')) + +Execute(ale#lsp#tsserver_message#Close() should return correct messages): + AssertEqual + \ [ + \ 1, + \ 'ts@close', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ } + \ ], + \ ale#lsp#tsserver_message#Close(bufnr('')) + +Execute(ale#lsp#tsserver_message#Change() should return correct messages): + AssertEqual + \ [ + \ 1, + \ 'ts@change', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 1, + \ 'offset': 1, + \ 'endLine': 1073741824, + \ 'endOffset': 1, + \ 'insertString': "foo()\nbar()\nbaz()\n", + \ } + \ ], + \ ale#lsp#tsserver_message#Change(bufnr('')) + +Execute(ale#lsp#tsserver_message#Geterr() should return correct messages): + AssertEqual + \ [ + \ 1, + \ 'ts@geterr', + \ { + \ 'files': [ale#path#Simplify(g:dir . '/foo/bar.ts')], + \ } + \ ], + \ ale#lsp#tsserver_message#Geterr(bufnr('')) + +Execute(ale#lsp#tsserver_message#Completions() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'ts@completions', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 347, + \ 'offset': 12, + \ 'prefix': 'abc', + \ 'includeExternalModuleExports': 1, + \ } + \ ], + \ ale#lsp#tsserver_message#Completions(bufnr(''), 347, 12, 'abc', 1) + +Execute(ale#lsp#tsserver_message#CompletionEntryDetails() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'ts@completionEntryDetails', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 347, + \ 'offset': 12, + \ 'entryNames': ['foo', 'bar'], + \ } + \ ], + \ ale#lsp#tsserver_message#CompletionEntryDetails(bufnr(''), 347, 12, ['foo', 'bar']) + +Execute(ale#lsp#tsserver_message#Definition() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'ts@definition', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 347, + \ 'offset': 12, + \ } + \ ], + \ ale#lsp#tsserver_message#Definition(bufnr(''), 347, 12) + +Execute(ale#lsp#tsserver_message#TypeDefinition() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'ts@typeDefinition', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 347, + \ 'offset': 12, + \ } + \ ], + \ ale#lsp#tsserver_message#TypeDefinition(bufnr(''), 347, 12) + +Execute(ale#lsp#tsserver_message#Implementation() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'ts@implementation', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 347, + \ 'offset': 12, + \ } + \ ], + \ ale#lsp#tsserver_message#Implementation(bufnr(''), 347, 12) + +Execute(ale#lsp#tsserver_message#References() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'ts@references', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 347, + \ 'offset': 12, + \ } + \ ], + \ ale#lsp#tsserver_message#References(bufnr(''), 347, 12) + +Execute(ale#lsp#tsserver_message#Quickinfo() should return correct messages): + AssertEqual + \ [ + \ 0, + \ 'ts@quickinfo', + \ { + \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'), + \ 'line': 347, + \ 'offset': 12, + \ } + \ ], + \ ale#lsp#tsserver_message#Quickinfo(bufnr(''), 347, 12) diff --git a/sources_non_forked/ale/test/lsp/test_lsp_command_formatting.vader b/sources_non_forked/ale/test/lsp/test_lsp_command_formatting.vader new file mode 100644 index 00000000..e99e1dad --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_lsp_command_formatting.vader @@ -0,0 +1,44 @@ +Before: + Save g:ale_command_wrapper + + runtime autoload/ale/lsp.vim + + let g:ale_command_wrapper = '' + + let g:args = [] + + " Mock the StartProgram function so we can just capture the arguments. + function! ale#lsp#StartProgram(...) abort + let g:args = a:000[1:] + endfunction + +After: + Restore + + unlet! g:args + + runtime autoload/ale/lsp.vim + +Execute(Command formatting should be applied correctly for LSP linters): + call ale#lsp_linter#StartLSP( + \ bufnr(''), + \ { + \ 'name': 'linter', + \ 'language': {-> 'x'}, + \ 'project_root': {-> '/foo/bar'}, + \ 'lsp': 'stdio', + \ 'executable': has('win32') ? 'cmd': 'true', + \ 'command': '%e --foo', + \ }, + \ {-> 0} + \) + + if has('win32') + AssertEqual + \ ['cmd', 'cmd /s/c "cmd --foo"'], + \ g:args + else + AssertEqual + \ ['true', [&shell, '-c', '''true'' --foo']], + \ g:args + endif diff --git a/sources_non_forked/ale/test/lsp/test_lsp_connections.vader b/sources_non_forked/ale/test/lsp/test_lsp_connections.vader new file mode 100644 index 00000000..1c2fceab --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_lsp_connections.vader @@ -0,0 +1,227 @@ +Before: + let g:ale_lsp_next_message_id = 1 + +After: + if exists('b:conn') && has_key(b:conn, 'id') + call ale#lsp#RemoveConnectionWithID(b:conn.id) + endif + + unlet! b:data + unlet! b:conn + +Execute(GetNextMessageID() should increment appropriately): + " We should get the initial ID, and increment a bit. + AssertEqual 1, ale#lsp#GetNextMessageID() + AssertEqual 2, ale#lsp#GetNextMessageID() + AssertEqual 3, ale#lsp#GetNextMessageID() + + " Set the maximum ID. + let g:ale_lsp_next_message_id = 9223372036854775807 + + " When we hit the maximum ID, the next ID afterwards should be 1. + AssertEqual 9223372036854775807, ale#lsp#GetNextMessageID() + AssertEqual 1, ale#lsp#GetNextMessageID() + +Execute(ale#lsp#CreateMessageData() should create an appropriate message): + " NeoVim outputs JSON with spaces, so the output is a little different. + if has('nvim') + " 79 is the size in bytes for UTF-8, not the number of characters. + AssertEqual + \ [ + \ 1, + \ "Content-Length: 79\r\n\r\n" + \ . '{"method": "someMethod", "jsonrpc": "2.0", "id": 1, "params": {"foo": "barÜ"}}', + \ ], + \ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}]) + " Check again to ensure that we use the next ID. + AssertEqual + \ [ + \ 2, + \ "Content-Length: 79\r\n\r\n" + \ . '{"method": "someMethod", "jsonrpc": "2.0", "id": 2, "params": {"foo": "barÜ"}}', + \ ], + \ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}]) + else + AssertEqual + \ [ + \ 1, + \ "Content-Length: 71\r\n\r\n" + \ . '{"method":"someMethod","jsonrpc":"2.0","id":1,"params":{"foo":"barÜ"}}', + \ ], + \ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}]) + AssertEqual + \ [ + \ 2, + \ "Content-Length: 71\r\n\r\n" + \ . '{"method":"someMethod","jsonrpc":"2.0","id":2,"params":{"foo":"barÜ"}}', + \ ], + \ ale#lsp#CreateMessageData([0, 'someMethod', {'foo': 'barÜ'}]) + endif + +Execute(ale#lsp#CreateMessageData() should create messages without params): + if has('nvim') + AssertEqual + \ [ + \ 1, + \ "Content-Length: 56\r\n\r\n" + \ . '{"method": "someOtherMethod", "jsonrpc": "2.0", "id": 1}', + \ ], + \ ale#lsp#CreateMessageData([0, 'someOtherMethod']) + else + AssertEqual + \ [ + \ 1, + \ "Content-Length: 51\r\n\r\n" + \ . '{"method":"someOtherMethod","jsonrpc":"2.0","id":1}', + \ ], + \ ale#lsp#CreateMessageData([0, 'someOtherMethod']) + endif + +Execute(ale#lsp#CreateMessageData() should create notifications): + if has('nvim') + AssertEqual + \ [ + \ 0, + \ "Content-Length: 48\r\n\r\n" + \ . '{"method": "someNotification", "jsonrpc": "2.0"}', + \ ], + \ ale#lsp#CreateMessageData([1, 'someNotification']) + AssertEqual + \ [ + \ 0, + \ "Content-Length: 74\r\n\r\n" + \ . '{"method": "someNotification", "jsonrpc": "2.0", "params": {"foo": "bar"}}', + \ ], + \ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}]) + else + AssertEqual + \ [ + \ 0, + \ "Content-Length: 45\r\n\r\n" + \ . '{"method":"someNotification","jsonrpc":"2.0"}', + \ ], + \ ale#lsp#CreateMessageData([1, 'someNotification']) + AssertEqual + \ [ + \ 0, + \ "Content-Length: 68\r\n\r\n" + \ . '{"method":"someNotification","jsonrpc":"2.0","params":{"foo":"bar"}}', + \ ], + \ ale#lsp#CreateMessageData([1, 'someNotification', {'foo': 'bar'}]) + endif + +Execute(ale#lsp#CreateMessageData() should create tsserver notification messages): + if has('nvim') + AssertEqual + \ [ + \ 0, + \ '{"seq": null, "type": "request", "command": "someNotification"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([1, 'ts@someNotification']) + AssertEqual + \ [ + \ 0, + \ '{"seq": null, "arguments": {"foo": "bar"}, "type": "request", "command": "someNotification"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([1, 'ts@someNotification', {'foo': 'bar'}]) + else + AssertEqual + \ [ + \ 0, + \ '{"seq":null,"type":"request","command":"someNotification"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([1, 'ts@someNotification']) + AssertEqual + \ [ + \ 0, + \ '{"seq":null,"arguments":{"foo":"bar"},"type":"request","command":"someNotification"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([1, 'ts@someNotification', {'foo': 'bar'}]) + endif + +Execute(ale#lsp#CreateMessageData() should create tsserver messages expecting responses): + if has('nvim') + AssertEqual + \ [ + \ 1, + \ '{"seq": 1, "type": "request", "command": "someMessage"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([0, 'ts@someMessage']) + AssertEqual + \ [ + \ 2, + \ '{"seq": 2, "arguments": {"foo": "bar"}, "type": "request", "command": "someMessage"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([0, 'ts@someMessage', {'foo': 'bar'}]) + else + AssertEqual + \ [ + \ 1, + \ '{"seq":1,"type":"request","command":"someMessage"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([0, 'ts@someMessage']) + AssertEqual + \ [ + \ 2, + \ '{"seq":2,"arguments":{"foo":"bar"},"type":"request","command":"someMessage"}' + \ . "\n", + \ ], + \ ale#lsp#CreateMessageData([0, 'ts@someMessage', {'foo': 'bar'}]) + endif + +Execute(ale#lsp#ReadMessageData() should read single whole messages): + AssertEqual + \ ['', [{'id': 2, 'jsonrpc': '2.0', 'result': {'foo': 'barÜ'}}]], + \ ale#lsp#ReadMessageData( + \ "Content-Length: 49\r\n\r\n" + \ . '{"id":2,"jsonrpc":"2.0","result":{"foo":"barÜ"}}' + \ ) + +Execute(ale#lsp#ReadMessageData() should ignore other headers): + AssertEqual + \ ['', [{'id': 2, 'jsonrpc': '2.0', 'result': {'foo': 'barÜ'}}]], + \ ale#lsp#ReadMessageData( + \ "First-Header: 49\r\n" + \ . "Content-Length: 49\r\n" + \ . "Other-Header: 49\r\n" + \ . "\r\n" + \ . '{"id":2,"jsonrpc":"2.0","result":{"foo":"barÜ"}}' + \ ) + +Execute(ale#lsp#ReadMessageData() should handle partial messages): + let b:data = "Content-Length: 49\r\n\r\n" . '{"id":2,"jsonrpc":"2.0","result":' + + AssertEqual [b:data, []], ale#lsp#ReadMessageData(b:data) + +Execute(ale#lsp#ReadMessageData() should handle multiple messages): + AssertEqual + \ ['', [ + \ {'id': 2, 'jsonrpc': '2.0', 'result': {'foo': 'barÜ'}}, + \ {'id': 2, 'jsonrpc': '2.0', 'result': {'foo123': 'barÜ'}}, + \ ]], + \ ale#lsp#ReadMessageData( + \ "Content-Length: 49\r\n\r\n" + \ . '{"id":2,"jsonrpc":"2.0","result":{"foo":"barÜ"}}' + \ . "Content-Length: 52\r\n\r\n" + \ . '{"id":2,"jsonrpc":"2.0","result":{"foo123":"barÜ"}}' + \ ) + +Execute(ale#lsp#ReadMessageData() should handle a message with part of a second message): + let b:data = "Content-Length: 52\r\n\r\n" . '{"id":2,"jsonrpc":"2.' + + AssertEqual + \ [b:data, [ + \ {'id': 2, 'jsonrpc': '2.0', 'result': {'foo': 'barÜ'}}, + \ ]], + \ ale#lsp#ReadMessageData( + \ "Content-Length: 49\r\n\r\n" + \ . '{"id":2,"jsonrpc":"2.0","result":{"foo":"barÜ"}}' + \ . b:data + \ ) diff --git a/sources_non_forked/ale/test/lsp/test_lsp_custom_request.vader b/sources_non_forked/ale/test/lsp/test_lsp_custom_request.vader new file mode 100644 index 00000000..c8767e59 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_lsp_custom_request.vader @@ -0,0 +1,158 @@ +Before: + runtime autoload/ale/linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + + let g:address = 'ccls_address' + let g:conn_id = -1 + let g:executable = 'ccls' + let g:executable_or_address = '' + let g:linter_name = 'ccls' + let g:magic_number = 42 + let g:no_result = 0 + let g:message_list = [] + let g:message_id = 1 + let g:method = '$ccls/call' + let g:parameters = {} + let g:project_root = '/project/root' + let g:response = '' + let g:return_value = -1 + + let g:linter_list = [{ + \ 'output_stream': 'stdout', + \ 'lint_file': 0, + \ 'language': 'cpp', + \ 'name': g:linter_name, + \ 'project_root': {b -> g:project_root}, + \ 'aliases': [], + \ 'read_buffer': 1, + \ 'command': '%e' + \ }] + + let g:callback_result = g:no_result + + " Encode dictionary to jsonrpc + function! Encode(obj) abort + let l:body = json_encode(a:obj) + return 'Content-Length: ' . strlen(l:body) . "\r\n\r\n" . l:body + endfunction + + " Replace the StartLSP function to mock an LSP linter + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register(g:executable_or_address, g:project_root, {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + call ale#lsp#HandleMessage(g:conn_id, Encode({'method': 'initialize'})) + + let l:details = { + \ 'command': g:executable, + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': g:project_root, + \} + + call ale#lsp_linter#OnInit(a:linter, l:details, a:Callback) + endfunction + + " Dummy callback + function! Callback(response) abort + let g:callback_result = a:response.result.value + endfunction + + " Replace the GetAll function to mock an LSP linter + function! ale#linter#GetAll(filetype) abort + return g:linter_list + endfunction + + " Replace the Send function to mock an LSP linter + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + return g:message_id + endfunction + + " Code for a test case + function! TestCase(is_notification) abort + " Test sending a custom request + let g:return_value = ale#lsp_linter#SendRequest( + \ bufnr('%'), + \ g:linter_name, + \ [a:is_notification, g:method, g:parameters], + \ function('Callback')) + + Assert index(g:message_list, [a:is_notification, g:method, g:parameters]) >= 0 + + " Mock an incoming response to the request + let g:response = Encode({ + \ 'id': g:message_id, + \ 'jsonrpc': '2.0', + \ 'result': {'value': g:magic_number} + \ }) + call ale#lsp#HandleMessage(g:conn_id, g:response) + + AssertEqual + \ a:is_notification ? g:no_result : g:magic_number, + \ g:callback_result + endfunction + +After: + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + unlet! g:callback_result + unlet! g:conn_id + unlet! g:executable + unlet! g:is_notification + unlet! g:linter_name + unlet! g:magic_number + unlet! g:message_list + unlet! g:message_id + unlet! g:method + unlet! g:no_result + unlet! g:parameters + unlet! g:project_root + unlet! g:response + unlet! g:return_value + + delfunction Encode + delfunction Callback + delfunction TestCase + + runtime autoload/ale/linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + +Given cpp(Empty cpp file): +Execute(Test custom request to server identified by executable): + let g:executable_or_address = g:executable + let g:linter_list[0].executable = {b -> g:executable} + let g:linter_list[0].lsp = 'stdio' + let g:is_notification = 0 + + call TestCase(g:is_notification) + +Given cpp(Empty cpp file): +Execute(Test custom notification to server identified by executable): + let g:executable_or_address = g:executable + let g:linter_list[0].executable = {b -> g:executable} + let g:linter_list[0].lsp = 'stdio' + let g:is_notification = 1 + + call TestCase(g:is_notification) + +Given cpp(Empty cpp file): +Execute(Test custom request to server identified by address): + let g:executable_or_address = g:address + let g:linter_list[0].address = {b -> g:address} + let g:linter_list[0].lsp = 'socket' + let g:is_notification = 0 + + call TestCase(g:is_notification) + +Given cpp(Empty cpp file): +Execute(Test custom notification to server identified by address): + let g:executable_or_address = g:address + let g:linter_list[0].address = {b -> g:address} + let g:linter_list[0].lsp = 'socket' + let g:is_notification = 1 + + call TestCase(g:is_notification) diff --git a/sources_non_forked/ale/test/lsp/test_lsp_error_parsing.vader b/sources_non_forked/ale/test/lsp/test_lsp_error_parsing.vader new file mode 100644 index 00000000..44169c80 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_lsp_error_parsing.vader @@ -0,0 +1,74 @@ +Execute(Invalid responses should be handled): + AssertEqual '', ale#lsp#response#GetErrorMessage({}) + AssertEqual '', ale#lsp#response#GetErrorMessage({'error': 0}) + AssertEqual '', ale#lsp#response#GetErrorMessage({'error': {}}) + AssertEqual '', ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': 0, + \ 'message': 'x', + \ }, + \}) + AssertEqual '', ale#lsp#response#GetErrorMessage({'error': {'code': -32602}}) + AssertEqual '', ale#lsp#response#GetErrorMessage({'error': {'code': -32603}}) + +Execute(Messages without tracebacks should be handled): + AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': -32602, + \ 'message': 'xyz', + \ }, + \}) + AssertEqual 'abc', ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': -32603, + \ 'message': 'abc', + \ }, + \}) + +Execute(Invalid traceback data should be tolerated): + AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': -32602, + \ 'message': 'xyz', + \ 'data': { + \ }, + \ }, + \}) + AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': -32602, + \ 'message': 'xyz', + \ 'data': { + \ 'traceback': 0, + \ }, + \ }, + \}) + AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': -32602, + \ 'message': 'xyz', + \ 'data': { + \ 'traceback': [], + \ }, + \ }, + \}) + +Execute(Messages with tracebacks should be handled): + AssertEqual "xyz\n123\n456", ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': -32602, + \ 'message': 'xyz', + \ 'data': { + \ 'traceback': ['123', '456'], + \ }, + \ }, + \}) + +Execute(Messages with string data should be handled): + AssertEqual "xyz\nUncaught Exception", ale#lsp#response#GetErrorMessage({ + \ 'error': { + \ 'code': -32602, + \ 'message': 'xyz', + \ 'data': 'Uncaught Exception', + \ }, + \}) diff --git a/sources_non_forked/ale/test/lsp/test_lsp_root_detection.vader b/sources_non_forked/ale/test/lsp/test_lsp_root_detection.vader new file mode 100644 index 00000000..291300f0 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_lsp_root_detection.vader @@ -0,0 +1,90 @@ +Before: + Save g:ale_lsp_root + Save g:ale_root + Save b:ale_lsp_root + Save b:ale_root + + unlet! g:ale_lsp_root + let g:ale_root = {} + + call ale#assert#SetUpLinterTest('c', 'clangd') + + function! Hook1(buffer) + return 'abc123' + endfunction + +After: + Restore + + delfunction Hook1 + + call ale#assert#TearDownLinterTest() + +Execute(The buffer-specific variable can be a string): + let b:ale_root = '/some/path' + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(The buffer-specific variable can be a dictionary): + let b:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(The buffer-specific variable can have funcrefs): + let b:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject 'abc123' + +Execute(The buffer-specific variable can be the old ale_lsp_root setting): + let b:ale_lsp_root = '/some/path' + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(The global variable can be a dictionary): + let g:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(The global variable can have funcrefs): + let g:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject 'abc123' + +Execute(The buffer-specific variable overrides the global variable): + let b:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'} + let g:ale_root = {'clangd': '/not/this/path', 'golangserver': '/elsewhere'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(The global variable is queried if the buffer-specific has no value): + let b:ale_root = {'golangserver': '/other/path'} + let g:ale_root = {'clangd': '/some/path', 'golangserver': '/elsewhere'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(The global variable can be the old ale_lsp_root setting): + let g:ale_root = {} + let g:ale_lsp_root = {'clangd': '/some/path', 'golangserver': '/other/path'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(A non-empty ale_root setting should replace the old ale_lsp_root): + let g:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'} + let g:ale_lsp_root = {'clangd': '/xxx', 'golangserver': '/xxx'} + call ale#test#SetFilename('other-file.c') + + AssertLSPProject '/some/path' + +Execute(No path should be returned by default): + call ale#test#SetFilename(tempname() . '/other-file.c') + + AssertLSPProject '' diff --git a/sources_non_forked/ale/test/lsp/test_lsp_startup.vader b/sources_non_forked/ale/test/lsp/test_lsp_startup.vader new file mode 100644 index 00000000..7417dbcb --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_lsp_startup.vader @@ -0,0 +1,492 @@ +Before: + Save g:ale_run_synchronously + + let g:ale_run_synchronously = 1 + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_run_synchronously_emulate_commands + + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/engine.vim + runtime autoload/ale/job.vim + runtime autoload/ale/socket.vim + + let g:job_map = {} + let g:emulate_job_failure = 0 + let g:next_job_id = 1 + let g:lsp_started = 0 + + let g:socket_map = {} + let g:emulate_socket_failure = 0 + let g:next_channel_id = 0 + + let g:message_buffer = '' + let g:calls = [] + + function! ale#engine#IsExecutable(buffer, executable) abort + return !empty(a:executable) + endfunction + + function! ale#job#HasOpenChannel(job_id) abort + return has_key(g:job_map, a:job_id) + endfunction + + function! ale#job#Stop(job_id) abort + if has_key(g:job_map, a:job_id) + call remove(g:job_map, a:job_id) + endif + endfunction + + function! ale#job#Start(command, options) abort + if g:emulate_job_failure + return 0 + endif + + let l:job_id = g:next_job_id + let g:next_job_id += 1 + let g:job_map[l:job_id] = [a:command, a:options] + + return l:job_id + endfunction + + function! ale#job#SendRaw(job_id, data) abort + let g:message_buffer .= a:data + endfunction + + function! ale#socket#IsOpen(channel_id) abort + return has_key(g:socket_map, a:channel_id) + endfunction + + function! ale#socket#Close(channel_id) abort + if has_key(g:socket_map, a:channel_id) + call remove(g:socket_map, a:channel_id) + endif + endfunction + + function! ale#socket#Open(address, options) abort + if g:emulate_socket_failure + return -1 + endif + + let l:channel_id = g:next_channel_id + let g:next_channel_id += 1 + let g:socket_map[l:channel_id] = [a:address, a:options] + + return l:channel_id + endfunction + + function! ale#socket#Send(channel_id, data) abort + let g:message_buffer .= a:data + endfunction + + function! PopMessages() abort + let l:message_list = [] + + for l:line in split(g:message_buffer, '\(\r\|\n\|Content-Length\)\+') + if l:line[:0] is '{' + let l:data = json_decode(l:line) + + call add(l:message_list, l:data) + endif + endfor + + let g:message_buffer = '' + + return l:message_list + endfunction + + function! SendMessage(message) abort + let l:conn_id = keys(ale#lsp#GetConnections())[0] + let l:body = json_encode(a:message) + let l:data = 'Content-Length: ' . strlen(l:body) . "\r\n\r\n" . l:body + + call ale#lsp#HandleMessage(l:conn_id, l:data) + endfunction + + function! Start(buffer) abort + let l:linter = values(ale#linter#GetLintersLoaded())[0][0] + + return ale#lsp_linter#StartLSP( + \ a:buffer, + \ l:linter, + \ {linter, details -> add(g:calls, [linter.name, details])}, + \) + endfunction + + function! AssertInitSuccess(linter_name, conn_prefix, language, root, command, buffer) abort + let l:messages = PopMessages() + + if a:linter_name is# 'tsserver' + AssertEqual + \ [ + \ { + \ 'seq': v:null, + \ 'arguments': { + \ 'file': expand('#' . a:buffer . ':p'), + \ }, + \ 'type': 'request', + \ 'command': 'open', + \ }, + \ ], + \ l:messages + else + AssertEqual + \ [ + \ { + \ 'method': 'initialize', + \ 'jsonrpc': '2.0', + \ 'id': 1, + \ 'params': { + \ 'initializationOptions': {}, + \ 'rootUri': ale#path#ToFileURI(a:root), + \ 'rootPath': a:root, + \ 'processId': getpid(), + \ 'capabilities': { + \ 'workspace': { + \ 'applyEdit': v:false, + \ 'didChangeConfiguration': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'symbol': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'workspaceFolders': v:false, + \ 'configuration': v:false, + \ }, + \ 'textDocument': { + \ 'synchronization': { + \ 'dynamicRegistration': v:false, + \ 'willSave': v:false, + \ 'willSaveWaitUntil': v:false, + \ 'didSave': v:true, + \ }, + \ 'completion': { + \ 'dynamicRegistration': v:false, + \ 'completionItem': { + \ 'snippetSupport': v:false, + \ 'commitCharactersSupport': v:false, + \ 'documentationFormat': ['plaintext'], + \ 'deprecatedSupport': v:false, + \ 'preselectSupport': v:false, + \ }, + \ 'contextSupport': v:false, + \ }, + \ 'hover': { + \ 'dynamicRegistration': v:false, + \ 'contentFormat': ['plaintext'], + \ }, + \ 'references': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'documentSymbol': { + \ 'dynamicRegistration': v:false, + \ 'hierarchicalDocumentSymbolSupport': v:false, + \ }, + \ 'definition': { + \ 'dynamicRegistration': v:false, + \ 'linkSupport': v:false, + \ }, + \ 'typeDefinition': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'implementation': { + \ 'dynamicRegistration': v:false, + \ 'linkSupport': v:false, + \ }, + \ 'publishDiagnostics': { + \ 'relatedInformation': v:true, + \ }, + \ 'codeAction': { + \ 'dynamicRegistration': v:false, + \ 'codeActionLiteralSupport': { + \ 'codeActionKind': { + \ 'valueSet': [] + \ } + \ } + \ }, + \ 'rename': { + \ 'dynamicRegistration': v:false, + \ }, + \ }, + \ }, + \ }, + \ }, + \ ], + \ l:messages + + call SendMessage({ + \ 'jsonrpc': '2.0', + \ 'id': 1, + \ 'result': { + \ 'capabilities': { + \ 'renameProvider': v:true, + \ 'executeCommandProvider': { + \ 'commands': [], + \ }, + \ 'hoverProvider': v:true, + \ 'documentSymbolProvider': v:true, + \ 'documentRangeFormattingProvider': v:true, + \ 'codeLensProvider': { + \ 'resolveProvider': v:false + \ }, + \ 'referencesProvider': v:true, + \ 'textDocumentSync': 2, + \ 'documentFormattingProvider': v:true, + \ 'codeActionProvider': v:true, + \ 'signatureHelpProvider': { + \ 'triggerCharacters': ['(', ','], + \ }, + \ 'completionProvider': { + \ 'triggerCharacters': ['.'], + \ 'resolveProvider': v:false + \ }, + \ 'definitionProvider': v:true, + \ 'experimental': {}, + \ 'documentHighlightProvider': v:true, + \ 'workspaceSymbolProvider': v:true, + \ }, + \ }, + \}) + + let l:messages = PopMessages() + + AssertEqual + \ [ + \ { + \ 'method': 'initialized', + \ 'jsonrpc': '2.0', + \ 'params': {}, + \ }, + \ { + \ 'method': 'textDocument/didOpen', + \ 'jsonrpc': '2.0', + \ 'params': { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('#' . a:buffer . ':p')), + \ 'version': ale#lsp#message#GetNextVersionID() - 1, + \ 'languageId': a:language, + \ 'text': "\n", + \ }, + \ }, + \ }, + \ ], + \ l:messages + endif + + AssertEqual + \ [ + \ [ + \ a:linter_name, + \ { + \ 'connection_id': a:conn_prefix . ':' . a:root, + \ 'project_root': a:root, + \ 'buffer': a:buffer, + \ 'command': !empty(a:command) ? ale#job#PrepareCommand(a:buffer, a:command) : '', + \ }, + \ ], + \ ], + \ g:calls + endfunction + + function! AssertInitFailure() abort + let l:messages = PopMessages() + + AssertEqual [], l:messages + AssertEqual [], g:calls + endfunction + + call ale#linter#Reset() + +After: + Restore + + call ale#linter#Reset() + call ale#lsp#ResetConnections() + + unlet! g:ale_run_synchronously_callbacks + unlet! g:job_map + unlet! g:emulate_job_failure + unlet! g:next_job_id + unlet! g:lsp_started + + unlet! g:socket_map + unlet! g:emulate_socket_failure + unlet! g:next_channel_id + + unlet! g:message_buffer + unlet! g:calls + + augroup VaderTest + autocmd! + augroup END + + augroup! VaderTest + + delfunction PopMessages + delfunction Start + delfunction AssertInitSuccess + delfunction AssertInitFailure + + runtime autoload/ale/engine.vim + runtime autoload/ale/job.vim + runtime autoload/ale/socket.vim + +Execute(tsserver should be started correctly): + runtime ale_linters/typescript/tsserver.vim + + Assert Start(bufnr('')) + call AssertInitSuccess('tsserver', 'tsserver', '', '', ale#Escape('tsserver'), bufnr('')) + +Execute(tsserver failures should be handled appropriately): + runtime ale_linters/typescript/tsserver.vim + + let g:emulate_job_failure = 1 + + Assert !Start(bufnr('')) + call AssertInitFailure() + +Execute(LSP jobs should start correctly): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'stdio', + \ 'executable': 'foo', + \ 'command': 'foo', + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + Assert Start(bufnr('')) + call AssertInitSuccess('foo', 'foo', 'foobar', '/foo/bar', 'foo', bufnr('')) + +Execute(LSP job failures should be handled): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'stdio', + \ 'executable': 'foo', + \ 'command': 'foo', + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + let g:emulate_job_failure = 1 + + Assert !Start(bufnr('')) + call AssertInitFailure() + +Execute(LSP TCP connections should start correctly): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'foo', + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + Assert Start(bufnr('')) + call AssertInitSuccess('foo', 'foo', 'foobar', '/foo/bar', '', bufnr('')) + +Execute(LSP TCP connection failures should be handled): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'foo', + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + let g:emulate_socket_failure = 1 + + Assert !Start(bufnr('')) + call AssertInitFailure() + +Execute(Deferred executables should be handled correctly): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'stdio', + \ 'executable': {b -> ale#command#Run(b, 'echo', {-> 'foo'})}, + \ 'command': '%e -c', + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + Assert Start(bufnr('')) + call ale#test#FlushJobs() + call AssertInitSuccess('foo', 'foo', 'foobar', '/foo/bar', ale#Escape('foo') . ' -c', bufnr('')) + +Execute(Deferred commands should be handled correctly): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'stdio', + \ 'executable': 'foo', + \ 'command': {b -> ale#command#Run(b, 'echo', {-> '%e -c'})}, + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + Assert Start(bufnr('')) + call ale#test#FlushJobs() + call AssertInitSuccess('foo', 'foo', 'foobar', '/foo/bar', ale#Escape('foo') . ' -c', bufnr('')) + +Execute(Deferred addresses should be handled correctly): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': {b -> ale#command#Run(b, 'echo', {-> 'localhost:1234'})}, + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + Assert Start(bufnr('')) + call ale#test#FlushJobs() + call AssertInitSuccess('foo', 'localhost:1234', 'foobar', '/foo/bar', '', bufnr('')) + +Execute(Servers that have crashed should be restarted): + call ale#lsp#Register('foo', '/foo/bar', {}) + call extend(ale#lsp#GetConnections()['foo:/foo/bar'], {'initialized': 1}) + + " Starting the program again should reset initialized to `0`. + call ale#lsp#StartProgram('foo:/foo/bar', 'foobar', 'foobar --start') + + AssertEqual 0, ale#lsp#GetConnections()['foo:/foo/bar']['initialized'] + AssertEqual ['initialize'], map(PopMessages(), 'v:val[''method'']') + +Execute(Current LSP buffer should receive ALELSPStarted): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'foo', + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + augroup VaderTest + autocmd! + autocmd User ALELSPStarted let g:lsp_started = 1 + augroup END + + Assert Start(bufnr('')) + call AssertInitSuccess('foo', 'foo', 'foobar', '/foo/bar', '', bufnr('')) + AssertEqual g:lsp_started, 1 + +Execute(Target LSP buffer should receive ALELSPStarted): + call ale#linter#Define('foobar', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'foo', + \ 'project_root': '/foo/bar', + \ 'initialization_options': {}, + \}) + + augroup VaderTest + autocmd! + autocmd User ALELSPStarted let g:lsp_started = 1 + augroup END + + let buffer = bufnr('') + + enew! + Assert Start(buffer) + call AssertInitSuccess('foo', 'foo', 'foobar', '/foo/bar', '', buffer) + execute 'buffer' . buffer + + AssertEqual g:lsp_started, 1 diff --git a/sources_non_forked/ale/test/lsp/test_other_initialize_message_handling.vader b/sources_non_forked/ale/test/lsp/test_other_initialize_message_handling.vader new file mode 100644 index 00000000..6711c746 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_other_initialize_message_handling.vader @@ -0,0 +1,216 @@ +Before: + runtime autoload/ale/lsp.vim + + let g:message_list = [] + let b:conn = { + \ 'id': 1, + \ 'is_tsserver': 0, + \ 'data': '', + \ 'root': '/foo/bar', + \ 'open_documents': {}, + \ 'initialized': 0, + \ 'init_request_id': 0, + \ 'init_options': {}, + \ 'config': {}, + \ 'callback_list': [], + \ 'message_queue': [], + \ 'init_queue': [], + \ 'capabilities': { + \ 'hover': 0, + \ 'rename': 0, + \ 'references': 0, + \ 'completion': 0, + \ 'completion_trigger_characters': [], + \ 'definition': 0, + \ 'symbol_search': 0, + \ 'code_actions': 0, + \ }, + \} + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + +After: + unlet! b:conn + unlet! g:message_list + + runtime autoload/ale/lsp.vim + +Execute(Messages with no method and capabilities should initialize projects): + call ale#lsp#HandleInitResponse(b:conn, { + \ 'result': {'capabilities': {}}, + \}) + + AssertEqual 1, b:conn.initialized + AssertEqual [[1, 'initialized', {}]], g:message_list + +Execute(Other messages should not initialize projects): + call ale#lsp#HandleInitResponse(b:conn, {'method': 'lolwat'}) + + AssertEqual 0, b:conn.initialized + AssertEqual [], g:message_list + + call ale#lsp#HandleInitResponse(b:conn, {'result': {'x': {}}}) + + AssertEqual 0, b:conn.initialized + AssertEqual [], g:message_list + +Execute(Capabilities should bet set up correctly): + call ale#lsp#HandleInitResponse(b:conn, { + \ 'jsonrpc': '2.0', + \ 'id': 1, + \ 'result': { + \ 'capabilities': { + \ 'renameProvider': v:true, + \ 'executeCommandProvider': { + \ 'commands': [], + \ }, + \ 'hoverProvider': v:true, + \ 'documentSymbolProvider': v:true, + \ 'documentRangeFormattingProvider': v:true, + \ 'codeLensProvider': { + \ 'resolveProvider': v:false + \ }, + \ 'referencesProvider': v:true, + \ 'textDocumentSync': 2, + \ 'documentFormattingProvider': v:true, + \ 'codeActionProvider': v:true, + \ 'signatureHelpProvider': { + \ 'triggerCharacters': ['(', ','], + \ }, + \ 'completionProvider': { + \ 'triggerCharacters': ['.'], + \ 'resolveProvider': v:false + \ }, + \ 'definitionProvider': v:true, + \ 'experimental': {}, + \ 'documentHighlightProvider': v:true, + \ 'workspaceSymbolProvider': v:true + \ }, + \ }, + \}) + + AssertEqual 1, b:conn.initialized + AssertEqual + \ { + \ 'completion_trigger_characters': ['.'], + \ 'completion': 1, + \ 'references': 1, + \ 'hover': 1, + \ 'definition': 1, + \ 'symbol_search': 1, + \ 'rename': 1, + \ 'code_actions': 1, + \ }, + \ b:conn.capabilities + AssertEqual [[1, 'initialized', {}]], g:message_list + +Execute(Disabled capabilities should be recognised correctly): + call ale#lsp#HandleInitResponse(b:conn, { + \ 'jsonrpc': '2.0', + \ 'id': 1, + \ 'result': { + \ 'capabilities': { + \ 'renameProvider': v:false, + \ 'executeCommandProvider': { + \ 'commands': [], + \ }, + \ 'hoverProvider': v:false, + \ 'documentSymbolProvider': v:true, + \ 'documentRangeFormattingProvider': v:true, + \ 'codeLensProvider': { + \ 'resolveProvider': v:false + \ }, + \ 'referencesProvider': v:false, + \ 'textDocumentSync': 2, + \ 'documentFormattingProvider': v:true, + \ 'codeActionProvider': v:false, + \ 'signatureHelpProvider': { + \ 'triggerCharacters': ['(', ','], + \ }, + \ 'definitionProvider': v:false, + \ 'experimental': {}, + \ 'documentHighlightProvider': v:true, + \ }, + \ }, + \}) + + AssertEqual 1, b:conn.initialized + AssertEqual + \ { + \ 'completion_trigger_characters': [], + \ 'completion': 0, + \ 'references': 0, + \ 'hover': 0, + \ 'definition': 0, + \ 'symbol_search': 0, + \ 'rename': 0, + \ 'code_actions': 0, + \ }, + \ b:conn.capabilities + AssertEqual [[1, 'initialized', {}]], g:message_list + +Execute(Capabilities should be enabled when send as Dictionaries): + call ale#lsp#HandleInitResponse(b:conn, { + \ 'jsonrpc': '2.0', + \ 'id': 1, + \ 'result': { + \ 'capabilities': { + \ 'renameProvider': {}, + \ 'executeCommandProvider': { + \ 'commands': [], + \ }, + \ 'hoverProvider': {}, + \ 'documentSymbolProvider': v:true, + \ 'documentRangeFormattingProvider': v:true, + \ 'codeLensProvider': { + \ 'resolveProvider': v:false + \ }, + \ 'completionProvider': { + \ 'triggerCharacters': ['.'], + \ 'resolveProvider': v:false + \ }, + \ 'referencesProvider': {}, + \ 'textDocumentSync': 2, + \ 'documentFormattingProvider': v:true, + \ 'codeActionProvider': v:true, + \ 'signatureHelpProvider': { + \ 'triggerCharacters': ['(', ','], + \ }, + \ 'definitionProvider': {}, + \ 'typeDefinitionProvider': {}, + \ 'implementationProvider': {}, + \ 'experimental': {}, + \ 'documentHighlightProvider': v:true, + \ 'workspaceSymbolProvider': {} + \ }, + \ }, + \}) + + AssertEqual 1, b:conn.initialized + AssertEqual + \ { + \ 'completion_trigger_characters': ['.'], + \ 'completion': 1, + \ 'references': 1, + \ 'hover': 1, + \ 'definition': 1, + \ 'typeDefinition': 1, + \ 'implementation': 1, + \ 'symbol_search': 1, + \ 'rename': 1, + \ 'code_actions': 1, + \ }, + \ b:conn.capabilities + AssertEqual [[1, 'initialized', {}]], g:message_list + +Execute(Results that are not dictionaries should be handled correctly): + call ale#lsp#HandleInitResponse(b:conn, { + \ 'jsonrpc': '2.0', + \ 'id': 1, + \ 'result': v:null, + \}) + AssertEqual [], g:message_list diff --git a/sources_non_forked/ale/test/lsp/test_read_lsp_diagnostics.vader b/sources_non_forked/ale/test/lsp/test_read_lsp_diagnostics.vader new file mode 100644 index 00000000..61ffc73f --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_read_lsp_diagnostics.vader @@ -0,0 +1,257 @@ +Before: + function Range(start_line, start_char, end_line, end_char) abort + return { + \ 'start': {'line': a:start_line, 'character': a:start_char}, + \ 'end': {'line': a:end_line, 'character': a:end_char}, + \} + endfunction + +After: + delfunction Range + +Execute(ale#lsp#response#ReadDiagnostics() should handle errors): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'lnum': 3, + \ 'col': 11, + \ 'end_lnum': 5, + \ 'end_col': 15, + \ 'code': 'some-error', + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'severity': 1, + \ 'range': Range(2, 10, 4, 15), + \ 'code': 'some-error', + \ 'message': 'Something went wrong!', + \ }, + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should handle warnings): + AssertEqual [ + \ { + \ 'type': 'W', + \ 'text': 'Something went wrong!', + \ 'lnum': 2, + \ 'col': 4, + \ 'end_lnum': 2, + \ 'end_col': 3, + \ 'code': 'some-warning', + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'severity': 2, + \ 'range': Range(1, 3, 1, 3), + \ 'code': 'some-warning', + \ 'message': 'Something went wrong!', + \ }, + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should treat messages with missing severity as errors): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'lnum': 3, + \ 'col': 11, + \ 'end_lnum': 5, + \ 'end_col': 15, + \ 'code': 'some-error', + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(2, 10, 4, 15), + \ 'code': 'some-error', + \ 'message': 'Something went wrong!', + \ }, + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should handle messages without codes): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'lnum': 3, + \ 'col': 11, + \ 'end_lnum': 5, + \ 'end_col': 15, + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(2, 10, 4, 15), + \ 'message': 'Something went wrong!', + \ }, + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should include sources in detail): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'detail': '[tslint] Something went wrong!', + \ 'lnum': 10, + \ 'col': 15, + \ 'end_lnum': 12, + \ 'end_col': 22, + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(9, 14, 11, 22), + \ 'message': 'Something went wrong!', + \ 'source': 'tslint', + \ } + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should keep detail with line breaks but replace with spaces in text): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'cannot borrow `cap` as mutable more than once at a time mutable borrow starts here in previous iteration of loop', + \ 'detail': "[rustc] cannot borrow `cap` as mutable\r\nmore than once at a time\n\nmutable borrow starts here\rin previous iteration of loop", + \ 'lnum': 10, + \ 'col': 15, + \ 'end_lnum': 12, + \ 'end_col': 22, + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(9, 14, 11, 22), + \ 'message': "cannot borrow `cap` as mutable\r\nmore than once at a time\n\nmutable borrow starts here\rin previous iteration of loop", + \ 'source': 'rustc', + \ } + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should consider -1 to be a meaningless code): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'lnum': 3, + \ 'col': 11, + \ 'end_lnum': 5, + \ 'end_col': 15, + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(2, 10, 4, 15), + \ 'message': 'Something went wrong!', + \ 'code': -1, + \ }, + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should handle multiple messages): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'lnum': 1, + \ 'col': 3, + \ 'end_lnum': 1, + \ 'end_col': 2, + \ }, + \ { + \ 'type': 'W', + \ 'text': 'A warning', + \ 'lnum': 2, + \ 'col': 5, + \ 'end_lnum': 2, + \ 'end_col': 4, + \ }, + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(0, 2, 0, 2), + \ 'message': 'Something went wrong!', + \ }, + \ { + \ 'severity': 2, + \ 'range': Range(1, 4, 1, 4), + \ 'message': 'A warning', + \ }, + \ ]}}) + +Execute(ale#lsp#response#ReadDiagnostics() should use relatedInformation for detail): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'lnum': 1, + \ 'col': 3, + \ 'end_lnum': 1, + \ 'end_col': 2, + \ 'detail': "Something went wrong!\n/tmp/someotherfile.txt:43:80:\n\tmight be this" + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(0, 2, 0, 2), + \ 'message': 'Something went wrong!', + \ 'relatedInformation': [{ + \ 'message': 'might be this', + \ 'location': { + \ 'uri': 'file:///tmp/someotherfile.txt', + \ 'range': { + \ 'start': { 'line': 42, 'character': 79 }, + \ 'end': { 'line': 142, 'character': 179}, + \ } + \ } + \ }] + \ } + \ ]}}) + +Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle tsserver responses): + AssertEqual + \ [ + \ { + \ 'type': 'E', + \ 'nr': 2365, + \ 'code': '2365', + \ 'text': 'Operator ''''+'''' cannot be applied to types ''''3'''' and ''''{}''''.', + \ 'lnum': 1, + \ 'col': 11, + \ 'end_lnum': 1, + \ 'end_col': 16, + \ }, + \ ], + \ ale#lsp#response#ReadTSServerDiagnostics({"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/bar/foo.ts","diagnostics":[{"start":{"line":1,"offset":11},"end":{"line":1,"offset":17},"text":"Operator ''+'' cannot be applied to types ''3'' and ''{}''.","code":2365}]}}) + +Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle warnings from tsserver): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 3, + \ 'nr': 2515, + \ 'code': '2515', + \ 'end_lnum': 27, + \ 'type': 'W', + \ 'end_col': 13, + \ 'text': 'Calls to ''console.log'' are not allowed. (no-console)', + \ } + \ ], + \ ale#lsp#response#ReadTSServerDiagnostics({"seq":0,"type":"event","event":"semanticDiag","body":{"file":"","diagnostics":[{"start":{"line":27,"offset":3},"end":{"line":27,"offset":14},"text":"Calls to 'console.log' are not allowed. (no-console)","code":2515,"category":"warning","source":"tslint"}]}}) + +Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle suggestions from tsserver): + AssertEqual + \ [ + \ { + \ 'lnum': 27, + \ 'col': 3, + \ 'nr': 2515, + \ 'code': '2515', + \ 'end_lnum': 27, + \ 'type': 'I', + \ 'end_col': 13, + \ 'text': 'Some info', + \ } + \ ], + \ ale#lsp#response#ReadTSServerDiagnostics({"seq":0,"type":"event","event":"semanticDiag","body":{"file":"","diagnostics":[{"start":{"line":27,"offset":3},"end":{"line":27,"offset":14},"text":"Some info","code":2515,"category":"suggestion","source":"tslint"}]}}) diff --git a/sources_non_forked/ale/test/lsp/test_reset_lsp.vader b/sources_non_forked/ale/test/lsp/test_reset_lsp.vader new file mode 100644 index 00000000..310b3d62 --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_reset_lsp.vader @@ -0,0 +1,98 @@ +Before: + Save g:ale_enabled + Save g:ale_set_signs + Save g:ale_set_quickfix + Save g:ale_set_loclist + Save g:ale_set_highlights + Save g:ale_echo_cursor + + let g:ale_enabled = 0 + let g:ale_set_signs = 0 + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 0 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + + function EmptyString() abort + return '' + endfunction + + call ale#engine#InitBufferInfo(bufnr('')) + " Call this function first, so we can be sure the module is loaded before we + " check if it exists. + call ale#lsp_linter#ClearLSPData() + + call ale#linter#Define('testft', { + \ 'name': 'lsplinter', + \ 'lsp': 'tsserver', + \ 'executable': function('EmptyString'), + \ 'command': function('EmptyString'), + \ 'project_root': function('EmptyString'), + \ 'language': function('EmptyString'), + \}) + + call ale#linter#Define('testft', { + \ 'name': 'otherlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd': 'true', + \ 'command': 'true', + \ 'read_buffer': 0, + \}) + +After: + Restore + + unlet! b:ale_save_event_fired + + delfunction EmptyString + call ale#linter#Reset() + +Given testft(Some file with an imaginary filetype): +Execute(ALEStopAllLSPs should clear the loclist): + let g:ale_buffer_info[bufnr('')].loclist = [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 0, + \ 'bufnr': bufnr(''), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'lsplinter', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 0, + \ 'bufnr': bufnr(''), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'otherlinter', + \ }, + \] + let g:ale_buffer_info[bufnr('')].active_linter_list = [ + \ {'name': 'lsplinter'}, + \ {'name': 'otherlinter'}, + \] + + ALEStopAllLSPs + + " The loclist should be updated. + AssertEqual g:ale_buffer_info[bufnr('')].loclist, [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 0, + \ 'bufnr': bufnr(''), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'otherlinter', + \ }, + \] + + " The LSP linter should be removed from the active linter list. + AssertEqual + \ ['otherlinter'], + \ map(copy(g:ale_buffer_info[bufnr('')].active_linter_list), 'v:val.name') diff --git a/sources_non_forked/ale/test/lsp/test_update_config.vader b/sources_non_forked/ale/test/lsp/test_update_config.vader new file mode 100644 index 00000000..698477ec --- /dev/null +++ b/sources_non_forked/ale/test/lsp/test_update_config.vader @@ -0,0 +1,21 @@ +Before: + runtime autoload/ale/lsp.vim + + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + + " Stub out this function, so we test updating configs. + function! ale#lsp#Send(conn_id, message) abort + endfunction + +After: + Restore + + unlet! g:conn_id + + runtime autoload/ale/lsp.vim + +Execute(Only send updates when the configuration dictionary changes): + AssertEqual 0, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {}) + AssertEqual 1, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {'a': 1}) + AssertEqual 0, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {'a': 1}) + AssertEqual 1, ale#lsp#UpdateConfig(g:conn_id, bufnr(''), {}) diff --git a/sources_non_forked/ale/test/python/test_deoplete_source.py b/sources_non_forked/ale/test/python/test_deoplete_source.py new file mode 100644 index 00000000..8304fa25 --- /dev/null +++ b/sources_non_forked/ale/test/python/test_deoplete_source.py @@ -0,0 +1,120 @@ +import unittest +import imp + +ale_module = imp.load_source( + 'deoplete.sources.ale', + '/testplugin/rplugin/python3/deoplete/sources/ale.py', +) + + +class VimMock(object): + def __init__(self, call_list, call_results, commands): + self.__call_list = call_list + self.__call_results = call_results + + self.__commands = commands + + def call(self, function, *args): + self.__call_list.append((function, args)) + + return self.__call_results.get(function, 0) + + def command(self, command): + self.__commands.append(command) + + +class DeopleteSourceTest(unittest.TestCase): + def setUp(self): + super(DeopleteSourceTest, self).setUp() + + self.call_list = [] + self.call_results = {'ale#completion#CanProvideCompletions': 1} + self.commands = [] + self.source = ale_module.Source('vim') + self.source.vim = VimMock( + self.call_list, self.call_results, self.commands) + + def test_attributes(self): + """ + Check all of the attributes we set. + """ + attributes = dict( + (key, getattr(self.source, key)) + for key in + dir(self.source) + if not key.startswith('__') + and key != 'vim' + and not hasattr(getattr(self.source, key), '__self__') + ) + + self.assertEqual(attributes, { + 'input_patterns': { + '_': r'\.\w*$', + 'rust': r'(\.|::)\w*$', + 'typescript': r'(\.|\'|")\w*$', + 'cpp': r'(\.|::|->)\w*$', + }, + 'is_bytepos': True, + 'is_volatile': True, + 'mark': '[L]', + 'min_pattern_length': 1, + 'name': 'ale', + 'rank': 1000, + }) + + def test_complete_position(self): + self.call_results['ale#completion#GetCompletionPositionForDeoplete'] = 2 + context = {'input': 'foo'} + + self.assertEqual(self.source.get_complete_position(context), 2) + self.assertEqual(self.call_list, [ + ('ale#completion#GetCompletionPositionForDeoplete', ('foo',)), + ]) + + def test_request_completion_results(self): + context = {'event': 'TextChangedI', 'is_refresh': True} + + self.assertEqual(self.source.gather_candidates(context), []) + self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), + ]) + self.assertEqual(self.commands, [ + "call ale#completion#GetCompletions('ale-callback', " + \ + "{'callback': {completions -> deoplete#auto_complete() }})" + ]) + + def test_request_completion_results_from_buffer_without_providers(self): + self.call_results['ale#completion#CanProvideCompletions'] = 0 + context = {'event': 'TextChangedI', 'is_refresh': True} + + self.assertIsNone(self.source.gather_candidates(context), []) + self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), + ]) + + def test_async_event(self): + context = {'event': 'Async', 'is_refresh': True} + self.call_results['ale#completion#GetCompletionResult'] = [ + { + 'word': 'foobar', + 'kind': 'v', + 'icase': 1, + 'menu': '', + 'info': '', + }, + ] + + self.assertEqual(self.source.gather_candidates(context), [ + { + 'word': 'foobar', + 'kind': 'v', + 'icase': 1, + 'menu': '', + 'info': '', + }, + ]) + + self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), + ('ale#completion#GetCompletionResult', ()), + ]) diff --git a/sources_non_forked/ale/test/script/block-padding-checker b/sources_non_forked/ale/test/script/block-padding-checker new file mode 100755 index 00000000..2feab6d0 --- /dev/null +++ b/sources_non_forked/ale/test/script/block-padding-checker @@ -0,0 +1,145 @@ +#!/usr/bin/env python +""" +This script checks for missing or forbidden blank lines before or after +particular Vim commands. This script ensures that VimL scripts are padded +correctly, so they are easier to read. +""" + +import sys +import re + +INDENTATION_RE = re.compile(r'^ *') +COMMENT_LINE_RE = re.compile(r'^ *"') +COMMAND_RE = re.compile(r'^ *([a-zA-Z\\]+)') +OPERATOR_END_RE = re.compile(r'(&&|\|\||\+|-|\*\| /)$') + +START_BLOCKS = set(['if', 'for', 'while', 'try', 'function']) +END_BLOCKS = set(['endif', 'endfor', 'endwhile', 'endtry', 'endfunction']) +MIDDLE_BLOCKS = set(['else', 'elseif', 'catch', 'finally']) +TERMINATORS = set(['return', 'throw']) + +WHITESPACE_BEFORE_SET = START_BLOCKS | TERMINATORS +WHITESPACE_FORBIDDEN_BEFORE_SET = END_BLOCKS | MIDDLE_BLOCKS +WHITESPACE_AFTER_SET = END_BLOCKS +WHITESPACE_FORBIDDEN_AFTER_SET = START_BLOCKS | MIDDLE_BLOCKS +SAME_INDENTATION_SET = set(['\\']) + + +def remove_comment_lines(line_iter): + for line_number, line in enumerate(line_iter, 1): + if not COMMENT_LINE_RE.match(line): + yield (line_number, line) + + +def check_lines(line_iter): + previous_indentation_level = None + previous_command = None + previous_line_blank = False + + for line_number, line in remove_comment_lines(line_iter): + if len(line) == 0: + # Check for commands where we shouldn't have blank lines after + # them, like `else` or the start of blocks like `function`. + if ( + previous_command is not None + and previous_command in WHITESPACE_FORBIDDEN_AFTER_SET + ): + yield ( + line_number, + 'Blank line forbidden after `%s`' % (previous_command,) + ) + + previous_line_blank = True + previous_command = None + else: + indentation_level = INDENTATION_RE.match(line).end() + command_match = COMMAND_RE.match(line) + + if command_match: + command = command_match.group(1) + + if ( + command in SAME_INDENTATION_SET + and previous_indentation_level is not None + and indentation_level != previous_indentation_level + ): + yield ( + line_number, + 'Line continuation should match previous indentation' + ) + + if ( + previous_indentation_level is not None + and indentation_level != previous_indentation_level + and abs(indentation_level - previous_indentation_level) != 4 # noqa + ): + yield ( + line_number, + 'Indentation should be 4 spaces' + ) + + # Check for commands requiring blank lines before them, if they + # aren't at the start of a block. + if ( + command in WHITESPACE_BEFORE_SET + and previous_indentation_level is not None + and indentation_level == previous_indentation_level + and previous_line_blank is False + ): + yield ( + line_number, + 'Blank line required before `%s`' % (command,) + ) + + # Check for commands where we shouldn't have blank lines before + # them, like `else` or the end of blocks like `endfunction`. + if ( + command in WHITESPACE_FORBIDDEN_BEFORE_SET + and previous_line_blank is True + ): + yield ( + line_number - 1, + 'Blank line forbidden before `%s`' % (command,) + ) + + # Check for commands requiring blank lines after them, if they + # aren't at the end of a block. + if ( + previous_command is not None + and previous_command in WHITESPACE_AFTER_SET + and previous_indentation_level is not None + and indentation_level == previous_indentation_level + and previous_line_blank is False + ): + yield ( + line_number - 1, + 'Blank line required after `%s`' % (command,) + ) + + previous_command = command + previous_line_blank = False + previous_indentation_level = indentation_level + + if OPERATOR_END_RE.search(line): + yield ( + line_number, + 'Put operators at the start of lines instead' + ) + + +def main(): + status = 0 + + for filename in sys.argv[1:]: + with open(filename) as vim_file: + line_iter = (line.rstrip() for line in vim_file) + + for line_number, message in check_lines(line_iter): + print('%s:%d %s' % (filename, line_number, message)) + status = 1 + + sys.exit(status) + + +if __name__ == "__main__": + main() diff --git a/sources_non_forked/ale/test/script/check-duplicate-tags b/sources_non_forked/ale/test/script/check-duplicate-tags new file mode 100755 index 00000000..ec1de788 --- /dev/null +++ b/sources_non_forked/ale/test/script/check-duplicate-tags @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +grep --exclude=tags -roh '\*.*\*$' doc | sort | uniq -d diff --git a/sources_non_forked/ale/test/script/check-supported-tools-tables b/sources_non_forked/ale/test/script/check-supported-tools-tables new file mode 100755 index 00000000..d238e77f --- /dev/null +++ b/sources_non_forked/ale/test/script/check-supported-tools-tables @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +set -e +set -u + +# This script compares the table of supported tools in both supported-tools.md +# (for GitHub) and doc/ale-supported-languages-and-tools.txt (for vim), so we +# can complain if they don't match up. + +doc_file="$(mktemp -t doc.XXXXXXXX)" +doc_sorted_file="$(mktemp -t doc-sorted.XXXXXXXX)" +readme_file="$(mktemp -t readme.XXXXXXXX)" + +while read -r; do + if [[ "$REPLY" =~ ^! ]]; then + language="${REPLY/!/}" + else + echo "$language - $REPLY" + fi +done < <( + grep '^\*\|^ *\*' doc/ale-supported-languages-and-tools.txt \ + | sed -e '1,2d' \ + | sed 's/^\* */!/' \ + | sed -E 's/^ *\* *|!!|\^|\(.*\)|`//g' \ + | sed 's/ *$//' +) > "$doc_file" + +while read -r; do + if [[ "$REPLY" =~ ^! ]]; then + language="${REPLY/!/}" + else + echo "$language - $REPLY" + fi +done < <( + grep '^\*\|^ *\*' supported-tools.md \ + | sed 's/^\* */!/' \ + | sed -E 's/^ *\* *|:floppy_disk:|:warning:|\(.*\)|\[|\].*|-n flag//g' \ + | sed 's/ *$//' +) > "$readme_file" + +exit_code=0 + +# Sort the tools ignoring case, and complain when things are out of order. +LC_ALL=en_US.UTF-8 sort -f -k1,2 "$doc_file" -o "$doc_sorted_file" + +diff -U0 "$doc_sorted_file" "$doc_file" || exit_code=$? + +if ((exit_code)); then + echo + echo "The supported tools list isn't sorted properly" + echo +fi + +diff -U0 "$readme_file" "$doc_file" || exit_code=$? + +rm "$doc_file" +rm "$doc_sorted_file" +rm "$readme_file" + +exit "$exit_code" diff --git a/sources_non_forked/ale/test/script/check-tag-alignment b/sources_non_forked/ale/test/script/check-tag-alignment new file mode 100755 index 00000000..d41db160 --- /dev/null +++ b/sources_non_forked/ale/test/script/check-tag-alignment @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +exit_code=0 + +# Documentation tags need to be aligned to the right margin, so look for +# tags which aren't at the right margin. +grep ' \*[^*]\+\*$' doc/ -r \ + | awk '{ sep = index($0, ":"); if (length(substr($0, sep + 1 )) < 79) { print } }' \ + | grep . && exit_code=1 + +exit $exit_code diff --git a/sources_non_forked/ale/test/script/check-tag-references b/sources_non_forked/ale/test/script/check-tag-references new file mode 100755 index 00000000..45e741fb --- /dev/null +++ b/sources_non_forked/ale/test/script/check-tag-references @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +exit_code=0 +tag_regex='[gb]\?:\?\(ale\|ALE\)[a-zA-Z_\-]\+' + +tags="$(mktemp -t tags.XXXXXXXX)" +refs="$(mktemp -t refs.XXXXXXXX)" +# Grep for tags and references, and complain if we find a reference without +# a tag for the reference. Only our tags will be included. +grep --exclude=tags -roh "\\*$tag_regex\\*" doc | sed 's/*//g' | sort -u > "$tags" +grep --exclude=tags -roh "|$tag_regex|" doc | sed 's/|//g' | sort -u > "$refs" + +exit_code=0 + +if ! [[ $(comm -23 $refs $tags | wc -l) -eq 0 ]]; then + exit_code=1 +fi + +rm "$tags" +rm "$refs" diff --git a/sources_non_forked/ale/test/script/check-toc b/sources_non_forked/ale/test/script/check-toc new file mode 100755 index 00000000..f3f8a9ea --- /dev/null +++ b/sources_non_forked/ale/test/script/check-toc @@ -0,0 +1,90 @@ +#!/usr/bin/env bash + +set -e +set -u + +# This script checks that the table of contents for the supported tools is +# sorted, and that the table matches the files. + +toc_section_start_line="$( + grep -m1 -n '^7\..*\*ale-other-integration-options\*' doc/ale.txt \ + | sed 's/\([0-9]*\).*/\1/' \ +)" +toc_start_offset="$( \ + tail -n +"$toc_section_start_line" doc/ale.txt \ + | grep -m1 -n '^ .*\.\.\.' \ + | sed 's/\([0-9]*\).*/\1/' \ +)" +# shellcheck disable=SC2003 +toc_start_line="$(expr "$toc_section_start_line" + "$toc_start_offset" - 1)" +toc_section_size="$( \ + tail -n +"$toc_start_line" doc/ale.txt \ + | grep -m1 -n '^===*$' \ + | sed 's/\([0-9]*\).*/\1/' \ +)" +# shellcheck disable=SC2003 +toc_end_line="$(expr "$toc_start_line" + "$toc_section_size" - 4)" + +toc_file="$(mktemp -t table-of-contents.XXXXXXXX)" +heading_file="$(mktemp -t headings.XXXXXXXX)" +tagged_toc_file="$(mktemp -t ale.txt.XXXXXXXX)" +sorted_toc_file="$(mktemp -t sorted-ale.txt.XXXXXXXX)" + +sed -n "$toc_start_line,$toc_end_line"p doc/ale.txt \ + | sed 's/^ \( *[^.][^.]*\)\.\.*|\(..*\)|/\1, \2/' \ + > "$toc_file" + +# Get all of the doc files in a natural sorted order. +doc_files="$(/usr/bin/env ls -1v doc | grep '^ale-' | sed 's/^/doc\//' | paste -sd ' ' -)" + +# shellcheck disable=SC2086 +grep -h '\*ale-.*-options\|^[a-z].*\*ale-.*\*$' $doc_files \ + | sed 's/^/ /' \ + | sed 's/ALE Shell Integration/ALE sh Integration/' \ + | sed 's/ALE BibTeX Integration/ALE bib Integration/' \ + | sed 's/ ALE \(.*\) Integration/\1/' \ + | sed 's/ *\*\(..*\)\*$/, \1/' \ + | tr '[:upper:]' '[:lower:]' \ + | sed 's/objective-c/objc/' \ + | sed 's/c++/cpp/' \ + > "$heading_file" + +exit_code=0 +in_section=0 +section_index=0 + +# Prefix numbers to table of contents entries so that sections aren't mixed up +# with sub-sections when they are sorted. +while read -r; do + if [[ "$REPLY" =~ ^\ ]]; then + if ! ((in_section)); then + let section_index='section_index + 1' + in_section=1 + fi + else + if ((in_section)); then + let section_index='section_index + 1' + in_section=0 + fi + fi + + echo "$section_index $REPLY" >> "$tagged_toc_file" +done < "$toc_file" + +# Sort the sections and sub-sections and remove the tags. +sort -sn "$tagged_toc_file" | sed 's/[0-9][0-9]* //' > "$sorted_toc_file" + +echo 'Check for bad ToC sorting:' +echo +diff -U2 "$sorted_toc_file" "$toc_file" || exit_code=$? + +echo 'Check for mismatched ToC and headings:' +echo +diff -U3 "$toc_file" "$heading_file" || exit_code=$? + +rm "$toc_file" +rm "$heading_file" +rm "$tagged_toc_file" +rm "$sorted_toc_file" + +exit "$exit_code" diff --git a/sources_non_forked/ale/test/script/custom-checks b/sources_non_forked/ale/test/script/custom-checks new file mode 100755 index 00000000..83afb28c --- /dev/null +++ b/sources_non_forked/ale/test/script/custom-checks @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +set -e +set -u + +exit_code=0 +docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$DOCKER_RUN_IMAGE") + +echo '========================================' +echo 'Running custom linting rules' +echo '========================================' +echo 'Custom warnings/errors follow:' +echo + +set -o pipefail +docker run "${docker_flags[@]}" test/script/custom-linting-rules . || exit_code=$? +set +o pipefail +echo + +echo '========================================' +echo 'Checking for duplicate tags' +echo '========================================' +echo 'Duplicate tags follow:' +echo + +set -o pipefail +docker run "${docker_flags[@]}" test/script/check-duplicate-tags . || exit_code=$? +set +o pipefail +echo + +echo '========================================' +echo 'Checking for invalid tag references' +echo '========================================' +echo 'Invalid tag references tags follow:' +echo + +set -o pipefail +docker run "${docker_flags[@]}" test/script/check-tag-references || exit_code=$? +set +o pipefail + +echo '========================================' +echo 'diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables' +echo '========================================' +echo 'Differences follow:' +echo + +set -o pipefail +docker run "${docker_flags[@]}" test/script/check-supported-tools-tables || exit_code=$? +set +o pipefail + +echo '========================================' +echo 'Look for badly aligned doc tags' +echo '========================================' +echo 'Badly aligned tags follow:' +echo + +set -o pipefail +docker run "${docker_flags[@]}" test/script/check-tag-alignment || exit_code=$? +set +o pipefail + +echo '========================================' +echo 'Look for table of contents issues' +echo '========================================' +echo + +set -o pipefail +docker run "${docker_flags[@]}" test/script/check-toc || exit_code=$? +set +o pipefail + +echo '========================================' +echo 'Check Python code' +echo '========================================' +echo + +docker run --rm -v "$PWD:/testplugin" "$DOCKER_RUN_IMAGE" \ + python -W ignore -m unittest discover /testplugin/test/python \ + || exit_code=$? +echo + +exit $exit_code diff --git a/sources_non_forked/ale/test/script/custom-linting-rules b/sources_non_forked/ale/test/script/custom-linting-rules new file mode 100755 index 00000000..486a0db7 --- /dev/null +++ b/sources_non_forked/ale/test/script/custom-linting-rules @@ -0,0 +1,166 @@ +#!/usr/bin/env bash + +set -e +set -u + +# This Bash script implements custom sanity checks for scripts beyond what +# Vint covers, which are easy to check with regex. + +# A flag for automatically fixing some errors. +FIX_ERRORS=0 +RETURN_CODE=0 + +function print_help() { + echo "Usage: test/script/custom-linting-rules [--fix] [DIRECTORY]" 1>&2 + echo 1>&2 + echo " -h, --help Print this help text" 1>&2 + echo " --fix Automatically fix some errors" 1>&2 + exit 1 +} + +while [ $# -ne 0 ]; do + case $1 in + -h) ;& --help) + print_help + ;; + --fix) + FIX_ERRORS=1 + shift + ;; + --) + shift + break + ;; + -?*) + echo "Invalid argument: $1" 1>&2 + exit 1 + ;; + *) + break + ;; + esac +done + +if [ $# -eq 0 ] || [ -z "$1" ]; then + print_help +fi + +shopt -s globstar + +directories=("$@") + +check_errors() { + regex="$1" + message="$2" + include_arg='' + exclude_arg='' + + if [ $# -gt 2 ]; then + include_arg="--include $3" + fi + + if [ $# -gt 3 ]; then + shift + shift + shift + + while (( "$#" )); do + exclude_arg="$exclude_arg --exclude $1" + shift + done + fi + + for directory in "${directories[@]}"; do + # shellcheck disable=SC2086 + while read -r; do + line=$(cut -d ":" -f2 <<< "$REPLY") + + if ((line > 1)); then + line=$((line - 1)) + file=$(cut -d ":" -f1 <<< "$REPLY") + + if sed -n "${line},${line}p" $file | grep -q '^ *" *no-custom-checks$'; then + continue + fi + fi + + RETURN_CODE=1 + echo "$REPLY $message" + done < <(grep -H -n "$regex" $include_arg $exclude_arg "$directory"/**/*.vim \ + | grep -v 'no-custom-checks' \ + | grep -o '^[^:]\+:[0-9]\+' \ + | sed 's:^\./::') + done +} + +if (( FIX_ERRORS )); then + for directory in "${directories[@]}"; do + sed -i "s/^\(function.*)\) *$/\1 abort/" "$directory"/**/*.vim + sed -i "s/shellescape(/ale#Escape(/" "$directory"/**/*.vim + sed -i 's/==#/is#/g' "$directory"/**/*.vim + sed -i 's/==?/is?/g' "$directory"/**/*.vim + sed -i 's/!=#/isnot#/g' "$directory"/**/*.vim + sed -i 's/!=?/isnot?/g' "$directory"/**/*.vim + # Improving type checks. + sed -i $'s/\\(==.\\?\\|is\\) type([\'"]\+)/is v:t_string/g' "$directory"/**/*.vim + sed -i 's/\(==.\?\|is\) type([0-9]\+)/is v:t_number/g' "$directory"/**/*.vim + sed -i 's/\(==.\?\|is\) type(\[\])/is v:t_list/g' "$directory"/**/*.vim + sed -i 's/\(==.\?\|is\) type({})/is v:t_dict/g' "$directory"/**/*.vim + sed -i 's/\(==.\?\|is\) type(function([^)]\+))/is v:t_func/g' "$directory"/**/*.vim + sed -i $'s/\\(!=.\\?\\|isnot\\) type([\'"]\+)/isnot v:t_string/g' "$directory"/**/*.vim + sed -i 's/\(!=.\?\|isnot\) type([0-9]\+)/isnot v:t_number/g' "$directory"/**/*.vim + sed -i 's/\(!=.\?\|isnot\) type(\[\])/isnot v:t_list/g' "$directory"/**/*.vim + sed -i 's/\(!=.\?\|isnot\) type({})/isnot v:t_dict/g' "$directory"/**/*.vim + sed -i 's/\(!=.\?\|isnot\) type(function([^)]\+))/isnot v:t_func/g' "$directory"/**/*.vim + done +fi + +# The arguments are: regex, explanation, [filename_filter], [list, of, exclusions] +check_errors \ + '^function.*) *$' \ + 'Function without abort keyword (See :help except-compat)' +check_errors '^function[^!]' 'function without !' +check_errors ' \+$' 'Trailing whitespace' +check_errors '^ * end\?i\? *$' 'Write endif, not en, end, or endi' +check_errors '^ [^ ]' 'Use four spaces, not two spaces' +check_errors $'\t' 'Use four spaces, not tabs' +# This check should prevent people from using a particular inconsistent name. +check_errors 'let g:ale_\w\+_\w\+_args =' 'Name your option g:ale___options instead' +check_errors 'shellescape(' 'Use ale#Escape instead of shellescape' +check_errors 'simplify(' 'Use ale#path#Simplify instead of simplify' +check_errors 'tempname(' 'Use ale#util#Tempname instead of tempname' +check_errors 'getcurpos(' "Use getpos('.') instead of getcurpos() if you don't need curswant, to avoid a bug that changes curswant" +check_errors "expand(['\"]%" "Use expand('#' . a:buffer . '...') instead. You might get a filename for the wrong buffer." +check_errors 'getcwd()' "Do not use getcwd(), as it could run from the wrong buffer. Use expand('#' . a:buffer . ':p:h') instead." +check_errors '==#' "Use 'is#' instead of '==#'. 0 ==# 'foobar' is true" +check_errors '==?' "Use 'is?' instead of '==?'. 0 ==? 'foobar' is true" +check_errors '!=#' "Use 'isnot#' instead of '!=#'. 0 !=# 'foobar' is false" +check_errors '!=?' "Use 'isnot?' instead of '!=?'. 0 !=? 'foobar' is false" +check_errors '^ *:\?echo' "Stray echo line. Ignore with \" no-custom-checks if needed" +check_errors '^ *:\?redir' 'User execute() instead of redir' +# Exclusions for grandfathered-in exceptions +exclusions="clojure/clj_kondo.vim elixir/elixir_ls.vim go/golangci_lint.vim swift/swiftformat.vim" +# shellcheck disable=SC2086 +check_errors $'name.:.*\'[a-z_]*[^a-z_0-9][a-z_0-9]*\',$' 'Use snake_case names for linters' '*/ale_linters/*' $exclusions +# Checks for improving type checks. +check_errors $'\\(==.\\?\\|is\\) type([\'"]\+)' "Use 'is v:t_string' instead" +check_errors '\(==.\?\|is\) type([0-9]\+)' "Use 'is v:t_number' instead" +check_errors '\(==.\?\|is\) type(\[\])' "Use 'is v:t_list' instead" +check_errors '\(==.\?\|is\) type({})' "Use 'is v:t_dict' instead" +check_errors '\(==.\?\|is\) type(function([^)]\+))' "Use 'is v:t_func' instead" +check_errors $'\\(!=.\\?\\|isnot\\) type([\'"]\+)' "Use 'isnot v:t_string' instead" +check_errors '\(!=.\?\|isnot\) type([0-9]\+)' "Use 'isnot v:t_number' instead" +check_errors '\(!=.\?\|isnot\) type(\[\])' "Use 'isnot v:t_list' instead" +check_errors '\(!=.\?\|isnot\) type({})' "Use 'isnot v:t_dict' instead" +check_errors '\(!=.\?\|isnot\) type(function([^)]\+))' "Use 'isnot v:t_func' instead" + +# Run a Python script to find lines that require padding around them. For +# users without Python installed, we'll skip these checks. GitHub Actions will +# run the script. +if command -v python > /dev/null; then + if ! test/script/block-padding-checker "$directory"/**/*.vim; then + RETURN_CODE=1 + fi +fi + +exit $RETURN_CODE diff --git a/sources_non_forked/ale/test/script/dumb_named_pipe_server.py b/sources_non_forked/ale/test/script/dumb_named_pipe_server.py new file mode 100644 index 00000000..a77e538c --- /dev/null +++ b/sources_non_forked/ale/test/script/dumb_named_pipe_server.py @@ -0,0 +1,42 @@ +""" +This Python script creates a named pipe server that does nothing but send its input +back to the client that connects to it. Only one argument must be given, the path +of a named pipe to bind to. +""" +import os +import socket +import sys + + +def main(): + if len(sys.argv) < 2: + sys.exit('You must specify a filepath') + + sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + if os.path.exists(sys.argv[1]): + os.remove(sys.argv[1]) + sock.bind(sys.argv[1]) + sock.listen(0) + + pid = os.fork() + + if pid: + print(pid) + sys.exit() + + while True: + connection = sock.accept()[0] + connection.settimeout(5) + + while True: + try: + connection.send(connection.recv(1024)) + except socket.timeout: + break + + connection.close() + + +if __name__ == "__main__": + main() diff --git a/sources_non_forked/ale/test/script/dumb_tcp_client.py b/sources_non_forked/ale/test/script/dumb_tcp_client.py new file mode 100644 index 00000000..3a728b02 --- /dev/null +++ b/sources_non_forked/ale/test/script/dumb_tcp_client.py @@ -0,0 +1,33 @@ +""" +This is just a script for testing that the dumb TCP server actually works +correctly, for verifying that problems with tests are in Vim. Pass the +same port number given to the test server to check that it's working. +""" +import socket +import sys + + +def main(): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + result = sock.connect_ex(('127.0.0.1', int(sys.argv[1]))) + + if result: + sock.close() + sys.exit("Couldn't connect to the socket!") + + data_sent = 'x' * 1024 + + sock.send(data_sent) + data_received = sock.recv(1024) + + if data_sent != data_received: + sock.close() + sys.exit("Data sent didn't match data received.") + + sock.close() + + print("Everything was just fine.") + + +if __name__ == "__main__": + main() diff --git a/sources_non_forked/ale/test/script/dumb_tcp_server.py b/sources_non_forked/ale/test/script/dumb_tcp_server.py new file mode 100644 index 00000000..c15db65e --- /dev/null +++ b/sources_non_forked/ale/test/script/dumb_tcp_server.py @@ -0,0 +1,40 @@ +""" +This Python script creates a TCP server that does nothing but send its input +back to the client that connects to it. Only one argument must be given, a port +to bind to. +""" +import os +import socket +import sys + + +def main(): + if len(sys.argv) < 2 or not sys.argv[1].isdigit(): + sys.exit('You must specify a port number') + + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.bind(('127.0.0.1', int(sys.argv[1]))) + sock.listen(0) + + pid = os.fork() + + if pid: + print(pid) + sys.exit() + + while True: + connection = sock.accept()[0] + connection.settimeout(5) + + while True: + try: + connection.send(connection.recv(1024)) + except socket.timeout: + break + + connection.close() + + +if __name__ == "__main__": + main() diff --git a/sources_non_forked/ale/test/script/run-vader-tests b/sources_non_forked/ale/test/script/run-vader-tests new file mode 100755 index 00000000..15a4a91e --- /dev/null +++ b/sources_non_forked/ale/test/script/run-vader-tests @@ -0,0 +1,167 @@ +#!/usr/bin/env bash + +set -e +set -u + +docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$DOCKER_RUN_IMAGE") +red='\033[0;31m' +green='\033[0;32m' +nc='\033[0m' +verbose=0 +quiet=0 + +while [ $# -ne 0 ]; do + case $1 in + -v) + verbose=1 + shift + ;; + -q) + quiet=1 + shift + ;; + --) + shift + break + ;; + -?*) + echo "Invalid argument: $1" 1>&2 + exit 1 + ;; + *) + break + ;; + esac +done + +vim="$1" +tests="$2" + +echo "$vim" + +case $vim in + neovim-v0.2*) + headless='' + ;; + # Neovim 0.6+ requires headless argument to load Vader tests. + neovim*) + headless='--headless' + ;; + *) + headless='' + ;; +esac + +# This file will be used to track if tests ran or not. +# We can't use a variable, because we need to set a value in a sub-shell. +run_file="$(mktemp -t tests_ran.XXXXXXXX)" + +function filter-vader-output() { + local hit_first_vader_line=0 + # When verbose mode is off, suppress output until Vader starts. + local start_output="$verbose" + local filtered_data='' + + while read -r; do + # Search for the first Vader output line. + # We can try starting tests again if they don't start. + if ((!hit_first_vader_line)); then + if [[ "$REPLY" = *'Starting Vader:'* ]]; then + hit_first_vader_line=1 + fi + fi + + if ((!start_output)); then + if ((hit_first_vader_line)); then + start_output=1 + else + continue + fi + fi + + if ((quiet)); then + if [[ "$REPLY" = *'Starting Vader:'* ]]; then + filtered_data="$REPLY" + elif [[ "$REPLY" = *'Success/Total'* ]]; then + success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)" + total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)" + + if [ "$success" -lt "$total" ]; then + echo "$filtered_data" + echo "$REPLY" + fi + + filtered_data='' + else + filtered_data="$filtered_data"$'\n'"$REPLY" + fi + else + echo "$REPLY" + fi + done + + # Note that we managed to get the Vader tests started if we did. + if ((hit_first_vader_line)); then + echo 1 > "$run_file" + fi +} + +function color-vader-output() { + while read -r; do + if [[ "$REPLY" = *'[EXECUTE] (X)'* ]]; then + echo -en "$red" + elif [[ "$REPLY" = *'[EXECUTE]'* ]] || [[ "$REPLY" = *'[ GIVEN]'* ]]; then + echo -en "$nc" + fi + + if [[ "$REPLY" = *'Success/Total'* ]]; then + success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)" + total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)" + + if [ "$success" -lt "$total" ]; then + echo -en "$red" + else + echo -en "$green" + fi + + echo "$REPLY" + echo -en "$nc" + else + echo "$REPLY" + fi + done + + echo -en "$nc" +} + +echo +echo '========================================' +echo "Running tests for $vim" +echo '========================================' +echo + +tries=0 + +while [ "$tries" -lt 5 ]; do + tries=$((tries + 1)) + + exit_code=0 + set -o pipefail + docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \ + "/vim-build/bin/$vim" -u test/vimrc ${headless} \ + "+Vader! $tests" 2>&1 | filter-vader-output | color-vader-output || exit_code=$? + set +o pipefail + + if [ -s "$run_file" ]; then + break + fi +done + +if [ "$tries" -gt 1 ]; then + echo + echo "Tried to run tests $tries times" +fi + +rm "$run_file" + +exit "$exit_code" diff --git a/sources_non_forked/ale/test/script/run-vint b/sources_non_forked/ale/test/script/run-vint new file mode 100755 index 00000000..ce42ad41 --- /dev/null +++ b/sources_non_forked/ale/test/script/run-vint @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -u + +exit_code=0 +docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$DOCKER_RUN_IMAGE") + +echo '========================================' +echo 'Running Vint to lint our code' +echo '========================================' +echo 'Vint warnings/errors follow:' +echo + +set -o pipefail +docker run -a stdout "${docker_flags[@]}" vint -s . || exit_code=$? +set +o pipefail +echo + +exit $exit_code diff --git a/sources_non_forked/ale/test/sign/test_linting_sets_signs.vader b/sources_non_forked/ale/test/sign/test_linting_sets_signs.vader new file mode 100644 index 00000000..1624449a --- /dev/null +++ b/sources_non_forked/ale/test/sign/test_linting_sets_signs.vader @@ -0,0 +1,76 @@ +Given foobar (Some imaginary filetype): + var y = 3+3; + var y = 3 + +Before: + Save g:ale_buffer_info + Save g:ale_echo_cursor + Save g:ale_run_synchronously + Save g:ale_set_highlights + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + Save g:ale_command_wrapper + + let g:ale_command_wrapper = '' + let g:ale_buffer_info = {} + let g:ale_run_synchronously = 1 + unlet! g:ale_run_synchronously_callbacks + let g:ale_set_signs = 1 + " Disable features we don't need for these tests. + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 0 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + + call ale#sign#Clear() + + function! TestCallback(buffer, output) + return [ + \ {'lnum': 1, 'text': 'foo', 'type': 'W'}, + \ {'lnum': 2, 'text': 'foo', 'type': 'E'}, + \] + endfunction + + function! CollectSigns() + redir => l:output + if has('nvim-0.4.2') || has('patch-8.1.614') + silent exec 'sign place group=ale' + else + silent exec 'sign place' + endif + redir END + + let l:actual_sign_list = [] + + for l:line in split(l:output, "\n") + let l:match = matchlist(l:line, ale#sign#ParsePattern()) + + if len(l:match) > 0 + call add(l:actual_sign_list, [l:match[1], l:match[3]]) + endif + endfor + + return l:actual_sign_list + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''', + \}) + +After: + delfunction TestCallback + delfunction CollectSigns + + unlet! g:ale_run_synchronously_callbacks + call ale#sign#Clear() + call ale#linter#Reset() + +Execute(The signs should be updated after linting is done): + ALELint + call ale#test#FlushJobs() + + AssertEqual [['1', 'ALEWarningSign'], ['2', 'ALEErrorSign']], CollectSigns() diff --git a/sources_non_forked/ale/test/sign/test_sign_column_highlighting.vader b/sources_non_forked/ale/test/sign/test_sign_column_highlighting.vader new file mode 100644 index 00000000..7ea5eb0f --- /dev/null +++ b/sources_non_forked/ale/test/sign/test_sign_column_highlighting.vader @@ -0,0 +1,68 @@ +Before: + Save g:ale_change_sign_column_color + Save &verbose + + function! ParseHighlight(name) abort + redir => l:output + silent execute 'highlight ' . a:name + redir end + + return substitute(join(split(l:output)[2:]), ' Last set.*', '', '') + endfunction + + function! SetHighlight(name, syntax) abort + let l:match = matchlist(a:syntax, '\vlinks to (.+)$') + + if !empty(l:match) + execute 'highlight link ' . a:name . ' ' . l:match[1] + else + execute 'highlight ' . a:name . ' ' a:syntax + endif + endfunction + + let g:sign_highlight = ParseHighlight('SignColumn') + +After: + Restore + + delfunction ParseHighlight + call SetHighlight('SignColumn', g:sign_highlight) + delfunction SetHighlight + unlet! g:sign_highlight + + call ale#sign#Clear() + +Execute(The SignColumn highlight shouldn't be changed if the option is off): + let g:ale_change_sign_column_color = 0 + let b:sign_highlight = ParseHighlight('SignColumn') + + call ale#sign#SetSigns(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'}, + \]) + AssertEqual b:sign_highlight, ParseHighlight('SignColumn') + + call ale#sign#SetSigns(bufnr(''), []) + AssertEqual b:sign_highlight, ParseHighlight('SignColumn') + +Execute(The SignColumn highlight should be set and reset): + let g:ale_change_sign_column_color = 1 + + call ale#sign#SetSigns(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'}, + \]) + AssertEqual 'links to ALESignColumnWithErrors', ParseHighlight('SignColumn') + + call ale#sign#SetSigns(bufnr(''), []) + AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn') + +Execute(The SignColumn should be correctly parsed when verbose=1): + set verbose=1 + highlight SignColumn ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey + + call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() + + AssertEqual + \ has('nvim') + \ ? 'ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey' + \ : 'term=standout ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey', + \ ParseHighlight('ALESignColumnWithoutErrors') diff --git a/sources_non_forked/ale/test/sign/test_sign_limits.vader b/sources_non_forked/ale/test/sign/test_sign_limits.vader new file mode 100644 index 00000000..d7a4e2f5 --- /dev/null +++ b/sources_non_forked/ale/test/sign/test_sign_limits.vader @@ -0,0 +1,57 @@ +Before: + Save g:ale_max_signs + + let g:ale_max_signs = -1 + + function! SetNProblems(sign_count) + let l:loclist = [] + let l:range = range(1, a:sign_count) + call setline(1, l:range) + + for l:index in l:range + call add(l:loclist, { + \ 'bufnr': bufnr(''), + \ 'lnum': l:index, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'a', + \}) + endfor + + call ale#sign#SetSigns(bufnr(''), l:loclist) + + return sort(map(ale#sign#FindCurrentSigns(bufnr(''))[1], 'v:val[0]'), 'n') + endfunction + +After: + Restore + + unlet! b:ale_max_signs + + delfunction SetNProblems + + call ale#sign#Clear() + +Execute(There should be no limit on signs with negative numbers): + AssertEqual range(1, 42), SetNProblems(42) + +Execute(0 signs should be set when the max is 0): + let g:ale_max_signs = 0 + + AssertEqual [], SetNProblems(42) + +Execute(1 signs should be set when the max is 1): + let g:ale_max_signs = 1 + + AssertEqual [1], SetNProblems(42) + +Execute(10 signs should be set when the max is 10): + let g:ale_max_signs = 10 + + " We'll check that we set signs for the first 10 items, not other lines. + AssertEqual range(1, 10), SetNProblems(42) + +Execute(5 signs should be set when the max is 5 for the buffer): + let b:ale_max_signs = 5 + + AssertEqual range(1, 5), SetNProblems(42) diff --git a/sources_non_forked/ale/test/sign/test_sign_parsing.vader b/sources_non_forked/ale/test/sign/test_sign_parsing.vader new file mode 100644 index 00000000..c0967f43 --- /dev/null +++ b/sources_non_forked/ale/test/sign/test_sign_parsing.vader @@ -0,0 +1,88 @@ +Execute (Parsing English signs should work): + if has('nvim-0.4.2') || has('patch-8.1.614') + AssertEqual + \ [0, [[9, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([ + \ 'Signs for app.js:', + \ ' line=9 id=1000001 group=ale name=ALEWarningSign', + \ ]) + else + AssertEqual + \ [0, [[9, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([ + \ 'Signs for app.js:', + \ ' line=9 id=1000001 name=ALEWarningSign', + \ ]) + endif + +Execute (Parsing Russian signs should work): + if has('nvim-0.4.2') || has('patch-8.1.614') + AssertEqual + \ [0, [[1, 1000001, 'ALEErrorSign']]], + \ ale#sign#ParseSigns([' строка=1 id=1000001 группа=ale имя=ALEErrorSign']) + else + AssertEqual + \ [0, [[1, 1000001, 'ALEErrorSign']]], + \ ale#sign#ParseSigns([' строка=1 id=1000001 имя=ALEErrorSign']) + endif + +Execute (Parsing Japanese signs should work): + if has('nvim-0.4.2') || has('patch-8.1.614') + AssertEqual + \ [0, [[1, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([' 行=1 識別子=1000001 グループ=ale 名前=ALEWarningSign']) + else + AssertEqual + \ [0, [[1, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([' 行=1 識別子=1000001 名前=ALEWarningSign']) + endif + +Execute (Parsing Spanish signs should work): + if has('nvim-0.4.2') || has('patch-8.1.614') + AssertEqual + \ [0, [[12, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([' línea=12 id=1000001 grupo=ale nombre=ALEWarningSign']) + else + AssertEqual + \ [0, [[12, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([' línea=12 id=1000001 nombre=ALEWarningSign']) + endif + +Execute (Parsing Italian signs should work): + if has('nvim-0.4.2') || has('patch-8.1.614') + AssertEqual + \ [0, [[1, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([' riga=1 id=1000001, gruppo=ale nome=ALEWarningSign']) + else + AssertEqual + \ [0, [[1, 1000001, 'ALEWarningSign']]], + \ ale#sign#ParseSigns([' riga=1 id=1000001, nome=ALEWarningSign']) + endif + +Execute (Parsing German signs should work): + if has('nvim-0.4.2') || has('patch-8.1.614') + AssertEqual + \ [0, [[235, 1000001, 'ALEErrorSign']]], + \ ale#sign#ParseSigns([' Zeile=235 id=1000001 Gruppe=ale Name=ALEErrorSign']) + else + AssertEqual + \ [0, [[235, 1000001, 'ALEErrorSign']]], + \ ale#sign#ParseSigns([' Zeile=235 id=1000001 Name=ALEErrorSign']) + endif + +Execute (The sign parser should indicate if the dummy sign is set): + if has('nvim-0.4.2') || has('patch-8.1.614') + AssertEqual + \ [1, [[1, 1000001, 'ALEErrorSign']]], + \ ale#sign#ParseSigns([ + \ ' строка=1 id=1000001 group=ale имя=ALEErrorSign', + \ ' line=1 id=1000000 group=ale name=ALEDummySign', + \ ]) + else + AssertEqual + \ [1, [[1, 1000001, 'ALEErrorSign']]], + \ ale#sign#ParseSigns([ + \ ' строка=1 id=1000001 имя=ALEErrorSign', + \ ' line=1 id=1000000 name=ALEDummySign', + \ ]) + endif diff --git a/sources_non_forked/ale/test/sign/test_sign_placement.vader b/sources_non_forked/ale/test/sign/test_sign_placement.vader new file mode 100644 index 00000000..7b80d83c --- /dev/null +++ b/sources_non_forked/ale/test/sign/test_sign_placement.vader @@ -0,0 +1,315 @@ +Before: + Save g:ale_buffer_info + Save g:ale_echo_cursor + Save g:ale_run_synchronously + Save g:ale_set_highlights + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + Save g:ale_command_wrapper + + let g:ale_command_wrapper = '' + let g:ale_buffer_info = {} + let g:ale_run_synchronously = 1 + let g:ale_set_signs = 1 + " Disable features we don't need for these tests. + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 0 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + + call ale#linter#Reset() + call ale#sign#Clear() + + function! GenerateResults(buffer, output) + return [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'foo', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'bar', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'baz', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'use this one', + \ }, + \ { + \ 'lnum': 4, + \ 'col': 2, + \ 'type': 'W', + \ 'text': 'ignore this one', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'ignore this one', + \ }, + \ { + \ 'lnum': 5, + \ 'col': 2, + \ 'type': 'E', + \ 'text': 'use this one', + \ }, + \] + endfunction + + function! ParseSigns() + redir => l:output + if has('nvim-0.4.2') || has('patch-8.1.614') + silent sign place group=ale + else + silent sign place + endif + redir END + + return map( + \ split(l:output, '\n')[2:], + \ 'matchlist(v:val, ''' . ale#sign#ParsePattern() . ''')[1:3]', + \) + endfunction + + call ale#linter#Define('testft', { + \ 'name': 'x', + \ 'executable': has('win32') ? 'cmd' : 'true', + \ 'command': 'true', + \ 'callback': 'GenerateResults', + \}) + +After: + Restore + + unlet! g:ale_run_synchronously_callbacks + unlet! g:loclist + delfunction GenerateResults + delfunction ParseSigns + call ale#linter#Reset() + call ale#sign#Clear() + +Execute(ale#sign#GetSignName should return the right sign names): + AssertEqual 'ALEErrorSign', ale#sign#GetSignName([{'type': 'E'}]) + AssertEqual 'ALEStyleErrorSign', ale#sign#GetSignName([{'type': 'E', 'sub_type': 'style'}]) + AssertEqual 'ALEWarningSign', ale#sign#GetSignName([{'type': 'W'}]) + AssertEqual 'ALEStyleWarningSign', ale#sign#GetSignName([{'type': 'W', 'sub_type': 'style'}]) + AssertEqual 'ALEInfoSign', ale#sign#GetSignName([{'type': 'I'}]) + AssertEqual 'ALEErrorSign', ale#sign#GetSignName([ + \ {'type': 'E'}, + \ {'type': 'W'}, + \ {'type': 'I'}, + \ {'type': 'E', 'sub_type': 'style'}, + \ {'type': 'W', 'sub_type': 'style'}, + \]) + AssertEqual 'ALEWarningSign', ale#sign#GetSignName([ + \ {'type': 'W'}, + \ {'type': 'I'}, + \ {'type': 'E', 'sub_type': 'style'}, + \ {'type': 'W', 'sub_type': 'style'}, + \]) + AssertEqual 'ALEInfoSign', ale#sign#GetSignName([ + \ {'type': 'I'}, + \ {'type': 'E', 'sub_type': 'style'}, + \ {'type': 'W', 'sub_type': 'style'}, + \]) + AssertEqual 'ALEStyleErrorSign', ale#sign#GetSignName([ + \ {'type': 'E', 'sub_type': 'style'}, + \ {'type': 'W', 'sub_type': 'style'}, + \]) + AssertEqual 'ALEStyleWarningSign', ale#sign#GetSignName([ + \ {'type': 'W', 'sub_type': 'style'}, + \]) + +Given testft(A file with warnings/errors): + foo + bar + baz + fourth line + fifth line + +Execute(The current signs should be set for running a job): + ALELint + call ale#test#FlushJobs() + + AssertEqual + \ [ + \ ['1', '1000001', 'ALEErrorSign'], + \ ['2', '1000002', 'ALEWarningSign'], + \ ['3', '1000003', 'ALEErrorSign'], + \ ['4', '1000004', 'ALEErrorSign'], + \ ['5', '1000005', 'ALEErrorSign'], + \ ], + \ ParseSigns() + +Execute(Loclist items with sign_id values should be kept): + if has('nvim-0.4.2') || has('patch-8.1.614') + exec 'sign place 1000347 group=ale line=3 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000348 group=ale line=15 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000349 group=ale line=16 name=ALEWarningSign buffer=' . bufnr('') + else + exec 'sign place 1000347 line=3 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000348 line=15 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000349 line=16 name=ALEWarningSign buffer=' . bufnr('') + endif + + let g:loclist = [ + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a', 'sign_id': 1000348}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'W', 'text': 'b', 'sign_id': 1000349}, + \ {'bufnr': bufnr(''), 'lnum': 3, 'col': 1, 'type': 'E', 'text': 'c', 'sign_id': 1000347}, + \ {'bufnr': bufnr(''), 'lnum': 4, 'col': 1, 'type': 'W', 'text': 'd'}, + \ {'bufnr': bufnr(''), 'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}, + \ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f'}, + \] + + call ale#sign#SetSigns(bufnr(''), g:loclist) + + " Sign IDs from before should be kept, and new signs should use + " IDs that haven't been used yet. + AssertEqual + \ [ + \ {'bufnr': bufnr(''), 'lnum': 3, 'col': 1, 'type': 'E', 'text': 'c', 'sign_id': 1000347}, + \ {'bufnr': bufnr(''), 'lnum': 4, 'col': 1, 'type': 'W', 'text': 'd', 'sign_id': 1000350}, + \ {'bufnr': bufnr(''), 'lnum': 15, 'col': 1, 'type': 'E', 'text': 'a', 'sign_id': 1000348}, + \ {'bufnr': bufnr(''), 'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e', 'sign_id': 1000348}, + \ {'bufnr': bufnr(''), 'lnum': 16, 'col': 1, 'type': 'W', 'text': 'b', 'sign_id': 1000351}, + \ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f', 'sign_id': 1000351}, + \ ], + \ g:loclist + + " Items should be grouped again. We should see error signs, where there + " were warnings before, and errors where there were errors and where we + " now have new warnings. + AssertEqual + \ [ + \ ['15', '1000348', 'ALEErrorSign'], + \ ['16', '1000351', 'ALEErrorSign'], + \ ['3', '1000347', 'ALEErrorSign'], + \ ['4', '1000350', 'ALEWarningSign'], + \ ], + \ sort(ParseSigns()) + +Execute(Items for other buffers should be ignored): + let g:loclist = [ + \ {'bufnr': bufnr('') - 1, 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'}, + \ {'bufnr': bufnr('') - 1, 'lnum': 2, 'col': 1, 'type': 'E', 'text': 'a', 'sign_id': 1000347}, + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'W', 'text': 'b'}, + \ {'bufnr': bufnr(''), 'lnum': 3, 'col': 1, 'type': 'E', 'text': 'c'}, + \ {'bufnr': bufnr(''), 'lnum': 4, 'col': 1, 'type': 'W', 'text': 'd'}, + \ {'bufnr': bufnr(''), 'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}, + \ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f'}, + \ {'bufnr': bufnr('') + 1, 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'}, + \] + + call ale#sign#SetSigns(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ ['1', '1000001', 'ALEErrorSign'], + \ ['15', '1000005', 'ALEWarningSign'], + \ ['16', '1000006', 'ALEErrorSign'], + \ ['2', '1000002', 'ALEWarningSign'], + \ ['3', '1000003', 'ALEErrorSign'], + \ ['4', '1000004', 'ALEWarningSign'], + \ ], + \ sort(ParseSigns()) + +Execute(Signs should be downgraded correctly): + call ale#sign#SetSigns(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'x'}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'W', 'text': 'x'}, + \]) + + AssertEqual + \ [ + \ ['1', '1000001', 'ALEErrorSign'], + \ ['2', '1000002', 'ALEWarningSign'], + \ ], + \ sort(ParseSigns()) + + call ale#sign#SetSigns(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'I', 'text': 'x'}, + \]) + + AssertEqual + \ [ + \ ['1', '1000003', 'ALEWarningSign'], + \ ['2', '1000004', 'ALEInfoSign'], + \ ], + \ sort(ParseSigns()) + +Execute(Signs should be upgraded correctly): + call ale#sign#SetSigns(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'I', 'text': 'x'}, + \]) + + AssertEqual + \ [ + \ ['1', '1000001', 'ALEWarningSign'], + \ ['2', '1000002', 'ALEInfoSign'], + \ ], + \ sort(ParseSigns()) + + call ale#sign#SetSigns(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'x'}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'W', 'text': 'x'}, + \]) + + AssertEqual + \ [ + \ ['1', '1000003', 'ALEErrorSign'], + \ ['2', '1000004', 'ALEWarningSign'], + \ ], + \ sort(ParseSigns()) + +Execute(It should be possible to clear signs with empty lists): + let g:loclist = [ + \ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f'}, + \] + + call ale#sign#SetSigns(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ ['16', '1000001', 'ALEErrorSign'], + \ ], + \ sort(ParseSigns()) + + call ale#sign#SetSigns(bufnr(''), []) + + AssertEqual [], ParseSigns() + +Execute(No exceptions should be thrown when setting signs for invalid buffers): + call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}]) + +Execute(Signs should be removed when lines have multiple sign IDs on them): + " We can fail to remove signs if there are multiple signs on one line, + " say after deleting lines in Vim, etc. + if has('nvim-0.4.2') || has('patch-8.1.614') + exec 'sign place 1000347 group=ale line=3 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000348 group=ale line=3 name=ALEWarningSign buffer=' . bufnr('') + exec 'sign place 1000349 group=ale line=10 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000350 group=ale line=10 name=ALEWarningSign buffer=' . bufnr('') + else + exec 'sign place 1000347 line=3 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000348 line=3 name=ALEWarningSign buffer=' . bufnr('') + exec 'sign place 1000349 line=10 name=ALEErrorSign buffer=' . bufnr('') + exec 'sign place 1000350 line=10 name=ALEWarningSign buffer=' . bufnr('') + endif + + call ale#sign#SetSigns(bufnr(''), []) + AssertEqual [], ParseSigns() diff --git a/sources_non_forked/ale/test/smoke_test.vader b/sources_non_forked/ale/test/smoke_test.vader new file mode 100644 index 00000000..1a984dec --- /dev/null +++ b/sources_non_forked/ale/test/smoke_test.vader @@ -0,0 +1,181 @@ +Before: + Save g:ale_enabled + Save g:ale_set_lists_synchronously + Save g:ale_buffer_info + Save &shell + + let g:ale_enabled = 1 + let g:ale_buffer_info = {} + let g:ale_set_lists_synchronously = 1 + + function! TestCallback(buffer, output) + " Windows adds extra spaces to the text from echo. + return [{ + \ 'lnum': 2, + \ 'col': 3, + \ 'text': substitute(a:output[0], ' *$', '', ''), + \}] + endfunction + function! TestCallback2(buffer, output) + return [{ + \ 'lnum': 3, + \ 'col': 4, + \ 'text': substitute(a:output[0], ' *$', '', ''), + \}] + endfunction + + " Running the command in another subshell seems to help here. + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''', + \}) + +After: + Restore + + unlet! g:i + unlet! g:results + unlet! g:expected_results + + delfunction TestCallback + delfunction TestCallback2 + call ale#engine#Cleanup(bufnr('')) + call ale#linter#Reset() + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(Linters should run with the default options): + AssertEqual 'foobar', &filetype + + let g:expected_results = [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'foo bar', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }] + + " Try the test a few times over in NeoVim 0.3 or Windows or Vim 8.2, + " where tests fail randomly. + for g:i in range(has('nvim-0.3') || has('win32') || has('patch-8.2.2401') ? 5 : 1) + call ale#Queue(0, '') + call ale#test#WaitForJobs(2000) + + let g:results = ale#test#GetLoclistWithoutNewerKeys() + + if g:results == g:expected_results + break + endif + endfor + + AssertEqual g:expected_results, g:results + +Execute(Linters should run in PowerShell too): + if has('win32') + set shell=powershell + + AssertEqual 'foobar', &filetype + + " Replace the callback to handle two lines. + function! TestCallback(buffer, output) + " Windows adds extra spaces to the text from echo. + return [ + \ { + \ 'lnum': 1, + \ 'col': 3, + \ 'text': substitute(a:output[0], ' *$', '', ''), + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'text': substitute(a:output[1], ' *$', '', ''), + \ }, + \] + endfunction + + " Recreate the command string to use &&, which PowerShell does not support. + call ale#linter#Reset() + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': 'cmd', + \ 'command': 'echo foo && echo bar', + \}) + + call ale#Queue(0, '') + call ale#test#WaitForJobs(4000) + + AssertEqual [ + \ { + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'foo', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }, + \ { + \ 'bufnr': bufnr('%'), + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'bar', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }, + \], ale#test#GetLoclistWithoutNewerKeys() + endif + +Execute(Previous errors should be removed when linters change): + call ale#Queue(0, '') + call ale#test#WaitForJobs(2000) + + call ale#linter#Reset() + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter2', + \ 'callback': 'TestCallback2', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') ? 'echo baz boz' : '/bin/sh -c ''echo baz boz''', + \}) + + let g:expected_results = [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 3, + \ 'vcol': 0, + \ 'col': 4, + \ 'text': 'baz boz', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}] + + " Try the test a few times over in NeoVim 0.3 or VIm 8.2 or Windows, + " where tests fail randomly. + for g:i in range(has('nvim-0.3') || has('win32') || has('patch-8.2.2401') ? 5 : 1) + call ale#Queue(0, '') + call ale#test#WaitForJobs(2000) + + let g:results = ale#test#GetLoclistWithoutNewerKeys() + + if g:results == g:expected_results + break + endif + endfor + + AssertEqual g:expected_results, g:results diff --git a/sources_non_forked/ale/test/test-files/.circleci/config.yml b/sources_non_forked/ale/test/test-files/.circleci/config.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/.gitignore b/sources_non_forked/ale/test/test-files/.gitignore new file mode 100644 index 00000000..7d6563e0 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/.gitignore @@ -0,0 +1,2 @@ +# Don't ignore hidden files for this directory +!.* diff --git a/sources_non_forked/ale/test/test-files/ada/testfile.adb b/sources_non_forked/ale/test/test-files/ada/testfile.adb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/alex/node-modules-2/node_modules/alex/cli.js b/sources_non_forked/ale/test/test-files/alex/node-modules-2/node_modules/alex/cli.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/alex/node-modules/node_modules/.bin/alex b/sources_non_forked/ale/test/test-files/alex/node-modules/node_modules/.bin/alex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/angular/node_modules/@angular/language-server/bin/ngserver b/sources_non_forked/ale/test/test-files/angular/node_modules/@angular/language-server/bin/ngserver new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/angular/node_modules/@angular/language-service/dummy b/sources_non_forked/ale/test/test-files/angular/node_modules/@angular/language-service/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ant/ant-project/build.xml b/sources_non_forked/ale/test/test-files/ant/ant-project/build.xml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ant/bin/ant b/sources_non_forked/ale/test/test-files/ant/bin/ant new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ant/bin/ant.exe b/sources_non_forked/ale/test/test-files/ant/bin/ant.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/bazel/BUILD b/sources_non_forked/ale/test/test-files/bazel/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/bazel/WORKSPACE b/sources_non_forked/ale/test/test-files/bazel/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/bazel/defs.bzl b/sources_non_forked/ale/test/test-files/bazel/defs.bzl new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/bib/dummy.bib b/sources_non_forked/ale/test/test-files/bib/dummy.bib new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/build_compile_commands_project/build/bad_folder_to_test_priority b/sources_non_forked/ale/test/test-files/c/build_compile_commands_project/build/bad_folder_to_test_priority new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/build_compile_commands_project/build/compile_commands.json b/sources_non_forked/ale/test/test-files/c/build_compile_commands_project/build/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/configure_project/Makefile b/sources_non_forked/ale/test/test-files/c/configure_project/Makefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/configure_project/configure b/sources_non_forked/ale/test/test-files/c/configure_project/configure new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/configure_project/include/test.h b/sources_non_forked/ale/test/test-files/c/configure_project/include/test.h new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/configure_project/subdir/Makefile b/sources_non_forked/ale/test/test-files/c/configure_project/subdir/Makefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/dummy.c b/sources_non_forked/ale/test/test-files/c/dummy.c new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/git_and_nested_makefiles/include/test.h b/sources_non_forked/ale/test/test-files/c/git_and_nested_makefiles/include/test.h new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/git_and_nested_makefiles/src/Makefile b/sources_non_forked/ale/test/test-files/c/git_and_nested_makefiles/src/Makefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/gnumakefile_project/GNUmakefile b/sources_non_forked/ale/test/test-files/c/gnumakefile_project/GNUmakefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/gnumakefile_project/file.c b/sources_non_forked/ale/test/test-files/c/gnumakefile_project/file.c new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/h_file_project/Makefile b/sources_non_forked/ale/test/test-files/c/h_file_project/Makefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/h_file_project/subdir/dummy b/sources_non_forked/ale/test/test-files/c/h_file_project/subdir/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/h_file_project/test.h b/sources_non_forked/ale/test/test-files/c/h_file_project/test.h new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/hpp_file_project/Makefile b/sources_non_forked/ale/test/test-files/c/hpp_file_project/Makefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/hpp_file_project/subdir/dummy b/sources_non_forked/ale/test/test-files/c/hpp_file_project/subdir/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/hpp_file_project/test.hpp b/sources_non_forked/ale/test/test-files/c/hpp_file_project/test.hpp new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/json_project/build/compile_commands.json b/sources_non_forked/ale/test/test-files/c/json_project/build/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/json_project/include/test.h b/sources_non_forked/ale/test/test-files/c/json_project/include/test.h new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/json_project/subdir/dummy b/sources_non_forked/ale/test/test-files/c/json_project/subdir/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/makefile_project/Makefile b/sources_non_forked/ale/test/test-files/c/makefile_project/Makefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/makefile_project/_astylerc b/sources_non_forked/ale/test/test-files/c/makefile_project/_astylerc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/makefile_project/args b/sources_non_forked/ale/test/test-files/c/makefile_project/args new file mode 100644 index 00000000..ccaf82ad --- /dev/null +++ b/sources_non_forked/ale/test/test-files/c/makefile_project/args @@ -0,0 +1,3 @@ +foolib.a +-DARGS1 +@subdir/args diff --git a/sources_non_forked/ale/test/test-files/c/makefile_project/include/test.h b/sources_non_forked/ale/test/test-files/c/makefile_project/include/test.h new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/makefile_project/subdir/args b/sources_non_forked/ale/test/test-files/c/makefile_project/subdir/args new file mode 100644 index 00000000..3fe9c3fe --- /dev/null +++ b/sources_non_forked/ale/test/test-files/c/makefile_project/subdir/args @@ -0,0 +1 @@ +-DARGS2 diff --git a/sources_non_forked/ale/test/test-files/c/makefile_project/subdir/dummy b/sources_non_forked/ale/test/test-files/c/makefile_project/subdir/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/c/makefile_project/subdir/file.c b/sources_non_forked/ale/test/test-files/c/makefile_project/subdir/file.c new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cargo/Cargo.toml b/sources_non_forked/ale/test/test-files/cargo/Cargo.toml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cargo/workspace_paths/Cargo.toml b/sources_non_forked/ale/test/test-files/cargo/workspace_paths/Cargo.toml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cargo/workspace_paths/subpath/Cargo.toml b/sources_non_forked/ale/test/test-files/cargo/workspace_paths/subpath/Cargo.toml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ccls/with_build_dir/unusual_build_dir_name/compile_commands.json b/sources_non_forked/ale/test/test-files/ccls/with_build_dir/unusual_build_dir_name/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ccls/with_ccls-root/.ccls-root b/sources_non_forked/ale/test/test-files/ccls/with_ccls-root/.ccls-root new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ccls/with_ccls/.ccls b/sources_non_forked/ale/test/test-files/ccls/with_ccls/.ccls new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ccls/with_compile_commands_json/compile_commands.json b/sources_non_forked/ale/test/test-files/ccls/with_compile_commands_json/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/checkstyle/other_config.xml b/sources_non_forked/ale/test/test-files/checkstyle/other_config.xml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/clangd/with_build_dir/unusual_build_dir_name/compile_commands.json b/sources_non_forked/ale/test/test-files/clangd/with_build_dir/unusual_build_dir_name/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/clangd/with_compile_commands/compile_commands.json b/sources_non_forked/ale/test/test-files/clangd/with_compile_commands/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/clangformat/with_clangformat/.clang-format b/sources_non_forked/ale/test/test-files/clangformat/with_clangformat/.clang-format new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cpp/.astylerc b/sources_non_forked/ale/test/test-files/cpp/.astylerc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cpp/dummy.cpp b/sources_non_forked/ale/test/test-files/cpp/dummy.cpp new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cppcheck/one/compile_commands.json b/sources_non_forked/ale/test/test-files/cppcheck/one/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cppcheck/one/two/three/file.c b/sources_non_forked/ale/test/test-files/cppcheck/one/two/three/file.c new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cppcheck/one/two/three/file.cpp b/sources_non_forked/ale/test/test-files/cppcheck/one/two/three/file.cpp new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cppcheck/with_build_dir/build/compile_commands.json b/sources_non_forked/ale/test/test-files/cppcheck/with_build_dir/build/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cquery/build/compile_commands.json b/sources_non_forked/ale/test/test-files/cquery/build/compile_commands.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cquery/with_cquery/.cquery b/sources_non_forked/ale/test/test-files/cquery/with_cquery/.cquery new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cspell/node-modules-2/node_modules/cspell/bin.js b/sources_non_forked/ale/test/test-files/cspell/node-modules-2/node_modules/cspell/bin.js new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cspell/node-modules/node_modules/.bin/cspell b/sources_non_forked/ale/test/test-files/cspell/node-modules/node_modules/.bin/cspell new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/csslint/other-app/testfile.css b/sources_non_forked/ale/test/test-files/csslint/other-app/testfile.css new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/csslint/some-app/.csslintrc b/sources_non_forked/ale/test/test-files/csslint/some-app/.csslintrc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/csslint/some-app/subdir/testfile.css b/sources_non_forked/ale/test/test-files/csslint/some-app/subdir/testfile.css new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cucumber/features/cuke.feature b/sources_non_forked/ale/test/test-files/cucumber/features/cuke.feature new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/cucumber/features/step_definitions/base_steps.rb b/sources_non_forked/ale/test/test-files/cucumber/features/step_definitions/base_steps.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/d/test.d b/sources_non_forked/ale/test/test-files/d/test.d new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/dart/.packages b/sources_non_forked/ale/test/test-files/dart/.packages new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/dart/testfile.dart b/sources_non_forked/ale/test/test-files/dart/testfile.dart new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/dprint/blank.ts b/sources_non_forked/ale/test/test-files/dprint/blank.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/dprint/dprint.json b/sources_non_forked/ale/test/test-files/dprint/dprint.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elixir/mix_project/lib/app.ex b/sources_non_forked/ale/test/test-files/elixir/mix_project/lib/app.ex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elixir/mix_project/mix.exs b/sources_non_forked/ale/test/test-files/elixir/mix_project/mix.exs new file mode 100644 index 00000000..419685ae --- /dev/null +++ b/sources_non_forked/ale/test/test-files/elixir/mix_project/mix.exs @@ -0,0 +1,3 @@ +defmodule Test.MixProject do + # fake mix project file +end diff --git a/sources_non_forked/ale/test/test-files/elixir/testfile.ex b/sources_non_forked/ale/test/test-files/elixir/testfile.ex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app1/lib/app.ex b/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app1/lib/app.ex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app1/mix.exs b/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app1/mix.exs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app2/lib/app.ex b/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app2/lib/app.ex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app2/mix.exs b/sources_non_forked/ale/test/test-files/elixir/umbrella_project/apps/app2/mix.exs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elixir/umbrella_project/mix.exs b/sources_non_forked/ale/test/test-files/elixir/umbrella_project/mix.exs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp-notests/elm.json b/sources_non_forked/ale/test/test-files/elm/newapp-notests/elm.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp-notests/node_modules/.bin/elm b/sources_non_forked/ale/test/test-files/elm/newapp-notests/node_modules/.bin/elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp-notests/tests/TestMain.elm b/sources_non_forked/ale/test/test-files/elm/newapp-notests/tests/TestMain.elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp/elm.json b/sources_non_forked/ale/test/test-files/elm/newapp/elm.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp/node_modules/.bin/elm b/sources_non_forked/ale/test/test-files/elm/newapp/node_modules/.bin/elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp/node_modules/.bin/elm-test b/sources_non_forked/ale/test/test-files/elm/newapp/node_modules/.bin/elm-test new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp/src/Main.elm b/sources_non_forked/ale/test/test-files/elm/newapp/src/Main.elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/newapp/tests/TestSuite.elm b/sources_non_forked/ale/test/test-files/elm/newapp/tests/TestSuite.elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/node_modules/.bin/elm-format b/sources_non_forked/ale/test/test-files/elm/node_modules/.bin/elm-format new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/oldapp/elm-package.json b/sources_non_forked/ale/test/test-files/elm/oldapp/elm-package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/oldapp/node_modules/.bin/elm b/sources_non_forked/ale/test/test-files/elm/oldapp/node_modules/.bin/elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/oldapp/node_modules/.bin/elm-test b/sources_non_forked/ale/test/test-files/elm/oldapp/node_modules/.bin/elm-test new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/oldapp/src/Main.elm b/sources_non_forked/ale/test/test-files/elm/oldapp/src/Main.elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/oldapp/tests/TestSuite.elm b/sources_non_forked/ale/test/test-files/elm/oldapp/tests/TestSuite.elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/elm/src/subdir/testfile.elm b/sources_non_forked/ale/test/test-files/elm/src/subdir/testfile.elm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eruby/dummy.html.erb b/sources_non_forked/ale/test/test-files/eruby/dummy.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d b/sources_non_forked/ale/test/test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/node_modules/.bin/eslint b/sources_non_forked/ale/test/test-files/eslint/node_modules/.bin/eslint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/other-app/subdir/testfile.js b/sources_non_forked/ale/test/test-files/eslint/other-app/subdir/testfile.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/package.json b/sources_non_forked/ale/test/test-files/eslint/package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/.eslintrc.js b/sources_non_forked/ale/test/test-files/eslint/react-app/.eslintrc.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/eslint/bin/eslint.js b/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/eslint/bin/eslint.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/standard/bin/cmd.js b/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/standard/bin/cmd.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js b/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/xo/cli.js b/sources_non_forked/ale/test/test-files/eslint/react-app/node_modules/xo/cli.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-config/.eslintrc b/sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-config/.eslintrc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-package-json/node_modules/.gitkeep b/sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-package-json/node_modules/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-package-json/package.json b/sources_non_forked/ale/test/test-files/eslint/react-app/subdir-with-package-json/package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.css b/sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.css new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.js b/sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.ts b/sources_non_forked/ale/test/test-files/eslint/react-app/subdir/testfile.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/yarn2-app/.yarn/sdks/eslint/bin/eslint.js b/sources_non_forked/ale/test/test-files/eslint/yarn2-app/.yarn/sdks/eslint/bin/eslint.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/eslint/yarn2-app/subdir/testfile.js b/sources_non_forked/ale/test/test-files/eslint/yarn2-app/subdir/testfile.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/fecs/fecs b/sources_non_forked/ale/test/test-files/fecs/fecs new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/fecs/fecs.exe b/sources_non_forked/ale/test/test-files/fecs/fecs.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/fish/testfile.fish b/sources_non_forked/ale/test/test-files/fish/testfile.fish new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/flow/a/.flowconfig b/sources_non_forked/ale/test/test-files/flow/a/.flowconfig new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/flow/a/sub/dummy b/sources_non_forked/ale/test/test-files/flow/a/sub/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/flow/b/sub/dummy b/sources_non_forked/ale/test/test-files/flow/b/sub/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/fortls-project/.fortls b/sources_non_forked/ale/test/test-files/fortls-project/.fortls new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/fortls-project/.fortls @@ -0,0 +1,2 @@ +{ +} diff --git a/sources_non_forked/ale/test/test-files/go/go.mod b/sources_non_forked/ale/test/test-files/go/go.mod new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/go/go.mod @@ -0,0 +1 @@ + diff --git a/sources_non_forked/ale/test/test-files/go/go1/prj1/file.go b/sources_non_forked/ale/test/test-files/go/go1/prj1/file.go new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/go/go2/prj2/file.go b/sources_non_forked/ale/test/test-files/go/go2/prj2/file.go new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/go/gopath/bin/gopls b/sources_non_forked/ale/test/test-files/go/gopath/bin/gopls new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/go/gopath/bin/staticcheck b/sources_non_forked/ale/test/test-files/go/gopath/bin/staticcheck new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/go/testfile.go b/sources_non_forked/ale/test/test-files/go/testfile.go new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/go/testfile2.go b/sources_non_forked/ale/test/test-files/go/testfile2.go new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/build-gradle-project/build.gradle b/sources_non_forked/ale/test/test-files/gradle/build-gradle-project/build.gradle new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/build-gradle-project/src/main/kotlin/dummy.kt b/sources_non_forked/ale/test/test-files/gradle/build-gradle-project/src/main/kotlin/dummy.kt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/gradle b/sources_non_forked/ale/test/test-files/gradle/gradle new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/non-gradle-project/src/main/kotlin/dummy.kt b/sources_non_forked/ale/test/test-files/gradle/non-gradle-project/src/main/kotlin/dummy.kt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/settings-gradle-project/settings.gradle b/sources_non_forked/ale/test/test-files/gradle/settings-gradle-project/settings.gradle new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/settings-gradle-project/src/main/kotlin/dummy.kt b/sources_non_forked/ale/test/test-files/gradle/settings-gradle-project/src/main/kotlin/dummy.kt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/unwrapped-project/build.gradle b/sources_non_forked/ale/test/test-files/gradle/unwrapped-project/build.gradle new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/unwrapped-project/settings.gradle b/sources_non_forked/ale/test/test-files/gradle/unwrapped-project/settings.gradle new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/unwrapped-project/src/main/kotlin/dummy.kt b/sources_non_forked/ale/test/test-files/gradle/unwrapped-project/src/main/kotlin/dummy.kt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/wrapped-project/build.gradle b/sources_non_forked/ale/test/test-files/gradle/wrapped-project/build.gradle new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/wrapped-project/gradlew b/sources_non_forked/ale/test/test-files/gradle/wrapped-project/gradlew new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/wrapped-project/settings.gradle b/sources_non_forked/ale/test/test-files/gradle/wrapped-project/settings.gradle new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt b/sources_non_forked/ale/test/test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/.haml-lint.yml b/sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/.haml-lint.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/.rubocop.yml b/sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/.rubocop.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/subdir/file.haml b/sources_non_forked/ale/test/test-files/hamllint/haml-lint-and-rubocop/subdir/file.haml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hamllint/haml-lint-yml/.haml-lint.yml b/sources_non_forked/ale/test/test-files/hamllint/haml-lint-yml/.haml-lint.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hamllint/haml-lint-yml/subdir/file.haml b/sources_non_forked/ale/test/test-files/hamllint/haml-lint-yml/subdir/file.haml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hamllint/rubocop-yml/.rubocop.yml b/sources_non_forked/ale/test/test-files/hamllint/rubocop-yml/.rubocop.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hamllint/rubocop-yml/subdir/file.haml b/sources_non_forked/ale/test/test-files/hamllint/rubocop-yml/subdir/file.haml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hdl_server/foo.vhd b/sources_non_forked/ale/test/test-files/hdl_server/foo.vhd new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hdl_server/with_config_file/.hdl_checker.config b/sources_non_forked/ale/test/test-files/hdl_server/with_config_file/.hdl_checker.config new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hdl_server/with_config_file/_hdl_checker.config b/sources_non_forked/ale/test/test-files/hdl_server/with_config_file/_hdl_checker.config new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hdl_server/with_config_file/foo.vhd b/sources_non_forked/ale/test/test-files/hdl_server/with_config_file/foo.vhd new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/hdl_server/with_git/files/foo.vhd b/sources_non_forked/ale/test/test-files/hdl_server/with_git/files/foo.vhd new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/hdl_server/with_git/files/foo.vhd @@ -0,0 +1 @@ + diff --git a/sources_non_forked/ale/test/test-files/hie_paths/file.hs b/sources_non_forked/ale/test/test-files/hie_paths/file.hs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/html_beautify/html-beautify b/sources_non_forked/ale/test/test-files/html_beautify/html-beautify new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/html_beautify/test.html b/sources_non_forked/ale/test/test-files/html_beautify/test.html new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/htmlhint/node_modules/.bin/htmlhint b/sources_non_forked/ale/test/test-files/htmlhint/node_modules/.bin/htmlhint new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/htmlhint/with_config/.htmlhintrc b/sources_non_forked/ale/test/test-files/htmlhint/with_config/.htmlhintrc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ink/story/main.ink b/sources_non_forked/ale/test/test-files/ink/story/main.ink new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/inko/test.inko b/sources_non_forked/ale/test/test-files/inko/test.inko new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/inko/tests/test/test_foo.inko b/sources_non_forked/ale/test/test-files/inko/tests/test/test_foo.inko new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/java/no_main/src/test/java/com/something/dummy b/sources_non_forked/ale/test/test-files/java/no_main/src/test/java/com/something/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/java/with_jaxb/src/main/java/com/something/dummy b/sources_non_forked/ale/test/test-files/java/with_jaxb/src/main/java/com/something/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/java/with_jaxb/src/main/jaxb/com/something/dummy b/sources_non_forked/ale/test/test-files/java/with_jaxb/src/main/jaxb/com/something/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/java/with_main/build/gen/main/java/com/something/dummy b/sources_non_forked/ale/test/test-files/java/with_main/build/gen/main/java/com/something/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/java/with_main/build/gen2/main/java/com/something/dummy b/sources_non_forked/ale/test/test-files/java/with_main/build/gen2/main/java/com/something/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/java/with_main/src/main/java/com/something/dummy b/sources_non_forked/ale/test/test-files/java/with_main/src/main/java/com/something/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/java/with_main/src/test/java/com/something/dummy b/sources_non_forked/ale/test/test-files/java/with_main/src/test/java/com/something/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/javascript/test.js b/sources_non_forked/ale/test/test-files/javascript/test.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/javascript_deno/custom_import_map.json b/sources_non_forked/ale/test/test-files/javascript_deno/custom_import_map.json new file mode 100644 index 00000000..9f5a19a1 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/javascript_deno/custom_import_map.json @@ -0,0 +1,3 @@ +{ + "imports": {} +} diff --git a/sources_non_forked/ale/test/test-files/javascript_deno/import_map.json b/sources_non_forked/ale/test/test-files/javascript_deno/import_map.json new file mode 100644 index 00000000..9f5a19a1 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/javascript_deno/import_map.json @@ -0,0 +1,3 @@ +{ + "imports": {} +} diff --git a/sources_non_forked/ale/test/test-files/javascript_deno/main.js b/sources_non_forked/ale/test/test-files/javascript_deno/main.js new file mode 100644 index 00000000..accefceb --- /dev/null +++ b/sources_non_forked/ale/test/test-files/javascript_deno/main.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/sources_non_forked/ale/test/test-files/javascript_deno/tsconfig.json b/sources_non_forked/ale/test/test-files/javascript_deno/tsconfig.json new file mode 100644 index 00000000..152b034e --- /dev/null +++ b/sources_non_forked/ale/test/test-files/javascript_deno/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "allowJs": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "isolatedModules": true, + "jsx": "react", + "lib": ["deno.window"], + "module": "esnext", + "strict": true, + "target": "esnext", + "useDefineForClassFields": true + }, + "includes": ["main.js"] +} diff --git a/sources_non_forked/ale/test/test-files/json/testfile.json b/sources_non_forked/ale/test/test-files/json/testfile.json new file mode 100644 index 00000000..fe317ebb --- /dev/null +++ b/sources_non_forked/ale/test/test-files/json/testfile.json @@ -0,0 +1 @@ +{"answer":42} diff --git a/sources_non_forked/ale/test/test-files/jsonlint/app-without-jsonlint/src/app.json b/sources_non_forked/ale/test/test-files/jsonlint/app-without-jsonlint/src/app.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/jsonlint/app/node_modules/.bin/jsonlint b/sources_non_forked/ale/test/test-files/jsonlint/app/node_modules/.bin/jsonlint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/jsonlint/app/src/app.json b/sources_non_forked/ale/test/test-files/jsonlint/app/src/app.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/jsonlint/node_modules/jsonlint/lib/cli.js b/sources_non_forked/ale/test/test-files/jsonlint/node_modules/jsonlint/lib/cli.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/julia/REQUIRE b/sources_non_forked/ale/test/test-files/julia/REQUIRE new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/julia/test.jl b/sources_non_forked/ale/test/test-files/julia/test.jl new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/kotlin/testfile.kt b/sources_non_forked/ale/test/test-files/kotlin/testfile.kt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/lessc/node_modules/.bin/lessc b/sources_non_forked/ale/test/test-files/lessc/node_modules/.bin/lessc new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/long-line/setup.cfg b/sources_non_forked/ale/test/test-files/long-line/setup.cfg new file mode 100644 index 00000000..43d7a3a1 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/long-line/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 90 diff --git a/sources_non_forked/ale/test/test-files/lua/testfile.lua b/sources_non_forked/ale/test/test-files/lua/testfile.lua new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/markdown/testfile.md b/sources_non_forked/ale/test/test-files/markdown/testfile.md new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/mvnw b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/mvnw new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/mvnw.cmd b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/mvnw.cmd new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/pom.xml b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/pom.xml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/pom.xml @@ -0,0 +1 @@ + diff --git a/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/src/main/java/dummy1.java b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module1/src/main/java/dummy1.java new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/maven/maven-java-project/module2/pom.xml b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module2/pom.xml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module2/pom.xml @@ -0,0 +1 @@ + diff --git a/sources_non_forked/ale/test/test-files/maven/maven-java-project/module2/src/main/java/dummy2.java b/sources_non_forked/ale/test/test-files/maven/maven-java-project/module2/src/main/java/dummy2.java new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/pom.xml b/sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/pom.xml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/pom.xml @@ -0,0 +1 @@ + diff --git a/sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/src/main/kotlin/dummy.kt b/sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/src/main/kotlin/dummy.kt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/maven/maven-kotlin-project/src/main/kotlin/dummy.kt @@ -0,0 +1 @@ + diff --git a/sources_non_forked/ale/test/test-files/maven/mvn b/sources_non_forked/ale/test/test-files/maven/mvn new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/maven/non-maven-project/src/main/java/dummy.java b/sources_non_forked/ale/test/test-files/maven/non-maven-project/src/main/java/dummy.java new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/nim/with-git/src/source.nim b/sources_non_forked/ale/test/test-files/nim/with-git/src/source.nim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ocaml/testfile.ml b/sources_non_forked/ale/test/test-files/ocaml/testfile.ml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ocamllsp/dune-project b/sources_non_forked/ale/test/test-files/ocamllsp/dune-project new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ols/.merlin b/sources_non_forked/ale/test/test-files/ols/.merlin new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ols/node_modules/.bin/ocaml-language-server b/sources_non_forked/ale/test/test-files/ols/node_modules/.bin/ocaml-language-server new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/pascal/test.pas b/sources_non_forked/ale/test/test-files/pascal/test.pas new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/project-with-php-cs-fixer/test.php b/sources_non_forked/ale/test/test-files/php/project-with-php-cs-fixer/test.php new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/project-with-php-cs-fixer/vendor/bin/php-cs-fixer b/sources_non_forked/ale/test/test-files/php/project-with-php-cs-fixer/vendor/bin/php-cs-fixer new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/project-with-phpcbf/foo/test.php b/sources_non_forked/ale/test/test-files/php/project-with-phpcbf/foo/test.php new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/project-with-phpcbf/vendor/bin/phpcbf b/sources_non_forked/ale/test/test-files/php/project-with-phpcbf/vendor/bin/phpcbf new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/project-without-php-cs-fixer/test.php b/sources_non_forked/ale/test/test-files/php/project-without-php-cs-fixer/test.php new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/project-without-phpcbf/foo/test.php b/sources_non_forked/ale/test/test-files/php/project-without-phpcbf/foo/test.php new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/vendor/bin/php-language-server.php b/sources_non_forked/ale/test/test-files/php/vendor/bin/php-language-server.php new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/with-composer/composer.json b/sources_non_forked/ale/test/test-files/php/with-composer/composer.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/with-composer/vendor/bin/php-language-server.php b/sources_non_forked/ale/test/test-files/php/with-composer/vendor/bin/php-language-server.php new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/php/with-git/vendor/bin/php-language-server.php b/sources_non_forked/ale/test/test-files/php/with-git/vendor/bin/php-language-server.php new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/phpcs/project-with-phpcs/foo/test.php b/sources_non_forked/ale/test/test-files/phpcs/project-with-phpcs/foo/test.php new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/phpcs/project-with-phpcs/vendor/bin/phpcs b/sources_non_forked/ale/test/test-files/phpcs/project-with-phpcs/vendor/bin/phpcs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/phpcs/project-without-phpcs/foo/test.php b/sources_non_forked/ale/test/test-files/phpcs/project-without-phpcs/foo/test.php new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/testfile b/sources_non_forked/ale/test/test-files/prettier/testfile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/testfile.css b/sources_non_forked/ale/test/test-files/prettier/testfile.css new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/testfile.js b/sources_non_forked/ale/test/test-files/prettier/testfile.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/testfile.json b/sources_non_forked/ale/test/test-files/prettier/testfile.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/testfile.scss b/sources_non_forked/ale/test/test-files/prettier/testfile.scss new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/testfile.ts b/sources_non_forked/ale/test/test-files/prettier/testfile.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/with_config/.prettierrc b/sources_non_forked/ale/test/test-files/prettier/with_config/.prettierrc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/with_config/testfile.js b/sources_non_forked/ale/test/test-files/prettier/with_config/testfile.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/with_prettierignore/.prettierignore b/sources_non_forked/ale/test/test-files/prettier/with_prettierignore/.prettierignore new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/prettier/with_prettierignore/src/testfile.js b/sources_non_forked/ale/test/test-files/prettier/with_prettierignore/src/testfile.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/proto/testfile.proto b/sources_non_forked/ale/test/test-files/proto/testfile.proto new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/psalm/vendor/bin/psalm b/sources_non_forked/ale/test/test-files/psalm/vendor/bin/psalm new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puglint/node_modules/.bin/pug-lint b/sources_non_forked/ale/test/test-files/puglint/node_modules/.bin/pug-lint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puglint/package.json b/sources_non_forked/ale/test/test-files/puglint/package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puglint/puglint_rc_dir/.pug-lintrc b/sources_non_forked/ale/test/test-files/puglint/puglint_rc_dir/.pug-lintrc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puglint/puglint_rc_js_dir/.pug-lintrc.js b/sources_non_forked/ale/test/test-files/puglint/puglint_rc_js_dir/.pug-lintrc.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puglint/puglint_rc_json_dir/.pug-lintrc.json b/sources_non_forked/ale/test/test-files/puglint/puglint_rc_json_dir/.pug-lintrc.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puppet/dummy.pp b/sources_non_forked/ale/test/test-files/puppet/dummy.pp new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puppet/new-style-module/lib/puppet/types/exampletype.rb b/sources_non_forked/ale/test/test-files/puppet/new-style-module/lib/puppet/types/exampletype.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puppet/new-style-module/metadata.json b/sources_non_forked/ale/test/test-files/puppet/new-style-module/metadata.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puppet/new-style-module/template/template.epp b/sources_non_forked/ale/test/test-files/puppet/new-style-module/template/template.epp new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puppet/old-style-module/manifests/init.pp b/sources_non_forked/ale/test/test-files/puppet/old-style-module/manifests/init.pp new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/puppet/old-style-module/templates/template.epp b/sources_non_forked/ale/test/test-files/puppet/old-style-module/templates/template.epp new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/purescript/bower/Foo.purs b/sources_non_forked/ale/test/test-files/purescript/bower/Foo.purs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/purescript/bower/bower.json b/sources_non_forked/ale/test/test-files/purescript/bower/bower.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/purescript/psc-package/Foo.purs b/sources_non_forked/ale/test/test-files/purescript/psc-package/Foo.purs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/purescript/psc-package/psc-package.json b/sources_non_forked/ale/test/test-files/purescript/psc-package/psc-package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/purescript/spago/Foo.purs b/sources_non_forked/ale/test/test-files/purescript/spago/Foo.purs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/purescript/spago/spago.dhall b/sources_non_forked/ale/test/test-files/purescript/spago/spago.dhall new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_manifest/MANIFEST.in b/sources_non_forked/ale/test/test-files/python/namespace_package_manifest/MANIFEST.in new file mode 100644 index 00000000..4617b0eb --- /dev/null +++ b/sources_non_forked/ale/test/test-files/python/namespace_package_manifest/MANIFEST.in @@ -0,0 +1,3 @@ +include README.md +include *.ini *.cfg *.txt +include requirements/*.txt diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_manifest/namespace/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/namespace_package_manifest/namespace/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_manifest/namespace/foo/bar.py b/sources_non_forked/ale/test/test-files/python/namespace_package_manifest/namespace/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_pytest/namespace/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/namespace_package_pytest/namespace/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_pytest/namespace/foo/bar.py b/sources_non_forked/ale/test/test-files/python/namespace_package_pytest/namespace/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_pytest/pytest.ini b/sources_non_forked/ale/test/test-files/python/namespace_package_pytest/pytest.ini new file mode 100644 index 00000000..1433c6c6 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/python/namespace_package_pytest/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +DJANGO_SETTINGS_MODULE=foo.settings diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_setup/namespace/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/namespace_package_setup/namespace/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_setup/namespace/foo/bar.py b/sources_non_forked/ale/test/test-files/python/namespace_package_setup/namespace/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_setup/setup.cfg b/sources_non_forked/ale/test/test-files/python/namespace_package_setup/setup.cfg new file mode 100644 index 00000000..791f075d --- /dev/null +++ b/sources_non_forked/ale/test/test-files/python/namespace_package_setup/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 119 diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_tox/namespace/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/namespace_package_tox/namespace/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_tox/namespace/foo/bar.py b/sources_non_forked/ale/test/test-files/python/namespace_package_tox/namespace/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/namespace_package_tox/tox.ini b/sources_non_forked/ale/test/test-files/python/namespace_package_tox/tox.ini new file mode 100644 index 00000000..edd8788c --- /dev/null +++ b/sources_non_forked/ale/test/test-files/python/namespace_package_tox/tox.ini @@ -0,0 +1,3 @@ +[tox] +envlist = + py352 diff --git a/sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/COMMIT_EDITMSG b/sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/COMMIT_EDITMSG new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/bar.py b/sources_non_forked/ale/test/test-files/python/no_virtualenv/subdir/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/pipenv/Pipfile.lock b/sources_non_forked/ale/test/test-files/python/pipenv/Pipfile.lock new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/poetry/poetry.lock b/sources_non_forked/ale/test/test-files/python/poetry/poetry.lock new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/.pyre_configuration.local b/sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/.pyre_configuration.local new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/foo/bar.py b/sources_non_forked/ale/test/test-files/python/pyre_configuration_dir/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/python-package-project/.flake8 b/sources_non_forked/ale/test/test-files/python/python-package-project/.flake8 new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/python-package-project/package-name/module.py b/sources_non_forked/ale/test/test-files/python/python-package-project/package-name/module.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_bandit/.bandit b/sources_non_forked/ale/test/test-files/python/with_bandit/.bandit new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_bandit/namespace/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/with_bandit/namespace/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_bandit/namespace/foo/bar.py b/sources_non_forked/ale/test/test-files/python/with_bandit/namespace/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/mypy.ini b/sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/mypy.ini new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/tests/pytest.ini b/sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/tests/pytest.ini new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/tests/testsubfolder/my_tests.py b/sources_non_forked/ale/test/test-files/python/with_mypy_ini_and_pytest_ini/tests/testsubfolder/my_tests.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/dir_with_yapf_config/.style.yapf b/sources_non_forked/ale/test/test-files/python/with_virtualenv/dir_with_yapf_config/.style.yapf new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/activate b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/activate new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autoflake.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autoflake.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autoimport.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autoimport.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autopep8.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/autopep8.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/black.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/black.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/flake8.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/flake8.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/flakehell.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/flakehell.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/gitlint.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/gitlint.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/isort.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/isort.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/mypy.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/mypy.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pyflakes.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pyflakes.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylama.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylama.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylint.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylint.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylsp.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pylsp.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pyre.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/pyre.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/reorder-python-imports.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/reorder-python-imports.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/unimport.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/unimport.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/vulture.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/vulture.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/yamlfix.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/yamlfix.exe new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/yapf.exe b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/Scripts/yapf.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/activate b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/activate new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autoflake b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autoflake new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autoimport b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autoimport new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autopep8 b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/autopep8 new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/black b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/black new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/flake8 b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/flake8 new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/flakehell b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/flakehell new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/gitlint b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/gitlint new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/isort b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/isort new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/mypy b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/mypy new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pyflakes b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pyflakes new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylama b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylama new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylint b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylint new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylsp b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pylsp new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pyre b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/pyre new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/reorder-python-imports b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/reorder-python-imports new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/unimport b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/unimport new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/vulture b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/vulture new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/yamlfix b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/yamlfix new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/yapf b/sources_non_forked/ale/test/test-files/python/with_virtualenv/env/bin/yapf new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/COMMIT_EDITMSG b/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/COMMIT_EDITMSG new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/__init__.py b/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/bar.py b/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/bar.py new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/bar.pyi b/sources_non_forked/ale/test/test-files/python/with_virtualenv/subdir/foo/bar.pyi new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/r/.Rprofile b/sources_non_forked/ale/test/test-files/r/.Rprofile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/foo.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/foo.rkt new file mode 100644 index 00000000..622f3eea --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/foo.rkt @@ -0,0 +1,3 @@ +#lang racket/base + +(displayln "foo") diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/init.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/init.rkt new file mode 100644 index 00000000..e0c94f27 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/c/init.rkt @@ -0,0 +1 @@ +#lang info diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/foo.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/foo.rkt new file mode 100644 index 00000000..622f3eea --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/foo.rkt @@ -0,0 +1,3 @@ +#lang racket/base + +(displayln "foo") diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/init.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/init.rkt new file mode 100644 index 00000000..e0c94f27 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/a/b/init.rkt @@ -0,0 +1 @@ +#lang info diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/a/foo.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/a/foo.rkt new file mode 100644 index 00000000..622f3eea --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/a/foo.rkt @@ -0,0 +1,3 @@ +#lang racket/base + +(displayln "foo") diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/a/init.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/a/init.rkt new file mode 100644 index 00000000..e0c94f27 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/a/init.rkt @@ -0,0 +1 @@ +#lang info diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/foo.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/foo.rkt new file mode 100644 index 00000000..622f3eea --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/foo.rkt @@ -0,0 +1,3 @@ +#lang racket/base + +(displayln "foo") diff --git a/sources_non_forked/ale/test/test-files/racket/many-inits/init.rkt b/sources_non_forked/ale/test/test-files/racket/many-inits/init.rkt new file mode 100644 index 00000000..e0c94f27 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/many-inits/init.rkt @@ -0,0 +1 @@ +#lang info diff --git a/sources_non_forked/ale/test/test-files/racket/simple-script/foo.rkt b/sources_non_forked/ale/test/test-files/racket/simple-script/foo.rkt new file mode 100644 index 00000000..622f3eea --- /dev/null +++ b/sources_non_forked/ale/test/test-files/racket/simple-script/foo.rkt @@ -0,0 +1,3 @@ +#lang racket/base + +(displayln "foo") diff --git a/sources_non_forked/ale/test/test-files/reasonml/bsconfig.json b/sources_non_forked/ale/test/test-files/reasonml/bsconfig.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/reasonml/testfile.re b/sources_non_forked/ale/test/test-files/reasonml/testfile.re new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/remark_lint/with_bin_path/node_modules/.bin/remark b/sources_non_forked/ale/test/test-files/remark_lint/with_bin_path/node_modules/.bin/remark new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/dummy.rb b/sources_non_forked/ale/test/test-files/ruby/dummy.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/not_a_rails_app/file.rb b/sources_non_forked/ale/test/test-files/ruby/not_a_rails_app/file.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/dummy.rb b/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/dummy.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/models/thing.rb b/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/models/thing.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb b/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/config/dummy.rb b/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/config/dummy.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/db/dummy.rb b/sources_non_forked/ale/test/test-files/ruby/valid_rails_app/db/dummy.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app1/Rakefile b/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app1/Rakefile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app1/lib/file.rb b/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app1/lib/file.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app2/Gemfile b/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app2/Gemfile new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app2/lib/file.rb b/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app2/lib/file.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app3/.solargraph.yml b/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app3/.solargraph.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app3/lib/file.rb b/sources_non_forked/ale/test/test-files/ruby/valid_ruby_app3/lib/file.rb new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/with_config/.rubocop.yml b/sources_non_forked/ale/test/test-files/ruby/with_config/.rubocop.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/ruby/with_config/.standard.yml b/sources_non_forked/ale/test/test-files/ruby/with_config/.standard.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/rust/cargo/Cargo.toml b/sources_non_forked/ale/test/test-files/rust/cargo/Cargo.toml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/rust/cargo/testfile.rs b/sources_non_forked/ale/test/test-files/rust/cargo/testfile.rs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/rust/rust-project/rust-project.json b/sources_non_forked/ale/test/test-files/rust/rust-project/rust-project.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/rust/rust-project/testfile.rs b/sources_non_forked/ale/test/test-files/rust/rust-project/testfile.rs new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/sasslint/with-bin/node_modules/.bin/sass-lint b/sources_non_forked/ale/test/test-files/sasslint/with-bin/node_modules/.bin/sass-lint new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/sasslint/with-source/node_modules/sass-lint/bin/sass-lint.js b/sources_non_forked/ale/test/test-files/sasslint/with-source/node_modules/sass-lint/bin/sass-lint.js new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/scala/dummy.scala b/sources_non_forked/ale/test/test-files/scala/dummy.scala new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/scala/invalid_sbt_project/Main.scala b/sources_non_forked/ale/test/test-files/scala/invalid_sbt_project/Main.scala new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/scala/valid_sbt_project/Main.scala b/sources_non_forked/ale/test/test-files/scala/valid_sbt_project/Main.scala new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/scala/valid_sbt_project/build.sbt b/sources_non_forked/ale/test/test-files/scala/valid_sbt_project/build.sbt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/slimlint/.rubocop.yml b/sources_non_forked/ale/test/test-files/slimlint/.rubocop.yml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/slimlint/subdir/file.slim b/sources_non_forked/ale/test/test-files/slimlint/subdir/file.slim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/smlnj/cm/foo.sml b/sources_non_forked/ale/test/test-files/smlnj/cm/foo.sml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/smlnj/cm/path/to/bar.sml b/sources_non_forked/ale/test/test-files/smlnj/cm/path/to/bar.sml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/smlnj/cm/sources.cm b/sources_non_forked/ale/test/test-files/smlnj/cm/sources.cm new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/smlnj/file/qux.sml b/sources_non_forked/ale/test/test-files/smlnj/file/qux.sml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/solhint/Contract.sol b/sources_non_forked/ale/test/test-files/solhint/Contract.sol new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/solhint/node_modules/.bin/solhint b/sources_non_forked/ale/test/test-files/solhint/node_modules/.bin/solhint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/solhint/node_modules/solhint/index.js b/sources_non_forked/ale/test/test-files/solhint/node_modules/solhint/index.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/solhint/package.json b/sources_non_forked/ale/test/test-files/solhint/package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/spectral/node_modules/.bin/spectral b/sources_non_forked/ale/test/test-files/spectral/node_modules/.bin/spectral new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/spectral/openapi.yaml b/sources_non_forked/ale/test/test-files/spectral/openapi.yaml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/stack/stack.yaml b/sources_non_forked/ale/test/test-files/stack/stack.yaml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/standard/with-bin/node_modules/.bin/standard b/sources_non_forked/ale/test/test-files/standard/with-bin/node_modules/.bin/standard new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/standard/with-cmd/node_modules/standard/bin/cmd.js b/sources_non_forked/ale/test/test-files/standard/with-cmd/node_modules/standard/bin/cmd.js new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/stylelint/node_modules/.bin/stylelint b/sources_non_forked/ale/test/test-files/stylelint/node_modules/.bin/stylelint new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swaglint/docs/swagger.yaml b/sources_non_forked/ale/test/test-files/swaglint/docs/swagger.yaml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swaglint/node_modules/.bin/swaglint b/sources_non_forked/ale/test/test-files/swaglint/node_modules/.bin/swaglint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swift/dummy.swift b/sources_non_forked/ale/test/test-files/swift/dummy.swift new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swift/non-swift-package-project/src/folder/dummy.swift b/sources_non_forked/ale/test/test-files/swift/non-swift-package-project/src/folder/dummy.swift new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/.swift-format b/sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/.swift-format new file mode 100644 index 00000000..19fb8b96 --- /dev/null +++ b/sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/.swift-format @@ -0,0 +1,10 @@ +{ + "version": 1, + "lineLength": 100, + "indentation": { + "spaces": 4 + }, + "respectsExistingLineBreaks": true, + "lineBreakBeforeControlFlowKeywords": true, + "lineBreakBeforeEachArgument": true +} diff --git a/sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/Package.swift b/sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/Package.swift new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/src/folder/dummy.swift b/sources_non_forked/ale/test/test-files/swift/swift-package-project-with-config/src/folder/dummy.swift new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swift/swift-package-project/Package.swift b/sources_non_forked/ale/test/test-files/swift/swift-package-project/Package.swift new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swift/swift-package-project/src/folder/dummy.swift b/sources_non_forked/ale/test/test-files/swift/swift-package-project/src/folder/dummy.swift new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swiftlint/cocoapods-and-react-native/Pods/SwiftLint/swiftlint b/sources_non_forked/ale/test/test-files/swiftlint/cocoapods-and-react-native/Pods/SwiftLint/swiftlint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swiftlint/cocoapods-and-react-native/ios/Pods/SwiftLint/swiftlint b/sources_non_forked/ale/test/test-files/swiftlint/cocoapods-and-react-native/ios/Pods/SwiftLint/swiftlint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swiftlint/cocoapods/Pods/SwiftLint/swiftlint b/sources_non_forked/ale/test/test-files/swiftlint/cocoapods/Pods/SwiftLint/swiftlint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/swiftlint/react-native/ios/Pods/SwiftLint/swiftlint b/sources_non_forked/ale/test/test-files/swiftlint/react-native/ios/Pods/SwiftLint/swiftlint new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/terraform/.terraform/dummy b/sources_non_forked/ale/test/test-files/terraform/.terraform/dummy new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/terraform/main.tf b/sources_non_forked/ale/test/test-files/terraform/main.tf new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tex/sample1.tex b/sources_non_forked/ale/test/test-files/tex/sample1.tex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tex/sample2.tex b/sources_non_forked/ale/test/test-files/tex/sample2.tex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tex/testfile.tex b/sources_non_forked/ale/test/test-files/tex/testfile.tex new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/textlint/with_bin_path/node_modules/.bin/textlint b/sources_non_forked/ale/test/test-files/textlint/with_bin_path/node_modules/.bin/textlint new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js b/sources_non_forked/ale/test/test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tflint/foo/.tflint.hcl b/sources_non_forked/ale/test/test-files/tflint/foo/.tflint.hcl new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tflint/foo/bar.tf b/sources_non_forked/ale/test/test-files/tflint/foo/bar.tf new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tidy/.tidyrc b/sources_non_forked/ale/test/test-files/tidy/.tidyrc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tidy/test.html b/sources_non_forked/ale/test/test-files/tidy/test.html new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tidy/tidy b/sources_non_forked/ale/test/test-files/tidy/tidy new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tidy/tidy.exe b/sources_non_forked/ale/test/test-files/tidy/tidy.exe new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/top/ale-special-directory-name-dont-use-this-please/empty-file b/sources_non_forked/ale/test/test-files/top/ale-special-directory-name-dont-use-this-please/empty-file new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/top/example.ini b/sources_non_forked/ale/test/test-files/top/example.ini new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/top/middle/bottom/dummy.txt b/sources_non_forked/ale/test/test-files/top/middle/bottom/dummy.txt new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tsserver/src/file1.ts b/sources_non_forked/ale/test/test-files/tsserver/src/file1.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tsserver/src/level-1/file2.ts b/sources_non_forked/ale/test/test-files/tsserver/src/level-1/file2.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tsserver/src/level-1/level-2/file3.ts b/sources_non_forked/ale/test/test-files/tsserver/src/level-1/level-2/file3.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tsserver/src/level-1/tsconfig.json b/sources_non_forked/ale/test/test-files/tsserver/src/level-1/tsconfig.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/tsserver/tsconfig.json b/sources_non_forked/ale/test/test-files/tsserver/tsconfig.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/typescript/custom_import_map.json b/sources_non_forked/ale/test/test-files/typescript/custom_import_map.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/typescript/import_map.json b/sources_non_forked/ale/test/test-files/typescript/import_map.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/typescript/test.ts b/sources_non_forked/ale/test/test-files/typescript/test.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/typescript/tsconfig.json b/sources_non_forked/ale/test/test-files/typescript/tsconfig.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/invalid_vim_project/test.vim b/sources_non_forked/ale/test/test-files/vim/invalid_vim_project/test.vim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/node_modules/.bin/vim-language-server b/sources_non_forked/ale/test/test-files/vim/node_modules/.bin/vim-language-server new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/path_with_autoload/autoload/test.vim b/sources_non_forked/ale/test/test-files/vim/path_with_autoload/autoload/test.vim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/path_with_autoload/test.vim b/sources_non_forked/ale/test/test-files/vim/path_with_autoload/test.vim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/path_with_initvim/init.vim b/sources_non_forked/ale/test/test-files/vim/path_with_initvim/init.vim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/path_with_plugin/plugin/test.vim b/sources_non_forked/ale/test/test-files/vim/path_with_plugin/plugin/test.vim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/path_with_plugin/test.vim b/sources_non_forked/ale/test/test-files/vim/path_with_plugin/test.vim new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/vim/path_with_vimrc/.vimrc b/sources_non_forked/ale/test/test-files/vim/path_with_vimrc/.vimrc new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/volar/node_modules/.bin/volar-server b/sources_non_forked/ale/test/test-files/volar/node_modules/.bin/volar-server new file mode 100755 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/volar/node_modules/typescript/lib/tsserverlibrary.js b/sources_non_forked/ale/test/test-files/volar/node_modules/typescript/lib/tsserverlibrary.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/volar/package.json b/sources_non_forked/ale/test/test-files/volar/package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/volar/src/App.vue b/sources_non_forked/ale/test/test-files/volar/src/App.vue new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/write-good/node-modules-2/node_modules/write-good/bin/write-good.js b/sources_non_forked/ale/test/test-files/write-good/node-modules-2/node_modules/write-good/bin/write-good.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/write-good/node-modules/node_modules/.bin/write-good b/sources_non_forked/ale/test/test-files/write-good/node-modules/node_modules/.bin/write-good new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/xo/monorepo/node_modules/xo/cli.js b/sources_non_forked/ale/test/test-files/xo/monorepo/node_modules/xo/cli.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/xo/monorepo/package.json b/sources_non_forked/ale/test/test-files/xo/monorepo/package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/index.js b/sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/index.js new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/index.ts b/sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/package.json b/sources_non_forked/ale/test/test-files/xo/monorepo/packages/a/package.json new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/yaml/test.yaml b/sources_non_forked/ale/test/test-files/yaml/test.yaml new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test-files/zig/build.zig b/sources_non_forked/ale/test/test-files/zig/build.zig new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/test_ale_has.vader b/sources_non_forked/ale/test/test_ale_has.vader new file mode 100644 index 00000000..ff5d640b --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_has.vader @@ -0,0 +1,13 @@ +Execute(Checks for versions below the current version should succeed): + AssertEqual 1, ale#Has('ale-3.2.0') + AssertEqual 1, ale#Has('ale-3.1.0') + AssertEqual 1, ale#Has('ale-3.0.0') + AssertEqual 1, ale#Has('ale-2.7.0') + AssertEqual 1, ale#Has('ale-2.6.0') + AssertEqual 1, ale#Has('ale-2.5.0') + AssertEqual 1, ale#Has('ale-2.4.0') + AssertEqual 1, ale#Has('ALE-2.2.1') + AssertEqual 1, ale#Has('ALE-1.0.0') + +Execute(Checks for newer versions should fail): + AssertEqual 0, ale#Has('ALE-20.0.0') diff --git a/sources_non_forked/ale/test/test_ale_info.vader b/sources_non_forked/ale/test/test_ale_info.vader new file mode 100644 index 00000000..2e0965a9 --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_info.vader @@ -0,0 +1,777 @@ +Before: + Save g:ale_buffer_info + Save g:ale_cache_executable_check_failures + Save g:ale_change_sign_column_color + Save g:ale_command_wrapper + Save g:ale_completion_delay + Save g:ale_completion_enabled + Save g:ale_completion_max_suggestions + Save g:ale_disable_lsp + Save g:ale_echo_cursor + Save g:ale_echo_msg_error_str + Save g:ale_echo_msg_format + Save g:ale_echo_msg_info_str + Save g:ale_echo_msg_warning_str + Save g:ale_fix_on_save + Save g:ale_fixers + Save g:ale_history_enabled + Save g:ale_history_log_output + Save g:ale_keep_list_window_open + Save g:ale_lint_delay + Save g:ale_lint_on_enter + Save g:ale_lint_on_filetype_changed + Save g:ale_lint_on_insert_leave + Save g:ale_lint_on_save + Save g:ale_lint_on_text_changed + Save g:ale_linters + Save g:ale_linters_explicit + Save g:ale_linters_ignore + Save g:ale_list_vertical + Save g:ale_list_window_size + Save g:ale_loclist_msg_format + Save g:ale_lsp_error_messages + Save g:ale_max_buffer_history_size + Save g:ale_max_signs + Save g:ale_maximum_file_size + Save g:ale_open_list + Save g:ale_pattern_options + Save g:ale_pattern_options_enabled + Save g:ale_root + Save g:ale_set_balloons + Save g:ale_set_highlights + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + Save g:ale_sign_column_always + Save g:ale_sign_error + Save g:ale_sign_info + Save g:ale_sign_offset + Save g:ale_sign_style_error + Save g:ale_sign_style_warning + Save g:ale_sign_warning + Save g:ale_sign_highlight_linenrs + Save g:ale_statusline_format + Save g:ale_type_map + Save g:ale_use_global_executables + Save g:ale_virtualtext_cursor + Save g:ale_warn_about_trailing_blank_lines + Save g:ale_warn_about_trailing_whitespace + + unlet! b:ale_history + + let g:ale_buffer_info = {} + let g:ale_cache_executable_check_failures = 0 + let g:ale_change_sign_column_color = 0 + let g:ale_command_wrapper = '' + let g:ale_completion_delay = 100 + let g:ale_completion_enabled = 0 + let g:ale_completion_max_suggestions = 50 + let g:ale_disable_lsp = 0 + let g:ale_echo_cursor = 1 + let g:ale_echo_msg_error_str = 'Error' + let g:ale_echo_msg_format = '%code: %%s' + let g:ale_echo_msg_info_str = 'Info' + let g:ale_echo_msg_warning_str = 'Warning' + let g:ale_fix_on_save = 0 + let g:ale_history_enabled = 1 + let g:ale_history_log_output = 1 + let g:ale_keep_list_window_open = 0 + let g:ale_lint_delay = 200 + let g:ale_lint_on_enter = 1 + let g:ale_lint_on_filetype_changed = 1 + let g:ale_lint_on_insert_leave = 1 + let g:ale_lint_on_save = 1 + let g:ale_lint_on_text_changed = 'normal' + let g:ale_linters_explicit = 0 + let g:ale_linters_ignore = {'python': ['pyright']} + let g:ale_list_vertical = 0 + let g:ale_list_window_size = 10 + let g:ale_loclist_msg_format = '%code: %%s' + let g:ale_lsp_error_messages = {} + let g:ale_max_buffer_history_size = 20 + let g:ale_max_signs = -1 + let g:ale_maximum_file_size = 0 + let g:ale_open_list = 0 + let g:ale_pattern_options = {} + let g:ale_pattern_options_enabled = 0 + let g:ale_root = {} + let g:ale_set_balloons = 0 + let g:ale_set_highlights = 1 + let g:ale_set_loclist = 1 + let g:ale_set_quickfix = 0 + let g:ale_set_signs = 1 + let g:ale_sign_column_always = 0 + let g:ale_sign_error = '>>' + let g:ale_sign_info = '--' + let g:ale_sign_offset = 1000000 + let g:ale_sign_style_error = '>>' + let g:ale_sign_style_warning = '--' + let g:ale_sign_warning = '--' + let g:ale_sign_highlight_linenrs = 0 + let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK'] + let g:ale_type_map = {} + let g:ale_use_global_executables = v:null + let g:ale_virtualtext_cursor = 0 + let g:ale_warn_about_trailing_blank_lines = 1 + let g:ale_warn_about_trailing_whitespace = 1 + + let g:testlinter1 = {'name': 'testlinter1', 'executable': 'testlinter1', 'command': 'testlinter1', 'callback': 'testCB1', 'output_stream': 'stdout'} + let g:testlinter2 = {'name': 'testlinter2', 'executable': 'testlinter2', 'command': 'testlinter2', 'callback': 'testCB2', 'output_stream': 'stdout'} + + call ale#engine#ResetExecutableCache() + call ale#linter#Reset() + call ale#linter#PreventLoading('testft') + let g:ale_linters = {} + let g:ale_fixers = {} + let g:ale_linter_aliases = {} + let g:ale_buffer_info = {} + let g:fixer_lines = [ + \ ' Suggested Fixers: ', + \ ' ''foo'' - Fix things the foo way', + \] + let g:variables_lines = [ + \ ' Linter Variables:', + \ '', + \] + let g:globals_lines = [ + \ ' Global Variables:', + \ '', + \ 'let g:ale_cache_executable_check_failures = 0', + \ 'let g:ale_change_sign_column_color = 0', + \ 'let g:ale_command_wrapper = ''''', + \ 'let g:ale_completion_delay = 100', + \ 'let g:ale_completion_enabled = 0', + \ 'let g:ale_completion_max_suggestions = 50', + \ 'let g:ale_disable_lsp = 0', + \ 'let g:ale_echo_cursor = 1', + \ 'let g:ale_echo_msg_error_str = ''Error''', + \ 'let g:ale_echo_msg_format = ''%code: %%s''', + \ 'let g:ale_echo_msg_info_str = ''Info''', + \ 'let g:ale_echo_msg_warning_str = ''Warning''', + \ 'let g:ale_enabled = 1', + \ 'let g:ale_fix_on_save = 0', + \ 'let g:ale_fixers = {}', + \ 'let g:ale_history_enabled = 1', + \ 'let g:ale_history_log_output = 1', + \ 'let g:ale_keep_list_window_open = 0', + \ 'let g:ale_lint_delay = 200', + \ 'let g:ale_lint_on_enter = 1', + \ 'let g:ale_lint_on_filetype_changed = 1', + \ 'let g:ale_lint_on_insert_leave = 1', + \ 'let g:ale_lint_on_save = 1', + \ 'let g:ale_lint_on_text_changed = ''normal''', + \ 'let g:ale_linter_aliases = {}', + \ 'let g:ale_linters = {}', + \ 'let g:ale_linters_explicit = 0', + \ 'let g:ale_linters_ignore = {''python'': [''pyright'']}', + \ 'let g:ale_list_vertical = 0', + \ 'let g:ale_list_window_size = 10', + \ 'let g:ale_loclist_msg_format = ''%code: %%s''', + \ 'let g:ale_max_buffer_history_size = 20', + \ 'let g:ale_max_signs = -1', + \ 'let g:ale_maximum_file_size = 0', + \ 'let g:ale_open_list = 0', + \ 'let g:ale_pattern_options = {}', + \ 'let g:ale_pattern_options_enabled = 0', + \ 'let g:ale_root = {}', + \ 'let g:ale_set_balloons = 0', + \ 'let g:ale_set_highlights = 1', + \ 'let g:ale_set_loclist = 1', + \ 'let g:ale_set_quickfix = 0', + \ 'let g:ale_set_signs = 1', + \ 'let g:ale_sign_column_always = 0', + \ 'let g:ale_sign_error = ''>>''', + \ 'let g:ale_sign_info = ''--''', + \ 'let g:ale_sign_offset = 1000000', + \ 'let g:ale_sign_style_error = ''>>''', + \ 'let g:ale_sign_style_warning = ''--''', + \ 'let g:ale_sign_warning = ''--''', + \ 'let g:ale_sign_highlight_linenrs = 0', + \ 'let g:ale_statusline_format = [''%d error(s)'', ''%d warning(s)'', ''OK'']', + \ 'let g:ale_type_map = {}', + \ 'let g:ale_use_global_executables = v:null', + \ 'let g:ale_virtualtext_cursor = 0', + \ 'let g:ale_warn_about_trailing_blank_lines = 1', + \ 'let g:ale_warn_about_trailing_whitespace = 1', + \] + let g:command_header = [ + \ ' Command History:', + \] + + function CheckInfo(expected_list) abort + let l:output = '' + + redir => l:output + noautocmd silent ALEInfo + redir END + + AssertEqual a:expected_list, split(l:output, "\n") + endfunction + + call ale#test#SetDirectory('/testplugin/test') + + call ale#fix#registry#Clear() + call ale#fix#registry#Add('foo', 'x', [], 'Fix things the foo way') + +After: + Restore + + if exists('g:info_test_file') && filereadable(g:info_test_file) + call delete(g:info_test_file) + endif + + unlet! g:testlinter1 + unlet! g:testlinter2 + unlet! b:ale_history + unlet! b:ale_linters + unlet! g:output + unlet! g:fixer_lines + unlet! g:variables_lines + unlet! g:globals_string + unlet! g:command_header + unlet! g:ale_testft_testlinter1_foo + unlet! g:ale_testft_testlinter1_bar + unlet! g:ale_testft2_testlinter2_foo + unlet! b:ale_testft2_testlinter2_foo + unlet! g:ale_testft2_testlinter2_bar + unlet! g:info_test_file + unlet! g:ale_testft_build_dir_names + unlet! g:ale_testft_testlinter2_option + delfunction CheckInfo + + call ale#test#RestoreDirectory() + call ale#fix#registry#ResetToDefaults() + +Given nolintersft (Empty buffer with no linters): +Execute (ALEInfo with no linters should return the right output): + call CheckInfo( + \ [ + \ ' Current Filetype: nolintersft', + \ 'Available Linters: []', + \ ' Enabled Linters: []', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given (Empty buffer with no filetype): +Execute (ALEInfo should return buffer-local global ALE settings): + let b:ale_linters = {'x': ['y']} + + call insert( + \ g:globals_lines, + \ 'let b:ale_linters = {''x'': [''y'']}', + \ index(g:globals_lines, 'let g:ale_linters = {}') + 1 + \) + + call CheckInfo( + \ [ + \ ' Current Filetype: ', + \ 'Available Linters: []', + \ ' Enabled Linters: []', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given (Empty buffer with no filetype): +Execute (ALEInfo with no filetype should return the right output): + call CheckInfo( + \ [ + \ ' Current Filetype: ', + \ 'Available Linters: []', + \ ' Enabled Linters: []', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft (Empty buffer): +Execute (ALEInfo with a single linter should return the right output): + call ale#linter#Define('testft', g:testlinter1) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft', + \ 'Available Linters: [''testlinter1'']', + \ ' Enabled Linters: [''testlinter1'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft (Empty buffer): +Execute (ALEInfo with two linters should return the right output): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft (Empty buffer): +Execute (ALEInfo should calculate enabled linters correctly): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['testlinter2']} + + let g:globals_lines[index(g:globals_lines, 'let g:ale_linters = {}')] + \ = 'let g:ale_linters = {''testft'': [''testlinter2'']}' + + call CheckInfo( + \ [ + \ ' Current Filetype: testft', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft (Empty buffer): +Execute (ALEInfo should only return linters for current filetype): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft', + \ 'Available Linters: [''testlinter1'']', + \ ' Enabled Linters: [''testlinter1'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo with compound filetypes should return linters for both of them): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo should return appropriately named global variables): + let g:ale_testft_testlinter1_foo = 'abc' + let g:ale_testft_testlinter1_bar = ['abc'] + let g:ale_testft2_testlinter2_foo = 123 + let g:ale_testft2_testlinter2_bar = {'x': 'y'} + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + [ + \ ' Linter Variables:', + \ '', + \ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}', + \ 'let g:ale_testft2_testlinter2_foo = 123', + \ 'let g:ale_testft_testlinter1_bar = [''abc'']', + \ 'let g:ale_testft_testlinter1_foo = ''abc''', + \ ] + \ + g:globals_lines + \ + g:command_header + \) + +Execute (ALEInfoToFile should write to a file correctly): + let g:ale_testft_testlinter1_foo = 'abc' + let g:ale_testft_testlinter1_bar = ['abc'] + let g:ale_testft2_testlinter2_foo = 123 + let g:ale_testft2_testlinter2_bar = {'x': 'y'} + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + let g:info_test_file = tempname() + execute 'ALEInfoToFile ' . fnameescape(g:info_test_file) + + AssertEqual + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + [ + \ ' Linter Variables:', + \ '', + \ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}', + \ 'let g:ale_testft2_testlinter2_foo = 123', + \ 'let g:ale_testft_testlinter1_bar = [''abc'']', + \ 'let g:ale_testft_testlinter1_foo = ''abc''', + \ ] + \ + g:globals_lines + \ + g:command_header, + \ readfile(g:info_test_file) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo should buffer-local linter variables): + let g:ale_testft2_testlinter2_foo = 123 + let b:ale_testft2_testlinter2_foo = 456 + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + [ + \ ' Linter Variables:', + \ '', + \ 'let g:ale_testft2_testlinter2_foo = 123', + \ 'let b:ale_testft2_testlinter2_foo = 456', + \ ] + \ + g:globals_lines + \ + g:command_header + \) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo should output linter aliases): + let g:testlinter1.aliases = ['testftalias1', 'testftalias2'] + let g:testlinter2.aliases = ['testftalias3', 'testftalias4'] + + let g:ale_testft2_testlinter2_foo = 123 + let b:ale_testft2_testlinter2_foo = 456 + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Linter Aliases:', + \ '''testlinter1'' -> [''testftalias1'', ''testftalias2'']', + \ '''testlinter2'' -> [''testftalias3'', ''testftalias4'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + [ + \ ' Linter Variables:', + \ '', + \ 'let g:ale_testft2_testlinter2_foo = 123', + \ 'let b:ale_testft2_testlinter2_foo = 456', + \ ] + \ + g:globals_lines + \ + g:command_header + \) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo should return command history): + let b:ale_history = [ + \ {'status': 'started', 'job_id': 347, 'command': 'first command'}, + \ {'status': 'started', 'job_id': 347, 'command': ['/bin/bash', '\c', 'last command']}, + \] + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \ + [ + \ '', + \ '(started) ''first command''', + \ '(started) [''/bin/bash'', ''\c'', ''last command'']', + \ ] + \) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo command history should print exit codes correctly): + let b:ale_history = [ + \ {'status': 'finished', 'exit_code': 0, 'job_id': 347, 'command': 'first command'}, + \ {'status': 'finished', 'exit_code': 1, 'job_id': 347, 'command': ['/bin/bash', '\c', 'last command']}, + \] + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \ + [ + \ '', + \ '(finished - exit code 0) ''first command''', + \ '(finished - exit code 1) [''/bin/bash'', ''\c'', ''last command'']', + \ ] + \) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo command history should print command output if logging is on): + let g:ale_history_log_output = 1 + + let b:ale_history = [ + \ { + \ 'status': 'finished', + \ 'exit_code': 0, + \ 'job_id': 347, + \ 'command': 'first command', + \ 'output': ['some', 'first command output'], + \ }, + \ { + \ 'status': 'finished', + \ 'exit_code': 1, + \ 'job_id': 347, + \ 'command': ['/bin/bash', '\c', 'last command'], + \ 'output': ['different second command output'], + \ }, + \ { + \ 'status': 'finished', + \ 'exit_code': 0, + \ 'job_id': 347, + \ 'command': 'command with no output', + \ 'output': [], + \ }, + \] + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \ + [ + \ '', + \ '(finished - exit code 0) ''first command''', + \ '', + \ '<<>>', + \ 'some', + \ 'first command output', + \ '<<>>', + \ '', + \ '(finished - exit code 1) [''/bin/bash'', ''\c'', ''last command'']', + \ '', + \ '<<>>', + \ 'different second command output', + \ '<<>>', + \ '', + \ '(finished - exit code 0) ''command with no output''', + \ '', + \ '<<>>', + \ ] + \) + +Execute (ALEInfo should include executable checks in the history): + call ale#linter#Define('testft', g:testlinter1) + call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo') + call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo') + call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable') + call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable') + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'']', + \ ' Enabled Linters: [''testlinter1'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \ + [ + \ '', + \ '(executable check - success) ' . (has('win32') ? 'cmd' : 'echo'), + \ '(executable check - failure) TheresNoWayThisIsExecutable', + \ '(executable check - failure) TheresNoWayThisIsExecutable', + \ ] + \) + +Execute (The option for caching failing executable checks should work): + let g:ale_cache_executable_check_failures = 1 + let g:globals_lines[2] = 'let g:ale_cache_executable_check_failures = 1' + + call ale#linter#Define('testft', g:testlinter1) + + call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo') + call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo') + call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable') + call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable') + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'']', + \ ' Enabled Linters: [''testlinter1'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \ + [ + \ '', + \ '(executable check - success) ' . (has('win32') ? 'cmd' : 'echo'), + \ '(executable check - failure) TheresNoWayThisIsExecutable', + \ ] + \) + +Given testft (Empty buffer): +Execute (LSP errors for a linter should be outputted): + let g:ale_lsp_error_messages = {'testlinter1': ['foo', 'bar']} + call ale#linter#Define('testft', g:testlinter1) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft', + \ 'Available Linters: [''testlinter1'']', + \ ' Enabled Linters: [''testlinter1'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + [ + \ ' LSP Error Messages:', + \ '', + \ '(Errors for testlinter1)', + \ 'foo', + \ 'bar', + \ ] + \ + g:command_header + \) + +Given testft (Empty buffer): +Execute (LSP errors for other linters shouldn't appear): + let g:ale_lsp_error_messages = {'testlinter2': ['foo']} + call ale#linter#Define('testft', g:testlinter1) + + call CheckInfo( + \ [ + \ ' Current Filetype: testft', + \ 'Available Linters: [''testlinter1'']', + \ ' Enabled Linters: [''testlinter1'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo should include linter global options): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + " eg: like g:c_build_dir_names + let g:ale_testft_build_dir_names = ['build', 'bin'] + + call add(g:variables_lines, 'let g:ale_testft_build_dir_names = [''build'', ''bin'']') + + call CheckInfo( + \ [ + \ ' Current Filetype: testft.testft2', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'', ''testlinter2'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + +Given testft (Empty buffer with two filetypes): +Execute (ALEInfo should include linter global options for enabled linters): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + + let g:ale_linters = {'testft': ['testlinter1']} + + " should not appear, since not enabled + let g:ale_testft_testlinter2_option = 'test' + + let g:globals_lines[index(g:globals_lines, 'let g:ale_linters = {}')] + \ = 'let g:ale_linters = {''testft'': [''testlinter1'']}' + + call CheckInfo( + \ [ + \ ' Current Filetype: testft', + \ 'Available Linters: [''testlinter1'', ''testlinter2'']', + \ ' Enabled Linters: [''testlinter1'']', + \ ' Ignored Linters: []', + \ ] + \ + g:fixer_lines + \ + g:variables_lines + \ + g:globals_lines + \ + g:command_header + \) + + diff --git a/sources_non_forked/ale/test/test_ale_info_to_clipboard.vader b/sources_non_forked/ale/test/test_ale_info_to_clipboard.vader new file mode 100644 index 00000000..2014a310 --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_info_to_clipboard.vader @@ -0,0 +1,15 @@ +After: + unlet! g:output + +Execute(ALEInfoToClipboard should that clipboard support is required): + " When run in the Docker image, there's no clipboard support, so this test + " will actually run. + if !has('clipboard') + let g:output = '' + + redir => g:output + :ALEInfoToClipboard + redir END + + AssertEqual 'clipboard not available. Try :ALEInfoToFile instead.', join(split(g:output)) + endif diff --git a/sources_non_forked/ale/test/test_ale_lint_command.vader b/sources_non_forked/ale/test/test_ale_lint_command.vader new file mode 100644 index 00000000..800c0827 --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_lint_command.vader @@ -0,0 +1,77 @@ +Before: + Save g:ale_buffer_info + Save g:ale_enabled + + let g:ale_buffer_info = {} + let g:ale_enabled = 1 + + let g:expected_loclist = [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'foo bar', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}] + + function! ToggleTestCallback(buffer, output) + return [{ + \ 'bufnr': a:buffer, + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': join(split(a:output[0])), + \ 'type': 'E', + \ 'nr': -1, + \}] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'ToggleTestCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': 'echo foo bar', + \}) + +After: + Restore + + unlet! g:expected_loclist + unlet! b:i + + call ale#engine#Cleanup(bufnr('')) + call ale#linter#Reset() + + let g:ale_buffer_info = {} + + delfunction ToggleTestCallback + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(ALELint should run the linters): + AssertEqual 'foobar', &filetype + + " Try to run the linter a few times, as it fails randomly in NeoVim. + for b:i in range(5) + ALELint + call ale#test#WaitForJobs(2000) + + if !has('nvim') + " Sleep so the delayed list function can run. + " This breaks the tests in NeoVim for some reason. + sleep 1ms + endif + + if ale#test#GetLoclistWithoutNewerKeys() == g:expected_loclist + break + endif + endfor + + " Check the loclist + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() diff --git a/sources_non_forked/ale/test/test_ale_lint_stop_command.vader b/sources_non_forked/ale/test/test_ale_lint_stop_command.vader new file mode 100644 index 00000000..c50db5a8 --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_lint_stop_command.vader @@ -0,0 +1,27 @@ +Before: + Save g:ale_buffer_info + + let g:ale_buffer_info = {} + + call ale#linter#PreventLoading('testft') + call ale#linter#Define('testft', { + \ 'name': 'testlinter', + \ 'callback': {-> []}, + \ 'executable': has('win32') ? 'cmd' : 'true', + \ 'command': 'sleep 9001', + \}) + +After: + Restore + + call ale#linter#Reset() + +Given testft (An empty file): +Execute(ALELintStop should stop ALE from linting): + ALELint + + Assert ale#engine#IsCheckingBuffer(bufnr('')), 'ALE did not start checking the buffer' + + ALELintStop + + Assert !ale#engine#IsCheckingBuffer(bufnr('')), 'ALELintStop didn''t work' diff --git a/sources_non_forked/ale/test/test_ale_populate_command.vader b/sources_non_forked/ale/test/test_ale_populate_command.vader new file mode 100644 index 00000000..14789c72 --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_populate_command.vader @@ -0,0 +1,96 @@ +Before: + Save g:ale_buffer_info + Save g:ale_enabled + Save g:ale_set_quickfix + Save g:ale_set_loclist + Save g:ale_open_list + + let g:ale_buffer_info = {} + let g:ale_enabled = 1 + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 0 + let g:ale_open_list = 1 + + let g:expected_loclist = [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'foo bar', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}] + + function! ToggleTestCallback(buffer, output) + return [{ + \ 'bufnr': a:buffer, + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': join(split(a:output[0])), + \ 'type': 'E', + \ 'nr': -1, + \}] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'ToggleTestCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': 'echo foo bar', + \}) + +After: + Restore + + unlet! g:expected_loclist + unlet! b:i + + call ale#engine#Cleanup(bufnr('')) + call ale#linter#Reset() + + " Not sure this is necessary since it was Save/Restore-d + let g:ale_buffer_info = {} + + delfunction ToggleTestCallback + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(ALEPopulateQuickfix should have results): + AssertEqual 'foobar', &filetype + + " Clear so we can check that they're unmodified. + call setqflist([]) + call setloclist(winnr(), []) + + " Try to run the linter a few times, as it fails randomly in NeoVim. + for b:i in range(5) + ALELint + call ale#test#WaitForJobs(2000) + + if !has('nvim') + " Sleep so the delayed list function can run. + " This breaks the tests in NeoVim for some reason. + sleep 1ms + endif + + if ale#test#GetLoclistWithoutNewerKeys() == g:expected_loclist + break + endif + endfor + + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + AssertEqual [], ale#test#GetQflistWithoutNewerKeys() + + ALEPopulateLocList + AssertNotEqual 0, get(getloclist(0, {'winid':0}), 'winid', 0) + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + + ALEPopulateQuickfix + AssertEqual g:expected_loclist, ale#test#GetQflistWithoutNewerKeys() diff --git a/sources_non_forked/ale/test/test_ale_toggle.vader b/sources_non_forked/ale/test/test_ale_toggle.vader new file mode 100644 index 00000000..98df3f75 --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_toggle.vader @@ -0,0 +1,444 @@ +Before: + Save g:ale_buffer_info + Save g:ale_set_signs + Save g:ale_set_lists_synchronously + Save g:ale_run_synchronously + Save g:ale_pattern_options + Save g:ale_pattern_options_enabled + Save g:ale_set_balloons + + let g:ale_set_signs = 1 + let g:ale_set_lists_synchronously = 1 + let g:ale_run_synchronously = 1 + unlet! g:ale_run_synchronously_callbacks + let g:ale_pattern_options = {} + let g:ale_pattern_options_enabled = 1 + let g:ale_set_balloons = + \ has('balloon_eval') && has('gui_running') || + \ has('balloon_eval_term') && !has('gui_running') + + unlet! b:ale_enabled + + let g:ale_buffer_info = {} + let g:expected_loclist = [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'foo bar', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}] + let g:expected_groups = [ + \ 'ALECleanupGroup', + \ 'ALEEvents', + \ 'ALEHighlightBufferGroup', + \] + let g:has_nvim_highlight = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace') + + function! ToggleTestCallback(buffer, output) + return [{ + \ 'bufnr': a:buffer, + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'foo bar', + \ 'type': 'E', + \ 'nr': -1, + \}] + endfunction + + function! ParseAuGroups() + redir => l:output + silent exec 'autocmd' + redir end + + let l:results = [] + + for l:line in split(l:output, "\n") + let l:match = matchlist(l:line, '^ALE[a-zA-Z]\+') + + " We don't care about some groups here. + if !empty(l:match) + \&& l:match[0] !=# 'ALECompletionGroup' + \&& l:match[0] !=# 'ALEBufferFixGroup' + \&& l:match[0] !=# 'ALEPatternOptionsGroup' + call add(l:results, l:match[0]) + endif + endfor + + call uniq(sort(l:results)) + + return l:results + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'ToggleTestCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': 'echo', + \ 'read_buffer': 0, + \}) + + call ale#sign#Clear() + +After: + Restore + + unlet! g:ale_run_synchronously_callbacks + unlet! g:expected_loclist + unlet! g:expected_groups + unlet! b:ale_enabled + unlet! g:output + unlet! g:has_nvim_highlight + + call ale#linter#Reset() + + " Toggle ALE back on if we fail when it's disabled. + if !g:ale_enabled + ALEToggle + endif + + delfunction ToggleTestCallback + delfunction ParseAuGroups + + call setloclist(0, []) + call ale#sign#Clear() + call clearmatches() + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(ALEToggle should reset everything and then run again): + AssertEqual 'foobar', &filetype + + ALELint + call ale#test#FlushJobs() + + " First check that everything is there... + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%')) + + " Only check the legacy matches if not using the new NeoVIM API. + if !g:has_nvim_highlight + AssertEqual + \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}], + \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}') + endif + + AssertEqual g:expected_groups, ParseAuGroups() + AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist + + " Now Toggle ALE off. + ALEToggle + + " Everything should be cleared. + Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed' + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys(), 'The loclist was not cleared' + AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared' + + if !g:has_nvim_highlight + AssertEqual [], getmatches(), 'The highlights were not cleared' + endif + + AssertEqual g:expected_groups, ParseAuGroups() + + " Toggle ALE on, everything should be set up and run again. + ALEToggle + call ale#test#FlushJobs() + + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%')) + + if !g:has_nvim_highlight + AssertEqual + \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}], + \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}') + endif + + AssertEqual g:expected_groups, ParseAuGroups() + AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist + +Execute(ALEToggle should skip filename keys and preserve them): + AssertEqual 'foobar', &filetype + + let g:ale_buffer_info['/foo/bar/baz.txt'] = { + \ 'job_list': [], + \ 'active_linter_list': [], + \ 'loclist': [], + \ 'temporary_file_list': [], + \ 'temporary_directory_list': [], + \ 'history': [], + \} + + ALELint + call ale#test#FlushJobs() + + " Now Toggle ALE off. + ALEToggle + + AssertEqual + \ { + \ 'job_list': [], + \ 'active_linter_list': [], + \ 'loclist': [], + \ 'temporary_file_list': [], + \ 'temporary_directory_list': [], + \ 'history': [], + \ }, + \ get(g:ale_buffer_info, '/foo/bar/baz.txt', {}) + + " Toggle ALE on again. + ALEToggle + call ale#test#FlushJobs() + + AssertEqual + \ { + \ 'job_list': [], + \ 'active_linter_list': [], + \ 'loclist': [], + \ 'temporary_file_list': [], + \ 'temporary_directory_list': [], + \ 'history': [], + \ }, + \ get(g:ale_buffer_info, '/foo/bar/baz.txt', {}) + +Execute(ALEDisable should reset everything and stay disabled): + ALELint + call ale#test#FlushJobs() + + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + + ALEDisable + call ale#test#FlushJobs() + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + AssertEqual 0, g:ale_enabled + + ALEDisable + call ale#test#FlushJobs() + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + AssertEqual 0, g:ale_enabled + +Execute(ALEEnable should enable ALE and lint again): + let g:ale_enabled = 0 + + ALEEnable + call ale#test#FlushJobs() + + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual 1, g:ale_enabled + +Execute(ALEReset should reset everything for a buffer): + AssertEqual 'foobar', &filetype + + ALELint + call ale#test#FlushJobs() + + " First check that everything is there... + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%')) + + if !g:has_nvim_highlight + AssertEqual + \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}], + \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}') + endif + + AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist + + " Now Toggle ALE off. + ALEReset + call ale#test#FlushJobs() + + " Everything should be cleared. + Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed' + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys(), 'The loclist was not cleared' + AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared' + + if !g:has_nvim_highlight + AssertEqual [], getmatches(), 'The highlights were not cleared' + endif + + AssertEqual 1, g:ale_enabled + +Execute(ALEToggleBuffer should reset everything and then run again): + AssertEqual 'foobar', &filetype + + ALELint + call ale#test#FlushJobs() + + " First check that everything is there... + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%')) + + if !g:has_nvim_highlight + AssertEqual + \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}], + \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}') + endif + + AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist + + " Now Toggle ALE off. + ALEToggleBuffer + + " Everything should be cleared. + Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed' + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys(), 'The loclist was not cleared' + AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared' + + if !g:has_nvim_highlight + AssertEqual [], getmatches(), 'The highlights were not cleared' + endif + + " Toggle ALE on, everything should be set up and run again. + ALEToggleBuffer + call ale#test#FlushJobs() + + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%')) + + if !g:has_nvim_highlight + AssertEqual + \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}], + \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}') + endif + + AssertEqual g:expected_groups, ParseAuGroups() + AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist + +Execute(ALEDisableBuffer should reset everything and stay disabled): + ALELint + call ale#test#FlushJobs() + + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + + ALEDisableBuffer + call ale#test#FlushJobs() + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + AssertEqual 0, b:ale_enabled + +Execute(ALEEnableBuffer should enable ALE and lint again): + let b:ale_enabled = 0 + + ALEEnableBuffer + call ale#test#FlushJobs() + + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual 1, b:ale_enabled + +Execute(ALEEnableBuffer should complain when ALE is disabled globally): + let g:ale_enabled = 0 + let b:ale_enabled = 0 + + redir => g:output + ALEEnableBuffer + redir END + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + AssertEqual 0, b:ale_enabled + AssertEqual 0, g:ale_enabled + AssertEqual + \ 'ALE cannot be enabled locally when disabled globally', + \ join(split(g:output)) + +Execute(ALEResetBuffer should reset everything for a buffer): + AssertEqual 'foobar', &filetype + + ALELint + call ale#test#FlushJobs() + + " First check that everything is there... + AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutNewerKeys() + AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%')) + + if !g:has_nvim_highlight + AssertEqual + \ [{'group': 'ALEError', 'pos1': [2, 3, 1]}], + \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}') + endif + + AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist + + " Now Toggle ALE off. + ALEResetBuffer + call ale#test#FlushJobs() + + " Everything should be cleared. + Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed' + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys(), 'The loclist was not cleared' + AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared' + + if !g:has_nvim_highlight + AssertEqual [], getmatches(), 'The highlights were not cleared' + endif + + AssertEqual 1, g:ale_enabled + AssertEqual 1, get(b:, 'ale_enabled', 1) + +Execute(Disabling ALE should disable balloons): + " These tests won't run in the console, but we can run them manually in GVim. + if has('balloon_eval') && has('gui_running') + \|| (has('balloon_eval_term') && !has('gui_running')) + call ale#linter#Reset() + + " Enable balloons, so we can check the expr value. + call ale#balloon#Enable() + + if has('balloon_eval') && has('gui_running') + AssertEqual 1, &ballooneval + else + AssertEqual 1, &balloonevalterm + endif + + AssertEqual 'ale#balloon#Expr()', &balloonexpr + + " Toggle ALE off. + ALEToggle + + " The balloon settings should be reset. + if has('balloon_eval') && has('gui_running') + AssertEqual 0, &ballooneval + else + AssertEqual 0, &balloonevalterm + endif + + AssertEqual '', &balloonexpr + endif + +Execute(Enabling ALE should enable balloons if the setting is on): + if has('balloon_eval') && has('gui_running') + \|| (has('balloon_eval_term') && !has('gui_running')) + call ale#linter#Reset() + call ale#balloon#Disable() + ALEDisable + let g:ale_set_balloons = 0 + ALEEnable + + if has('balloon_eval') && has('gui_running') + AssertEqual 0, &ballooneval + else + AssertEqual 0, &balloonevalterm + endif + + AssertEqual '', &balloonexpr + + ALEDisable + let g:ale_set_balloons = 1 + ALEEnable + + if has('balloon_eval') && has('gui_running') + AssertEqual 1, &ballooneval + else + AssertEqual 1, &balloonevalterm + endif + + AssertEqual 'ale#balloon#Expr()', &balloonexpr + endif diff --git a/sources_non_forked/ale/test/test_ale_var.vader b/sources_non_forked/ale/test/test_ale_var.vader new file mode 100644 index 00000000..419a9983 --- /dev/null +++ b/sources_non_forked/ale/test/test_ale_var.vader @@ -0,0 +1,24 @@ +Before: + let g:ale_some_variable = 'abc' + +After: + unlet! g:ale_some_variable + unlet! b:undefined_variable_name + +Execute(ale#Var should return global variables): + AssertEqual 'abc', ale#Var(bufnr(''), 'some_variable') + +Execute(ale#Var should return buffer overrides): + let b:ale_some_variable = 'def' + + AssertEqual 'def', ale#Var(bufnr(''), 'some_variable') + +Execute(ale#Var should return buffer overrides for buffer numbers as strings): + let b:ale_some_variable = 'def' + + AssertEqual 'def', ale#Var(string(bufnr('')), 'some_variable') + +Execute(ale#Var should throw exceptions for undefined variables): + let b:undefined_variable_name = 'def' + + AssertThrows call ale#Var(bufnr(''), 'undefined_variable_name') diff --git a/sources_non_forked/ale/test/test_alejobstarted_autocmd.vader b/sources_non_forked/ale/test/test_alejobstarted_autocmd.vader new file mode 100644 index 00000000..6fa1ff8e --- /dev/null +++ b/sources_non_forked/ale/test/test_alejobstarted_autocmd.vader @@ -0,0 +1,46 @@ +Before: + Save g:ale_buffer_info + + let g:job_started_success = 0 + let g:ale_run_synchronously = 1 + + unlet! b:ale_linted + + function! TestCallback(buffer, output) + return [] + endfunction + + call ale#linter#PreventLoading('testft') + call ale#linter#Define('testft', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'true', + \ 'command': 'true', + \}) + +After: + Restore + + let g:ale_run_synchronously = 0 + + augroup VaderTest + autocmd! + augroup END + + augroup! VaderTest + + unlet! g:job_started_success + + delfunction TestCallback + call ale#linter#Reset() + +Given testft (An empty file): +Execute(Run a lint cycle with an actual job to check for ALEJobStarted): + augroup VaderTest + autocmd! + autocmd User ALEJobStarted let g:job_started_success = 1 + augroup END + + ALELint + + AssertEqual g:job_started_success, 1 diff --git a/sources_non_forked/ale/test/test_alelint_autocmd.vader b/sources_non_forked/ale/test/test_alelint_autocmd.vader new file mode 100644 index 00000000..332cb36f --- /dev/null +++ b/sources_non_forked/ale/test/test_alelint_autocmd.vader @@ -0,0 +1,40 @@ +Before: + let g:pre_success = 0 + let g:post_success = 0 + let g:ale_run_synchronously = 1 + + unlet! b:ale_linted + +After: + let g:ale_run_synchronously = 0 + let g:ale_buffer_info = {} + + augroup VaderTest + autocmd! + augroup END + + augroup! VaderTest + +Given testft(An empty file): +Execute(Run a lint cycle, and check that a variable is set in the autocmd): + augroup VaderTest + autocmd! + autocmd User ALELintPre let g:pre_success = 1 + autocmd User ALELintPost let g:post_success = 1 + augroup END + + call ale#Queue(0) + + AssertEqual g:pre_success, 1 + AssertEqual g:post_success, 1 + +Execute(b:ale_linted should be increased after each lint cycle): + AssertEqual get(b:, 'ale_linted'), 0 + + call ale#Queue(0) + + AssertEqual get(b:, 'ale_linted'), 1 + + call ale#Queue(0) + + AssertEqual get(b:, 'ale_linted'), 2 diff --git a/sources_non_forked/ale/test/test_ant_build_classpath_command.vader b/sources_non_forked/ale/test/test_ant_build_classpath_command.vader new file mode 100644 index 00000000..b97dc594 --- /dev/null +++ b/sources_non_forked/ale/test/test_ant_build_classpath_command.vader @@ -0,0 +1,27 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/java/javac.vim + + Save $PATH + let $PATH = ale#path#Simplify(g:dir . '/test-files/ant/bin') + +After: + Restore + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return `cd '[dir]' && 'ant' classpath -S -q`): + call ale#test#SetFilename('test-files/ant/ant-project/Main.java') + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'), + \ ale#Escape('ant') . ' classpath' . ' -S' . ' -q', + \ ], + \ ale#ant#BuildClasspathCommand(bufnr('')) + +Execute(Should return empty string if ant cannot be executed): + call ale#test#SetFilename('test-files/ant/not-an-ant-project/Main.java') + + AssertEqual ['', ''], ale#ant#BuildClasspathCommand(bufnr('')) diff --git a/sources_non_forked/ale/test/test_ant_find_project_root.vader b/sources_non_forked/ale/test/test_ant_find_project_root.vader new file mode 100644 index 00000000..b0868ad7 --- /dev/null +++ b/sources_non_forked/ale/test/test_ant_find_project_root.vader @@ -0,0 +1,35 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/java/javac.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return current directory if called on the project root): + call ale#test#SetFilename('test-files/ant/ant-project/Main.java') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'), + \ ale#ant#FindProjectRoot(bufnr('')) + +Execute(Should return root directory if called on a deeply nested source file): + call ale#test#SetFilename('test-files/ant/ant-project/src/several/namespace/layers/A.java') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'), + \ ale#ant#FindProjectRoot(bufnr('')) + +Execute(Should return empty string if called on a non-ant project): + call ale#test#SetFilename('test-files/ant/non-ant-project/Main.java') + + AssertEqual + \ '', + \ ale#ant#FindProjectRoot(bufnr('')) + +Execute(Should return empty string if called on a file in a non-ant project): + call ale#test#SetFilename('test-files/ant/non-ant-project/several/namespace/layers/A.java') + + AssertEqual + \ '', + \ ale#ant#FindProjectRoot(bufnr('')) diff --git a/sources_non_forked/ale/test/test_autocmd_commands.vader b/sources_non_forked/ale/test/test_autocmd_commands.vader new file mode 100644 index 00000000..2f0a893f --- /dev/null +++ b/sources_non_forked/ale/test/test_autocmd_commands.vader @@ -0,0 +1,238 @@ +Before: + function! CheckAutocmd(group) + call ale#events#Init() + + redir => l:output + execute 'silent! autocmd ' . a:group + redir END + + let l:matches = [] + let l:header = '' + " Some event names have aliases, and NeoVim and Vim produce + " different output. The names are remapped to fix this. + let l:event_name_corrections = { + \ 'BufWrite': 'BufWritePre', + \ 'BufRead': 'BufReadPost', + \} + + " autocmd commands are split across two lines in output, so we + " must merge the lines back into one simple line. + for l:line in split(l:output, "\n") + if l:line =~# '^ALE' && split(l:line)[0] ==# a:group + let l:header = split(l:line)[1] + let l:header = get(l:event_name_corrections, l:header, l:header) + elseif !empty(l:header) + " There's an extra line for buffer events, and we should only look + " for the one matching the current buffer. + if l:line =~# '' + let l:header .= ' ' + elseif l:line[:0] is# ' ' + call add(l:matches, join(split(l:header . l:line))) + else + let l:header = '' + endif + endif + endfor + + call sort(l:matches) + + return l:matches + endfunction + + Save g:ale_completion_enabled + Save g:ale_echo_cursor + Save g:ale_enabled + Save g:ale_fix_on_save + Save g:ale_lint_on_enter + Save g:ale_lint_on_filetype_changed + Save g:ale_lint_on_insert_leave + Save g:ale_lint_on_save + Save g:ale_lint_on_text_changed + Save g:ale_pattern_options_enabled + Save g:ale_hover_cursor + + " Turn everything on by defaul for these tests. + let g:ale_completion_enabled = 1 + let g:ale_echo_cursor = 1 + let g:ale_enabled = 1 + let g:ale_fix_on_save = 1 + let g:ale_lint_on_enter = 1 + let g:ale_lint_on_filetype_changed = 1 + let g:ale_lint_on_insert_leave = 1 + let g:ale_lint_on_save = 1 + let g:ale_lint_on_text_changed = 1 + let g:ale_pattern_options_enabled = 1 + let g:ale_hover_cursor = 1 + +After: + delfunction CheckAutocmd + Restore + + if g:ale_completion_enabled + call ale#completion#Enable() + else + call ale#completion#Disable() + endif + + call ale#events#Init() + +Execute (All events should be set up when everything is on): + let g:ale_echo_cursor = 1 + + AssertEqual + \ [ + \ 'BufEnter * call ale#events#ReadOrEnterEvent(str2nr(expand('''')))', + \ 'BufReadPost * call ale#events#ReadOrEnterEvent(str2nr(expand('''')))', + \ 'BufWinEnter * call ale#events#LintOnEnter(str2nr(expand('''')))', + \ 'BufWritePost * call ale#events#SaveEvent(str2nr(expand('''')))', + \ 'CursorHold * if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarningWithDelay() | endif', + \ 'CursorHold if exists(''*ale#lsp#Send'') | call ale#hover#ShowTruncatedMessageAtCursor() | endif', + \ 'CursorMoved * if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarningWithDelay() | endif', + \ 'FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand('''')))', + \ 'FileType * call ale#events#FileTypeEvent( str2nr(expand('''')), expand(''''))', + \ 'InsertLeave * if ale#Var(str2nr(expand('''')), ''lint_on_insert_leave'') | call ale#Queue(0) | endif', + \ 'InsertLeave if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarning() | endif', + \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ ], + \ CheckAutocmd('ALEEvents') + +Execute (Only the required events should be bound even if various settings are off): + let g:ale_enabled = 1 + let g:ale_completion_enabled = 0 + let g:ale_echo_cursor = 0 + let g:ale_fix_on_save = 0 + let g:ale_lint_on_enter = 0 + let g:ale_lint_on_filetype_changed = 0 + let g:ale_lint_on_insert_leave = 0 + let g:ale_lint_on_save = 0 + let g:ale_lint_on_text_changed = 0 + let g:ale_pattern_options_enabled = 0 + let g:ale_hover_cursor = 0 + + AssertEqual + \ [ + \ 'BufEnter * call ale#events#ReadOrEnterEvent(str2nr(expand('''')))', + \ 'BufReadPost * call ale#events#ReadOrEnterEvent(str2nr(expand('''')))', + \ 'BufWritePost * call ale#events#SaveEvent(str2nr(expand('''')))', + \ ], + \ CheckAutocmd('ALEEvents') + +Execute (The cursor hoever event should be enabled with g:ale_hover_cursor = 1): + let g:ale_enabled = 1 + let g:ale_completion_enabled = 0 + let g:ale_echo_cursor = 0 + let g:ale_fix_on_save = 0 + let g:ale_lint_on_enter = 0 + let g:ale_lint_on_filetype_changed = 0 + let g:ale_lint_on_insert_leave = 0 + let g:ale_lint_on_save = 0 + let g:ale_lint_on_text_changed = 0 + let g:ale_pattern_options_enabled = 0 + let g:ale_hover_cursor = 1 + + AssertEqual + \ [ + \ 'BufEnter * call ale#events#ReadOrEnterEvent(str2nr(expand('''')))', + \ 'BufReadPost * call ale#events#ReadOrEnterEvent(str2nr(expand('''')))', + \ 'BufWritePost * call ale#events#SaveEvent(str2nr(expand('''')))', + \ 'CursorHold * if exists(''*ale#lsp#Send'') | call ale#hover#ShowTruncatedMessageAtCursor() | endif', + \ ], + \ CheckAutocmd('ALEEvents') + +Execute (g:ale_lint_on_text_changed = 1 bind both events): + let g:ale_lint_on_text_changed = 1 + + AssertEqual + \ [ + \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ ], + \ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''') + +Execute (g:ale_lint_on_text_changed = 'always' should bind both events): + let g:ale_lint_on_text_changed = 'always' + + AssertEqual + \ [ + \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ ], + \ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''') + +Execute (g:ale_lint_on_text_changed = 'normal' should bind only TextChanged): + let g:ale_lint_on_text_changed = 'normal' + + AssertEqual + \ [ + \ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ ], + \ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''') + +Execute (g:ale_lint_on_text_changed = 'insert' should bind only TextChangedI): + let g:ale_lint_on_text_changed = 'insert' + + AssertEqual + \ [ + \ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand('''')), ''lint_delay''))', + \ ], + \ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''') + +Execute (g:ale_lint_on_insert_leave = 1 should bind InsertLeave): + let g:ale_lint_on_insert_leave = 1 + let g:ale_echo_cursor = 0 + + AssertEqual + \ [ + \ 'InsertLeave * if ale#Var(str2nr(expand('''')), ''lint_on_insert_leave'') | call ale#Queue(0) | endif', + \ ], + \ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^InsertLeave''') + +Execute (g:ale_lint_on_filetype_changed = 1 should bind the FileType event): + let g:ale_lint_on_filetype_changed = 1 + + AssertEqual + \ [ + \ 'FileType * call ale#events#FileTypeEvent( ' + \ . 'str2nr(expand('''')), ' + \ . 'expand('''')' + \ . ')', + \ ], + \ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''\v^FileType''') + +Execute (ALECleanupGroup should include the right commands): + if exists('##VimSuspend') + AssertEqual [ + \ 'BufDelete * if exists(''*ale#engine#Cleanup'') | call ale#engine#Cleanup(str2nr(expand(''''))) | endif', + \ 'QuitPre * call ale#events#QuitEvent(str2nr(expand('''')))', + \ 'VimSuspend * if exists(''*ale#engine#CleanupEveryBuffer'') | call ale#engine#CleanupEveryBuffer() | endif', + \], CheckAutocmd('ALECleanupGroup') + else + AssertEqual [ + \ 'BufDelete * if exists(''*ale#engine#Cleanup'') | call ale#engine#Cleanup(str2nr(expand(''''))) | endif', + \ 'QuitPre * call ale#events#QuitEvent(str2nr(expand('''')))', + \], CheckAutocmd('ALECleanupGroup') + endif + +Execute(ALECompletionActions should always be set up): + AssertEqual [ + \ 'CompleteDone * call ale#completion#HandleUserData(v:completed_item)', + \], CheckAutocmd('ALECompletionActions') + +Execute(Enabling completion should set up autocmd events correctly): + let g:ale_completion_enabled = 0 + call ale#completion#Enable() + + AssertEqual [ + \ 'CompleteDone * call ale#completion#Done()', + \ 'TextChangedI * call ale#completion#Queue()', + \], CheckAutocmd('ALECompletionGroup') + AssertEqual 1, g:ale_completion_enabled + +Execute(Disabling completion should remove autocmd events correctly): + let g:ale_completion_enabled = 1 + call ale#completion#Enable() + call ale#completion#Disable() + + AssertEqual [], CheckAutocmd('ALECompletionGroup') + AssertEqual 0, g:ale_completion_enabled diff --git a/sources_non_forked/ale/test/test_backwards_compatibility.vader b/sources_non_forked/ale/test/test_backwards_compatibility.vader new file mode 100644 index 00000000..e4e3756f --- /dev/null +++ b/sources_non_forked/ale/test/test_backwards_compatibility.vader @@ -0,0 +1,19 @@ +" These tests, and the code that it covers, may be removed upon a major release. + +After: + unlet! g:ale_linters_sh_shellcheck_exclusions + unlet! g:ale_sh_shellcheck_exclusions + unlet! g:ale_linters_sh_shell_default_shell + unlet! g:ale_sh_shell_default_shell + +Execute(Old variable name for the 'shellcheck' linter should still work): + let g:ale_linters_sh_shellcheck_exclusions = 'SC1234' + runtime ale_linters/sh/shellcheck.vim + + AssertEqual 'SC1234', g:ale_sh_shellcheck_exclusions + +Execute (Old variable name for the 'shell' linter should still work): + let g:ale_linters_sh_shell_default_shell = 'woosh' + runtime ale_linters/sh/shell.vim + + AssertEqual 'woosh', g:ale_sh_shell_default_shell diff --git a/sources_non_forked/ale/test/test_balloon_messages.vader b/sources_non_forked/ale/test/test_balloon_messages.vader new file mode 100644 index 00000000..d0724c21 --- /dev/null +++ b/sources_non_forked/ale/test/test_balloon_messages.vader @@ -0,0 +1,87 @@ +Before: + Save g:ale_buffer_info + Save g:ale_enabled + Save g:ale_set_balloons + + let g:ale_set_balloons = 1 + + let g:ale_buffer_info[bufnr('')] = {'loclist': [ + \ { + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'col': 10, + \ 'linter_name': 'eslint', + \ 'type': 'W', + \ 'text': 'Ignore me.', + \ }, + \ { + \ 'bufnr': bufnr(''), + \ 'lnum': 1, + \ 'col': 10, + \ 'text': 'Missing semicolon. (semi)', + \ 'type': 'E', + \ }, + \ { + \ 'bufnr': bufnr(''), + \ 'lnum': 2, + \ 'col': 10, + \ 'text': 'Infix operators must be spaced. (space-infix-ops)' + \ }, + \ { + \ 'bufnr': bufnr(''), + \ 'lnum': 2, + \ 'col': 15, + \ 'text': 'Missing radix parameter (radix)' + \ }, + \]} + +After: + Restore + + unlet! b:ale_enabled + unlet! b:ale_set_balloons + +Execute(Balloon messages should be shown for the correct lines): + AssertEqual + \ 'Missing semicolon. (semi)', + \ ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(Balloon messages should be shown for earlier columns): + AssertEqual + \ 'Infix operators must be spaced. (space-infix-ops)', + \ ale#balloon#MessageForPos(bufnr(''), 2, 1) + +Execute(Balloon messages should be shown for later columns): + AssertEqual + \ 'Missing radix parameter (radix)', + \ ale#balloon#MessageForPos(bufnr(''), 2, 16) + +Execute(Balloon messages should be disabled if ALE is disabled globally): + let g:ale_enabled = 0 + " Enabling the buffer should not make a difference. + let b:ale_enabled = 1 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(Balloon messages should be disabled if ALE is disabled for a buffer): + let b:ale_enabled = 0 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(Balloon messages should be disabled if the global setting is off): + let g:ale_set_balloons = 0 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(Balloon messages should be disabled if the buffer setting is off): + let b:ale_set_balloons = 0 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(The balloon buffer setting should override the global one): + let g:ale_set_balloons = 0 + let b:ale_set_balloons = 1 + + AssertEqual + \ 'Missing semicolon. (semi)', + \ ale#balloon#MessageForPos(bufnr(''), 1, 1) diff --git a/sources_non_forked/ale/test/test_c_flag_parsing.vader b/sources_non_forked/ale/test/test_c_flag_parsing.vader new file mode 100644 index 00000000..c661651e --- /dev/null +++ b/sources_non_forked/ale/test/test_c_flag_parsing.vader @@ -0,0 +1,689 @@ +Before: + Save g:ale_c_parse_makefile + Save g:ale_c_always_make + Save b:ale_c_always_make + + call ale#test#SetDirectory('/testplugin/test') + + let g:ale_c_parse_makefile = 1 + let g:ale_c_always_make = 1 + let b:ale_c_always_make = 1 + + function SplitAndParse(path_prefix, command) abort + let l:args = ale#c#ShellSplit(a:command) + + return ale#c#ParseCFlags(a:path_prefix, 0, l:args) + endfunction + +After: + delfunction SplitAndParse + + Restore + + call ale#test#RestoreDirectory() + +Execute(The make command should be correct): + call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c') + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'make -n --always-make', + \ ], + \ ale#c#GetMakeCommand(bufnr('')) + + " You should be able to disable --always-make for a buffer. + let b:ale_c_always_make = 0 + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'make -n', + \ ], + \ ale#c#GetMakeCommand(bufnr('')) + +Execute(Should recognize GNUmakefile as a makefile): + call ale#test#SetFilename('test-files/c/gnumakefile_project/file.c') + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir. '/test-files/c/gnumakefile_project'), + \ 'make -n --always-make', + \ ], + \ ale#c#GetMakeCommand(bufnr('')) + +Execute(The CFlags parser should be able to parse include directives): + call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c') + + AssertEqual + \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')), + \ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c']) + + AssertEqual + \ '-isystem ' . ale#Escape('/usr/include/dir'), + \ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -isystem /usr/include/dir -c file.c']) + +Execute(ParseCFlags should ignore -c and -o): + call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c') + + AssertEqual + \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')), + \ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c -o a.out']) + +Execute(The CFlags parser should be able to parse macro directives): + call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c') + + AssertEqual + \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' -DTEST=1', + \ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=1 -c file.c']) + +Execute(The CFlags parser should be able to parse macro directives with spaces): + call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c') + + AssertEqual + \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' -DTEST=$(( 2 * 4 ))', + \ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=$(( 2 * 4 )) -c file.c']) + +Execute(The CFlags parser should be able to parse shell directives with spaces): + call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c') + + AssertEqual + \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' -DTEST=`date +%s`', + \ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=`date +%s` -c file.c']) + +Execute(ParseCFlags should be able to parse flags with relative paths): + AssertEqual + \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include')) + \ . ' -DTEST=`date +%s`', + \ SplitAndParse( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'gcc -Isubdir ' + \ . '-I'. ale#path#Simplify('kernel/include') + \ . ' -DTEST=`date +%s` -c file.c' + \ ) + +Execute(We should handle paths with spaces in double quotes): + AssertEqual + \ '-Dgoal=9' + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include')) + \ . ' -DTEST=`date +%s`', + \ SplitAndParse( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' + \ . '-I"dir with spaces"' . ' -I'. ale#path#Simplify('kernel/include') + \ . ' -DTEST=`date +%s` -c file.c' + \ ) + +Execute(ParseCFlags should handle paths with spaces in single quotes): + AssertEqual + \ '-Dgoal=9' + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include')) + \ . ' -DTEST=`date +%s`', + \ SplitAndParse( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' + \ . '-I''dir with spaces''' . ' -I'. ale#path#Simplify('kernel/include') + \ . ' -DTEST=`date +%s` -c file.c' + \ ) + +Execute(ParseCFlags should handle paths with minuses): + AssertEqual + \ '-Dgoal=9' + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir-with-dash')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include')) + \ . ' -DTEST=`date +%s`', + \ SplitAndParse( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' + \ . '-I''dir with spaces''' . ' -Idir-with-dash' + \ . ' -I'. ale#path#Simplify('kernel/include') + \ . ' -DTEST=`date +%s` -c file.c' + \ ) + +Execute(We should handle -D with minuses): + AssertEqual + \ '-Dgoal=9' + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' -Dmacro-with-dash' + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir-with-dash')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include')) + \ . ' -DTEST=`date +%s`', + \ SplitAndParse( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' + \ . '-Dmacro-with-dash ' + \ . '-I''dir with spaces''' . ' -Idir-with-dash' + \ . ' -I'. ale#path#Simplify('kernel/include') + \ . ' -DTEST=`date +%s` -c file.c' + \ ) + +Execute(We should handle flags at the end of the line): + AssertEqual + \ '-Dgoal=9' + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')) + \ . ' -Dmacro-with-dash' + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir-with-dash')) + \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include')), + \ SplitAndParse( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' + \ . '-Dmacro-with-dash ' + \ . '-I''dir with spaces''' . ' -Idir-with-dash' + \ . ' -I'. ale#path#Simplify('kernel/include') + \ ) + +Execute(FlagsFromCompileCommands should tolerate empty values): + AssertEqual '', ale#c#FlagsFromCompileCommands(bufnr(''), '') + +Execute(ParseCompileCommandsFlags should tolerate empty values): + AssertEqual '', ale#c#ParseCompileCommandsFlags(bufnr(''), {}, {}) + +Execute(ParseCompileCommandsFlags should parse some basic flags): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c')) + + " We should read the absolute path filename entry, not the other ones. + AssertEqual + \ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')), + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'): [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ }, + \ ], + \ "xmms2-mpris.c": [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ }, + \ ], + \ }, + \ { + \ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': 'other.c', + \ }, + \ ], + \ "src": [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'), + \ }, + \ ], + \ }, + \ ) + +Execute(ParseCompileCommandsFlags should fall back to files with the same name): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c')) + + " We should prefer the basename file flags, not the base dirname flags. + AssertEqual + \ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')), + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ "xmms2-mpris.c": [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ }, + \ ], + \ }, + \ { + \ "src": [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'), + \ }, + \ ], + \ }, + \ ) + +Execute(ParseCompileCommandsFlags should parse flags for exact directory matches): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c')) + + " We should ues the exact directory flags, not the file basename flags. + AssertEqual + \ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')), + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ "xmms2-mpris.c": [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ }, + \ ], + \ }, + \ { + \ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': 'other.c', + \ }, + \ ], + \ "src": [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'), + \ }, + \ ], + \ }, + \ ) + +Execute(ParseCompileCommandsFlags should fall back to files in the same directory): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c')) + + AssertEqual + \ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')), + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ {}, + \ { + \ "src": [ + \ { + \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), + \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2') + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'), + \ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'), + \ }, + \ ], + \ }, + \ ) + +Execute(ParseCompileCommandsFlags should tolerate items without commands): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c')) + + AssertEqual + \ '', + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ "xmms2-mpris.c": [ + \ { + \ 'directory': '/foo/bar/xmms2-mpris', + \ 'file': '/foo/bar/xmms2-mpris/src/xmms2-mpris.c', + \ }, + \ ], + \ }, + \ {}, + \ ) + +Execute(ParseCompileCommandsFlags should take commands from matching .c files for .h files): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.h')) + + AssertEqual + \ '-I ' . ale#Escape('/usr/include/xmms2'), + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ 'xmms2-mpris.c': [ + \ { + \ 'directory': '/foo/bar/xmms2-mpris', + \ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c', + \ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2' + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c', + \ }, + \ ], + \ }, + \ {}, + \ ) + +Execute(ParseCompileCommandsFlags should take commands from matching .cpp files for .hpp files): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.hpp')) + + AssertEqual + \ '-I ' . ale#Escape('/usr/include/xmms2'), + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ 'xmms2-mpris.cpp': [ + \ { + \ 'directory': '/foo/bar/xmms2-mpris', + \ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp', + \ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2' + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp', + \ }, + \ ], + \ }, + \ { + \ }, + \ ) + +Execute(ParseCompileCommandsFlags should take commands from matching .cpp files for .h files): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.h')) + + AssertEqual + \ '-I ' . ale#Escape('/usr/include/xmms2'), + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ 'xmms2-mpris.cpp': [ + \ { + \ 'directory': '/foo/bar/xmms2-mpris', + \ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp', + \ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2' + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp', + \ }, + \ ], + \ }, + \ { + \ }, + \ ) + +Execute(ParseCompileCommandsFlags should not take commands from .c files for .h files with different names): + silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/other.h')) + + AssertEqual + \ '', + \ ale#c#ParseCompileCommandsFlags( + \ bufnr(''), + \ { + \ 'xmms2-mpris.c': [ + \ { + \ 'directory': '/foo/bar/xmms2-mpris', + \ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c', + \ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2' + \ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o' + \ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c', + \ }, + \ ], + \ }, + \ { + \ }, + \ ) + +Execute(ShellSplit should not merge flags): + AssertEqual + \ [ + \ 'gcc', + \ '-Dgoal=9', + \ '-Tlinkerfile.ld', + \ 'blabla', + \ '-Isubdir', + \ 'subdir/somedep1.o', + \ 'subdir/somedep2.o', + \ '-I''dir with spaces''', + \ '-Idir-with-dash', + \ 'subdir/somedep3.o', + \ 'subdir/somedep4.o', + \ '-I' . ale#path#Simplify('kernel/include'), + \ 'subdir/somedep5.o', + \ 'subdir/somedep6.o', + \ ], + \ ale#c#ShellSplit( + \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' + \ . 'subdir/somedep1.o ' . 'subdir/somedep2.o ' + \ . '-I''dir with spaces''' . ' -Idir-with-dash ' + \ . 'subdir/somedep3.o ' . 'subdir/somedep4.o ' + \ . ' -I'. ale#path#Simplify('kernel/include') . ' ' + \ . 'subdir/somedep5.o ' . 'subdir/somedep6.o' + \ ) + +Execute(ShellSplit should handle parenthesis and quotes): + AssertEqual + \ [ + \ 'gcc', + \ '-Dgoal=9', + \ '-Tlinkerfile.ld', + \ 'blabla', + \ '-Dtest1="('' '')"', + \ 'file1.o', + \ '-Dtest2=''(` `)''', + \ 'file2.o', + \ '-Dtest3=`(" ")`', + \ 'file3.o', + \ ] , + \ ale#c#ShellSplit( + \ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla ' + \ . '-Dtest1="('' '')" file1.o ' + \ . '-Dtest2=''(` `)'' file2.o ' + \ . '-Dtest3=`(" ")` file3.o' + \ ) + +Execute(We should include several important flags): + AssertEqual + \ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/inc')) + \ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/include')) + \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incquote')) + \ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incsystem')) + \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/incafter')) + \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incframework')) + \ . ' -include file.h' + \ . ' -imacros macros.h' + \ . ' -Dmacro="value"' + \ . ' -DGoal=9' + \ . ' -D macro2' + \ . ' -D macro3="value"' + \ . ' -Bbdir' + \ . ' -B bdir2' + \ . ' -iprefix prefix -iwithprefix prefix2 -iwithprefixbefore prefix3' + \ . ' -isysroot sysroot --sysroot=test --no-sysroot-suffix -imultilib multidir' + \ . ' -Wsome-warning -std=c89 -pedantic -pedantic-errors -ansi' + \ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++' + \ . ' -iplugindir=dir -march=native -w', + \ ale#c#ParseCFlags( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 0, + \ [ + \ 'gcc', + \ '-Iinc', + \ '-I', + \ 'include', + \ '-iquote', + \ 'incquote', + \ '-isystem', + \ 'incsystem', + \ '-idirafter', + \ 'incafter', + \ '-iframework', + \ 'incframework', + \ '-include', + \ 'file.h', + \ '-imacros', + \ 'macros.h', + \ '-Dmacro="value"', + \ '-DGoal=9', + \ '-D', + \ 'macro2', + \ '-D', + \ 'macro3="value"', + \ '-Bbdir', + \ '-B', + \ 'bdir2', + \ '-iprefix', + \ 'prefix', + \ '-iwithprefix', + \ 'prefix2', + \ '-iwithprefixbefore', + \ 'prefix3', + \ '-isysroot', + \ 'sysroot', + \ '--sysroot=test', + \ '--no-sysroot-suffix', + \ '-imultilib', + \ 'multidir', + \ '-Wsome-warning', + \ '-std=c89', + \ '-pedantic', + \ '-pedantic-errors', + \ '-ansi', + \ '-foption', + \ '-O2', + \ '-C', + \ '-CC', + \ '-trigraphs', + \ '-nostdinc', + \ '-nostdinc++', + \ '-iplugindir=dir', + \ '-march=native', + \ '-w', + \ ], + \ ) + +Execute(We should quote the flags we need to quote): + AssertEqual + \ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/inc')) + \ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/include')) + \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incquote')) + \ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incsystem')) + \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/incafter')) + \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incframework')) + \ . ' -include file.h' + \ . ' -imacros macros.h' + \ . ' ' . ale#Escape('-Dmacro="value"') + \ . ' -DGoal=9' + \ . ' -D macro2' + \ . ' -D ' . ale#Escape('macro3="value"') + \ . ' -Bbdir' + \ . ' -B bdir2' + \ . ' -iprefix prefix -iwithprefix prefix2 -iwithprefixbefore prefix3' + \ . ' -isysroot sysroot --sysroot=test' + \ . ' ' . ale#Escape('--sysroot="quoted"') + \ . ' ' . ale#Escape('--sysroot=foo bar') + \ . ' --no-sysroot-suffix -imultilib multidir' + \ . ' -Wsome-warning -std=c89 -pedantic -pedantic-errors -ansi' + \ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++' + \ . ' -iplugindir=dir -march=native -w', + \ ale#c#ParseCFlags( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 1, + \ [ + \ 'gcc', + \ '-Iinc', + \ '-I', + \ 'include', + \ '-iquote', + \ 'incquote', + \ '-isystem', + \ 'incsystem', + \ '-idirafter', + \ 'incafter', + \ '-iframework', + \ 'incframework', + \ '-include', + \ 'file.h', + \ '-imacros', + \ 'macros.h', + \ '-Dmacro="value"', + \ '-DGoal=9', + \ '-D', + \ 'macro2', + \ '-D', + \ 'macro3="value"', + \ '-Bbdir', + \ '-B', + \ 'bdir2', + \ '-iprefix', + \ 'prefix', + \ '-iwithprefix', + \ 'prefix2', + \ '-iwithprefixbefore', + \ 'prefix3', + \ '-isysroot', + \ 'sysroot', + \ '--sysroot=test', + \ '--sysroot="quoted"', + \ '--sysroot=foo bar', + \ '--no-sysroot-suffix', + \ '-imultilib', + \ 'multidir', + \ '-Wsome-warning', + \ '-std=c89', + \ '-pedantic', + \ '-pedantic-errors', + \ '-ansi', + \ '-foption', + \ '-O2', + \ '-C', + \ '-CC', + \ '-trigraphs', + \ '-nostdinc', + \ '-nostdinc++', + \ '-iplugindir=dir', + \ '-march=native', + \ '-w', + \ ], + \ ) + +Execute(We should exclude other flags that cause problems): + AssertEqual + \ '', + \ ale#c#ParseCFlags( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 0, + \ [ + \ 'gcc', + \ '-Wl,option', + \ '-Wa,option', + \ '-Wp,option', + \ '-c', + \ 'filename.c', + \ 'somelib.a', + \ '-fdump-file=name', + \ '-fdiagnostics-arg', + \ '-fno-show-column', + \ '-fstack-usage', + \ '-Tlinkerfile.ld', + \ ], + \ ) + +Execute(We should expand @file in CFlags): + AssertEqual + \ '-DARGS1 -DARGS2 -O2', + \ ale#c#ParseCFlags( + \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'), + \ 0, + \ [ + \ 'gcc', + \ '-g', + \ '@./args', + \ '-O2', + \ ], + \ ) diff --git a/sources_non_forked/ale/test/test_checkingbuffer_autocmd.vader b/sources_non_forked/ale/test/test_checkingbuffer_autocmd.vader new file mode 100644 index 00000000..9e642b15 --- /dev/null +++ b/sources_non_forked/ale/test/test_checkingbuffer_autocmd.vader @@ -0,0 +1,57 @@ +Before: + Save g:ale_run_synchronously + Save g:ale_buffer_info + + let g:ale_run_synchronously = 1 + let g:ale_buffer_info = {} + + let g:checking_buffer = 0 + + unlet! b:ale_linted + + function! TestCallback(buffer, output) + return [] + endfunction + + call ale#linter#PreventLoading('testft') + call ale#linter#Define('testft', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'true', + \ 'command': 'true', + \}) + +After: + Restore + + unlet! g:checking_buffer + + delfunction TestCallback + call ale#linter#Reset() + + augroup VaderTest + autocmd! + augroup END + + augroup! VaderTest + +Given testft (An empty file): +Execute(ALELintPre should not return success on ale#engine#IsCheckingBuffer): + augroup VaderTest + autocmd! + autocmd User ALELintPre let g:checking_buffer = ale#engine#IsCheckingBuffer(bufnr('')) ? 1 : 0 + augroup END + + ALELint + + AssertEqual g:checking_buffer, 0 + +Execute(ALEJobStarted should return success on ale#engine#IsCheckingBuffer): + augroup VaderTest + autocmd! + autocmd User ALEJobStarted let g:checking_buffer = ale#engine#IsCheckingBuffer(bufnr('')) ? 1 : 0 + augroup END + + ALELint + + AssertEqual g:checking_buffer, 1 diff --git a/sources_non_forked/ale/test/test_cleanup.vader b/sources_non_forked/ale/test/test_cleanup.vader new file mode 100644 index 00000000..232874aa --- /dev/null +++ b/sources_non_forked/ale/test/test_cleanup.vader @@ -0,0 +1,14 @@ +After: + unlet! g:buffer + let g:ale_buffer_info = {} + +Execute('ALE globals should be cleared when the buffer is deleted): + new + + let g:ale_buffer_info = { + \ bufnr(''): {'temporary_file_list': [], 'temporary_directory_list': []}, + \ 10347: {'temporary_file_list': [], 'temporary_directory_list': []}, + \} + + bdelete + AssertEqual {10347: {'temporary_file_list': [], 'temporary_directory_list': []}}, g:ale_buffer_info diff --git a/sources_non_forked/ale/test/test_code_action.vader b/sources_non_forked/ale/test/test_code_action.vader new file mode 100644 index 00000000..80e2b1d8 --- /dev/null +++ b/sources_non_forked/ale/test/test_code_action.vader @@ -0,0 +1,605 @@ +Before: + let g:notified_changes = [] + + runtime autoload/ale/lsp.vim + + function! ale#lsp#NotifyForChanges(conn_id, buffer) abort + call add(g:notified_changes, { + \ 'conn_id': a:conn_id, + \ 'buffer': a:buffer + \}) + endfunction + + Save g:ale_enabled + let g:ale_enabled = 0 + + let g:file1 = tempname() + let g:file2 = tempname() + let g:test = {} + + let g:test.create_change = {line, offset, end_line, end_offset, value -> + \{ + \ 'changes': [{ + \ 'fileName': g:file1, + \ 'textChanges': [{ + \ 'start': { + \ 'line': line, + \ 'offset': offset, + \ }, + \ 'end': { + \ 'line': end_line, + \ 'offset': end_offset, + \ }, + \ 'newText': value, + \ }], + \ }] + \}} + + function! WriteFileAndEdit() abort + let g:test.text = [ + \ 'class Name {', + \ ' value: string', + \ '}', + \] + call writefile(g:test.text, g:file1, 'S') + execute 'edit ' . g:file1 + endfunction! + +After: + " Close the extra buffers if we opened it. + if bufnr(g:file1) != -1 && buflisted(bufnr(g:file1)) + execute ':bp! | :bd! ' . bufnr(g:file1) + endif + if bufnr(g:file2) != -1 && buflisted(bufnr(g:file2)) + execute ':bp! | :bd! ' . bufnr(g:file2) + endif + + if filereadable(g:file1) + call delete(g:file1) + endif + if filereadable(g:file2) + call delete(g:file2) + endif + + unlet! g:notified_changes + " unlet! g:expected_notified_changes + unlet! g:file1 + unlet! g:file2 + unlet! g:test + unlet! g:changes + delfunction WriteFileAndEdit + + runtime autoload/ale/lsp.vim + + Restore + + +Execute(It should modify and save multiple files): + call writefile([ + \ 'class Name {', + \ ' value: string', + \ '}', + \ '', + \ 'class B {', + \ ' constructor(readonly a: Name) {}', + \ '}' + \], g:file1, 'S') + call writefile([ + \ 'import A from "A"', + \ 'import {', + \ ' B,', + \ ' C,', + \ '} from "module"', + \ 'import D from "D"', + \], g:file2, 'S') + + call ale#code_action#HandleCodeAction( + \ { + \ 'changes': [{ + \ 'fileName': g:file1, + \ 'textChanges': [{ + \ 'start': { + \ 'line': 1, + \ 'offset': 7, + \ }, + \ 'end': { + \ 'line': 1, + \ 'offset': 11, + \ }, + \ 'newText': 'Value', + \ }, { + \ 'start': { + \ 'line': 6, + \ 'offset': 27, + \ }, + \ 'end': { + \ 'line': 6, + \ 'offset': 31, + \ }, + \ 'newText': 'Value', + \ }], + \ }, { + \ 'fileName': g:file2, + \ 'textChanges': [{ + \ 'start': { + \ 'line': 2, + \ 'offset': 1, + \ }, + \ 'end': { + \ 'line': 6, + \ 'offset': 1, + \ }, + \ 'newText': "import {A, B} from 'module'\n\n", + \ }] + \ }], + \ }, + \ {'should_save': 1, 'conn_id': 'test_conn'}, + \) + + AssertEqual [ + \ 'class Value {', + \ ' value: string', + \ '}', + \ '', + \ 'class B {', + \ ' constructor(readonly a: Value) {}', + \ '}', + \ '', + \], readfile(g:file1, 'b') + + AssertEqual [ + \ 'import A from "A"', + \ 'import {A, B} from ''module''', + \ '', + \ 'import D from "D"', + \ '', + \], readfile(g:file2, 'b') + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(g:file1), + \}, { + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(g:file2), + \}], g:notified_changes + +Execute(Beginning of file can be modified): + let g:test.text = [ + \ 'class Name {', + \ ' value: string', + \ '}', + \] + call writefile(g:test.text, g:file1, 'S') + + call ale#code_action#HandleCodeAction( + \ { + \ 'changes': [{ + \ 'fileName': g:file1, + \ 'textChanges': [{ + \ 'start': { + \ 'line': 1, + \ 'offset': 1, + \ }, + \ 'end': { + \ 'line': 1, + \ 'offset': 1, + \ }, + \ 'newText': "type A: string\ntype B: number\n", + \ }], + \ }] + \ }, + \ {'should_save': 1, 'conn_id': 'test_conn'}, + \) + + AssertEqual [ + \ 'type A: string', + \ 'type B: number', + \] + g:test.text + [''], readfile(g:file1, 'b') + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(g:file1), + \}], g:notified_changes + + +Execute(End of file can be modified): + let g:test.text = [ + \ 'class Name {', + \ ' value: string', + \ '}', + \] + call writefile(g:test.text, g:file1, 'S') + + call ale#code_action#HandleCodeAction( + \ { + \ 'changes': [{ + \ 'fileName': g:file1, + \ 'textChanges': [{ + \ 'start': { + \ 'line': 4, + \ 'offset': 1, + \ }, + \ 'end': { + \ 'line': 4, + \ 'offset': 1, + \ }, + \ 'newText': "type A: string\ntype B: number\n", + \ }], + \ }] + \ }, + \ {'should_save': 1, 'conn_id': 'test_conn'}, + \) + + AssertEqual g:test.text + [ + \ 'type A: string', + \ 'type B: number', + \ '', + \], readfile(g:file1, 'b') + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(g:file1), + \}], g:notified_changes + + +Execute(Current buffer contents will be reloaded): + let g:test.text = [ + \ 'class Name {', + \ ' value: string', + \ '}', + \] + call writefile(g:test.text, g:file1, 'S') + + execute 'edit ' . g:file1 + let g:test.buffer = bufnr(g:file1) + + call ale#code_action#HandleCodeAction( + \ { + \ 'changes': [{ + \ 'fileName': g:file1, + \ 'textChanges': [{ + \ 'start': { + \ 'line': 1, + \ 'offset': 1, + \ }, + \ 'end': { + \ 'line': 1, + \ 'offset': 1, + \ }, + \ 'newText': "type A: string\ntype B: number\n", + \ }], + \ }] + \ }, + \ {'should_save': 1, 'conn_id': 'test_conn'}, + \) + + AssertEqual [ + \ 'type A: string', + \ 'type B: number', + \] + g:test.text + [''], readfile(g:file1, 'b') + + AssertEqual [ + \ 'type A: string', + \ 'type B: number', + \] + g:test.text, getbufline(g:test.buffer, 1, '$') + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(g:file1), + \}], g:notified_changes + + +Execute(Unlisted buffer contents will be modified correctly): + let g:test.text = [ + \ 'class Name {', + \ ' value: string', + \ '}', + \] + call writefile(g:test.text, g:file1, 'S') + + execute 'edit ' . g:file1 + let g:test.buffer = bufnr(g:file1) + + execute 'bd' + AssertEqual bufnr(g:file1), g:test.buffer + + call ale#code_action#HandleCodeAction( + \ { + \ 'changes': [{ + \ 'fileName': g:file1, + \ 'textChanges': [{ + \ 'start': { + \ 'line': 1, + \ 'offset': 1, + \ }, + \ 'end': { + \ 'line': 1, + \ 'offset': 1, + \ }, + \ 'newText': "type A: string\ntype B: number\n", + \ }], + \ }] + \ }, + \ {'should_save': 1, 'conn_id': 'test_conn'}, + \) + + AssertEqual [ + \ 'type A: string', + \ 'type B: number', + \] + g:test.text + [''], readfile(g:file1, 'b') + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(g:file1), + \}], g:notified_changes + +# Tests for cursor repositioning. In comments `=` designates change range, and +# `C` cursor position + +# C === +Execute(Cursor will not move when it is before text change): + call WriteFileAndEdit() + let g:test.changes = g:test.create_change(2, 3, 2, 8, 'value2') + + call setpos('.', [0, 1, 1, 0]) + call ale#code_action#HandleCodeAction(g:test.changes, { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \}) + AssertEqual [1, 1], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + + call setpos('.', [0, 2, 2, 0]) + call ale#code_action#HandleCodeAction(g:test.changes, { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \}) + AssertEqual [2, 2], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}, { + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +# ====C==== +Execute(Cursor column will move to the change end when cursor between start/end): + let g:test.changes = g:test.create_change(2, 3, 2, 8, 'value2') + + for r in range(3, 8) + call WriteFileAndEdit() + call setpos('.', [0, 2, r, 0]) + AssertEqual ' value: string', getline('.') + call ale#code_action#HandleCodeAction(g:test.changes, { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \}) + AssertEqual ' value2: string', getline('.') + AssertEqual [2, 9], getpos('.')[1:2] + endfor + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}, { + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}, { + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}, { + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}, { + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}, { + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + + +# ====C +Execute(Cursor column will move back when new text is shorter): + call WriteFileAndEdit() + call setpos('.', [0, 2, 8, 0]) + AssertEqual ' value: string', getline('.') + call ale#code_action#HandleCodeAction( + \ g:test.create_change(2, 3, 2, 8, 'val'), + \ { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \ }) + AssertEqual ' val: string', getline('.') + AssertEqual [2, 6], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + + +# ==== C +Execute(Cursor column will move forward when new text is longer): + call WriteFileAndEdit() + + call setpos('.', [0, 2, 8, 0]) + AssertEqual ' value: string', getline('.') + call ale#code_action#HandleCodeAction( + \ g:test.create_change(2, 3, 2, 8, 'longValue'), + \ { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \ }) + AssertEqual ' longValue: string', getline('.') + AssertEqual [2, 12], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +# ========= +# = +# C +Execute(Cursor line will move when updates are happening on lines above): + call WriteFileAndEdit() + call setpos('.', [0, 3, 1, 0]) + AssertEqual '}', getline('.') + call ale#code_action#HandleCodeAction( + \ g:test.create_change(1, 1, 2, 1, "test\ntest\n"), + \ { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \ }) + AssertEqual '}', getline('.') + AssertEqual [4, 1], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + + +# ========= +# =C +Execute(Cursor line and column will move when change on lines above and just before cursor column): + call WriteFileAndEdit() + call setpos('.', [0, 2, 2, 0]) + AssertEqual ' value: string', getline('.') + call ale#code_action#HandleCodeAction( + \ g:test.create_change(1, 1, 2, 1, "test\ntest\n123"), + \ { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \ }) + AssertEqual '123 value: string', getline('.') + AssertEqual [3, 5], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +# ========= +# ======C== +# = +Execute(Cursor line and column will move at the end of changes): + call WriteFileAndEdit() + call setpos('.', [0, 2, 10, 0]) + AssertEqual ' value: string', getline('.') + call ale#code_action#HandleCodeAction( + \ g:test.create_change(1, 1, 3, 1, "test\n"), + \ { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \ }) + AssertEqual '}', getline('.') + AssertEqual [2, 1], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +# C == +# === +Execute(Cursor will not move when changes happening on lines >= cursor, but after cursor): + call WriteFileAndEdit() + call setpos('.', [0, 2, 3, 0]) + AssertEqual ' value: string', getline('.') + call ale#code_action#HandleCodeAction( + \ g:test.create_change(2, 10, 3, 1, "number\n"), + \ { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \ }) + AssertEqual ' value: number', getline('.') + AssertEqual [2, 3], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +Execute(Cursor will not move when change covers entire file): + call WriteFileAndEdit() + call setpos('.', [0, 2, 3, 0]) + call ale#code_action#HandleCodeAction( + \ g:test.create_change(1, 1, len(g:test.text) + 1, 1, + \ join(g:test.text + ['x'], "\n")), + \ { + \ 'should_save': 1, + \ 'conn_id': 'test_conn', + \ }) + AssertEqual [2, 3], getpos('.')[1:2] + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +Execute(It should just modify file when should_save is set to v:false): + call WriteFileAndEdit() + let g:test.change = g:test.create_change(1, 1, 1, 1, "import { writeFile } from 'fs';\n") + call ale#code_action#HandleCodeAction(g:test.change, { + \ 'conn_id': 'test_conn', + \}) + AssertEqual 1, getbufvar(bufnr(''), '&modified') + AssertEqual [ + \ 'import { writeFile } from ''fs'';', + \ 'class Name {', + \ ' value: string', + \ '}', + \], getline(1, '$') + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +Given typescript(An example TypeScript file): + type Foo = {} + + export interface ISomething { + fooLongName: Foo | null + } + + export class SomethingElse implements ISomething { + // Bindings + fooLongName!: ISomething['fooLongName'] + } + +Execute(): + let g:changes = [ + \ {'end': {'offset': 14, 'line': 4}, 'newText': 'foo', 'start': {'offset': 3, 'line': 4}}, + \ {'end': {'offset': 40, 'line': 9}, 'newText': 'foo', 'start': {'offset': 29, 'line': 9}}, + \ {'end': {'offset': 14, 'line': 9}, 'newText': 'foo', 'start': {'offset': 3, 'line': 9}}, + \] + + call ale#code_action#ApplyChanges(expand('%:p'), g:changes, { + \ 'conn_id': 'test_conn', + \}) + + AssertEqual [{ + \ 'conn_id': 'test_conn', + \ 'buffer': bufnr(''), + \}], g:notified_changes + +Expect(The changes should be applied correctly): + type Foo = {} + + export interface ISomething { + foo: Foo | null + } + + export class SomethingElse implements ISomething { + // Bindings + foo!: ISomething['foo'] + } diff --git a/sources_non_forked/ale/test/test_code_action_corner_cases.vader b/sources_non_forked/ale/test/test_code_action_corner_cases.vader new file mode 100644 index 00000000..b5741d43 --- /dev/null +++ b/sources_non_forked/ale/test/test_code_action_corner_cases.vader @@ -0,0 +1,141 @@ +" Tests for various corner cases of applying code changes from LSP. +" +" These can be verified against the reference vscode implementation using the +" following javascript program: +" +" const { TextDocument } = require('vscode-languageserver-textdocument'); +" const { TextEdit, Position, Range } = require('vscode-languageserver-types'); +" function MkPos(line, offset) { return Position.create(line - 1, offset - 1); } +" function MkInsert(pos, newText) { return TextEdit.insert(pos, newText); } +" function MkDelete(start, end) { return TextEdit.del(Range.create(start, end)); } +" function TestChanges(s, es) { +" return TextDocument.applyEdits(TextDocument.create(null, null, null, s), es); +" } +" +" const fs = require("fs"); +" const assert = require('assert').strict; +" const testRegex = /(? ale#lsp_linter#OnInit(a:linter, l:details, a:Callback)} + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#Execute(expr) abort + call add(g:expr_list, a:expr) + endfunction + + function! ale#code_action#HandleCodeAction(code_action, options) abort + let g:handle_code_action_called = 1 + Assert !get(a:options, 'should_save') + call add(g:code_actions, a:code_action) + endfunction + + function! ale#util#Input(message, value) abort + return '2' + endfunction + +After: + Restore + + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:capability_checked + unlet! g:InitCallback + unlet! g:old_filename + unlet! g:conn_id + unlet! g:Callback + unlet! g:message_list + unlet! g:expr_list + unlet! b:ale_linters + unlet! g:options + unlet! g:code_actions + unlet! g:handle_code_action_called + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/codefix.vim + runtime autoload/ale/code_action.vim + +Execute(Failed codefix responses should be handled correctly): + call ale#codefix#HandleTSServerResponse( + \ 1, + \ {'command': 'getCodeFixes', 'request_seq': 3} + \) + AssertEqual g:handle_code_action_called, 0 + +Given typescript(Some typescript file): + foo + somelongerline () + bazxyzxyzxyz + +Execute(getCodeFixes from tsserver should be handled): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleTSServerResponse(1, { + \ 'command': 'getCodeFixes', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'type': 'response', + \ 'body': [ + \ { + \ 'description': 'Import default "x" from module "./z"', + \ 'fixName': 'import', + \ 'changes': [ + \ { + \ 'fileName': "/foo/bar/file1.ts", + \ 'textChanges': [ + \ { + \ 'end': { + \ 'line': 2, + \ 'offset': 1, + \ }, + \ 'newText': 'import x from "./z";^@', + \ 'start': { + \ 'line': 2, + \ 'offset': 1, + \ } + \ } + \ ] + \ } + \ ] + \ } + \ ] + \}) + + AssertEqual g:handle_code_action_called, 1 + AssertEqual + \ [ + \ { + \ 'description': 'codefix', + \ 'changes': [ + \ { + \ 'fileName': "/foo/bar/file1.ts", + \ 'textChanges': [ + \ { + \ 'end': { + \ 'line': 2, + \ 'offset': 1 + \ }, + \ 'newText': 'import x from "./z";^@', + \ 'start': { + \ 'line': 2, + \ 'offset': 1 + \ } + \ } + \ ] + \ } + \ ] + \ } + \ ], + \ g:code_actions + +Execute(getCodeFixes from tsserver should be handled with user input if there are more than one action): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleTSServerResponse(1, { + \ 'command': 'getCodeFixes', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'type': 'response', + \ 'body': [ + \ { + \ 'description': 'Import default "x" from module "./z"', + \ 'fixName': 'import', + \ 'changes': [ + \ { + \ 'fileName': "/foo/bar/file1.ts", + \ 'textChanges': [ + \ { + \ 'end': { + \ 'line': 2, + \ 'offset': 1, + \ }, + \ 'newText': 'import x from "./z";^@', + \ 'start': { + \ 'line': 2, + \ 'offset': 1, + \ } + \ } + \ ] + \ } + \ ] + \ }, + \ { + \ 'description': 'Import default "x" from module "./y"', + \ 'fixName': 'import', + \ 'changes': [ + \ { + \ 'fileName': "/foo/bar/file1.ts", + \ 'textChanges': [ + \ { + \ 'end': { + \ 'line': 2, + \ 'offset': 1, + \ }, + \ 'newText': 'import x from "./y";^@', + \ 'start': { + \ 'line': 2, + \ 'offset': 1, + \ } + \ } + \ ] + \ } + \ ] + \ } + \ ] + \}) + + AssertEqual g:handle_code_action_called, 1 + AssertEqual + \ [ + \ { + \ 'description': 'codefix', + \ 'changes': [ + \ { + \ 'fileName': "/foo/bar/file1.ts", + \ 'textChanges': [ + \ { + \ 'end': { + \ 'line': 2, + \ 'offset': 1 + \ }, + \ 'newText': 'import x from "./y";^@', + \ 'start': { + \ 'line': 2, + \ 'offset': 1 + \ } + \ } + \ ] + \ } + \ ] + \ } + \ ], + \ g:code_actions + +Execute(Prints a tsserver error message when getCodeFixes unsuccessful): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleTSServerResponse(1, { + \ 'command': 'getCodeFixes', + \ 'request_seq': 3, + \ 'success': v:false, + \ 'message': 'something is wrong', + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''Error while getting code fixes. Reason: something is wrong'''], g:expr_list + +Execute(Does nothing when where are no code fixes): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleTSServerResponse(1, { + \ 'command': 'getCodeFixes', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [] + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''No code fixes available.'''], g:expr_list + +Execute(tsserver codefix requests should be sent): + call ale#linter#Reset() + + runtime ale_linters/typescript/tsserver.vim + let g:ale_buffer_info = {bufnr(''): {'loclist': [{'lnum': 2, 'col': 5, 'code': 2304, 'linter_name': 'tsserver'}]}} + call setpos('.', [bufnr(''), 2, 16, 0]) + + " ALECodeAction + call ale#codefix#Execute(0) + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'code_actions', g:capability_checked + AssertEqual + \ 'function(''ale#codefix#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@getCodeFixes', { + \ 'startLine': 2, + \ 'startOffset': 16, + \ 'endLine': 2, + \ 'endOffset': 17, + \ 'file': expand('%:p'), + \ 'errorCodes': [2304], + \ }] + \ ], + \ g:message_list + +Execute(tsserver codefix requests should be sent only for error with code): + call ale#linter#Reset() + + runtime ale_linters/typescript/tsserver.vim + let g:ale_buffer_info = {bufnr(''): {'loclist': [{'lnum': 2, 'col': 16, 'linter_name': 'tsserver'}, {'lnum': 2, 'col': 16, 'code': 2304, 'linter_name': 'tsserver'}]}} + call setpos('.', [bufnr(''), 2, 16, 0]) + + " ALECodeAction + call ale#codefix#Execute(0) + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'code_actions', g:capability_checked + AssertEqual + \ 'function(''ale#codefix#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@getCodeFixes', { + \ 'startLine': 2, + \ 'startOffset': 16, + \ 'endLine': 2, + \ 'endOffset': 17, + \ 'file': expand('%:p'), + \ 'errorCodes': [2304], + \ }] + \ ], + \ g:message_list + +Execute(getApplicableRefactors from tsserver should be handled): + call ale#codefix#SetMap({3: { + \ 'buffer': expand('%:p'), + \ 'line': 1, + \ 'column': 2, + \ 'end_line': 3, + \ 'end_column': 4, + \ 'connection_id': 0, + \}}) + call ale#codefix#HandleTSServerResponse(1, + \ {'seq': 0, 'request_seq': 3, 'type': 'response', 'success': v:true, 'body': [{'actions': [{'description': 'Extract to constant in enclosing scope', 'name': 'constant_scope_0'}], 'description': 'Extract constant', 'name': 'Extract Symbol'}, {'actions': [{'description': 'Extract to function in module scope', 'name': 'function_scope_1'}], 'description': 'Extract function', 'name': 'Extract Symbol'}], 'command': 'getApplicableRefactors'}) + + AssertEqual + \ [ + \ [0, 'ts@getEditsForRefactor', { + \ 'startLine': 1, + \ 'startOffset': 2, + \ 'endLine': 3, + \ 'endOffset': 5, + \ 'file': expand('%:p'), + \ 'refactor': 'Extract Symbol', + \ 'action': 'function_scope_1', + \ }] + \ ], + \ g:message_list + +Execute(getApplicableRefactors should print error on failure): + call ale#codefix#SetMap({3: { + \ 'buffer': expand('%:p'), + \ 'line': 1, + \ 'column': 2, + \ 'end_line': 3, + \ 'end_column': 4, + \ 'connection_id': 0, + \}}) + call ale#codefix#HandleTSServerResponse(1, + \ {'seq': 0, 'request_seq': 3, 'type': 'response', 'success': v:false, 'message': 'oops', 'command': 'getApplicableRefactors'}) + + AssertEqual ['echom ''Error while getting applicable refactors. Reason: oops'''], g:expr_list + +Execute(getApplicableRefactors should do nothing if there are no refactors): + call ale#codefix#SetMap({3: { + \ 'buffer': expand('%:p'), + \ 'line': 1, + \ 'column': 2, + \ 'end_line': 3, + \ 'end_column': 4, + \ 'connection_id': 0, + \}}) + call ale#codefix#HandleTSServerResponse(1, + \ {'seq': 0, 'request_seq': 3, 'type': 'response', 'success': v:true, 'body': [], 'command': 'getApplicableRefactors'}) + + AssertEqual ['echom ''No applicable refactors available.'''], g:expr_list + +Execute(getEditsForRefactor from tsserver should be handled): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleTSServerResponse(1, + \{'seq': 0, 'request_seq': 3, 'type': 'response', 'success': v:true, 'body': {'edits': [{'fileName': '/foo/bar/file.ts', 'textChanges': [{'end': {'offset': 35, 'line': 9}, 'newText': 'newFunction(app);', 'start': {'offset': 3, 'line': 8}}, {'end': {'offset': 4, 'line': 19}, 'newText': '^@function newFunction(app: Router) {^@ app.use(booExpressCsrf());^@ app.use(booExpressRequireHttps);^@}^@', 'start': {'offset': 4, 'line': 19}}]}], 'renameLocation': {'offset': 3, 'line': 8}, 'renameFilename': '/foo/bar/file.ts'}, 'command': 'getEditsForRefactor' } + \) + + AssertEqual g:handle_code_action_called, 1 + AssertEqual + \ [ + \ { + \ 'description': 'editsForRefactor', + \ 'changes': [{'fileName': '/foo/bar/file.ts', 'textChanges': [{'end': {'offset': 35, 'line': 9}, 'newText': 'newFunction(app);', 'start': {'offset': 3, 'line': 8}}, {'end': {'offset': 4, 'line': 19}, 'newText': '^@function newFunction(app: Router) {^@ app.use(booExpressCsrf());^@ app.use(booExpressRequireHttps);^@}^@', 'start': {'offset': 4, 'line': 19}}]}], + \ } + \ ], + \ g:code_actions + +Execute(getEditsForRefactor should print error on failure): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleTSServerResponse(1, + \{'seq': 0, 'request_seq': 3, 'type': 'response', 'success': v:false, 'message': 'oops', 'command': 'getEditsForRefactor' } + \) + + AssertEqual ['echom ''Error while getting edits for refactor. Reason: oops'''], g:expr_list + +Execute(Failed LSP responses should be handled correctly): + call ale#codefix#HandleLSPResponse( + \ 1, + \ {'method': 'workspace/applyEdit', 'request_seq': 3} + \) + AssertEqual g:handle_code_action_called, 0 + +Given python(Some python file): + def main(): + a = 1 + b = a + 2 + +Execute("workspace/applyEdit" from LSP should be handled): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleLSPResponse(1, + \ {'id': 0, 'jsonrpc': '2.0', 'method': 'workspace/applyEdit', 'params': {'edit': {'changes': {'file:///foo/bar/file.ts': [{'range': {'end': {'character': 27, 'line': 7}, 'start': {'character': 27, 'line': 7}}, 'newText': ', Config'}, {'range': {'end': {'character': 12, 'line': 96}, 'start': {'character': 2, 'line': 94}}, 'newText': 'await newFunction(redis, imageKey, cover, config);'}, {'range': {'end': {'character': 2, 'line': 99}, 'start': {'character': 2, 'line': 99}}, 'newText': '^@async function newFunction(redis: IRedis, imageKey: string, cover: Buffer, config: Config) {^@ try {^@ await redis.set(imageKey, cover, ''ex'', parseInt(config.coverKeyTTL, 10));^@ }^@ catch { }^@}^@'}]}}}}) + + AssertEqual g:handle_code_action_called, 1 + AssertEqual + \ [{'description': 'applyEdit', 'changes': [{'fileName': '/foo/bar/file.ts', 'textChanges': [{'end': {'offset': 28, 'line': 8}, 'newText': ', Config', 'start': {'offset': 28, 'line': 8}}, {'end': {'offset': 13, 'line': 97}, 'newText': 'await newFunction(redis, imageKey, cover, config);', 'start': {'offset': 3, 'line': 95}}, {'end': {'offset': 3, 'line': 100}, 'newText': '^@async function newFunction(redis: IRedis, imageKey: string, cover: Buffer, config: Config) {^@ try {^@ await redis.set(imageKey, cover, ''ex'', parseInt(config.coverKeyTTL, 10));^@ }^@ catch { }^@}^@', 'start': {'offset': 3, 'line': 100}}]}]}], + \ g:code_actions + +Execute(Code Actions from LSP should be handled when returned with documentChanges): + call ale#codefix#SetMap({2: {}}) + call ale#codefix#HandleLSPResponse(1, + \ {'id': 2, 'jsonrpc': '2.0', 'result': [{'diagnostics': v:null, 'edit': {'changes': v:null, 'documentChanges': [{'edits': [{'range': {'end': {'character': 4, 'line': 2}, 'start': {'character': 4, 'line': 1}}, 'newText': ''}, {'range': {'end': {'character': 9, 'line': 2}, 'start': {'character': 8, 'line': 2}}, 'newText': '(1)'}], 'textDocument': {'uri': 'file:///foo/bar/test.py', 'version': v:null}}]}, 'kind': 'refactor.inline', 'title': 'Inline variable', 'command': v:null}, {'diagnostics': v:null, 'edit': {'changes': v:null, 'documentChanges': [{'edits': [{'range': {'end': {'character': 0, 'line': 0}, 'start': {'character': 0, 'line': 0}}, 'newText': 'def func_bomdjnxh():^@ a = 1return a^@^@^@'}, {'range': {'end': {'character': 9, 'line': 1}, 'start': {'character': 8, 'line': 1}}, 'newText': 'func_bomdjnxh()^@'}], 'textDocument': {'uri': 'file:///foo/bar/test.py', 'version': v:null}}]}, 'kind': 'refactor.extract', 'title': 'Extract expression into function ''func_bomdjnxh''', 'command': v:null}]}) + + AssertEqual g:handle_code_action_called, 1 + AssertEqual + \ [{'description': 'codeaction', 'changes': [{'fileName': '/foo/bar/test.py', 'textChanges': [{'end': {'offset': 1, 'line': 1}, 'newText': 'def func_bomdjnxh():^@ a = 1return a^@^@^@', 'start': {'offset': 1, 'line': 1}}, {'end': {'offset': 10, 'line': 2}, 'newText': 'func_bomdjnxh()^@', 'start': {'offset': 9, 'line': 2}}]}]}], + \ g:code_actions + +Execute(LSP Code Actions handles CodeAction responses): + call ale#codefix#SetMap({3: { + \ 'connection_id': 0, + \}}) + call ale#codefix#HandleLSPResponse(1, + \ {'id': 3, 'jsonrpc': '2.0', 'result': [{'kind': 'refactor', 'title': 'Extract to inner function in function ''getVideo''', 'command': {'arguments': [{'file': '/foo/bar/file.ts', 'endOffset': 0, 'action': 'function_scope_0', 'startOffset': 1, 'startLine': 65, 'refactor': 'Extract Symbol', 'endLine': 68}], 'title': 'Extract to inner function in function ''getVideo''', 'command': '_typescript.applyRefactoring'}}, {'kind': 'refactor', 'title': 'Extract to function in module scope', 'command': {'arguments': [{'file': '/foo/bar/file.ts', 'endOffset': 0, 'action': 'function_scope_1', 'startOffset': 1, 'startLine': 65, 'refactor': 'Extract Symbol', 'endLine': 68}], 'title': 'Extract to function in module scope', 'command': '_typescript.applyRefactoring'}}]}) + + AssertEqual + \ [[0, 'workspace/executeCommand', {'arguments': [{'file': '/foo/bar/file.ts', 'action': 'function_scope_1', 'endOffset': 0, 'refactor': 'Extract Symbol', 'endLine': 68, 'startLine': 65, 'startOffset': 1}], 'command': '_typescript.applyRefactoring'}]], + \ g:message_list + +Execute(LSP Code Actions handles Command responses): + call ale#codefix#SetMap({2: { + \ 'connection_id': 2, + \}}) + call ale#codefix#HandleLSPResponse(1, + \ {'id': 2, 'jsonrpc': '2.0', 'result': [{'title': 'fake for testing'}, {'arguments': [{'documentChanges': [{'edits': [{'range': {'end': {'character': 31, 'line': 2}, 'start': {'character': 31, 'line': 2}}, 'newText': ', createVideo'}], 'textDocument': {'uri': 'file:///foo/bar/file.ts', 'version': 1}}]}], 'title': 'Add ''createVideo'' to existing import declaration from "./video"', 'command': '_typescript.applyWorkspaceEdit'}]}) + + AssertEqual + \ [[0, 'workspace/executeCommand', {'arguments': [{'documentChanges': [{'edits': [{'range': {'end': {'character': 31, 'line': 2}, 'start': {'character': 31, 'line': 2}}, 'newText': ', createVideo'}], 'textDocument': {'uri': 'file:///foo/bar/file.ts', 'version': 1}}]}], 'command': '_typescript.applyWorkspaceEdit'}]], + \ g:message_list + +Execute(Prints message when LSP code action returns no results): + call ale#codefix#SetMap({3: {}}) + call ale#codefix#HandleLSPResponse(1, + \ {'id': 3, 'jsonrpc': '2.0', 'result': []}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''No code actions received from server'''], g:expr_list + +Execute(LSP code action requests should be sent): + call ale#linter#Reset() + + runtime ale_linters/python/jedils.vim + let g:ale_buffer_info = {bufnr(''): {'loclist': [{'lnum': 2, 'col': 5, 'end_lnum': 2, 'end_col': 6, 'code': 2304, 'text': 'oops'}]}} + call setpos('.', [bufnr(''), 2, 5, 0]) + + " ALECodeAction + call ale#codefix#Execute(0) + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'code_actions', g:capability_checked + AssertEqual + \ 'function(''ale#codefix#HandleLSPResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ [0, 'textDocument/codeAction', { + \ 'context': { + \ 'diagnostics': [{'range': {'end': {'character': 6, 'line': 1}, 'start': {'character': 4, 'line': 1}}, 'code': 2304, 'message': 'oops'}] + \ }, + \ 'range': {'end': {'character': 5, 'line': 1}, 'start': {'character': 4, 'line': 1}}, + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))} + \ }] + \ ], + \ g:message_list[-1:] + +Execute(LSP code action requests should be sent only for error with code): + call ale#linter#Reset() + + runtime ale_linters/python/jedils.vim + let g:ale_buffer_info = {bufnr(''): {'loclist': [{'lnum': 2, 'col': 5, 'end_lnum': 2, 'end_col': 6, 'code': 2304, 'text': 'oops'}]}} + call setpos('.', [bufnr(''), 2, 5, 0]) + + " ALECodeAction + call ale#codefix#Execute(0) + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'code_actions', g:capability_checked + AssertEqual + \ 'function(''ale#codefix#HandleLSPResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ [0, 'textDocument/codeAction', { + \ 'context': { + \ 'diagnostics': [{'range': {'end': {'character': 6, 'line': 1}, 'start': {'character': 4, 'line': 1}}, 'code': 2304, 'message': 'oops'}] + \ }, + \ 'range': {'end': {'character': 5, 'line': 1}, 'start': {'character': 4, 'line': 1}}, + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))} + \ }] + \ ], + \ g:message_list[-1:] diff --git a/sources_non_forked/ale/test/test_computed_lint_file_values.vader b/sources_non_forked/ale/test/test_computed_lint_file_values.vader new file mode 100644 index 00000000..6c3d209d --- /dev/null +++ b/sources_non_forked/ale/test/test_computed_lint_file_values.vader @@ -0,0 +1,150 @@ +Before: + Save g:ale_enabled + Save g:ale_run_synchronously + Save g:ale_set_lists_synchronously + Save g:ale_buffer_info + + let g:ale_enabled = 1 + let g:ale_buffer_info = {} + let g:ale_run_synchronously = 1 + let g:ale_set_lists_synchronously = 1 + + function! TestCallback(buffer, output) + " Windows adds extra spaces to the text from echo. + return [{ + \ 'lnum': 2, + \ 'col': 3, + \ 'text': 'testlinter1', + \}] + endfunction + function! TestCallback2(buffer, output) + " Windows adds extra spaces to the text from echo. + return [{ + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'testlinter2', + \}] + endfunction + function! TestCallback3(buffer, output) + " Windows adds extra spaces to the text from echo. + return [{ + \ 'lnum': 3, + \ 'col': 3, + \ 'text': 'testlinter3', + \}] + endfunction + + " These two linters computer their lint_file values after running commands. + call ale#linter#Define('foobar', { + \ 'name': 'testlinter1', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''', + \ 'lint_file': {b -> ale#command#Run(b, 'echo', {-> 1})}, + \}) + call ale#linter#Define('foobar', { + \ 'name': 'testlinter2', + \ 'callback': 'TestCallback2', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''', + \ 'lint_file': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 1})})}, + \}) + " This one directly computes the result. + call ale#linter#Define('foobar', { + \ 'name': 'testlinter3', + \ 'callback': 'TestCallback3', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''', + \ 'lint_file': {b -> 1}, + \}) + + let g:filename = tempname() + call writefile([], g:filename) + call ale#test#SetFilename(g:filename) + +After: + delfunction TestCallback + + call ale#engine#Cleanup(bufnr('')) + Restore + call ale#linter#Reset() + + " Items and markers, etc. + call setloclist(0, []) + call clearmatches() + call ale#sign#Clear() + + if filereadable(g:filename) + call delete(g:filename) + endif + + unlet g:filename + +Given foobar(A file with some lines): + foo + bar + baz + +Execute(lint_file results where the result is eventually computed should be run): + call ale#Queue(0, 'lint_file') + call ale#test#FlushJobs() + + AssertEqual + \ [ + \ { + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'testlinter2', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }, + \ { + \ 'bufnr': bufnr('%'), + \ 'lnum': 2, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'testlinter1', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }, + \ { + \ 'bufnr': bufnr('%'), + \ 'lnum': 3, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'testlinter3', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(Linters where lint_file eventually evaluates to 1 shouldn't be run if we don't want to run them): + call ale#Queue(0, '') + call ale#test#FlushJobs() + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + +Execute(Keeping computed lint_file jobs running should work): + AssertEqual 'testlinter2', ale#linter#Get('foobar')[1].name + + call ale#engine#InitBufferInfo(bufnr('')) + + call ale#engine#MarkLinterActive( + \ g:ale_buffer_info[bufnr('')], + \ ale#linter#Get('foobar')[1] + \) + call ale#engine#RunLinters(bufnr(''), ale#linter#Get('foobar'), 0) + + Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list), + \ 'The active linter list was empty' + Assert ale#engine#IsCheckingBuffer(bufnr('')), + \ 'The IsCheckingBuffer function returned 0' diff --git a/sources_non_forked/ale/test/test_csslint_config_detection.vader b/sources_non_forked/ale/test/test_csslint_config_detection.vader new file mode 100644 index 00000000..c8e5fa98 --- /dev/null +++ b/sources_non_forked/ale/test/test_csslint_config_detection.vader @@ -0,0 +1,29 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + + runtime ale_linters/css/csslint.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(--config should be set when the .csslintrc file is found): + call ale#test#SetFilename('test-files/csslint/some-app/subdir/testfile.js') + + AssertEqual + \ ( + \ 'csslint --format=compact ' + \ . '--config=' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/csslint/some-app/.csslintrc')) + \ . ' %t' + \ ), + \ ale_linters#css#csslint#GetCommand(bufnr('')) + +Execute(--config should not be used when no .csslintrc file exists): + call ale#test#SetFilename('test-files/csslint/other-app/testfile.css') + + AssertEqual + \ ( + \ 'csslint --format=compact ' + \ . ' %t' + \ ), + \ ale_linters#css#csslint#GetCommand(bufnr('')) diff --git a/sources_non_forked/ale/test/test_cursor_warnings.vader b/sources_non_forked/ale/test/test_cursor_warnings.vader new file mode 100644 index 00000000..b767d225 --- /dev/null +++ b/sources_non_forked/ale/test/test_cursor_warnings.vader @@ -0,0 +1,256 @@ +Before: + Save g:ale_echo_msg_format + Save g:ale_echo_cursor + Save b:ale_lint_on_insert_leave + + let g:ale_echo_msg_format = '%code: %%s' + let b:ale_lint_on_insert_leave = 0 + + " We should prefer the error message at column 10 instead of the warning. + let g:ale_buffer_info = { + \ bufnr('%'): { + \ 'loclist': [ + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'bettercode', + \ 'nr': -1, + \ 'type': 'W', + \ 'code': 'semi', + \ 'text': 'Ignore me.', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'bettercode', + \ 'nr': -1, + \ 'type': 'E', + \ 'code': 'semi', + \ 'text': "Missing semicolon.\r", + \ 'detail': "Every statement should end with a semicolon\nsecond line", + \ }, + \ { + \ 'lnum': 1, + \ 'col': 14, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'bettercode', + \ 'nr': -1, + \ 'type': 'I', + \ 'text': 'Some information', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 10, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'bettercode', + \ 'nr': -1, + \ 'type': 'W', + \ 'code': 'space-infix-ops', + \ 'text': 'Infix operators must be spaced.', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 15, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'bettercode', + \ 'nr': -1, + \ 'type': 'E', + \ 'code': 'radix', + \ 'text': 'Missing radix parameter', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 1, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'bettercode', + \ 'nr': -1, + \ 'type': 'E', + \ 'text': 'lowercase error', + \ }, + \ ], + \ }, + \} + + " Turn off other features, we only care about this one feature in this test. + let g:ale_set_loclist = 0 + let g:ale_set_signs = 0 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 1 + + runtime autoload/ale/cursor.vim + + let g:last_message = '' + + function! ale#cursor#Echom(message) abort + let g:last_message = a:message + endfunction + + call ale#linter#Reset() + call ale#linter#PreventLoading('javascript') + +After: + Restore + + unlet! g:last_message + + runtime autoload/ale/cursor.vim + + call cursor(1, 1) + + let g:ale_set_loclist = 1 + let g:ale_set_signs = 1 + let g:ale_set_highlights = 1 + + let g:ale_buffer_info = {} + + unlet! g:output + unlet! b:ale_loclist_msg_format + + " Clearing the messages breaks tests on NeoVim for some reason, but all + " we need to do for these tests is just make it so the last message isn't + " carried over between test cases. + echomsg '' + + " Close the preview window if it's open. + if &filetype is# 'ale-preview' + noautocmd :q! + endif + + call ale#linter#Reset() + +Given javascript(A Javscript file with warnings/errors): + var x = 3 + 12345678 + var x = 5*2 + parseInt("10"); + // comment + +Execute(Messages should be shown for the correct lines): + call cursor(1, 1) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'semi: Missing semicolon.', g:last_message + +Execute(Messages should be shown for earlier columns): + call cursor(2, 1) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'space-infix-ops: Infix operators must be spaced.', g:last_message + +Execute(Messages should be shown for later columns): + call cursor(2, 16) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'radix: Missing radix parameter', g:last_message + +Execute(The message at the cursor should be shown when linting ends): + call cursor(1, 1) + call ale#engine#SetResults( + \ bufnr('%'), + \ g:ale_buffer_info[bufnr('%')].loclist, + \) + + AssertEqual 'semi: Missing semicolon.', g:last_message + +Execute(The message at the cursor should be shown on InsertLeave): + call cursor(2, 9) + doautocmd InsertLeave + + AssertEqual 'space-infix-ops: Infix operators must be spaced.', g:last_message + +Execute(ALEDetail should print 'detail' attributes): + call cursor(1, 1) + + ALEDetail + + AssertEqual + \ ['Every statement should end with a semicolon', 'second line'], + \ getline(1, '$') + +Execute(ALEDetail should print regular 'text' attributes): + call cursor(2, 10) + + ALEDetail + + " ALEDetail opens a window, so check the text in it. + AssertEqual + \ ['Infix operators must be spaced.'], + \ getline(1, '$') + +Execute(ALEDetail should not capitlise cursor messages): + call cursor(3, 1) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'lowercase error', g:last_message + +Execute(The linter name should be formatted into the message correctly): + let g:ale_echo_msg_format = '%linter%: %s' + + call cursor(2, 9) + call ale#cursor#EchoCursorWarning() + + AssertEqual + \ 'bettercode: Infix operators must be spaced.', + \ g:last_message + +Execute(The severity should be formatted into the message correctly): + let g:ale_echo_msg_format = '%severity%: %s' + + call cursor(2, 9) + call ale#cursor#EchoCursorWarning() + + AssertEqual + \ 'Warning: Infix operators must be spaced.', + \ g:last_message + + call cursor(1, 10) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'Error: Missing semicolon.', g:last_message + + call cursor(1, 14) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'Info: Some information', g:last_message + +Execute(The %code% and %ifcode% should show the code and some text): + let g:ale_echo_msg_format = '%(code) %%s' + + call cursor(2, 9) + call ale#cursor#EchoCursorWarning() + + AssertEqual + \ '(space-infix-ops) Infix operators must be spaced.', + \ g:last_message + +Execute(The %code% and %ifcode% should be removed when there's no code): + let g:ale_echo_msg_format = '%(code) %%s' + + call cursor(1, 14) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'Some information', g:last_message + +Execute(The buffer message format option should take precedence): + let g:ale_echo_msg_format = '%(code) %%s' + let b:ale_echo_msg_format = 'FOO %s' + + call cursor(1, 14) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'FOO Some information', g:last_message + +Execute(The cursor message shouldn't be echoed if the option is off): + let g:ale_echo_cursor = 0 + let g:last_message = 'foo' + + call cursor(1, 1) + call ale#cursor#EchoCursorWarning() + + AssertEqual 'foo', g:last_message diff --git a/sources_non_forked/ale/test/test_deferred_command_string.vader b/sources_non_forked/ale/test/test_deferred_command_string.vader new file mode 100644 index 00000000..173b6bb2 --- /dev/null +++ b/sources_non_forked/ale/test/test_deferred_command_string.vader @@ -0,0 +1,50 @@ +Before: + Save g:ale_run_synchronously + Save g:ale_emulate_job_failure + Save g:ale_buffer_info + + let g:ale_run_synchronously = 1 + let g:ale_buffer_info = {} + let b:ale_history = [] + + call ale#linter#Reset() + call ale#assert#SetUpLinterTestCommands() + call ale#linter#Define('foobar', { + \ 'name': 'lint_file_linter', + \ 'callback': 'LintFileCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 'foo'})})}, + \ 'read_buffer': 0, + \}) + + " Run the test commands in the shell. + let g:ale_run_synchronously_emulate_commands = 0 + +After: + Restore + + call ale#assert#TearDownLinterTest() + unlet! g:ale_run_synchronously_callbacks + +Given foobar (Some imaginary filetype): +Execute(It should be possible to compute an executable to check based on the result of commands): + AssertLinter has('win32') ? 'cmd' : 'echo', 'foo' + + ALELint + call ale#test#FlushJobs() + + AssertEqual + \ 1, + \ len(filter(copy(b:ale_history), 'string(v:val.command) =~# ''foo''')) + +Execute(It handle the deferred command failing): + let g:ale_emulate_job_failure = 1 + + AssertLinter has('win32') ? 'cmd' : 'echo', 0 + + ALELint + call ale#test#FlushJobs() + + AssertEqual + \ 0, + \ len(filter(copy(b:ale_history), 'string(v:val.command) =~# ''foo''')) diff --git a/sources_non_forked/ale/test/test_deferred_executable_string.vader b/sources_non_forked/ale/test/test_deferred_executable_string.vader new file mode 100644 index 00000000..3bdc5251 --- /dev/null +++ b/sources_non_forked/ale/test/test_deferred_executable_string.vader @@ -0,0 +1,46 @@ +Before: + Save g:ale_run_synchronously + Save g:ale_emulate_job_failure + Save g:ale_buffer_info + + let g:ale_run_synchronously = 1 + let g:ale_buffer_info = {} + let b:ale_history = [] + + call ale#linter#Reset() + call ale#assert#SetUpLinterTestCommands() + call ale#linter#Define('foobar', { + \ 'name': 'lint_file_linter', + \ 'callback': 'LintFileCallback', + \ 'executable': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 'foo'})})}, + \ 'command': 'echo', + \ 'read_buffer': 0, + \}) + +After: + Restore + + call ale#assert#TearDownLinterTest() + +Given foobar (Some imaginary filetype): +Execute(It should be possible to compute an executable to check based on the result of commands): + AssertLinter 'foo', 'echo' + + ALELint + call ale#test#FlushJobs() + + AssertEqual + \ [{'status': 0, 'job_id': 'executable', 'command': 'foo'}], + \ filter(copy(b:ale_history), 'v:val.job_id is# ''executable''') + +Execute(It handle the deferred command failing): + let g:ale_emulate_job_failure = 1 + + AssertLinter 0, 'echo' + + ALELint + call ale#test#FlushJobs() + + AssertEqual + \ [], + \ filter(copy(b:ale_history), 'v:val.job_id is# ''executable''') diff --git a/sources_non_forked/ale/test/test_deno_executable_detection.vader b/sources_non_forked/ale/test/test_deno_executable_detection.vader new file mode 100644 index 00000000..87690bfe --- /dev/null +++ b/sources_non_forked/ale/test/test_deno_executable_detection.vader @@ -0,0 +1,20 @@ +Before: + Save g:ale_deno_executable + runtime autoload/ale/handlers/deno.vim + +After: + unlet! b:ale_deno_executable + + call ale#linter#Reset() + +Execute(Default executable should be detected correctly): + AssertEqual + \ 'deno', + \ ale#handlers#deno#GetExecutable(bufnr('')) + +Execute(User specified executable should override default): + let g:ale_deno_executable = '/path/to/deno-bin' + AssertEqual + \ '/path/to/deno-bin', + \ ale#handlers#deno#GetExecutable(bufnr('')) + diff --git a/sources_non_forked/ale/test/test_disabling_ale.vader b/sources_non_forked/ale/test/test_disabling_ale.vader new file mode 100644 index 00000000..6159f793 --- /dev/null +++ b/sources_non_forked/ale/test/test_disabling_ale.vader @@ -0,0 +1,119 @@ +Before: + Save g:ale_buffer_info + Save g:ale_enabled + Save b:ale_enabled + Save g:ale_maximum_file_size + Save b:ale_maximum_file_size + + function! SetUpCursorData() + let g:ale_buffer_info = { + \ bufnr('%'): { + \ 'loclist': [ + \ { + \ 'lnum': 2, + \ 'col': 10, + \ 'linter_name': 'testlinter', + \ 'type': 'W', + \ 'text': 'X' + \ }, + \ ], + \ }, + \} + + call cursor(2, 16) + endfunction + + function! TestCallback(buffer, output) + return [] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': 'echo', + \ 'command': 'true', + \}) + + function GetLastMessage() + redir => l:output + silent mess + redir END + + let l:lines = split(l:output, "\n") + + return empty(l:lines) ? '' : l:lines[-1] + endfunction + + echomsg '' + +After: + Restore + call ale#linter#Reset() + delfunction TestCallback + delfunction GetLastMessage + delfunction SetUpCursorData + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(Linting shouldn't happen when ALE is disabled globally): + let g:ale_enabled = 0 + let g:ale_buffer_info = {} + + call ale#Queue(0) + + AssertEqual {}, g:ale_buffer_info + +Execute(Linting shouldn't happen when the file is too large with a global options): + let g:ale_maximum_file_size = 12 + let g:ale_buffer_info = {} + + call ale#Queue(0) + + AssertEqual {}, g:ale_buffer_info + +Execute(Linting shouldn't happen when ALE is disabled locally): + let b:ale_enabled = 0 + let g:ale_buffer_info = {} + + call ale#Queue(0) + + AssertEqual {}, g:ale_buffer_info + +Execute(Linting shouldn't happen when the file is too large with a local options): + let b:ale_maximum_file_size = 12 + let g:ale_buffer_info = {} + + call ale#Queue(0) + + AssertEqual {}, g:ale_buffer_info + +Execute(Cursor warnings shouldn't be echoed when ALE is disabled globally): + let g:ale_enabled = 0 + + call SetUpCursorData() + call ale#cursor#EchoCursorWarning() + AssertEqual '', GetLastMessage() + +Execute(Cursor warnings shouldn't be echoed when the file is too large with global options): + let g:ale_maximum_file_size = 12 + + call SetUpCursorData() + call ale#cursor#EchoCursorWarning() + AssertEqual '', GetLastMessage() + +Execute(Cursor warnings shouldn't be echoed when ALE is disabled locally): + let b:ale_enabled = 0 + + call SetUpCursorData() + call ale#cursor#EchoCursorWarning() + AssertEqual '', GetLastMessage() + +Execute(Cursor warnings shouldn't be echoed when the file is too large with local options): + let b:ale_maximum_file_size = 12 + + call SetUpCursorData() + call ale#cursor#EchoCursorWarning() + AssertEqual '', GetLastMessage() diff --git a/sources_non_forked/ale/test/test_dockerfile_hadolint_linter.vader b/sources_non_forked/ale/test/test_dockerfile_hadolint_linter.vader new file mode 100644 index 00000000..6e02b212 --- /dev/null +++ b/sources_non_forked/ale/test/test_dockerfile_hadolint_linter.vader @@ -0,0 +1,90 @@ +" NOTE: We use the 'b:' forms below to ensure that we're properly using +" ale#Var() + +Given dockerfile: + # + +Before: + Save g:ale_dockerfile_hadolint_use_docker + Save g:ale_dockerfile_hadolint_docker_image + silent! unlet g:ale_dockerfile_hadolint_use_docker + silent! unlet g:ale_dockerfile_hadolint_docker_image + + " enable loading inside test container + silent! cd /testplugin + source ale_linters/dockerfile/hadolint.vim + + +After: + Restore + silent! unlet b:ale_dockerfile_hadolint_use_docker + silent! unlet b:ale_dockerfile_hadolint_docker_image + + +Execute(linter honors ..._use_docker correctly): + + " default: never + AssertEqual + \ 'hadolint', + \ ale_linters#dockerfile#hadolint#GetExecutable(bufnr('')) + + " explicit never + let b:ale_dockerfile_hadolint_use_docker = 'never' + AssertEqual + \ 'hadolint', + \ ale_linters#dockerfile#hadolint#GetExecutable(bufnr('')) + + let b:ale_dockerfile_hadolint_use_docker = 'always' + AssertEqual + \ 'docker', + \ ale_linters#dockerfile#hadolint#GetExecutable(bufnr('')) + + " hadolint if present, otherwise docker + let command = 'docker' + if executable('hadolint') + let command = 'hadolint' + endif + + let b:ale_dockerfile_hadolint_use_docker = 'yes' + AssertEqual + \ command, + \ ale_linters#dockerfile#hadolint#GetExecutable(bufnr('')) + + +Execute(command is correct when using docker): + let b:ale_dockerfile_hadolint_use_docker = 'always' + + AssertEqual + \ "docker run --rm -i hadolint/hadolint hadolint --no-color -", + \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) + + +Execute(command is correct when not docker): + let b:ale_dockerfile_hadolint_use_docker = 'never' + + AssertEqual + \ "hadolint --no-color -", + \ ale_linters#dockerfile#hadolint#GetCommand(bufnr('')) + +Execute(test warnings from hadolint): + AssertEqual + \ [{'lnum': 10, 'col': 0, 'type': 'W', 'code': 'DL3007', 'text': 'DL3007: Using latest is prone to errors', 'detail': "DL3007 ( https://github.com/hadolint/hadolint/wiki/DL3007 )\n\nUsing latest is prone to errors"}], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ '-:10 DL3007 warning: Using latest is prone to errors', + \ ]) + +Execute(test warnings from shellcheck): + AssertEqual + \ [{'lnum': 3, 'col': 0, 'type': 'W', 'code': 'SC2154', 'text': 'SC2154: bar is referenced but not assigned.', 'detail': "SC2154 ( https://github.com/koalaman/shellcheck/wiki/SC2154 )\n\nbar is referenced but not assigned."}], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ '-:3 SC2154 warning: bar is referenced but not assigned.', + \ ]) + +Execute(test errors from dockerfile parser): + AssertEqual + \ [{'lnum': 3, 'col': 4, 'type': 'E', 'text': 'unexpected "A" expecting at least one space after ''RUN''', 'detail': 'hadolint could not parse the file because of a syntax error.'}], + \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [ + \ "/dev/stdin:3:4 unexpected \"A\" expecting at least one space after 'RUN'", + \ ]) + +" fin... diff --git a/sources_non_forked/ale/test/test_env_function.vader b/sources_non_forked/ale/test/test_env_function.vader new file mode 100644 index 00000000..856a3f57 --- /dev/null +++ b/sources_non_forked/ale/test/test_env_function.vader @@ -0,0 +1,8 @@ +Execute(ale#Env should produce the correct syntax): + if has('win32') + AssertEqual 'set name=xxx && ', ale#Env('name', 'xxx') + AssertEqual 'set name="foo bar" && ', ale#Env('name', 'foo bar') + else + AssertEqual 'name=''xxx'' ', ale#Env('name', 'xxx') + AssertEqual 'name=''foo bar'' ', ale#Env('name', 'foo bar') + endif diff --git a/sources_non_forked/ale/test/test_errors_removed_after_filetype_changed.vader b/sources_non_forked/ale/test/test_errors_removed_after_filetype_changed.vader new file mode 100644 index 00000000..7c6c55af --- /dev/null +++ b/sources_non_forked/ale/test/test_errors_removed_after_filetype_changed.vader @@ -0,0 +1,78 @@ +Before: + Save &filetype + Save g:ale_buffer_info + Save g:ale_echo_cursor + Save g:ale_run_synchronously + Save g:ale_set_highlights + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + + let g:ale_buffer_info = {} + + " Enable only the one feature we need. + let g:ale_set_signs = 0 + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 1 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + + let g:ale_run_synchronously = 1 + unlet! g:ale_run_synchronously_callbacks + call setloclist(0, []) + + noautocmd let &filetype = 'foobar' + + function! TestCallback(buffer, output) + return [{'text': 'x', 'lnum': 1}] + endfunction + + call ale#linter#PreventLoading('foobar') + call ale#linter#Define('foobar', { + \ 'name': 'buffer_linter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd': 'true', + \ 'command': 'true', + \ 'read_buffer': 0, + \}) + call ale#linter#PreventLoading('foobar2') + call ale#linter#Define('foobar2', { + \ 'name': 'buffer_linter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd': 'true', + \ 'command': 'true', + \ 'read_buffer': 0, + \}) + +After: + Restore + + unlet! g:ale_run_synchronously_callbacks + delfunction TestCallback + + call ale#linter#Reset() + call setloclist(0, []) + +Execute(Error should be removed when the filetype changes to something else we cannot check): + call ale#Queue(0) + call ale#test#FlushJobs() + sleep 1ms + + AssertEqual 1, len(ale#test#GetLoclistWithoutNewerKeys()) + + noautocmd let &filetype = 'foobar2' + + call ale#Queue(0) + call ale#test#FlushJobs() + sleep 1ms + + " We should get some items from the second filetype. + AssertEqual 1, len(ale#test#GetLoclistWithoutNewerKeys()) + + noautocmd let &filetype = 'xxx' + + call ale#Queue(0) + call ale#test#FlushJobs() + sleep 1ms + + AssertEqual 0, len(ale#test#GetLoclistWithoutNewerKeys()) diff --git a/sources_non_forked/ale/test/test_filename_mapping.vader b/sources_non_forked/ale/test/test_filename_mapping.vader new file mode 100644 index 00000000..e9af539a --- /dev/null +++ b/sources_non_forked/ale/test/test_filename_mapping.vader @@ -0,0 +1,62 @@ +Before: + Save g:ale_filename_mappings + Save b:ale_filename_mappings + + let g:ale_filename_mappings = {} + unlet! b:ale_filename_mappings + +After: + Restore + +Execute(ale#GetFilenameMappings should return the correct mappings for given linters/fixers): + let g:ale_filename_mappings = {'a': [['foo', 'bar']], 'b': [['baz', 'foo']]} + + AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), 'a') + AssertEqual [['baz', 'foo']], ale#GetFilenameMappings(bufnr(''), 'b') + AssertEqual [], ale#GetFilenameMappings(bufnr(''), 'c') + + let b:ale_filename_mappings = {'b': [['abc', 'xyz']]} + + AssertEqual [], ale#GetFilenameMappings(bufnr(''), 'a') + AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), 'b') + AssertEqual [], ale#GetFilenameMappings(bufnr(''), 'c') + +Execute(ale#GetFilenameMappings should return Lists set for use with all tools): + let g:ale_filename_mappings = [['foo', 'bar']] + + AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), 'a') + AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), '') + AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), v:null) + + let b:ale_filename_mappings = [['abc', 'xyz']] + + AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), 'a') + AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), '') + AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), v:null) + +Execute(ale#GetFilenameMappings should let you use * as a fallback): + let g:ale_filename_mappings = {'a': [['foo', 'bar']], '*': [['abc', 'xyz']]} + + AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), 'a') + AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), 'b') + AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), '') + AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), v:null) + +Execute(ale#filename_mapping#Invert should invert filename mappings): + AssertEqual + \ [['b', 'a'], ['y', 'x']], + \ ale#filename_mapping#Invert([['a', 'b'], ['x', 'y']]) + \ +Execute(ale#filename_mapping#Map return the filename as-is if there are no mappings): + AssertEqual + \ '/foo//bar', + \ ale#filename_mapping#Map('/foo//bar', [['/bar', '/data/']]) + +Execute(ale#filename_mapping#Map should map filenames): + AssertEqual + \ '/data/bar', + \ ale#filename_mapping#Map('/foo//bar', [ + \ ['/data/', '/baz/'], + \ ['/foo/', '/data/'], + \ ['/foo/', '/xyz/'], + \ ]) diff --git a/sources_non_forked/ale/test/test_filerename.vader b/sources_non_forked/ale/test/test_filerename.vader new file mode 100644 index 00000000..c91b3556 --- /dev/null +++ b/sources_non_forked/ale/test/test_filerename.vader @@ -0,0 +1,224 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.txt') + + let g:old_filename = expand('%:p') + let g:Callback = '' + let g:expr_list = [] + let g:message_list = [] + let g:handle_code_action_called = 0 + let g:code_actions = [] + let g:options = {} + let g:capability_checked = '' + let g:conn_id = v:null + let g:InitCallback = v:null + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/filerename.vim + runtime autoload/ale/code_action.vim + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + + if a:linter.lsp is# 'tsserver' + call ale#lsp#MarkConnectionAsTsserver(g:conn_id) + endif + + let l:details = { + \ 'command': 'foobar', + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \} + + let g:InitCallback = {-> ale#lsp_linter#OnInit(a:linter, l:details, a:Callback)} + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#Execute(expr) abort + call add(g:expr_list, a:expr) + endfunction + + function! ale#code_action#HandleCodeAction(code_action, options) abort + let g:handle_code_action_called = 1 + Assert get(a:options, 'should_save') + call add(g:code_actions, a:code_action) + endfunction + + function! ale#util#Input(message, value, completion) abort + return 'a-new-name' + endfunction + + call ale#filerename#SetMap({ + \ 3: { + \ 'old_name': 'oldName', + \ 'new_name': 'aNewName', + \ }, + \}) + +After: + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + call ale#filerename#SetMap({}) + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:capability_checked + unlet! g:InitCallback + unlet! g:old_filename + unlet! g:conn_id + unlet! g:Callback + unlet! g:message_list + unlet! g:expr_list + unlet! b:ale_linters + unlet! g:options + unlet! g:code_actions + unlet! g:handle_code_action_called + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/filerename.vim + runtime autoload/ale/code_action.vim + +Execute(Other messages for the tsserver handler should be ignored): + call ale#filerename#HandleTSServerResponse(1, {'command': 'foo'}) + AssertEqual g:handle_code_action_called, 0 + +Execute(Failed file rename responses should be handled correctly): + call ale#filerename#SetMap({3: {'old_name': 'oldName', 'new_name': 'a-test'}}) + call ale#filerename#HandleTSServerResponse( + \ 1, + \ {'command': 'getEditsForFileRename', 'request_seq': 3} + \) + AssertEqual g:handle_code_action_called, 0 + +Given typescript(Some typescript file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Code actions from tsserver should be handled): + call ale#filerename#HandleTSServerResponse(1, { + \ 'command': 'getEditsForFileRename', + \ 'seq': 0, + \ 'request_seq': 3, + \ 'type': 'response', + \ 'success': v:true, + \ 'body': [ + \ { + \ 'fileName': '/foo/bar/file1.tsx', + \ 'textChanges': [ + \ { + \ 'end': {'offset': 55, 'line': 22}, + \ 'newText': './file2', + \ 'start': {'offset': 34, 'line': 22}, + \ } + \ ] + \ } + \ ], + \}) + + AssertEqual + \ [ + \ { + \ 'description': 'filerename', + \ 'changes': [ + \ { + \ 'fileName': '/foo/bar/file1.tsx', + \ 'textChanges': [ + \ { + \ 'end': {'offset': 55, 'line': 22}, + \ 'newText': './file2', + \ 'start': {'offset': 34, 'line': 22}, + \ } + \ ] + \ } + \ ], + \ } + \ ], + \ g:code_actions + +Execute(HandleTSServerResponse does nothing when no data in filerename_map): + call ale#filerename#HandleTSServerResponse(1, { + \ 'command': 'getEditsForFileRename', + \ 'request_seq': -9, + \ 'success': v:true, + \ 'body': {} + \}) + + AssertEqual g:handle_code_action_called, 0 + +Execute(Prints a tsserver error message when unsuccessful): + call ale#filerename#HandleTSServerResponse(1, { + \ 'command': 'getEditsForFileRename', + \ 'request_seq': 3, + \ 'success': v:false, + \ 'message': 'This file cannot be renamed', + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''Error renaming file "oldName" to "aNewName". ' . + \ 'Reason: This file cannot be renamed'''], g:expr_list + +Execute(Does nothing when no changes): + call ale#filerename#HandleTSServerResponse(1, { + \ 'command': 'getEditsForFileRename', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [], + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''No changes while renaming "oldName" to "aNewName"'''], g:expr_list + +Execute(tsserver file rename requests should be sent): + call ale#filerename#SetMap({}) + call ale#linter#Reset() + + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEFileRename + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'filerename', g:capability_checked + AssertEqual + \ 'function(''ale#filerename#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@getEditsForFileRename', { + \ 'oldFilePath': expand('%:p'), + \ 'newFilePath': 'a-new-name', + \ }] + \ ], + \ g:message_list + AssertEqual {'42': {'old_name': expand('%:p'), 'new_name': 'a-new-name'}}, + \ ale#filerename#GetMap() diff --git a/sources_non_forked/ale/test/test_filetype_linter_defaults.vader b/sources_non_forked/ale/test/test_filetype_linter_defaults.vader new file mode 100644 index 00000000..0f463880 --- /dev/null +++ b/sources_non_forked/ale/test/test_filetype_linter_defaults.vader @@ -0,0 +1,137 @@ +Before: + Save g:ale_linters + Save g:ale_linters_explicit + + let g:ale_linters_explicit = 0 + let g:ale_linters = {} + + function! GetLinterNames(filetype) abort + return sort(map(ale#linter#Get(a:filetype), 'v:val.name')) + endfunction + +After: + Restore + + call ale#linter#Reset() + +Execute(The defaults for the apkbuild filetype should be correct): + AssertEqual ['apkbuild_lint', 'secfixes_check'], GetLinterNames('apkbuild') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('apkbuild') + +Execute(The defaults for the csh filetype should be correct): + AssertEqual ['shell'], GetLinterNames('csh') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('csh') + +Execute(The defaults for the elixir filetype should be correct): + AssertEqual ['credo', 'dialyxir', 'dogma'], GetLinterNames('elixir') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('elixir') + +Execute(The defaults for the go filetype should be correct): + AssertEqual ['gofmt', 'golint', 'gopls', 'govet'], GetLinterNames('go') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('go') + +Execute(The defaults for the hack filetype should be correct): + AssertEqual ['hack'], GetLinterNames('hack') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('hack') + +Execute(The defaults for the help filetype should be correct): + AssertEqual [], GetLinterNames('help') + +Execute(The defaults for the inko filetype should be correct): + AssertEqual ['inko'], GetLinterNames('inko') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('inko') + +Execute(The defaults for the json filetype should be correct): + AssertEqual ['jsonlint', 'spectral', 'vscodejson'], GetLinterNames('json') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('json') + +Execute(The defaults for the json5 filetype should be correct): + AssertEqual [], GetLinterNames('json5') + +Execute(The defaults for the jsonc filetype should be correct): + AssertEqual [], GetLinterNames('jsonc') + +Execute(The defaults for the perl filetype should be correct): + AssertEqual ['perlcritic'], GetLinterNames('perl') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('perl') + +Execute(The defaults for the perl6 filetype should be correct): + AssertEqual [], GetLinterNames('perl6') + +Execute(The defaults for the python filetype should be correct): + AssertEqual ['flake8', 'mypy', 'pylint', 'pyright'], GetLinterNames('python') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('python') + +Execute(The defaults for the rust filetype should be correct): + AssertEqual ['cargo', 'rls'], GetLinterNames('rust') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('rust') + +Execute(The defaults for the spec filetype should be correct): + AssertEqual [], GetLinterNames('spec') + +Execute(The defaults for the text filetype should be correct): + AssertEqual [], GetLinterNames('text') + +Execute(The defaults for the vue filetype should be correct): + AssertEqual ['eslint', 'vls'], GetLinterNames('vue') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('vue') + +Execute(The defaults for the zsh filetype should be correct): + AssertEqual ['shell'], GetLinterNames('zsh') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('zsh') + +Execute(The defaults for the verilog filetype should be correct): + " This filetype isn't configured with default, so we can test loading all + " available linters with this. + AssertEqual ['hdl-checker', 'iverilog', 'verilator', 'vlog', 'xvlog', 'yosys'], GetLinterNames('verilog') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('verilog') + +Execute(The defaults for the vader filetype should be correct): + AssertEqual ['vimls'], GetLinterNames('vader') + + let g:ale_linters_explicit = 1 + + AssertEqual [], GetLinterNames('vader') + +Execute(Default aliases for React should be defined): + AssertEqual ['javascript', 'jsx'], ale#linter#ResolveFiletype('javascriptreact') + AssertEqual ['typescript', 'tsx'], ale#linter#ResolveFiletype('typescriptreact') diff --git a/sources_non_forked/ale/test/test_filetype_mapping.vader b/sources_non_forked/ale/test/test_filetype_mapping.vader new file mode 100644 index 00000000..2d72491d --- /dev/null +++ b/sources_non_forked/ale/test/test_filetype_mapping.vader @@ -0,0 +1,29 @@ +Before: + augroup TestFiletypeGroup + autocmd! + autocmd BufEnter,BufRead *.x setf xfiletype + autocmd BufEnter,BufRead *.y set filetype=yfiletype + autocmd BufEnter,BufRead *.z setlocal filetype=zfiletype + autocmd BufEnter,BufRead *.jsx set filetype=javascript.jsx + augroup END + +After: + unlet! g:map + augroup TestFiletypeGroup + autocmd! + augroup END + augroup! TestFiletypeGroup + +Execute(ALE should parse autocmd filetypes correctly): + let g:map = ale#filetypes#LoadExtensionMap() + + AssertEqual '.x', g:map['xfiletype'] + AssertEqual '.y', g:map['yfiletype'] + AssertEqual '.z', g:map['zfiletype'] + AssertEqual '.jsx', g:map['javascript.jsx'] + +Execute(ALE should guess file extensions appropriately): + " The whole string should be used, if there's a match. + AssertEqual '.jsx', ale#filetypes#GuessExtension('javascript.jsx') + " The first part should be used. + AssertEqual '.x', ale#filetypes#GuessExtension('xfiletype.yfiletype') diff --git a/sources_non_forked/ale/test/test_find_nearest_directory.vader b/sources_non_forked/ale/test/test_find_nearest_directory.vader new file mode 100644 index 00000000..740668da --- /dev/null +++ b/sources_non_forked/ale/test/test_find_nearest_directory.vader @@ -0,0 +1,17 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + +Execute(We should be able to find a directory some directory down): + call ale#test#SetFilename('test-files/top/middle/bottom/dummy.txt') + + AssertEqual + \ ale#path#Simplify(expand('%:p:h:h:h:h:h') . '/test-files/top/ale-special-directory-name-dont-use-this-please/'), + \ ale#path#FindNearestDirectory(bufnr('%'), 'ale-special-directory-name-dont-use-this-please') + +Execute(We shouldn't find anything for files which don't match): + AssertEqual + \ '', + \ ale#path#FindNearestDirectory(bufnr('%'), 'ale-this-should-never-match-anything') diff --git a/sources_non_forked/ale/test/test_find_references.vader b/sources_non_forked/ale/test/test_find_references.vader new file mode 100644 index 00000000..01c15469 --- /dev/null +++ b/sources_non_forked/ale/test/test_find_references.vader @@ -0,0 +1,480 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.txt') + + Save g:ale_default_navigation + + let g:old_filename = expand('%:p') + let g:Callback = '' + let g:expr_list = [] + let g:message_list = [] + let g:preview_called = 0 + let g:item_list = [] + let g:options = {} + let g:capability_checked = '' + let g:conn_id = v:null + let g:InitCallback = v:null + let g:ale_default_navigation = 'buffer' + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/preview.vim + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + + if a:linter.lsp is# 'tsserver' + call ale#lsp#MarkConnectionAsTsserver(g:conn_id) + endif + + let l:details = { + \ 'command': 'foobar', + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \} + + let g:InitCallback = {-> ale#lsp_linter#OnInit(a:linter, l:details, a:Callback)} + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#Execute(expr) abort + call add(g:expr_list, a:expr) + endfunction + + function! ale#preview#ShowSelection(item_list, options) abort + let g:preview_called = 1 + let g:item_list = a:item_list + let g:options = a:options + + call ale#preview#SetLastSelection(a:item_list, a:options) + endfunction + +After: + Restore + + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + call ale#references#SetMap({}) + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:capability_checked + unlet! g:InitCallback + unlet! g:old_filename + unlet! g:conn_id + unlet! g:Callback + unlet! g:message_list + unlet! g:expr_list + unlet! b:ale_linters + unlet! g:options + unlet! g:item_list + unlet! g:preview_called + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/preview.vim + +Execute(Other messages for the tsserver handler should be ignored): + call ale#references#HandleTSServerResponse(1, {'command': 'foo'}) + +Execute(Failed reference responses should be handled correctly): + call ale#references#SetMap({3: {}}) + call ale#references#HandleTSServerResponse( + \ 1, + \ {'command': 'references', 'request_seq': 3} + \) + AssertEqual {}, ale#references#GetMap() + +Given typescript(Some typescript file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Results should be shown for tsserver responses): + " We should remember these options when we repeat the selection. + call ale#references#SetMap( + \ { + \ 3: { + \ 'ignorethis': 'x', + \ 'open_in': 'tab', + \ 'use_relative_paths': 1, + \ } + \ } + \) + call ale#references#HandleTSServerResponse(1, { + \ 'command': 'references', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'symbolStartOffset': 9, + \ 'refs': [ + \ { + \ 'file': '/foo/bar/app.ts', + \ 'isWriteAccess': v:true, + \ 'lineText': 'import {doSomething} from ''./whatever''', + \ 'end': {'offset': 24, 'line': 9}, + \ 'start': {'offset': 9, 'line': 9}, + \ 'isDefinition': v:true, + \ }, + \ { + \ 'file': '/foo/bar/app.ts', + \ 'isWriteAccess': v:false, + \ 'lineText': ' doSomething()', + \ 'end': {'offset': 18, 'line': 804}, + \ 'start': {'offset': 3, 'line': 804}, + \ 'isDefinition': v:false, + \ }, + \ { + \ 'file': '/foo/bar/other/app.ts', + \ 'isWriteAccess': v:false, + \ 'lineText': ' doSomething()', + \ 'end': {'offset': 18, 'line': 51}, + \ 'start': {'offset': 3, 'line': 51}, + \ 'isDefinition': v:false, + \ }, + \ ], + \ 'symbolDisplayString': 'import doSomething', + \ 'symbolName': 'doSomething()', + \ }, + \}) + + AssertEqual + \ [ + \ {'filename': '/foo/bar/app.ts', 'column': 9, 'line': 9, 'match': 'import {doSomething} from ''./whatever'''}, + \ {'filename': '/foo/bar/app.ts', 'column': 3, 'line': 804, 'match': 'doSomething()'}, + \ {'filename': '/foo/bar/other/app.ts', 'column': 3, 'line': 51, 'match': 'doSomething()'}, + \ ], + \ g:item_list + AssertEqual {}, ale#references#GetMap() + + " We should be able to repeat selections with ALERepeatSelection + let g:item_list = [] + ALERepeatSelection + + AssertEqual + \ [ + \ {'filename': '/foo/bar/app.ts', 'column': 9, 'line': 9, 'match': 'import {doSomething} from ''./whatever'''}, + \ {'filename': '/foo/bar/app.ts', 'column': 3, 'line': 804, 'match': 'doSomething()'}, + \ {'filename': '/foo/bar/other/app.ts', 'column': 3, 'line': 51, 'match': 'doSomething()'}, + \ ], + \ g:item_list + AssertEqual {}, ale#references#GetMap() + AssertEqual + \ { + \ 'open_in': 'tab', + \ 'use_relative_paths': 1, + \ }, + \ g:options + +Execute(Results should be put to quickfix for tsserver responses): + call ale#references#SetMap( + \ { + \ 3: { + \ 'ignorethis': 'x', + \ 'open_in': 'quickfix', + \ } + \ } + \) + call ale#references#HandleTSServerResponse(1, { + \ 'command': 'references', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'symbolStartOffset': 9, + \ 'refs': [ + \ { + \ 'file': '/foo/bar/app.ts', + \ 'isWriteAccess': v:true, + \ 'lineText': 'import {doSomething} from ''./whatever''', + \ 'end': {'offset': 24, 'line': 9}, + \ 'start': {'offset': 9, 'line': 9}, + \ 'isDefinition': v:true, + \ }, + \ { + \ 'file': '/foo/bar/app.ts', + \ 'isWriteAccess': v:false, + \ 'lineText': ' doSomething()', + \ 'end': {'offset': 18, 'line': 804}, + \ 'start': {'offset': 3, 'line': 804}, + \ 'isDefinition': v:false, + \ }, + \ { + \ 'file': '/foo/bar/other/app.ts', + \ 'isWriteAccess': v:false, + \ 'lineText': ' doSomething()', + \ 'end': {'offset': 18, 'line': 51}, + \ 'start': {'offset': 3, 'line': 51}, + \ 'isDefinition': v:false, + \ }, + \ ], + \ 'symbolDisplayString': 'import doSomething', + \ 'symbolName': 'doSomething()', + \ }, + \}) + + AssertEqual + \ 3, + \ len(getqflist()) + AssertEqual {}, ale#references#GetMap() + +Execute(The preview window should not be opened for empty tsserver responses): + call ale#references#SetMap({3: {}}) + call ale#references#HandleTSServerResponse(1, { + \ 'command': 'references', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'symbolStartOffset': 9, + \ 'refs': [ + \ ], + \ 'symbolDisplayString': 'import doSomething', + \ 'symbolName': 'doSomething()', + \ }, + \}) + + Assert !g:preview_called + AssertEqual {}, ale#references#GetMap() + AssertEqual ['echom ''No references found.'''], g:expr_list + +Execute(tsserver reference requests should be sent): + call ale#linter#Reset() + + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEFindReferences + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'references', g:capability_checked + AssertEqual + \ 'function(''ale#references#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@references', {'file': expand('%:p'), 'line': 2, 'offset': 5}] + \ ], + \ g:message_list + AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap() + +Execute('-relative' argument should enable 'use_relative_paths' in HandleTSServerResponse): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEFindReferences -relative + + call g:InitCallback() + + AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap() + +Execute(`-tab` should display results in tabs): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEFindReferences -tab + + call g:InitCallback() + + AssertEqual {'42': {'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap() + +Execute(The default navigation type should be used): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + let g:ale_default_navigation = 'tab' + ALEFindReferences + + call g:InitCallback() + + AssertEqual {'42': {'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap() + +Execute(`-split` should display results in splits): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEFindReferences -split + + call g:InitCallback() + + AssertEqual {'42': {'open_in': 'split', 'use_relative_paths': 0}}, ale#references#GetMap() + +Execute(`-vsplit` should display results in vsplits): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEFindReferences -vsplit + + call g:InitCallback() + + AssertEqual {'42': {'open_in': 'vsplit', 'use_relative_paths': 0}}, ale#references#GetMap() + +Execute(`-quickfix` should display results in quickfix): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEFindReferences -quickfix + + call g:InitCallback() + + AssertEqual {'42': {'open_in': 'quickfix', 'use_relative_paths': 0}}, ale#references#GetMap() + +Given python(Some Python file): + foo + somelongerline + bazxyzxyzxyz + +Execute(LSP reference responses should be handled): + call ale#references#SetMap({3: {}}) + call ale#references#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': [ + \ { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'range': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')), + \ 'range': { + \ 'start': {'line': 7, 'character': 15}, + \ }, + \ }, + \ ], + \ } + \) + + AssertEqual + \ [ + \ { + \ 'filename': ale#path#Simplify(g:dir . '/completion_dummy_file'), + \ 'line': 3, + \ 'column': 8, + \ }, + \ { + \ 'filename': ale#path#Simplify(g:dir . '/other_file'), + \ 'line': 8, + \ 'column': 16, + \ }, + \ ], + \ g:item_list + AssertEqual {}, ale#references#GetMap() + +Execute(LSP reference responses should be put to quickfix): + call ale#references#SetMap({3: { 'open_in': 'quickfix' }}) + call ale#references#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': [ + \ { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'range': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')), + \ 'range': { + \ 'start': {'line': 7, 'character': 15}, + \ }, + \ }, + \ ], + \ } + \) + + AssertEqual + \ 2, + \ len(getqflist()) + +Execute(Preview windows should not be opened for empty LSP reference responses): + call ale#references#SetMap({3: {}}) + call ale#references#HandleLSPResponse(1, {'id': 3, 'result': []}) + + Assert !g:preview_called + AssertEqual {}, ale#references#GetMap() + AssertEqual ['echom ''No references found.'''], g:expr_list + +Execute(LSP reference responses with a null result should be handled): + call ale#references#SetMap({3: {}}) + call ale#references#HandleLSPResponse(1, {'id': 3, 'result': v:null}) + + Assert !g:preview_called + AssertEqual {}, ale#references#GetMap() + AssertEqual ['echom ''No references found.'''], g:expr_list + +Execute(LSP reference requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEFindReferences + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'references', g:capability_checked + AssertEqual + \ 'function(''ale#references#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/references', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ 'context': {'includeDeclaration': v:false}, + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap() + +Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResponse): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEFindReferences -relative + + call g:InitCallback() + + AssertEqual {'42': {'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap() diff --git a/sources_non_forked/ale/test/test_floating_preview.vader b/sources_non_forked/ale/test/test_floating_preview.vader new file mode 100644 index 00000000..43415556 --- /dev/null +++ b/sources_non_forked/ale/test/test_floating_preview.vader @@ -0,0 +1,92 @@ +Before: + let g:ale_floating_preview = 0 + let g:ale_hover_to_floating_preview = 0 + let g:ale_detail_to_floating_preview = 0 + + runtime autoload/ale/floating_preview.vim + + let g:floated_lines = [] + let g:floating_preview_show_called = 0 + + " Stub out so we can track the call + function! ale#floating_preview#Show(lines, ...) abort + let g:floating_preview_show_called = 1 + let g:floated_lines = a:lines + endfunction + + let g:ale_buffer_info = { + \ bufnr('%'): { + \ 'loclist': [ + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'notalinter', + \ 'nr': -1, + \ 'type': 'E', + \ 'code': 'semi', + \ 'text': "Missing semicolon.\r", + \ 'detail': "Every statement should end with a semicolon\nsecond line", + \ }, + \ ], + \ } + \} + + call ale#linter#Reset() + call ale#linter#PreventLoading('javascript') + +After: + Restore + + let g:ale_floating_preview = 0 + let g:ale_hover_to_floating_preview = 0 + let g:ale_detail_to_floating_preview = 0 + + call cursor(1, 1) + + let g:ale_buffer_info = {} + + " Close the preview window if it's open. + if &filetype is# 'ale-preview' + noautocmd :q! + endif + + call ale#linter#Reset() + + +Given javascript(A file with warnings/errors): + var x = 3 + 12345678 + var x = 5*2 + parseInt("10"); + // comment + +Execute(Floating preview is used with ALEDetail when g:ale_floating_preview set): + let g:ale_floating_preview = 1 + + call cursor(1, 10) + + ALEDetail + + let expected = ["Every statement should end with a semicolon", "second line"] + + AssertEqual 1, g:floating_preview_show_called + AssertEqual expected, g:floated_lines + +Execute(Floating preview is used with ALEDetail when g:ale_detail_to_floating_preview set): + let g:ale_detail_to_floating_preview = 1 + + call cursor(1, 10) + + ALEDetail + + let expected = ["Every statement should end with a semicolon", "second line"] + + AssertEqual 1, g:floating_preview_show_called + AssertEqual expected, g:floated_lines + +Execute(Floating preview is not used with ALEDetail by default): + call cursor(1, 10) + + ALEDetail + + AssertEqual 0, g:floating_preview_show_called diff --git a/sources_non_forked/ale/test/test_format_command.vader b/sources_non_forked/ale/test/test_format_command.vader new file mode 100644 index 00000000..b0440dcd --- /dev/null +++ b/sources_non_forked/ale/test/test_format_command.vader @@ -0,0 +1,186 @@ +Before: + silent! cd /testplugin/test + silent file top/middle/bottom/dummy.txt + + function! CheckTempFile(filename) abort + " Check every part of the temporary filename, except the random part. + AssertEqual fnamemodify(tempname(), ':h'), fnamemodify(a:filename, ':h:h') + AssertEqual 'dummy.txt', fnamemodify(a:filename, ':t') + endfunction + + runtime autoload/ale/command.vim + + function! ale#command#CreateTempFile(buffer, temporary_file, input) abort + return !empty(a:temporary_file) + endfunction + +After: + unlet! g:result + unlet! g:match + + delfunction CheckTempFile + + runtime autoload/ale/command.vim + +Execute(FormatCommand should do nothing to basic command strings): + AssertEqual + \ ['', 'awesome-linter do something', 0], + \ ale#command#FormatCommand(bufnr('%'), '', 'awesome-linter do something', 0, v:null, v:null, []) + +Execute(FormatCommand should handle %%, and ignore other percents): + AssertEqual + \ ['', '% %%d %%f %x %', 0], + \ ale#command#FormatCommand(bufnr('%'), '', '%% %%%d %%%f %x %', 0, v:null, v:null, []) + +Execute(FormatCommand should convert %s to the current filename): + AssertEqual + \ [ + \ '', + \ 'foo ' . ale#Escape(expand('%:p')) . ' bar ' . ale#Escape(expand('%:p')), + \ 0, + \ ], + \ ale#command#FormatCommand(bufnr('%'), '', 'foo %s bar %s', 0, v:null, v:null, []) + +Execute(FormatCommand should convert %t to a new temporary filename): + let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %t', 0, v:null, v:null, []) + + call CheckTempFile(g:result[0]) + + let g:match = matchlist(g:result[1], '\v^foo (.*) bar (.*)$') + + Assert !empty(g:match), 'No match found! Result was: ' . g:result[1] + " The first item of the result should be a temporary filename, and it should + " be the same as the escaped name in the command string. + AssertEqual ale#Escape(g:result[0]), g:match[1] + " The two temporary filenames formatted in should be the same. + AssertEqual g:match[1], g:match[2] + +Execute(FormatCommand should not convert %t to a new temporary filename when the input is given as v:false): + let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %t', 0, v:false, v:null, []) + + AssertEqual ['', 'foo %t bar %t', 0], g:result + +Execute(FormatCommand should signal that files are created when temporary files are needed): + AssertEqual + \ 1, + \ ale#command#FormatCommand(bufnr('%'), '', 'foo %t', 0, v:null, v:null, [])[2] + + AssertEqual + \ 0, + \ ale#command#FormatCommand(bufnr('%'), '', 'foo %s', 0, v:null, v:null, [])[2] + +Execute(FormatCommand should let you combine %s and %t): + let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %s', 0, v:null, v:null, []) + + call CheckTempFile(g:result[0]) + + let g:match = matchlist(g:result[1], '\v^foo (.*) bar (.*)$') + + Assert !empty(g:match), 'No match found! Result was: ' . g:result[1] + " The first item of the result should be a temporary filename, and it should + " be the same as the escaped name in the command string. + AssertEqual ale#Escape(g:result[0]), g:match[1] + " The second item should be equal to the original filename. + AssertEqual ale#Escape(expand('%:p')), g:match[2] + +Execute(FormatCommand should replace %e with the escaped executable): + if has('win32') + AssertEqual + \ ['', 'foo foo', 0], + \ ale#command#FormatCommand(bufnr('%'), 'foo', '%e %e', 0, v:null, v:null, []) + AssertEqual + \ ['', '"foo bar"', 0], + \ ale#command#FormatCommand(bufnr('%'), 'foo bar', '%e', 0, v:null, v:null, []) + AssertEqual + \ ['', '%e %e', 0], + \ ale#command#FormatCommand(bufnr('%'), '', '%e %e', 0, v:null, v:null, []) + else + AssertEqual + \ ['', '''foo'' ''foo''', 0], + \ ale#command#FormatCommand(bufnr('%'), 'foo', '%e %e', 0, v:null, v:null, []) + AssertEqual + \ ['', '''foo bar''', 0], + \ ale#command#FormatCommand(bufnr('%'), 'foo bar', '%e', 0, v:null, v:null, []) + AssertEqual + \ ['', '%e %e', 0], + \ ale#command#FormatCommand(bufnr('%'), '', '%e %e', 0, v:null, v:null, []) + endif + +Execute(EscapeCommandPart should escape all percent signs): + AssertEqual '%%s %%t %%%% %%s %%t %%%%', ale#engine#EscapeCommandPart('%s %t %% %s %t %%') + +Execute(EscapeCommandPart should pipe in temporary files appropriately): + let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo bar', 1, v:null, v:null, []) + + call CheckTempFile(g:result[0]) + + let g:match = matchlist(g:result[1], '\v^foo bar \< (.*)$') + Assert !empty(g:match), 'No match found! Result was: ' . g:result[1] + AssertEqual ale#Escape(g:result[0]), g:match[1] + + let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo bar %t', 1, v:null, v:null, []) + + call CheckTempFile(g:result[0]) + + let g:match = matchlist(g:result[1], '\v^foo bar (.*)$') + Assert !empty(g:match), 'No match found! Result was: ' . g:result[1] + AssertEqual ale#Escape(g:result[0]), g:match[1] + +Execute(FormatCommand should apply filename modifiers to the current file): + AssertEqual + \ ale#Escape(expand('%:p:h')) + \ . ' ' . ale#Escape('dummy.txt') + \ . ' ' . ale#Escape(expand('%:p:h:t')) + \ . ' ' . ale#Escape('txt') + \ . ' ' . ale#Escape(expand('%:p:r')), + \ ale#command#FormatCommand(bufnr(''), '', '%s:h %s:t %s:h:t %s:e %s:r', 0, v:null, v:null, [])[1] + +Execute(FormatCommand should apply filename modifiers to the temporary file): + let g:result = ale#command#FormatCommand(bufnr(''), '', '%t:h %t:t %t:h:t %t:e %t:r', 0, v:null, v:null, []) + + AssertEqual + \ ale#Escape(fnamemodify(g:result[0], ':h')) + \ . ' ' . ale#Escape('dummy.txt') + \ . ' ' . ale#Escape(fnamemodify(g:result[0], ':h:t')) + \ . ' ' . ale#Escape('txt') + \ . ' ' . ale#Escape(fnamemodify(g:result[0], ':r')), + \ g:result[1] + +Execute(FormatCommand should apply filename mappings the current file): + let g:result = ale#command#FormatCommand(bufnr('%'), '', '%s', 0, v:null, v:null, [ + \ [expand('%:p:h'), '/foo/bar'], + \]) + + Assert g:result[1] =~# '/foo/bar' + +Execute(FormatCommand should apply filename mappings to temporary files): + let g:result = ale#command#FormatCommand(bufnr('%'), '', '%t', 0, v:null, v:null, [ + \ [fnamemodify(tempname(), ':h:h'), '/foo/bar'] + \]) + + Assert g:result[1] =~# '/foo/bar' + +Execute(FormatCommand should apply filename modifiers to mapped filenames): + let g:result = ale#command#FormatCommand(bufnr('%'), '', '%s:h', 0, v:null, v:null, [ + \ [expand('%:p:h'), '/foo/bar'], + \]) + + AssertEqual ale#Escape('/foo/bar'), g:result[1] + + let g:result = ale#command#FormatCommand(bufnr('%'), '', '%t:h:h:h', 0, v:null, v:null, [ + \ [fnamemodify(tempname(), ':h:h'), '/foo/bar'] + \]) + + AssertEqual ale#Escape('/foo/bar'), g:result[1] + +Execute(FormatCommand should apply regular cwd paths): + AssertEqual + \ 'cd ' . (has('unix') ? '' : '/d ') . ale#Escape('/foo /bar') . ' && abc', + \ ale#command#FormatCommand(bufnr('%'), '', 'abc', 0, v:null, '/foo /bar', [])[1] + \ +Execute(FormatCommand should apply cwd subsitution and formatting): + call ale#test#SetFilename('foo.txt') + + AssertEqual + \ 'cd ' . (has('unix') ? '' : '/d ') . ale#Escape(getcwd()) . ' && abc', + \ ale#command#FormatCommand(bufnr('%'), '', 'abc', 0, v:null, '%s:h', [])[1] diff --git a/sources_non_forked/ale/test/test_format_temporary_file_creation.vader b/sources_non_forked/ale/test/test_format_temporary_file_creation.vader new file mode 100644 index 00000000..10409400 --- /dev/null +++ b/sources_non_forked/ale/test/test_format_temporary_file_creation.vader @@ -0,0 +1,63 @@ +Before: + Save g:ale_buffer_info + Save g:ale_echo_cursor + Save g:ale_enabled + Save g:ale_run_synchronously + Save g:ale_set_highlights + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + + " Disable the features we don't need to check. + let g:ale_buffer_info = {} + let g:ale_echo_cursor = 0 + let g:ale_enabled = 1 + let g:ale_run_synchronously = 1 + unlet! g:ale_run_synchronously_callbacks + let g:ale_set_highlights = 0 + let g:ale_set_loclist = 0 + let g:ale_set_quickfix = 0 + let g:ale_set_signs = 0 + + let g:output = [] + + function! TestCallback(buffer, output) + " Extract just letters from the output. + let g:output = filter( + \ map(a:output, 'matchstr(v:val, ''[a-zA-Z]\+'')'), + \ '!empty(v:val)' + \) + + return [] + endfunction + + call ale#linter#PreventLoading('foobar') + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'cat', + \ 'command': has('win32') ? 'type %t' : 'cat %t', + \}) + +After: + Restore + + unlet! g:ale_run_synchronously_callbacks + unlet! g:output + delfunction TestCallback + + call ale#engine#Cleanup(bufnr('')) + call ale#linter#Reset() + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(ALE should be able to read the %t file): + AssertEqual 'foobar', &filetype + + ALELint + call ale#test#FlushJobs() + + AssertEqual ['foo', 'bar', 'baz'], g:output diff --git a/sources_non_forked/ale/test/test_function_arg_count.vader b/sources_non_forked/ale/test/test_function_arg_count.vader new file mode 100644 index 00000000..d256c403 --- /dev/null +++ b/sources_non_forked/ale/test/test_function_arg_count.vader @@ -0,0 +1,45 @@ +Before: + function! Func0() + endfunction + function! Func1(x) + endfunction + function! Func2(x,y) + endfunction + function! Func3(x,y,z) + endfunction + function! Func3a(x,y,z,...) + endfunction + +After: + delfunction Func0 + delfunction Func1 + delfunction Func2 + delfunction Func3 + delfunction Func3a + +Execute(We should be able to compute the argument count for function names): + AssertEqual 0, ale#util#FunctionArgCount('Func0') + AssertEqual 1, ale#util#FunctionArgCount('Func1') + AssertEqual 2, ale#util#FunctionArgCount('Func2') + AssertEqual 3, ale#util#FunctionArgCount('Func3') + AssertEqual 3, ale#util#FunctionArgCount('Func3a') + +Execute(We should be able to compute the argument count for Funcrefs): + AssertEqual 0, ale#util#FunctionArgCount(function('Func0')) + AssertEqual 1, ale#util#FunctionArgCount(function('Func1')) + AssertEqual 2, ale#util#FunctionArgCount(function('Func2')) + AssertEqual 3, ale#util#FunctionArgCount(function('Func3')) + AssertEqual 3, ale#util#FunctionArgCount(function('Func3a')) + +Execute(We should be able to compute the argument count for lambdas): + if has('lambda') + AssertEqual 0, ale#util#FunctionArgCount({->1}) + AssertEqual 1, ale#util#FunctionArgCount({x->1}) + AssertEqual 2, ale#util#FunctionArgCount({x,y->1}) + AssertEqual 3, ale#util#FunctionArgCount({x,y,z->1}) + AssertEqual 3, ale#util#FunctionArgCount({x,y,z,...->1}) + endif + +Execute(We should be able to compute the argument count autoload functions not yet loaded): + AssertEqual 1, ale#util#FunctionArgCount(function('ale#fixers#yapf#Fix')) + AssertEqual 1, ale#util#FunctionArgCount('ale#fixers#yapf#Fix') diff --git a/sources_non_forked/ale/test/test_fuzzy_json_decode.vader b/sources_non_forked/ale/test/test_fuzzy_json_decode.vader new file mode 100644 index 00000000..4b1c6088 --- /dev/null +++ b/sources_non_forked/ale/test/test_fuzzy_json_decode.vader @@ -0,0 +1,29 @@ +Execute(FuzzyJSONDecode should return the default for empty Lists): + AssertEqual [], ale#util#FuzzyJSONDecode([], []) + AssertEqual {}, ale#util#FuzzyJSONDecode([], {}) + +Execute(FuzzyJSONDecode should return the default for empty Strings): + AssertEqual [], ale#util#FuzzyJSONDecode('', []) + AssertEqual {}, ale#util#FuzzyJSONDecode('', {}) + +Execute(FuzzyJSONDecode should return the default value for ['']): + AssertEqual [], ale#util#FuzzyJSONDecode([''], []) + AssertEqual {}, ale#util#FuzzyJSONDecode([''], {}) + +Execute(FuzzyJSONDecode should return the default value for only whitespace lines): + AssertEqual [], ale#util#FuzzyJSONDecode(['', "\n"], []) + AssertEqual {}, ale#util#FuzzyJSONDecode(['', "\n"], {}) + +Execute(FuzzyJSONDecode should return the default for Lists with invalid JSON): + AssertEqual [], ale#util#FuzzyJSONDecode(['x'], []) + AssertEqual {}, ale#util#FuzzyJSONDecode(['x'], {}) + +Execute(FuzzyJSONDecode should return the default for Strings with invalid JSON): + AssertEqual [], ale#util#FuzzyJSONDecode('x', []) + AssertEqual {}, ale#util#FuzzyJSONDecode('x', {}) + +Execute(FuzzyJSONDecode should return the JSON from the JSON string): + AssertEqual {'x': 3}, ale#util#FuzzyJSONDecode('{"x": 3}', []) + AssertEqual {'x': 3}, ale#util#FuzzyJSONDecode('{"x": 3}', {}) + AssertEqual {'x': 3}, ale#util#FuzzyJSONDecode(['{"x"', ': 3}'], []) + AssertEqual {'x': 3}, ale#util#FuzzyJSONDecode(['{"x"', ': 3}'], {}) diff --git a/sources_non_forked/ale/test/test_get_abspath.vader b/sources_non_forked/ale/test/test_get_abspath.vader new file mode 100644 index 00000000..7e1b5930 --- /dev/null +++ b/sources_non_forked/ale/test/test_get_abspath.vader @@ -0,0 +1,29 @@ +Execute(Relative paths should be resolved correctly): + AssertEqual + \ has('win32') ? '\foo\bar\baz\whatever.txt' : '/foo/bar/baz/whatever.txt', + \ ale#path#GetAbsPath('/foo/bar/xyz', '../baz/whatever.txt') + AssertEqual + \ has('win32') ? '\foo\bar\xyz\whatever.txt' : '/foo/bar/xyz/whatever.txt', + \ ale#path#GetAbsPath('/foo/bar/xyz', './whatever.txt') + AssertEqual + \ has('win32') ? '\foo\bar\xyz\whatever.txt' : '/foo/bar/xyz/whatever.txt', + \ ale#path#GetAbsPath('/foo/bar/xyz', 'whatever.txt') + + if has('win32') + AssertEqual + \ 'C:\foo\bar\baz\whatever.txt', + \ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '../whatever.txt') + endif + +Execute(Absolute paths should be resolved correctly): + AssertEqual + \ has('win32') ? '\ding\dong' : '/ding/dong', + \ ale#path#GetAbsPath('/foo/bar/xyz', '/ding/dong') + + AssertEqual + \ has('win32') ? '\ding\dong' : '/ding/dong', + \ ale#path#GetAbsPath('/foo/bar/xyz', '//ding/dong') + + if has('win32') + AssertEqual '\ding', ale#path#GetAbsPath('/foo/bar/xyz', '\\ding') + endif diff --git a/sources_non_forked/ale/test/test_get_loclist.vader b/sources_non_forked/ale/test/test_get_loclist.vader new file mode 100644 index 00000000..14696998 --- /dev/null +++ b/sources_non_forked/ale/test/test_get_loclist.vader @@ -0,0 +1,31 @@ +Before: + let g:loclist = [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'eslint', + \ 'nr': -1, + \ 'type': 'E', + \ 'col': 10, + \ 'text': 'Missing semicolon. (semi)' + \ }, + \ { + \ 'lnum': 2, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'eslint', + \ 'nr': -1, + \ 'type': 'W', + \ 'col': 10, + \ 'text': 'Infix operators must be spaced. (space-infix-ops)' + \ }, + \] + let g:ale_buffer_info = {'1': {'loclist': g:loclist}} + +After: + unlet g:loclist + let g:ale_buffer_info = {} + +Execute(GetLoclist should return the loclist): + AssertEqual g:loclist, ale#engine#GetLoclist(1) diff --git a/sources_non_forked/ale/test/test_getmatches.vader b/sources_non_forked/ale/test/test_getmatches.vader new file mode 100644 index 00000000..edf84f6e --- /dev/null +++ b/sources_non_forked/ale/test/test_getmatches.vader @@ -0,0 +1,163 @@ +Execute (ale#util#GetMatches should return matches for many lines): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '56', + \ '41', + \ 'Missing semicolon.', + \ 'Error/semi', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ ], + \ [ + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$', + \ ] + \ ) + +Execute (ale#util#GetMatches should accept a string for a single pattern): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '56', + \ '41', + \ 'Missing semicolon.', + \ 'Error/semi', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ ], + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$' + \ ) + +Execute (ale#util#MapMatches should map matches): + AssertEqual + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ ], + \ ale#util#MapMatches( + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ ], + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$', + \ {match -> match[0]} + \ ) + +Execute (ale#util#GetMatches should accept a single line as a string): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ [ + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$', + \ ] + \ ) + +Execute (ale#util#GetMatches should match multiple patterns correctly): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '56', + \ '41', + \ 'Missing semicolon.', + \ 'Error/semi', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token', + \ '13', + \ '3', + \ 'Parsing error: Unexpected token', + \ '', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token', + \ ], + \ [ + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$', + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\)$', + \ ] + \ ) diff --git a/sources_non_forked/ale/test/test_go_to_definition.vader b/sources_non_forked/ale/test/test_go_to_definition.vader new file mode 100644 index 00000000..726de551 --- /dev/null +++ b/sources_non_forked/ale/test/test_go_to_definition.vader @@ -0,0 +1,689 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.txt') + + Save g:ale_default_navigation + + let g:old_filename = expand('%:p') + let g:Callback = '' + let g:message_list = [] + let g:expr_list = [] + let g:capability_checked = '' + let g:conn_id = v:null + let g:InitCallback = v:null + let g:ale_default_navigation = 'buffer' + + runtime autoload/ale/linter.vim + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + + if a:linter.lsp is# 'tsserver' + call ale#lsp#MarkConnectionAsTsserver(g:conn_id) + endif + + let l:details = { + \ 'command': 'foobar', + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \} + + let g:InitCallback = {-> ale#lsp_linter#OnInit(a:linter, l:details, a:Callback)} + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#Execute(expr) abort + call add(g:expr_list, a:expr) + endfunction + +After: + Restore + + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + call ale#definition#SetMap({}) + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:capability_checked + unlet! g:InitCallback + unlet! g:old_filename + unlet! g:conn_id + unlet! g:Callback + unlet! g:message_list + unlet! g:expr_list + unlet! b:ale_linters + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + +Execute(Other messages for the tsserver handler should be ignored): + call ale#definition#HandleTSServerResponse(1, {'command': 'foo'}) + +Execute(Tagstack should be incremented if supported): + if exists('*gettagstack') && exists('*settagstack') + let original_stack_depth = gettagstack().length + endif + call ale#definition#UpdateTagStack() + if exists('*gettagstack') && exists('*settagstack') + AssertEqual original_stack_depth + 1, gettagstack().length + endif + +Execute(Failed definition responses should be handled correctly): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleTSServerResponse( + \ 1, + \ {'command': 'definition', 'request_seq': 3} + \) + AssertEqual {}, ale#definition#GetMap() + +Execute(Failed definition responses with no files should be handled correctly): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'definition', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [], + \ } + \) + AssertEqual {}, ale#definition#GetMap() + +Given typescript(Some typescript file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Other files should be jumped to for definition responses): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'definition', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [ + \ { + \ 'file': ale#path#Simplify(g:dir . '/completion_dummy_file'), + \ 'start': {'line': 3, 'offset': 7}, + \ }, + \ ], + \ } + \) + + AssertEqual + \ [ + \ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 7], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Other files should be jumped to for definition responses in tabs too): + call ale#definition#SetMap({3: {'open_in': 'tab'}}) + call ale#definition#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'definition', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [ + \ { + \ 'file': ale#path#Simplify(g:dir . '/completion_dummy_file'), + \ 'start': {'line': 3, 'offset': 7}, + \ }, + \ ], + \ } + \) + + AssertEqual + \ [ + \ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 7], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Other files should be jumped to for definition responses in splits too): + call ale#definition#SetMap({3: {'open_in': 'split'}}) + call ale#definition#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'definition', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [ + \ { + \ 'file': ale#path#Simplify(g:dir . '/completion_dummy_file'), + \ 'start': {'line': 3, 'offset': 7}, + \ }, + \ ], + \ } + \) + + AssertEqual + \ [ + \ 'split +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 7], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Other files should be jumped to for definition responses in vsplits too): + call ale#definition#SetMap({3: {'open_in': 'vsplit'}}) + call ale#definition#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'definition', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [ + \ { + \ 'file': ale#path#Simplify(g:dir . '/completion_dummy_file'), + \ 'start': {'line': 3, 'offset': 7}, + \ }, + \ ], + \ } + \) + + AssertEqual + \ [ + \ 'vsplit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 7], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(tsserver definition requests should be sent): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEGoToDefinition + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'definition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@definition', {'file': expand('%:p'), 'line': 2, 'offset': 5}] + \ ], + \ g:message_list + AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap() + +Execute(tsserver type definition requests should be sent): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEGoToTypeDefinition + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'typeDefinition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@typeDefinition', {'file': expand('%:p'), 'line': 2, 'offset': 5}] + \ ], + \ g:message_list + AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap() + +Execute(tsserver implementation requests should be sent): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEGoToImplementation + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'implementation', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@implementation', {'file': expand('%:p'), 'line': 2, 'offset': 5}] + \ ], + \ g:message_list + AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap() + +Execute(tsserver tab definition requests should be sent): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALEGoToDefinition -tab + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'definition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@definition', {'file': expand('%:p'), 'line': 2, 'offset': 5}] + \ ], + \ g:message_list + AssertEqual {'42': {'open_in': 'tab'}}, ale#definition#GetMap() + +Execute(The default navigation type should be used): + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + let g:ale_default_navigation = 'tab' + ALEGoToDefinition + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'definition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@definition', {'file': expand('%:p'), 'line': 2, 'offset': 5}] + \ ], + \ g:message_list + AssertEqual {'42': {'open_in': 'tab'}}, ale#definition#GetMap() + +Given python(Some Python file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Other files should be jumped to for LSP definition responses): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'range': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ } + \) + + AssertEqual + \ [ + \ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 8], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Newer LocationLink items should be supported): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': { + \ 'targetUri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'targetRange': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ } + \) + + AssertEqual + \ [ + \ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 8], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Locations inside the same file should be jumped to without using :edit): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(expand('%:p'))), + \ 'range': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ } + \) + + AssertEqual + \ [ + \ ], + \ g:expr_list + AssertEqual [3, 8], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Other files should be jumped to in tabs for LSP definition responses): + call ale#definition#SetMap({3: {'open_in': 'tab'}}) + call ale#definition#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'range': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ } + \) + + AssertEqual + \ [ + \ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 8], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Definition responses with lists should be handled): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': [ + \ { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'range': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')), + \ 'range': { + \ 'start': {'line': 20, 'character': 3}, + \ }, + \ }, + \ ], + \ } + \) + + AssertEqual + \ [ + \ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ ], + \ g:expr_list + AssertEqual [3, 8], getpos('.')[1:2] + AssertEqual {}, ale#definition#GetMap() + +Execute(Definition responses with null response should be handled): + call ale#definition#SetMap({3: {'open_in': 'current-buffer'}}) + call ale#definition#HandleLSPResponse(1, {'id': 3, 'result': v:null}) + + AssertEqual [], g:expr_list + +Execute(LSP definition requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEGoToDefinition + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'definition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/definition', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap() + +Execute(LSP type definition requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEGoToTypeDefinition + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'typeDefinition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/typeDefinition', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap() + +Execute(LSP implementation requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEGoToImplementation + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'implementation', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/implementation', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'open_in': 'current-buffer'}}, ale#definition#GetMap() + +Execute(LSP tab definition requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEGoToDefinition -tab + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'definition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/definition', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'open_in': 'tab'}}, ale#definition#GetMap() + +Execute(LSP tab type definition requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEGoToTypeDefinition -tab + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'typeDefinition', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/typeDefinition', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'open_in': 'tab'}}, ale#definition#GetMap() + +Execute(LSP tab implementation requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALEGoToImplementation -tab + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'implementation', g:capability_checked + AssertEqual + \ 'function(''ale#definition#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/implementation', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'open_in': 'tab'}}, ale#definition#GetMap() diff --git a/sources_non_forked/ale/test/test_gradle_build_classpath_command.vader b/sources_non_forked/ale/test/test_gradle_build_classpath_command.vader new file mode 100644 index 00000000..9557aa0d --- /dev/null +++ b/sources_non_forked/ale/test/test_gradle_build_classpath_command.vader @@ -0,0 +1,52 @@ +Before: + Save $PATH + Save $PATHEXT + + let $PATHEXT = '.' + + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/kotlin/kotlinc.vim + + let g:command_tail = ' -I ' . ale#Escape(ale#gradle#GetInitPath()) + \ . ' -q printClasspath' + + let g:gradle_init_path = ale#path#Simplify(g:dir . '../../autoload/ale/gradle/init.gradle') + +After: + Restore + + unlet! g:gradle_init_path + unlet! g:command_tail + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return 'gradlew' command if project includes gradle wapper): + call ale#test#SetFilename('test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project'), + \ ale#Escape(ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project/gradlew')) + \ . g:command_tail, + \ ], + \ ale#gradle#BuildClasspathCommand(bufnr('')) + +Execute(Should return 'gradle' command if project does not include gradle wapper): + call ale#test#SetFilename('test-files/gradle/unwrapped-project/src/main/kotlin/dummy.kt') + let $PATH .= (has('win32') ? ';' : ':') + \ . ale#path#Simplify(g:dir . '/test-files/gradle') + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir . '/test-files/gradle/unwrapped-project'), + \ ale#Escape('gradle') . g:command_tail + \ ], + \ ale#gradle#BuildClasspathCommand(bufnr('')) + +Execute(Should return empty string if gradle cannot be executed): + call ale#test#SetFilename('test-files/gradle/non-gradle-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ ['', ''], + \ ale#gradle#BuildClasspathCommand(bufnr('')) diff --git a/sources_non_forked/ale/test/test_gradle_find_executable.vader b/sources_non_forked/ale/test/test_gradle_find_executable.vader new file mode 100644 index 00000000..f874748c --- /dev/null +++ b/sources_non_forked/ale/test/test_gradle_find_executable.vader @@ -0,0 +1,37 @@ +Before: + Save $PATH + Save $PATHEXT + + " Count the gradle executable without .exe as executable on Windows + let $PATHEXT = '.' + + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/kotlin/kotlinc.vim + +After: + Restore + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return 'gradlew' if found in parent directory): + call ale#test#SetFilename('test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project/gradlew'), + \ ale#gradle#FindExecutable(bufnr('')) + +Execute(Should return 'gradle' if 'gradlew' not found in parent directory): + call ale#test#SetFilename('test-files/gradle/unwrapped-project/src/main/kotlin/dummy.kt') + let $PATH .= (has('win32') ? ';': ':') . ale#path#Simplify(g:dir . '/test-files/gradle') + + AssertEqual + \ 'gradle', + \ ale#gradle#FindExecutable(bufnr('')) + +Execute(Should return empty string if 'gradlew' not in parent directory and gradle not in path): + call ale#test#SetFilename('test-files/gradle/unwrapped-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ '', + \ ale#gradle#FindExecutable(bufnr('')) diff --git a/sources_non_forked/ale/test/test_gradle_find_project_root.vader b/sources_non_forked/ale/test/test_gradle_find_project_root.vader new file mode 100644 index 00000000..b6159188 --- /dev/null +++ b/sources_non_forked/ale/test/test_gradle_find_project_root.vader @@ -0,0 +1,35 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/kotlin/kotlinc.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return directory for 'gradlew' if found in parent directory): + call ale#test#SetFilename('test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/gradle/wrapped-project'), + \ ale#gradle#FindProjectRoot(bufnr('')) + +Execute(Should return directory for 'settings.gradle' if found in parent directory): + call ale#test#SetFilename('test-files/gradle/settings-gradle-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/gradle/settings-gradle-project'), + \ ale#gradle#FindProjectRoot(bufnr('')) + +Execute(Should return directory for 'build.gradle' if found in parent directory): + call ale#test#SetFilename('test-files/gradle/build-gradle-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/gradle/build-gradle-project'), + \ ale#gradle#FindProjectRoot(bufnr('')) + +Execute(Should return empty string if gradle files are not found in parent directory): + call ale#test#SetFilename('test-files/gradle/non-gradle-project/src/main/kotlin/dummy.kt') + + AssertEqual + \ '', + \ ale#gradle#FindProjectRoot(bufnr('')) diff --git a/sources_non_forked/ale/test/test_highlight_placement.vader b/sources_non_forked/ale/test/test_highlight_placement.vader new file mode 100644 index 00000000..44ae369b --- /dev/null +++ b/sources_non_forked/ale/test/test_highlight_placement.vader @@ -0,0 +1,465 @@ +Before: + Save g:ale_buffer_info + Save g:ale_echo_cursor + Save g:ale_enabled + Save g:ale_run_synchronously + Save g:ale_set_highlights + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + Save g:ale_exclude_highlights + Save b:ale_exclude_highlights + + runtime autoload/ale/virtualtext.vim + runtime autoload/ale/highlight.vim + + let g:ale_run_synchronously = 1 + unlet! g:ale_run_synchronously_callbacks + let g:ale_set_highlights = 1 + let g:ale_set_signs = 1 + let g:ale_buffer_info = {} + + " Disable features we don't need for these tests. + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 0 + let g:ale_echo_cursor = 0 + let g:ale_exclude_highlights = [] + let b:ale_exclude_highlights = [] + + function! GenerateResults(buffer, output) + return [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'foo', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'type': 'W', + \ 'text': 'bar', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 5, + \ 'type': 'E', + \ 'text': 'wat', + \ }, + \] + endfunction + + let g:has_nvim_highlight = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace') + let g:nvim_highlight_matches = {} + + function! ale#highlight#nvim_buf_clear_namespace(buffer, ns_id, line_start, line_end) abort + if a:line_end != -1 + throw 'nvim api behavior not supported' + endif + + let l:matches = get(g:nvim_highlight_matches, a:buffer, []) + call filter( + \ l:matches, + \ {_, val -> val.pos1[0] < (a:line_start + 1) }, + \) + endfunction + + function! ale#highlight#nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start, col_end) abort + if a:col_end == -1 + throw 'nvim api behavior not supported' + endif + + let l:matches = get(g:nvim_highlight_matches, a:buffer, []) + let g:nvim_highlight_matches[a:buffer] = l:matches + + let l:new_match = { + \ 'group': a:hl_group, + \ 'priority': 10, + \ 'pos1': [a:line + 1, a:col_start + 1, a:col_end - a:col_start], + \} + + call add(l:matches, l:new_match) + " sort by line number to emulate getmatches faithfully + call sort(l:matches, {m1, m2 -> m1.pos1[0] - m2.pos1[0]}) + endfunction + + " We don't care what the IDs are, just that we have some matches. + " The IDs are generated. + function! GetMatchesWithoutIDs() abort + if g:has_nvim_highlight + return get(g:nvim_highlight_matches, bufnr(''), []) + else + let l:list = getmatches() + + for l:item in l:list + call remove(l:item, 'id') + endfor + + return l:list + endif + endfunction + + function! GetLinkedGroup(grp) abort + return synIDattr(synIDtrans(hlID(a:grp)), 'name') + endfunction + + call ale#linter#Define('testft', { + \ 'name': 'x', + \ 'executable': has('win32') ? 'cmd': 'echo', + \ 'command': has('win32') ? 'echo' : '/bin/sh -c ''echo''', + \ 'callback': 'GenerateResults', + \}) + highlight link SomeOtherGroup SpellBad + +After: + Restore + + unlet! g:ale_run_synchronously_callbacks + unlet! g:items + unlet! b:ale_enabled + unlet! g:has_nvim_highlight + unlet! g:nvim_highlight_matches + + delfunction GenerateResults + call ale#linter#Reset() + call clearmatches() + call ale#sign#Clear() + if has('textprop') && has('popupwin') + call prop_type_delete('ale') + endif + highlight clear SomeOtherGroup + + runtime autoload/ale/highlight.vim + +Given testft(A Javscript file with warnings/errors): + foo + bar + baz wat + line four + +" Autoloading virtualtext.vim first should still properly initialize hl-groups +Execute(Loading virtualtext first does not break highlight groups): + AssertEqual + \ "SpellBad", + \ GetLinkedGroup("ALEError") + AssertEqual + \ "SpellCap", + \ GetLinkedGroup("ALEWarning") + +Execute(Highlights should be set when a linter runs): + ALELint + call ale#test#FlushJobs() + + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]}, + \ {'group': 'ALEWarning', 'priority': 10, 'pos1': [2, 1, 1]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 5, 1]} + \ ], + \ GetMatchesWithoutIDs() + +" This test is important for preventing ALE from showing highlights for +" the wrong files. +Execute(Highlights set by ALE should be removed when buffer cleanup is done): + call ale#engine#InitBufferInfo(bufnr('%')) + + call ale#highlight#SetHighlights(bufnr('%'), [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2}, + \]) + + if !g:has_nvim_highlight + " This check doesn't work with the new API, for some reason. + AssertEqual + \ [{'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 1]}], + \ GetMatchesWithoutIDs() + endif + + call ale#engine#Cleanup(bufnr('%')) + + AssertEqual [], GetMatchesWithoutIDs() + +Execute(Highlights should be cleared when buffers are hidden): + call ale#engine#InitBufferInfo(bufnr('%')) + " The second item should be ignored, as it has no column infomration. + let g:ale_buffer_info[bufnr('%')].loclist = [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2}, + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 4, 'col': 0}, + \] + call ale#highlight#SetHighlights( + \ bufnr('%'), + \ g:ale_buffer_info[bufnr('%')].loclist + \) + + AssertEqual 1, len(GetMatchesWithoutIDs()), 'The highlights weren''t initially set!' + + call ale#highlight#BufferHidden(bufnr('%')) + + AssertEqual 0, len(GetMatchesWithoutIDs()), 'The highlights weren''t cleared!' + + call ale#highlight#UpdateHighlights() + + AssertEqual 1, len(GetMatchesWithoutIDs()), 'The highlights weren''t set again!' + +Execute(Only ALE highlights should be restored when buffers are restored): + call ale#engine#InitBufferInfo(bufnr('%')) + let g:ale_buffer_info[bufnr('%')].loclist = [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2}, + \] + call ale#highlight#SetHighlights( + \ bufnr('%'), + \ g:ale_buffer_info[bufnr('%')].loclist + \) + + call matchaddpos('SomeOtherGroup', [[1, 1, 1]]) + + " We should have both highlights. + if g:has_nvim_highlight + " When the newer NeoVim API is used, we don't have to worry about + " other highlights, namespacing is available. + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 1]}, + \ ], + \ GetMatchesWithoutIDs() + else + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 1]}, + \ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]}, + \ ], + \ sort(GetMatchesWithoutIDs(), {m1, m2 -> m1.group < m2.group ? -1 : 1}) + endif + + call ale#highlight#BufferHidden(bufnr('%')) + + " We should remove our highlight, but not the other one. + if g:has_nvim_highlight + AssertEqual [], GetMatchesWithoutIDs() + else + AssertEqual + \ [ + \ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]} + \ ], + \ GetMatchesWithoutIDs() + endif + + call ale#highlight#UpdateHighlights() + + " Our highlight should apper again. + if g:has_nvim_highlight + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 1]}, + \ ], + \ GetMatchesWithoutIDs() + else + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 1]}, + \ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]}, + \ ], + \ sort(GetMatchesWithoutIDs(), {m1, m2 -> m1.group < m2.group ? -1 : 1}) + endif + +Execute(Higlight end columns should set an appropriate size): + call ale#highlight#SetHighlights(bufnr('%'), [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2, 'end_col': 5}, + \ {'bufnr': bufnr('%'), 'type': 'W', 'lnum': 4, 'col': 1, 'end_col': 5}, + \]) + + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 2, 4]}, + \ {'group': 'ALEWarning', 'priority': 10, 'pos1': [4, 1, 5]}, + \ ], + \ GetMatchesWithoutIDs() + +Execute(Higlight end columns should set an appropriate size): + call ale#highlight#SetHighlights(bufnr('%'), [ + \ {'bufnr': bufnr('%') - 1, 'type': 'E', 'lnum': 1, 'col': 1}, + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 1, 'col': 1}, + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 2, 'col': 1}, + \ {'bufnr': bufnr('%'), 'type': 'E', 'sub_type': 'style', 'lnum': 3, 'col': 1}, + \ {'bufnr': bufnr('%'), 'type': 'W', 'lnum': 4, 'col': 1}, + \ {'bufnr': bufnr('%'), 'type': 'W', 'lnum': 5, 'col': 1}, + \ {'bufnr': bufnr('%'), 'type': 'W', 'sub_type': 'style', 'lnum': 6, 'col': 1}, + \ {'bufnr': bufnr('%'), 'type': 'I', 'lnum': 7, 'col': 1}, + \ {'bufnr': bufnr('%') + 1, 'type': 'E', 'lnum': 1, 'col': 1}, + \]) + + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [2, 1, 1]}, + \ {'group': 'ALEStyleError', 'priority': 10, 'pos1': [3, 1, 1]}, + \ {'group': 'ALEWarning', 'priority': 10, 'pos1': [4, 1, 1]}, + \ {'group': 'ALEWarning', 'priority': 10, 'pos1': [5, 1, 1]}, + \ {'group': 'ALEStyleWarning', 'priority': 10, 'pos1': [6, 1, 1]}, + \ {'group': 'ALEInfo', 'priority': 10, 'pos1': [7, 1, 1]}, + \ ], + \ GetMatchesWithoutIDs() + +Execute(Highlighting should support errors spanning many lines): + let g:items = [ + \ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3}, + \] + + call ale#highlight#SetHighlights(bufnr(''), g:items) + + if g:has_nvim_highlight + " The newer NeoVim highlight API produces different output. + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [2, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [3, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [4, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [5, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [6, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [7, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [8, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [9, 1, 1073741824]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [10, 1, 3]}, + \ ], + \ GetMatchesWithoutIDs() + else + " We should set 2 highlights for the item, as we can only add 8 at a time. + AssertEqual + \ [ + \ { + \ 'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1073741824], + \ 'pos2': [2], 'pos3': [3], 'pos4': [4], 'pos5': [5], 'pos6': [6], + \ 'pos7': [7], 'pos8': [8], + \ }, + \ { + \ 'group': 'ALEError', 'priority': 10, + \ 'pos1': [9], 'pos2': [10, 1, 3] + \ }, + \ ], + \ GetMatchesWithoutIDs() + endif + +Execute(Highlights should always be cleared when the buffer highlight list is empty): + if g:has_nvim_highlight + " The newer API uses namespacing. We'll emulate it here. + call ale#highlight#nvim_buf_add_highlight( + \ bufnr(''), + \ 1, + \ 'ALEError', + \ 0, + \ 0, + \ 1, + \) + + AssertEqual + \ [{'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]}], + \ GetMatchesWithoutIDs() + else + " Add our highlights and something else. + call matchaddpos('ALEError', [[1, 1, 1]]) + call matchaddpos('SomeOtherGroup', [[1, 1, 1]]) + + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]}, + \ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]}, + \ ], + \ GetMatchesWithoutIDs() + endif + + + " Set the List we use for holding highlights for buffers. + let b:ale_highlight_items = [] + + " Call the function for updating the highlights called when buffers + " are entered, or when problems are presented. + call ale#highlight#UpdateHighlights() + + " Check that we remove our highlights. + if g:has_nvim_highlight + AssertEqual [], GetMatchesWithoutIDs() + else + AssertEqual + \ [{'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]}], + \ GetMatchesWithoutIDs() + endif + +Execute(Highlights should be hidden when excluded): + let b:ale_exclude_highlights = ['ig.*ore', 'nope'] + + call ale#highlight#SetHighlights(bufnr('%'), [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 1, 'col': 1, 'text': 'hello'}, + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 2, 'col': 1, 'text': 'ignore'}, + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 1, 'text': 'nope'}, + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 4, 'col': 1, 'text': 'world'}, + \]) + + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]}, + \ {'group': 'ALEError', 'priority': 10, 'pos1': [4, 1, 1]}, + \ ], + \ GetMatchesWithoutIDs() + +Execute(Highlights should be cleared when ALE is disabled): + let g:ale_enabled = 1 + call ale#highlight#SetHighlights(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3}, + \]) + + let g:ale_enabled = 0 + call ale#highlight#UpdateHighlights() + + AssertEqual [], GetMatchesWithoutIDs() + + let g:ale_enabled = 1 + call ale#highlight#SetHighlights(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3}, + \]) + + let b:ale_enabled = 0 + call ale#highlight#UpdateHighlights() + + AssertEqual [], GetMatchesWithoutIDs() + +Execute(Line highlights should be set when signs are disabled): + " This will mess with your settings, but it needs to be tested. + " We need to match highlights case-insenstive when removing them. + hi link aleerrorline spellbad + + let g:ale_set_signs = 0 + + call ale#highlight#SetHighlights(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1}, + \ {'bufnr': bufnr(''), 'type': 'W', 'lnum': 2, 'col': 1}, + \ {'bufnr': bufnr(''), 'type': 'I', 'lnum': 3, 'col': 1}, + \]) + + if g:has_nvim_highlight + " The output is different with the newer NeoVIM highlight API. + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]}, + \ {'group': 'ALEErrorLine', 'priority': 10, 'pos1': [1, 1, 1073741824]}, + \ {'group': 'ALEWarning', 'priority': 10, 'pos1': [2, 1, 1]}, + \ {'group': 'ALEWarningLine', 'priority': 10, 'pos1': [2, 1, 1073741824]}, + \ {'group': 'ALEInfo', 'priority': 10, 'pos1': [3, 1, 1]}, + \ {'group': 'ALEInfoLine', 'priority': 10, 'pos1': [3, 1, 1073741824]} + \ ], + \ GetMatchesWithoutIDs() + else + AssertEqual + \ [ + \ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]}, + \ {'group': 'ALEWarning', 'priority': 10, 'pos1': [2, 1, 1]}, + \ {'group': 'ALEInfo', 'priority': 10, 'pos1': [3, 1, 1]}, + \ {'group': 'aleerrorline', 'priority': 10, 'pos1': [1]}, + \ {'group': 'ALEWarningLine', 'priority': 10, 'pos1': [2]}, + \ {'group': 'ALEInfoLine', 'priority': 10, 'pos1': [3]}, + \ ], + \ GetMatchesWithoutIDs() + endif + + " All of the highlights should be removed. + call ale#highlight#RemoveHighlights() + AssertEqual [], GetMatchesWithoutIDs() diff --git a/sources_non_forked/ale/test/test_highlight_position_chunking.vader b/sources_non_forked/ale/test/test_highlight_position_chunking.vader new file mode 100644 index 00000000..cd9161b5 --- /dev/null +++ b/sources_non_forked/ale/test/test_highlight_position_chunking.vader @@ -0,0 +1,76 @@ +Execute(CreatePositions() should support single character matches): + AssertEqual [[[1, 5, 1]]], ale#highlight#CreatePositions(1, 5, 1, 5) + " When the end column is behind the start column, ignore it. + AssertEqual [[[2, 5, 1]]], ale#highlight#CreatePositions(2, 5, 1, 5) + +Execute(CreatePositions() should support multiple character matches on a single line): + AssertEqual [[[1, 5, 6]]], ale#highlight#CreatePositions(1, 5, 1, 10) + " When the end column is behind the start column, ignore it. + AssertEqual [[[2, 5, 6]]], ale#highlight#CreatePositions(2, 5, 1, 10) + +Execute(CreatePositions() should support character matches two lines): + AssertEqual [[[1, 5, 1073741824], [2, 1, 10]]], ale#highlight#CreatePositions(1, 5, 2, 10) + +Execute(CreatePositions() should support character matches across many lines): + " Test chunks from 1,3 to 1,17 + AssertEqual [ + \ [[1, 5, 1073741824], 2, [3, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 3, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, [4, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 4, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, [5, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 5, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, [6, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 6, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, [7, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 7, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, [8, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 8, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [[9, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 9, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, [10, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 10, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, 10, [11, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 11, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, 10, 11, [12, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 12, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, 10, 11, 12, [13, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 13, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, 10, 11, 12, 13, [14, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 14, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, 10, 11, 12, 13, 14, [15, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 15, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, 10, 11, 12, 13, 14, 15, [16, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 16, 10) + AssertEqual [ + \ [[1, 5, 1073741824], 2, 3, 4, 5, 6, 7, 8], + \ [9, 10, 11, 12, 13, 14, 15, 16], + \ [[17, 1, 10]], + \], ale#highlight#CreatePositions(1, 5, 17, 10) + " Test another random sample at higher lines. + AssertEqual [ + \ [[21, 8, 1073741824], 22, 23, 24, 25, 26, 27, 28], + \ [29, 30, 31, 32, 33, 34, 35, 36], + \ [[37, 1, 2]], + \], ale#highlight#CreatePositions(21, 8, 37, 2) diff --git a/sources_non_forked/ale/test/test_history_saving.vader b/sources_non_forked/ale/test/test_history_saving.vader new file mode 100644 index 00000000..5d81c2a3 --- /dev/null +++ b/sources_non_forked/ale/test/test_history_saving.vader @@ -0,0 +1,177 @@ +Before: + Save g:ale_max_buffer_history_size + Save g:ale_history_enabled + Save g:ale_history_log_output + Save g:ale_run_synchronously + Save g:ale_enabled + + let g:ale_enabled = 1 + let g:ale_run_synchronously = 1 + + unlet! b:ale_fixers + unlet! b:ale_enabled + unlet! b:ale_history + + " Temporarily set the shell to /bin/sh, if it isn't already set that way. + " This will make it so the test works when running it directly. + let g:current_shell = &shell + + if !has('win32') + let &shell = '/bin/sh' + endif + + let g:history = [] + let g:ale_buffer_info = {} + let g:ale_max_buffer_history_size = 20 + let g:ale_history_log_output = 0 + + function! TestFixer(buffer) + return {'command': 'echo foo'} + endfunction + + function! CollectResults(buffer, output) + return [] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'CollectResults', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') + \ ? 'echo command history test' + \ : '/bin/sh -c ''echo command history test''', + \ 'read_buffer': 0, + \}) + +After: + Restore + + unlet! g:expected_results + unlet! b:ale_fixers + unlet! b:ale_enabled + " Clear the history we changed. + unlet! b:ale_history + + " Reset the shell back to what it was before. + let &shell = g:current_shell + unlet g:current_shell + unlet g:history + + call ale#engine#Cleanup(bufnr('')) + call ale#linter#Reset() + + let g:ale_buffer_info = {} + let g:ale_max_buffer_history_size = 20 + delfunction TestFixer + delfunction CollectResults + +Given foobar (Some imaginary filetype): + anything + +Execute(History should be set when commands are run): + AssertEqual 'foobar', &filetype + + let b:ale_history = [] + ALELint + call ale#test#FlushJobs() + + let g:history = filter( + \ copy(ale#history#Get(bufnr(''))), + \ 'v:val.job_id isnot# ''executable''', + \) + + AssertEqual 1, len(g:history) + AssertEqual + \ ['command', 'exit_code', 'job_id', 'status'], + \ sort(keys(g:history[0])) + + if has('win32') + AssertEqual 'cmd /s/c "echo command history test"', g:history[0].command + else + AssertEqual ['/bin/sh', '-c', '/bin/sh -c ''echo command history test'''], g:history[0].command + endif + + AssertEqual 'finished', g:history[0].status + AssertEqual 0, g:history[0].exit_code + " The Job ID will change each time, but we can check the type. + AssertEqual type(1), type(g:history[0].job_id) + +Execute(History should be not set when disabled): + AssertEqual 'foobar', &filetype + + let g:ale_history_enabled = 0 + + ALELint + call ale#test#FlushJobs() + + AssertEqual [], ale#history#Get(bufnr('')) + +Execute(History should include command output if logging is enabled): + AssertEqual 'foobar', &filetype + + let g:ale_history_log_output = 1 + + " Retry this test until it works. This one can randomly fail. + let b:ale_history = [] + ALELint + call ale#test#FlushJobs() + + let g:history = ale#history#Get(bufnr('')) + + AssertEqual 1, len(g:history) + AssertEqual + \ ['command history test'], + \ map( + \ copy(get(g:history[0], 'output', [])), + \ 'substitute(v:val, ''[\r ]*$'', '''', ''g'')' + \ ) + +Execute(History items should be popped after going over the max): + let b:ale_history = map(range(20), '{''status'': ''started'', ''job_id'': v:val, ''command'': ''foobar''}') + + call ale#history#Add(bufnr(''), 'started', 347, 'last command') + + AssertEqual + \ ( + \ map(range(1, 19), '{''status'': ''started'', ''job_id'': v:val, ''command'': ''foobar''}') + \ + [{'status': 'started', 'job_id': 347, 'command': 'last command'}] + \ ), + \ ale#history#Get(bufnr('')) + +Execute(Nothing should be added to history if the size is too low): + let g:ale_max_buffer_history_size = 0 + + call ale#history#Add(bufnr(''), 'started', 347, 'last command') + + AssertEqual [], ale#history#Get(bufnr('')) + + let g:ale_max_buffer_history_size = -2 + + call ale#history#Add(1, 'started', 347, 'last command') + + AssertEqual [], ale#history#Get(bufnr('')) + +Given foobar(Some file with an imaginary filetype): + a + b + c + +Execute(The history should be updated when fixers are run): + call ale#test#SetFilename('dummy.txt') + + let b:ale_fixers = {'foobar': ['TestFixer']} + let b:ale_enabled = 0 + + ALEFix + + AssertEqual ['started'], map(copy(b:ale_history), 'v:val.status') + + call ale#test#FlushJobs() + + AssertEqual ['finished'], map(copy(b:ale_history), 'v:val.status') + + if has('win32') + AssertEqual 'cmd /s/c "echo foo ', split(b:ale_history[0].command, '<')[0] + else + AssertEqual '/bin/sh -c echo foo ', split(join(b:ale_history[0].command), '<')[0] + endif diff --git a/sources_non_forked/ale/test/test_hover.vader b/sources_non_forked/ale/test/test_hover.vader new file mode 100644 index 00000000..7a9c8d91 --- /dev/null +++ b/sources_non_forked/ale/test/test_hover.vader @@ -0,0 +1,272 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.txt') + + let g:Callback = 0 + let g:message_list = [] + let g:item_list = [] + let g:show_message_arg_list = [] + + let g:ale_floating_preview = 0 + let g:ale_hover_to_floating_preview = 0 + let g:ale_detail_to_floating_preview = 0 + + runtime autoload/ale/linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/util.vim + runtime autoload/ale/floating_preview.vim + runtime autoload/ale/hover.vim + + let g:floated_lines = [] + let g:floating_preview_show_called = 0 + + " Stub out so we can track the call + function! ale#floating_preview#Show(lines, ...) abort + let g:floating_preview_show_called = 1 + let g:floated_lines = a:lines + endfunction + + function! ale#lsp_linter#StartLSP(buffer, linter, callback) abort + let g:Callback = a:callback + + return { + \ 'command': 'foobar', + \ 'connection_id': 347, + \ 'project_root': '/foo/bar', + \} + endfunction + + function! ale#lsp#Send(conn_id, message, root) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#ShowMessage(string, ...) abort + call add(g:show_message_arg_list, [a:string] + a:000) + endfunction + + function! HandleValidLSPResult(result) abort + " The cursor is beyond the length of the line. + " We will clamp the cursor position with the line length. + call setpos('.', [bufnr(''), 1, 5, 0]) + + call ale#hover#SetMap({3: { + \ 'buffer': bufnr(''), + \ 'line': 1, + \ 'column': 5, + \}}) + call ale#hover#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': a:result, + \ } + \) + endfunction + + +After: + call ale#hover#SetMap({}) + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:Callback + unlet! g:message_list + unlet! b:ale_linters + unlet! g:show_message_arg_list + + delfunction HandleValidLSPResult + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/floating_preview.vim + +Given python(Some Python file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Other messages for the tsserver handler should be ignored): + call ale#hover#HandleTSServerResponse(1, {'command': 'foo'}) + +Execute(Failed hover responses should be handled correctly): + call ale#hover#SetMap({3: {}}) + call ale#hover#HandleTSServerResponse( + \ 1, + \ {'command': 'quickinfo', 'request_seq': 3} + \) + AssertEqual {}, ale#hover#GetMap() + +Given typescript(Some typescript file): + foo + somelongerline + bazxyzxyzxyz + +Execute(tsserver quickinfo responses will null missing bodies should be handled): + call ale#hover#SetMap({3: {}}) + call ale#hover#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'quickinfo', + \ 'request_seq': 3, + \ 'success': v:true, + \ } + \) + + AssertEqual {}, ale#hover#GetMap() + +Execute(tsserver quickinfo displayString values should be displayed): + call ale#hover#SetMap({3: {'buffer': bufnr('')}}) + call ale#hover#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'quickinfo', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': {'displayString': 'foo bar'}, + \ } + \) + + AssertEqual [['foo bar']], g:show_message_arg_list + AssertEqual {}, ale#hover#GetMap() + +Execute(LSP hover responses with just a string should be handled): + call HandleValidLSPResult({'contents': 'foobar'}) + + AssertEqual [['foobar', {'commands': []}]], g:show_message_arg_list + AssertEqual {}, ale#hover#GetMap() + +Execute(LSP hover null responses should be handled): + call HandleValidLSPResult(v:null) + + AssertEqual [], g:show_message_arg_list + AssertEqual {}, ale#hover#GetMap() + +Execute(LSP hover responses with markup content should be handled): + call HandleValidLSPResult({'contents': {'kind': 'markdown', 'value': 'markup'}}) + + AssertEqual [['markup', {'commands': []}]], g:show_message_arg_list + AssertEqual {}, ale#hover#GetMap() + +Execute(LSP hover responses with markup content missing values should be handled): + call HandleValidLSPResult({'contents': {'kind': 'markdown'}}) + + AssertEqual [], g:show_message_arg_list + AssertEqual {}, ale#hover#GetMap() + +Execute(LSP hover response with lists of strings should be handled): + call HandleValidLSPResult({'contents': [ + \ "foo\n", + \ "bar\n", + \]}) + + AssertEqual [["foo\n\nbar", {'commands': []}]], g:show_message_arg_list + AssertEqual {}, ale#hover#GetMap() + +Execute(LSP hover response with lists of strings and marked strings should be handled): + call HandleValidLSPResult({'contents': [ + \ {'language': 'rust', 'value': 'foo'}, + \ "bar\n", + \]}) + + AssertEqual [ + \ [ + \ "foo\n\nbar", + \ { + \ 'commands': [ + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_rust syntax/rust.vim', + \ 'syntax region ALE_hover_1 start=/\%1l/ end=/\%2l/ contains=@ALE_hover_rust', + \ ], + \ }, + \ ], + \], g:show_message_arg_list + AssertEqual {}, ale#hover#GetMap() + +Execute(LSP hover with ale_floating_preview should float): + let g:ale_floating_preview = 1 + + call HandleValidLSPResult({'contents': "the message\ncontinuing"}) + + AssertEqual 1, g:floating_preview_show_called + AssertEqual ["the message", "continuing"], g:floated_lines + +Execute(LSP hover ale_hover_to_floating_preview should float): + let g:ale_hover_to_floating_preview = 1 + + call HandleValidLSPResult({'contents': "the message\ncontinuing"}) + + AssertEqual 1, g:floating_preview_show_called + AssertEqual ["the message", "continuing"], g:floated_lines + + +Execute(LSP hover by default should not float): + call HandleValidLSPResult({'contents': "the message\ncontinuing"}) + + AssertEqual 0, g:floating_preview_show_called + +Execute(tsserver responses for documentation requests should be handled): + call ale#hover#SetMap({3: {'show_documentation': 1, 'buffer': bufnr('')}}) + + call ale#hover#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'quickinfo', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'documentation': 'foo is a very good method', + \ 'displayString': 'foo bar', + \ }, + \ } + \) + + " The preview window should show the text. + AssertEqual ['foo is a very good method'], ale#test#GetPreviewWindowText() + silent! pclose + +Execute(hover with show_documentation should be in the preview window, not floating): + let g:ale_hover_to_floating_preview = 1 + let g:ale_floating_preview = 1 + + call ale#hover#SetMap({3: {'show_documentation': 1, 'buffer': bufnr('')}}) + + call ale#hover#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'quickinfo', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'documentation': 'foo is a very good method', + \ 'displayString': 'foo bar ', + \ }, + \ } + \) + + let expected = ["Every statement should end with a semicolon", "second line"] + + AssertEqual 0, g:floating_preview_show_called + +Execute(TSServer hover without show_documentation and ale_floating_preview should float): + let g:ale_floating_preview = 1 + + call ale#hover#SetMap({3: {'buffer': bufnr('')}}) + + call ale#hover#HandleTSServerResponse( + \ 1, + \ { + \ 'command': 'quickinfo', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'displayString': "the message\ncontinuing", + \ }, + \ } + \) + + AssertEqual 1, g:floating_preview_show_called + AssertEqual ["the message", "continuing"], g:floated_lines diff --git a/sources_non_forked/ale/test/test_hover_parsing.vader b/sources_non_forked/ale/test/test_hover_parsing.vader new file mode 100644 index 00000000..4129c26a --- /dev/null +++ b/sources_non_forked/ale/test/test_hover_parsing.vader @@ -0,0 +1,173 @@ +Execute(Invalid results should be handled): + AssertEqual [[], []], ale#hover#ParseLSPResult(0) + AssertEqual [[], []], ale#hover#ParseLSPResult([0]) + AssertEqual [[], []], ale#hover#ParseLSPResult('') + AssertEqual [[], []], ale#hover#ParseLSPResult({}) + AssertEqual [[], []], ale#hover#ParseLSPResult([{}]) + AssertEqual [[], []], ale#hover#ParseLSPResult(['']) + AssertEqual [[], []], ale#hover#ParseLSPResult({'value': ''}) + AssertEqual [[], []], ale#hover#ParseLSPResult([{'value': ''}]) + AssertEqual [[], []], ale#hover#ParseLSPResult({'kind': 'markdown'}) + AssertEqual [[], []], ale#hover#ParseLSPResult({'kind': 'plaintext'}) + AssertEqual [[], []], ale#hover#ParseLSPResult({'kind': 'x', 'value': 'xxx'}) + +Execute(A string with a code fence should be handled): + AssertEqual + \ [ + \ [ + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_python syntax/python.vim', + \ 'syntax region ALE_hover_1 start=/\%1l/ end=/\%3l/ contains=@ALE_hover_python', + \ ], + \ [ + \ 'def foo():', + \ ' pass', + \ ], + \ ], + \ ale#hover#ParseLSPResult(join([ + \ '```python', + \ 'def foo():', + \ ' pass', + \ '```', + \ ], "\n")) + + AssertEqual + \ [ + \ [ + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_python syntax/python.vim', + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_typescript syntax/typescript.vim', + \ 'syntax region ALE_hover_1 start=/\%1l/ end=/\%3l/ contains=@ALE_hover_python', + \ 'syntax region ALE_hover_2 start=/\%5l/ end=/\%8l/ contains=@ALE_hover_python', + \ 'syntax region ALE_hover_3 start=/\%8l/ end=/\%10l/ contains=@ALE_hover_typescript', + \ ], + \ [ + \ 'def foo():', + \ ' pass', + \ '', + \ 'middle line', + \ '', + \ 'def bar():', + \ ' pass', + \ '', + \ 'const baz = () => undefined', + \ ], + \ ], + \ ale#hover#ParseLSPResult(join([ + \ '```python', + \ 'def foo():', + \ ' pass', + \ '```', + \ 'middle line', + \ '```python', + \ 'def bar():', + \ ' pass', + \ '```', + \ '```typescript', + \ 'const baz = () => undefined', + \ '```', + \ ], "\n")) + +Execute(Multiple strings with fences should be handled): + AssertEqual + \ [ + \ [ + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_python syntax/python.vim', + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_typescript syntax/typescript.vim', + \ 'syntax region ALE_hover_1 start=/\%1l/ end=/\%3l/ contains=@ALE_hover_python', + \ 'syntax region ALE_hover_2 start=/\%5l/ end=/\%8l/ contains=@ALE_hover_python', + \ 'syntax region ALE_hover_3 start=/\%8l/ end=/\%10l/ contains=@ALE_hover_typescript', + \ ], + \ [ + \ 'def foo():', + \ ' pass', + \ '', + \ 'middle line', + \ '', + \ 'def bar():', + \ ' pass', + \ '', + \ 'const baz = () => undefined', + \ ], + \ ], + \ ale#hover#ParseLSPResult([ + \ join([ + \ '```python', + \ 'def foo():', + \ ' pass', + \ '```', + \ ], "\n"), + \ join([ + \ 'middle line', + \ '```python', + \ 'def bar():', + \ ' pass', + \ '```', + \ '```typescript', + \ 'const baz = () => undefined', + \ '```', + \ ], "\n"), + \ ]) + +Execute(Objects with kinds should be handled): + AssertEqual + \ [ + \ [ + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_python syntax/python.vim', + \ 'syntax region ALE_hover_1 start=/\%1l/ end=/\%3l/ contains=@ALE_hover_python', + \ ], + \ [ + \ 'def foo():', + \ ' pass', + \ '', + \ '```typescript', + \ 'const baz = () => undefined', + \ '```', + \ ], + \ ], + \ ale#hover#ParseLSPResult([ + \ { + \ 'kind': 'markdown', + \ 'value': join([ + \ '```python', + \ 'def foo():', + \ ' pass', + \ '```', + \ ], "\n"), + \ }, + \ { + \ 'kind': 'plaintext', + \ 'value': join([ + \ '```typescript', + \ 'const baz = () => undefined', + \ '```', + \ ], "\n"), + \ }, + \ ]) + +Execute(Simple markdown formatting should be handled): + AssertEqual + \ [ + \ [ + \ 'unlet! b:current_syntax', + \ 'syntax include @ALE_hover_python syntax/python.vim', + \ 'syntax region ALE_hover_1 start=/\%1l/ end=/\%3l/ contains=@ALE_hover_python', + \ ], + \ [ + \ 'def foo():', + \ ' pass', + \ '', + \ 'formatted _ line _', + \ ], + \ ], + \ ale#hover#ParseLSPResult(join([ + \ '```python', + \ 'def foo():', + \ ' pass', + \ '```', + \ 'formatted \_ line \_', + \ ], "\n")) diff --git a/sources_non_forked/ale/test/test_ignoring_linters.vader b/sources_non_forked/ale/test/test_ignoring_linters.vader new file mode 100644 index 00000000..f97a0cf6 --- /dev/null +++ b/sources_non_forked/ale/test/test_ignoring_linters.vader @@ -0,0 +1,403 @@ +Before: + Save g:ale_disable_lsp + +After: + Restore + + unlet! b:ale_disable_lsp + +Execute(GetList should ignore some invalid values): + AssertEqual [], ale#engine#ignore#GetList('', 'foo') + AssertEqual [], ale#engine#ignore#GetList('', 0) + AssertEqual [], ale#engine#ignore#GetList('', v:null) + +Execute(GetList should handle Lists): + AssertEqual ['foo', 'bar'], ale#engine#ignore#GetList('', ['foo', 'bar']) + +Execute(GetList should handle Dictionaries): + AssertEqual + \ ['linter1', 'linter2'], + \ uniq(sort(ale#engine#ignore#GetList('x.y.z', { + \ 'x': ['linter1'], + \ 'abc': ['linter3'], + \ 'z': ['linter2'], + \ }))) + +Execute(Exclude should ignore some invalid values): + AssertEqual + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ ale#engine#ignore#Exclude( + \ 'foo.bar', + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ 'foo', + \ 0, + \ ) + AssertEqual + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ ale#engine#ignore#Exclude( + \ 'foo.bar', + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ 0, + \ 0, + \ ) + AssertEqual + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ ale#engine#ignore#Exclude( + \ 'foo.bar', + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ v:null, + \ 0, + \ ) + +Execute(Exclude should handle Lists): + AssertEqual + \ [ + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ ale#engine#ignore#Exclude( + \ 'foo.bar', + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ ['linter1', 'alias1'], + \ 0, + \ ) + +Execute(Exclude should handle Dictionaries): + AssertEqual + \ [ + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ ale#engine#ignore#Exclude( + \ 'foo.bar', + \ [ + \ {'name': 'linter1', 'aliases': []}, + \ {'name': 'linter2', 'aliases': ['alias1']}, + \ {'name': 'linter3', 'aliases': []}, + \ ], + \ {'foo': ['linter1'], 'bar': ['alias1']}, + \ 0, + \ ) + +Execute(Exclude should filter LSP linters when g:ale_disable_lsp is set to 1): + AssertEqual + \ [ + \ {'name': 'linter1', 'aliases': [], 'lsp': ''}, + \ {'name': 'linter2', 'aliases': []}, + \ ], + \ ale#engine#ignore#Exclude( + \ 'foo', + \ [ + \ {'name': 'linter1', 'aliases': [], 'lsp': ''}, + \ {'name': 'linter2', 'aliases': []}, + \ {'name': 'linter3', 'aliases': [], 'lsp': 'stdio'}, + \ ], + \ [], + \ 1, + \ ) + +Execute(Exclude should filter LSP linters when b:ale_disable_lsp is set to 1): + AssertEqual + \ [ + \ {'name': 'linter1', 'aliases': [], 'lsp': ''}, + \ {'name': 'linter2', 'aliases': []}, + \ ], + \ ale#engine#ignore#Exclude( + \ 'foo', + \ [ + \ {'name': 'linter1', 'aliases': [], 'lsp': ''}, + \ {'name': 'linter2', 'aliases': []}, + \ {'name': 'linter3', 'aliases': [], 'lsp': 'stdio'}, + \ ], + \ [], + \ 1, + \ ) + +Before: + Save g:ale_linters_ignore + Save g:ale_buffer_info + Save g:ale_disable_lsp + + let g:ale_disable_lsp = 0 + + let g:linters = [] + let g:loclist = [] + let g:run_linters_called = 0 + + runtime autoload/ale/engine.vim + + " Mock the engine function so we can set it up. + function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort + let g:linters = a:linters + let g:run_linters_called = 1 + endfunction + + function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort + let g:loclist = a:loclist + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'true', + \ 'command': has('win32') ? 'echo' : 'true', + \}) + call ale#test#SetDirectory('/testplugin/test') + +After: + Restore + + unlet! b:ale_linted + unlet! b:ale_linters_ignore + unlet! b:ale_quitting + unlet! b:ale_save_event_fired + unlet! b:ale_disable_lsp + unlet! g:linters + unlet! g:loclist + unlet! g:lsp_message + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + call ale#lsp_linter#ClearLSPData() + runtime autoload/ale/engine.vim + +Given foobar(An empty file): +Execute(Global ignore lists should be applied for linters): + " We have to set up buffer info so RunLinters is called. + let g:ale_buffer_info = {bufnr(''): {}} + + ALELint + Assert g:run_linters_called, "The mock callback wasn't called" + AssertEqual ['testlinter'], map(g:linters, 'v:val.name') + + let g:ale_linters_ignore = ['testlinter'] + ALELint + AssertEqual [], g:linters + +Execute(buffer ignore lists should be applied for linters): + " We have to set up buffer info so RunLinters is called. + let g:ale_buffer_info = {bufnr(''): {}} + + ALELint + Assert g:run_linters_called, "The mock callback wasn't called" + AssertEqual ['testlinter'], map(g:linters, 'v:val.name') + + let b:ale_linters_ignore = ['testlinter'] + ALELint + AssertEqual [], g:linters + +Execute(Buffer ignore lists should be applied for tsserver): + call ale#test#SetFilename('filename.ts') + call ale#engine#InitBufferInfo(bufnr('')) + + let g:lsp_message = { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'syntaxDiag', + \ 'body': { + \ 'file': g:dir . '/filename.ts', + \ 'diagnostics':[ + \ { + \ 'start': { + \ 'line':2, + \ 'offset':14, + \ }, + \ 'end': { + \ 'line':2, + \ 'offset':15, + \ }, + \ 'text': ''','' expected.', + \ "code":1005 + \ }, + \ ], + \ }, + \} + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 14, + \ 'nr': 1005, + \ 'code': '1005', + \ 'type': 'E', + \ 'end_col': 14, + \ 'end_lnum': 2, + \ 'text': ''','' expected.', + \ }, + \ ], + \ g:loclist + + let g:loclist = [] + let b:ale_linters_ignore = ['tsserver'] + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual [], g:loclist + +Execute(Buffer ignore lists should be applied for LSP linters): + call ale#test#SetFilename('filename.py') + call ale#engine#InitBufferInfo(bufnr('')) + call ale#lsp_linter#SetLSPLinterMap({'347': 'lsplinter'}) + + let g:lsp_message = { + \ 'jsonrpc': '2.0', + \ 'method': 'textDocument/publishDiagnostics', + \ 'params': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'diagnostics': [ + \ { + \ 'severity': 1, + \ 'message': 'x', + \ 'range': { + \ 'start': {'line': 0, 'character': 9}, + \ 'end': {'line': 0, 'character': 9}, + \ }, + \ } + \ ], + \ }, + \} + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'type': 'E', + \ 'end_col': 9, + \ 'end_lnum': 1, + \ 'text': 'x', + \ } + \ ], + \ g:loclist + + let b:ale_linters_ignore = ['lsplinter'] + let g:loclist = [] + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual [], g:loclist + +Execute(ale_disable_lsp should be applied for tsserver): + call ale#test#SetFilename('filename.ts') + call ale#engine#InitBufferInfo(bufnr('')) + + let g:lsp_message = { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'syntaxDiag', + \ 'body': { + \ 'file': g:dir . '/filename.ts', + \ 'diagnostics':[ + \ { + \ 'start': { + \ 'line':2, + \ 'offset':14, + \ }, + \ 'end': { + \ 'line':2, + \ 'offset':15, + \ }, + \ 'text': ''','' expected.', + \ "code":1005 + \ }, + \ ], + \ }, + \} + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 14, + \ 'nr': 1005, + \ 'code': '1005', + \ 'type': 'E', + \ 'end_col': 14, + \ 'end_lnum': 2, + \ 'text': ''','' expected.', + \ }, + \ ], + \ g:loclist + + let g:loclist = [] + let b:ale_disable_lsp = 1 + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual [], g:loclist + +Execute(ale_disable_lsp should be applied for LSP linters): + call ale#test#SetFilename('filename.py') + call ale#engine#InitBufferInfo(bufnr('')) + call ale#lsp_linter#SetLSPLinterMap({'347': 'lsplinter'}) + + let g:lsp_message = { + \ 'jsonrpc': '2.0', + \ 'method': 'textDocument/publishDiagnostics', + \ 'params': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'diagnostics': [ + \ { + \ 'severity': 1, + \ 'message': 'x', + \ 'range': { + \ 'start': {'line': 0, 'character': 9}, + \ 'end': {'line': 0, 'character': 9}, + \ }, + \ } + \ ], + \ }, + \} + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'type': 'E', + \ 'end_col': 9, + \ 'end_lnum': 1, + \ 'text': 'x', + \ } + \ ], + \ g:loclist + + let b:ale_disable_lsp = 1 + let g:loclist = [] + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual [], g:loclist diff --git a/sources_non_forked/ale/test/test_jq_linter.vader b/sources_non_forked/ale/test/test_jq_linter.vader new file mode 100644 index 00000000..cbe23b96 --- /dev/null +++ b/sources_non_forked/ale/test/test_jq_linter.vader @@ -0,0 +1,18 @@ +Before: + runtime ale_linters/json/jq.vim + +After: + call ale#linter#Reset() + +Execute (Should parse error correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 9, + \ 'text': 'Expected another array element', + \ } + \ ], + \ ale_linters#json#jq#Handle(0, [ + \ 'parse error: Expected another array element at line 1, column 9' + \ ]) diff --git a/sources_non_forked/ale/test/test_jsonlint_executable_detection.vader b/sources_non_forked/ale/test/test_jsonlint_executable_detection.vader new file mode 100644 index 00000000..60bc6d75 --- /dev/null +++ b/sources_non_forked/ale/test/test_jsonlint_executable_detection.vader @@ -0,0 +1,45 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + + runtime ale_linters/json/jsonlint.vim + +After: + let g:ale_json_jsonlint_executable = 'jsonlint' + let g:ale_json_jsonlint_use_global = 0 + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(local executable should be detected correctly): + call ale#test#SetFilename('test-files/jsonlint/app/src/app.json') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/jsonlint/app/node_modules/.bin/jsonlint'), + \ ale_linters#json#jsonlint#GetExecutable(bufnr('')) + +Execute(recursively executable should be detected correctly): + call ale#test#SetFilename('test-files/jsonlint/app-without-jsonlint/src/app.json') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/jsonlint/node_modules/jsonlint/lib/cli.js'), + \ ale_linters#json#jsonlint#GetExecutable(bufnr('')) + +Execute(use_global should override project executable): + let g:ale_json_jsonlint_use_global = 1 + + call ale#test#SetFilename('test-files/jsonlint/app/src/app.json') + + AssertEqual + \ 'jsonlint', + \ ale_linters#json#jsonlint#GetExecutable(bufnr('')) + +Execute(manually defined should override default executable): + let g:ale_json_jsonlint_use_global = 1 + let g:ale_json_jsonlint_executable = 'custom_jsonlint' + + call ale#test#SetFilename('test-files/jsonlint/app/src/app.json') + + AssertEqual + \ 'custom_jsonlint', + \ ale_linters#json#jsonlint#GetExecutable(bufnr('')) + diff --git a/sources_non_forked/ale/test/test_line_join.vader b/sources_non_forked/ale/test/test_line_join.vader new file mode 100644 index 00000000..9356a2b7 --- /dev/null +++ b/sources_non_forked/ale/test/test_line_join.vader @@ -0,0 +1,84 @@ +Before: + let g:lines = [] + let g:data = '' + + function! LineCallback(job_id, line) abort + call add(g:lines, a:line) + endfunction + + function! RawCallback(job_id, some_data) abort + let g:data .= a:some_data + endfunction + +After: + unlet! g:last_line + unlet! g:lines + unlet! g:data + delfunction LineCallback + delfunction RawCallback + +Execute (ALE should handle empty Lists for the lines): + let g:last_line = ale#util#JoinNeovimOutput(1, '', [], 'nl', function('LineCallback')) + + AssertEqual [], g:lines + AssertEqual '', g:last_line + +Execute (ALE should pass on full lines for NeoVim): + let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', 'y', ''], 'nl', function('LineCallback')) + + AssertEqual ['x', 'y'], g:lines + AssertEqual '', g:last_line + +Execute (ALE should pass on a single long line): + let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x'], 'nl', function('LineCallback')) + + AssertEqual [], g:lines + AssertEqual 'x', g:last_line + +Execute (ALE should handle just a single line of output): + let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', ''], 'nl', function('LineCallback')) + + AssertEqual ['x'], g:lines + AssertEqual '', g:last_line + +Execute (ALE should join two incomplete pieces of large lines together): + let g:last_line = ale#util#JoinNeovimOutput(1, 'x', ['y'], 'nl', function('LineCallback')) + + AssertEqual [], g:lines + AssertEqual 'xy', g:last_line + +Execute (ALE join incomplete lines, and set new ones): + let g:last_line = ale#util#JoinNeovimOutput(1, 'x', ['y', 'z', 'a'], 'nl', function('LineCallback')) + + AssertEqual ['xy', 'z'], g:lines + AssertEqual 'a', g:last_line + +Execute (ALE join incomplete lines, and set new ones, with two elements): + let g:last_line = ale#util#JoinNeovimOutput(1, 'x', ['y', 'z'], 'nl', function('LineCallback')) + + AssertEqual ['xy'], g:lines + AssertEqual 'z', g:last_line + +Execute (ALE should pass on full lines for NeoVim for raw data): + let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', 'y', ''], 'raw', function('RawCallback')) + + AssertEqual "x\ny\n", g:data + AssertEqual '', g:last_line + +Execute (ALE should pass on a single long line): + let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x'], 'raw', function('RawCallback')) + + AssertEqual 'x', g:data + AssertEqual '', g:last_line + +Execute (ALE should handle just a single line of output): + let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', ''], 'raw', function('RawCallback')) + + AssertEqual "x\n", g:data + AssertEqual '', g:last_line + +Execute (ALE should pass on two lines and one incomplete one): + let g:last_line = ale#util#JoinNeovimOutput(1, '', ['y', 'z', 'a'], 'raw', function('RawCallback')) + + AssertEqual "y\nz\na", g:data + AssertEqual '', g:last_line diff --git a/sources_non_forked/ale/test/test_lint_file_linters.vader b/sources_non_forked/ale/test/test_lint_file_linters.vader new file mode 100644 index 00000000..682e4130 --- /dev/null +++ b/sources_non_forked/ale/test/test_lint_file_linters.vader @@ -0,0 +1,317 @@ +Before: + Save g:ale_fix_on_save + Save g:ale_enabled + Save g:ale_run_synchronously + Save g:ale_set_lists_synchronously + Save g:ale_buffer_info + Save g:ale_linters + + let g:ale_buffer_info = {} + let g:ale_run_synchronously = 1 + unlet! g:ale_run_synchronously_callbacks + let g:ale_set_lists_synchronously = 1 + let b:ale_save_event_fired = 0 + + let g:buffer_result = [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'buffer error', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'buffer warning', + \ 'type': 'W', + \ }, + \] + + function! LintFileCallback(buffer, output) + return [ + \ { + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'file warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'text': 'file error', + \ 'type': 'E', + \ }, + \] + endfunction + + function! BufferCallback(buffer, output) + return deepcopy(g:buffer_result) + endfunction + + function! GetSimplerLoclist() + let l:loclist = [] + + for l:item in ale#test#GetLoclistWithoutNewerKeys() + call add(l:loclist, { + \ 'lnum': l:item.lnum, + \ 'col': l:item.col, + \ 'text': l:item.text, + \ 'type': l:item.type, + \}) + endfor + + return l:loclist + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'lint_file_linter', + \ 'callback': 'LintFileCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': 'echo', + \ 'lint_file': 1, + \}) + + call ale#linter#Define('foobar', { + \ 'name': 'buffer_linter', + \ 'callback': 'BufferCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': 'echo', + \ 'read_buffer': 0, + \}) + + let g:filename = tempname() + call writefile([], g:filename) + call ale#test#SetFilename(g:filename) + +After: + if !g:ale_run_synchronously + call ale#engine#Cleanup(bufnr('')) + endif + + Restore + + unlet! g:ale_run_synchronously_callbacks + unlet! b:ale_save_event_fired + unlet! b:ale_enabled + unlet g:buffer_result + let g:ale_buffer_info = {} + call ale#linter#Reset() + call setloclist(0, []) + delfunction LintFileCallback + delfunction BufferCallback + + if filereadable(g:filename) + call delete(g:filename) + endif + + unlet g:filename + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(Running linters without 'lint_file' should run only buffer linters): + call ale#Queue(0) + call ale#test#FlushJobs() + + AssertEqual [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'buffer error', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'buffer warning', + \ 'type': 'W', + \ }, + \], GetSimplerLoclist() + +Execute(Running linters with 'lint_file' should run all linters): + Assert filereadable(expand('%:p')), 'The file was not readable' + + call ale#Queue(0, 'lint_file') + call ale#test#FlushJobs() + + AssertEqual [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'buffer error', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'file warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 1, + \ 'text': 'buffer warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'text': 'file error', + \ 'type': 'E', + \ }, + \], GetSimplerLoclist() + +Execute(Linter errors from files should be kept): + Assert filereadable(expand('%:p')), 'The file was not readable' + + call ale#Queue(0, 'lint_file') + call ale#test#FlushJobs() + + " Change the results for the buffer callback. + let g:buffer_result = [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'new buffer error', + \ 'type': 'E', + \ }, + \] + + call ale#Queue(0) + call ale#test#FlushJobs() + + AssertEqual [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'new buffer error', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'file warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'text': 'file error', + \ 'type': 'E', + \ }, + \], GetSimplerLoclist() + +Execute(Linter errors from files should be kept when no other linters are run): + let g:ale_linters = {'foobar': ['lint_file_linter']} + Assert filereadable(expand('%:p')), 'The file was not readable' + + call ale#Queue(0, 'lint_file') + call ale#test#FlushJobs() + + AssertEqual [ + \ { + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'file warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'text': 'file error', + \ 'type': 'E', + \ }, + \], GetSimplerLoclist() + + call ale#Queue(0) + + AssertEqual [ + \ { + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'file warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'text': 'file error', + \ 'type': 'E', + \ }, + \], GetSimplerLoclist() + +Execute(The Save event should respect the buffer number): + let g:ale_linters = {'foobar': ['lint_file_linter']} + Assert filereadable(expand('%:p')), 'The file was not readable' + + call ale#events#SaveEvent(bufnr('') + 1) + call ale#test#FlushJobs() + + " We shouldn't get any prblems yet. + AssertEqual [], GetSimplerLoclist() + + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + " We should get them now we used the right buffer number. + AssertEqual [ + \ { + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'file warning', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 2, + \ 'col': 3, + \ 'text': 'file error', + \ 'type': 'E', + \ }, + \], GetSimplerLoclist() + +Execute(The Save event should set b:ale_save_event_fired to 1): + let g:ale_lint_on_save = 1 + let b:ale_enabled = 1 + + call ale#linter#Reset() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + " This flag needs to be set so windows can be opened, etc. + AssertEqual 1, b:ale_save_event_fired + +Execute(b:ale_save_event_fired should be set to 0 when results are set): + let b:ale_save_event_fired = 1 + + call ale#engine#SetResults(bufnr(''), []) + call ale#test#FlushJobs() + + AssertEqual 0, b:ale_save_event_fired + +Execute(lint_file linters should stay running after checking without them): + let g:ale_run_synchronously = 0 + + " Run all linters, then just the buffer linters. + call ale#Queue(0, 'lint_file') + call ale#Queue(0) + + " The lint_file linter should still be running. + AssertEqual + \ ['lint_file_linter', 'buffer_linter'], + \ map(copy(g:ale_buffer_info[bufnr('')].active_linter_list), 'v:val.name') + " We should have 1 job for each linter. + AssertEqual + \ 2, + \ len(keys(get(get(ale#command#GetData(), bufnr(''), {}), 'jobs', {}))) + + call ale#test#WaitForJobs(2000) + +Execute(The save event should not lint the buffer when ALE is disabled): + let g:ale_enabled = 0 + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual [], GetSimplerLoclist() + AssertEqual 0, b:ale_save_event_fired diff --git a/sources_non_forked/ale/test/test_lint_on_enter_when_file_changed.vader b/sources_non_forked/ale/test/test_lint_on_enter_when_file_changed.vader new file mode 100644 index 00000000..9d5e64e2 --- /dev/null +++ b/sources_non_forked/ale/test/test_lint_on_enter_when_file_changed.vader @@ -0,0 +1,84 @@ +Before: + Save &filetype + Save g:ale_buffer_info + Save g:ale_lint_on_enter + Save g:ale_set_lists_synchronously + + let g:buf = bufnr('') + let g:ale_lint_on_enter = 1 + let g:ale_run_synchronously = 1 + let g:ale_set_lists_synchronously = 1 + + function! TestCallback(buffer, output) + return [{ + \ 'lnum': 1, + \ 'col': 3, + \ 'text': 'baz boz', + \}] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'true', + \ 'command': has('win32') ? 'echo' : 'true', + \}) + +After: + Restore + unlet! g:buf + let g:ale_run_synchronously = 0 + delfunction TestCallback + call ale#linter#Reset() + call setloclist(0, []) + +Execute(The file changed event function should set b:ale_file_changed): + let g:ale_lint_on_enter = 0 + + if has('gui_running') + new + else + e test + endif + + call ale#events#FileChangedEvent(g:buf) + close + + " We should set the flag in the other buffer + AssertEqual 1, getbufvar(g:buf, 'ale_file_changed') + +Execute(The file changed event function should lint the current buffer when it has changed): + set filetype=foobar + call ale#events#FileChangedEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual [{ + \ 'bufnr': bufnr(''), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'baz boz', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }], ale#test#GetLoclistWithoutNewerKeys() + +Execute(The buffer should be checked after entering it after the file has changed): + let b:ale_file_changed = 1 + + set filetype=foobar + call ale#events#ReadOrEnterEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual [{ + \ 'bufnr': bufnr(''), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 3, + \ 'text': 'baz boz', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \ }], ale#test#GetLoclistWithoutNewerKeys() diff --git a/sources_non_forked/ale/test/test_lint_on_filetype_changed.vader b/sources_non_forked/ale/test/test_lint_on_filetype_changed.vader new file mode 100644 index 00000000..cfc99d58 --- /dev/null +++ b/sources_non_forked/ale/test/test_lint_on_filetype_changed.vader @@ -0,0 +1,77 @@ +Before: + Save &filetype + Save g:ale_lint_on_filetype_changed + + let g:ale_lint_on_filetype_changed = 1 + let g:queue_calls = [] + + function! ale#Queue(...) + call add(g:queue_calls, a:000) + endfunction + +After: + Restore + + unlet! g:queue_calls + + " Reload the ALE code to load the real function again. + runtime autoload/ale.vim + + unlet! b:ale_original_filetype + +Execute(The original filetype should be set on BufEnter): + let &filetype = 'foobar' + + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 'foobar', b:ale_original_filetype + + let &filetype = 'bazboz' + + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 'bazboz', b:ale_original_filetype + +Execute(Linting should not be queued when the filetype is the same): + let b:ale_original_filetype = 'foobar' + let g:queue_calls = [] + + call ale#events#FileTypeEvent(bufnr(''), 'foobar') + + AssertEqual [], g:queue_calls + +Execute(Linting should be queued when the filetype changes): + let b:ale_original_filetype = 'foobar' + let g:queue_calls = [] + + call ale#events#FileTypeEvent(bufnr(''), 'bazboz') + + AssertEqual [[300, 'lint_file', bufnr('')]], g:queue_calls + " The original filetype should be updated, so we don't trigger linting + " by setting a filetype equal to what it already is. + AssertEqual 'bazboz', b:ale_original_filetype + +Execute(Linting should be done when the original filetype was blank): + let b:ale_original_filetype = '' + + call ale#events#FileTypeEvent(bufnr(''), 'bazboz') + + AssertEqual [[300, 'lint_file', bufnr('')]], g:queue_calls + AssertEqual 'bazboz', b:ale_original_filetype + +Execute(Linting should not be done when the setting is off): + let b:ale_original_filetype = 'foobar' + let g:ale_lint_on_filetype_changed = 0 + + call ale#events#FileTypeEvent(bufnr(''), 'bazboz') + + AssertEqual [], g:queue_calls + " We should still update the old filetype + AssertEqual 'bazboz', b:ale_original_filetype + +Execute(Linting should be done when the original filetype was not set): + unlet! b:ale_original_filetype + + call ale#events#FileTypeEvent(bufnr(''), 'bazboz') + + AssertEqual [], g:queue_calls diff --git a/sources_non_forked/ale/test/test_linter_defintion_processing.vader b/sources_non_forked/ale/test/test_linter_defintion_processing.vader new file mode 100644 index 00000000..4c096a5e --- /dev/null +++ b/sources_non_forked/ale/test/test_linter_defintion_processing.vader @@ -0,0 +1,501 @@ +Before: + Save g:ale_root + Save b:ale_root + + let g:ale_root = {} + unlet! b:ale_root + + let g:linter = {} + +After: + unlet g:linter + +Execute (PreProcess should throw when the linter object is not a Dictionary): + AssertThrows call ale#linter#PreProcess('testft', '') + AssertEqual 'The linter object must be a Dictionary', g:vader_exception + +Execute (PreProcess should throw when there is no name): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': 'echo', + \}) + AssertEqual '`name` must be defined to name the linter', g:vader_exception + +Execute (PreProcess should throw when there is no callback): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'executable': 'echo', + \ 'command': 'echo', + \}) + AssertEqual '`callback` must be defined with a callback to accept output', g:vader_exception + +Execute (PreProcess should throw when then callback is not a function): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 1, + \ 'executable': 'echo', + \ 'command': 'echo', + \}) + AssertEqual '`callback` must be defined with a callback to accept output', g:vader_exception + +Execute (PreProcess should throw when there is no executable): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'command': 'echo', + \}) + AssertEqual '`executable` must be defined', g:vader_exception + +Execute (PreProcess should throw when executable is not a string): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 123, + \ 'command': 'echo', + \}) + AssertEqual '`executable` must be a String or Function if defined', g:vader_exception + +Execute (PreProcess should allow executable to be a callback): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': function('type'), + \ 'command': 'echo', + \}) + +Execute (PreProcess should throw when there is no command): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \}) + AssertEqual '`command` must be defined', g:vader_exception + +Execute (PreProcess should throw when command is not a string): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': [], + \}) + AssertEqual '`command` must be a String or Function if defined', g:vader_exception + +Execute (PreProcess should allow command to be a callback): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': function('type'), + \}) + +Execute (PreProcess should throw when cwd is not a string): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'cwd': [], + \ 'command': 'echo', + \}) + AssertEqual '`cwd` must be a String or Function if defined', g:vader_exception + +Execute (PreProcess should allow cwd to be a callback): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'cwd': function('type'), + \ 'command': 'echo', + \}) + +Execute (PreProcess should allow cwd to be a string): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'cwd': '/foo/bar', + \ 'command': 'echo', + \}) + +Execute (PreProcess should when the output stream isn't a valid string): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': 'echo', + \ 'output_stream': 'xxx', + \}) + AssertEqual "`output_stream` must be 'stdout', 'stderr', or 'both'", g:vader_exception + +Execute (PreProcess should not throw when everything is correct): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': 'echo', + \}) + +Execute (PreProcess should accept an stdout output_stream): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': 'echo', + \ 'output_stream': 'stdout', + \}) + +Execute (PreProcess should accept an stderr output_stream): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': 'echo', + \ 'output_stream': 'stderr', + \}) + +Execute (PreProcess should accept a 'both' output_stream): + call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': 'echo', + \ 'output_stream': 'both', + \}) + +Execute(PreProcess should process the read_buffer option correctly): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \ 'read_buffer': '0', + \} + + AssertThrows call ale#linter#PreProcess('testft', g:linter) + AssertEqual '`read_buffer` must be `0` or `1`', g:vader_exception + + let g:linter.read_buffer = 0 + + call ale#linter#PreProcess('testft', g:linter) + + let g:linter.read_buffer = 1 + + call ale#linter#PreProcess('testft', g:linter) + +Execute(PreProcess should set a default value for read_buffer): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \} + + AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer + +Execute(PreProcess should process the lint_file option correctly): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \ 'lint_file': 'x', + \} + + AssertThrows call ale#linter#PreProcess('testft', g:linter) + AssertEqual '`lint_file` must be `0`, `1`, or a Function', g:vader_exception + + let g:linter.lint_file = 0 + + AssertEqual 0, ale#linter#PreProcess('testft', g:linter).lint_file + " The default for read_buffer should be 1 when lint_file is 0 + AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer + + let g:linter.lint_file = 1 + + AssertEqual 1, ale#linter#PreProcess('testft', g:linter).lint_file + " The default for read_buffer should still be 1 + AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer + + let g:linter.read_buffer = 1 + + " We should be able to set `read_buffer` and `lint_file` at the same time. + AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer + + let g:linter.lint_file = function('type') + + Assert type(ale#linter#PreProcess('testft', g:linter).lint_file) is v:t_func + +Execute(PreProcess should set a default value for lint_file): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \} + + AssertEqual 0, ale#linter#PreProcess('testft', g:linter).lint_file + +Execute(PreProcess should set a default value for aliases): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \} + + AssertEqual [], ale#linter#PreProcess('testft', g:linter).aliases + +Execute(PreProcess should complain about invalid `aliases` values): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \ 'aliases': 'foo', + \} + + AssertThrows call ale#linter#PreProcess('testft', g:linter) + AssertEqual '`aliases` must be a List of String values', g:vader_exception + + let g:linter.aliases = [1] + + AssertThrows call ale#linter#PreProcess('testft', g:linter) + AssertEqual '`aliases` must be a List of String values', g:vader_exception + +Execute(PreProcess should accept `aliases` lists): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \ 'aliases': [], + \} + + AssertEqual [], ale#linter#PreProcess('testft', g:linter).aliases + + let g:linter.aliases = ['foo', 'bar'] + + AssertEqual ['foo', 'bar'], ale#linter#PreProcess('testft', g:linter).aliases + +Execute(PreProcess should accept tsserver LSP configuration): + let g:linter = { + \ 'name': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \ 'lsp': 'tsserver', + \ 'language': 'x', + \ 'project_root': 'x', + \} + + AssertEqual 'tsserver', ale#linter#PreProcess('testft', g:linter).lsp + +Execute(PreProcess should accept stdio LSP configuration): + let g:linter = { + \ 'name': 'x', + \ 'executable': 'x', + \ 'command': 'x', + \ 'lsp': 'stdio', + \ 'language': 'x', + \ 'project_root': 'x', + \} + + AssertEqual 'stdio', ale#linter#PreProcess('testft', g:linter).lsp + +Execute(PreProcess should accept LSP server configurations): + let g:linter = { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 'foobar', + \ 'project_root': 'x', + \} + + AssertEqual 'socket', ale#linter#PreProcess('testft', g:linter).lsp + +Execute(PreProcess should accept let you specify the `language` as a Function): + let g:linter = { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': {-> 'foobar'}, + \ 'project_root': 'x', + \} + + AssertEqual 'foobar', ale#linter#PreProcess('testft', g:linter).language(bufnr('')) + +Execute(PreProcess should complain about invalid language values): + let g:linter = { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 0, + \ 'project_root': 'x', + \} + + AssertThrows call ale#linter#PreProcess('testft', g:linter) + AssertEqual '`language` must be a String or Function if defined', g:vader_exception + +Execute(PreProcess should use the filetype as the language string by default): + let g:linter = { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'project_root': 'x', + \} + + AssertEqual 'testft', ale#linter#PreProcess('testft', g:linter).language + +Execute(PreProcess should require an `address` for LSP socket configurations): + let g:linter = { + \ 'name': 'x', + \ 'lsp': 'socket', + \} + + AssertThrows call ale#linter#PreProcess('testft', g:linter) + AssertEqual '`address` must be defined for getting the LSP address', g:vader_exception + +Execute(PreProcess should complain about `address` for non-LSP linters): + let g:linter = { + \ 'name': 'x', + \ 'callback': 'SomeFunction', + \ 'executable': 'echo', + \ 'command': 'echo', + \ 'address': 'X', + \} + + AssertThrows call ale#linter#PreProcess('testft', g:linter) + AssertEqual '`address` cannot be used when lsp != ''socket''', g:vader_exception + +Execute(PreProcess accept `address` as a String): + let g:linter = ale#linter#PreProcess('testft', { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'foo:123', + \ 'language': 'x', + \ 'project_root': 'x', + \}) + + AssertEqual 'foo:123', ale#linter#GetAddress(0, g:linter) + +Execute(PreProcess accept address as a Function): + let g:linter = ale#linter#PreProcess('testft', { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': {-> 'foo:123'}, + \ 'language': 'x', + \ 'project_root': 'x', + \}) + + AssertEqual 'foo:123', ale#linter#GetAddress(0, g:linter) + +Execute(PreProcess should complain about invalid address values): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 0, + \ 'language': 'x', + \ 'project_root': 'x', + \}) + AssertEqual '`address` must be a String or Function if defined', g:vader_exception + +Execute(PreProcess should allow the `project_root` to be set as a String): + let g:linter = ale#linter#PreProcess('testft', { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'foo:123', + \ 'language': 'x', + \ 'project_root': '/foo/bar', + \}) + + AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter) + +Execute(PreProcess should `project_root` be set as a Function): + let g:linter = ale#linter#PreProcess('testft', { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'foo:123', + \ 'language': 'x', + \ 'project_root': {-> '/foo/bar'}, + \}) + + AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter) + +Execute(PreProcess should complain when `project_root` is invalid): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'foo:123', + \ 'language': 'x', + \ 'project_root': 0, + \}) + AssertEqual '`project_root` must be a String or Function', g:vader_exception + +Execute(PreProcess should throw when `initialization_options` is not a Dictionary or callback): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 'x', + \ 'project_root': 'x', + \ 'initialization_options': 0, + \}) + AssertEqual '`initialization_options` must be a Dictionary or Function if defined', g:vader_exception + +Execute(PreProcess should accept `initialization_options` as a Dictionary): + let g:linter = ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 'x', + \ 'project_root': 'x', + \ 'initialization_options': {'foo': v:true}, + \}) + + AssertEqual {'foo': v:true}, ale#lsp_linter#GetOptions(0, g:linter) + +Execute(PreProcess should accept `initialization_options` as a Function): + let g:linter = ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 'x', + \ 'project_root': 'x', + \ 'initialization_options': {-> {'foo': v:true}}, + \}) + + AssertEqual {'foo': v:true}, ale#lsp_linter#GetOptions(0, g:linter) + +Execute(PreProcess should accept `lsp_config` as a Dictionary): + let g:linter = { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 'x', + \ 'project_root': 'x', + \ 'lsp_config': {'foo': 'bar'}, + \} + + AssertEqual {'foo': 'bar'}, ale#lsp_linter#GetConfig(0, g:linter) + +Execute(PreProcess should accept `lsp_config` as a Function): + let g:linter = { + \ 'name': 'x', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 'x', + \ 'project_root': 'x', + \ 'lsp_config': {-> {'foo': 'bar'}}, + \} + + AssertEqual {'foo': 'bar'}, ale#lsp_linter#GetConfig(0, g:linter) + +Execute(PreProcess should throw when `lsp_config` is not a Dictionary or Function): + AssertThrows call ale#linter#PreProcess('testft', { + \ 'name': 'foo', + \ 'lsp': 'socket', + \ 'address': 'X', + \ 'language': 'x', + \ 'project_root': 'x', + \ 'lsp_config': 'x', + \}) + AssertEqual '`lsp_config` must be a Dictionary or Function if defined', g:vader_exception diff --git a/sources_non_forked/ale/test/test_linter_retrieval.vader b/sources_non_forked/ale/test/test_linter_retrieval.vader new file mode 100644 index 00000000..88885b71 --- /dev/null +++ b/sources_non_forked/ale/test/test_linter_retrieval.vader @@ -0,0 +1,190 @@ +Before: + Save g:ale_linters + Save g:ale_linter_aliases + + let g:testlinter1 = {'name': 'testlinter1', 'executable': 'testlinter1', 'command': 'testlinter1', 'callback': 'testCB1', 'output_stream': 'stdout', 'read_buffer': 1, 'lint_file': 0, 'aliases': [], 'lsp': ''} + let g:testlinter2 = {'name': 'testlinter2', 'executable': 'testlinter2', 'command': 'testlinter2', 'callback': 'testCB2', 'output_stream': 'stdout', 'read_buffer': 0, 'lint_file': 1, 'aliases': [], 'lsp': ''} + call ale#linter#Reset() + call ale#linter#PreventLoading('testft') + call ale#linter#PreventLoading('javascript') + call ale#linter#PreventLoading('typescript') + +After: + Restore + + unlet! g:testlinter1 + unlet! g:testlinter2 + unlet! b:ale_linters + unlet! b:ale_linter_aliases + call ale#linter#Reset() + +Execute (You should be able to get a defined linter): + call ale#linter#Define('testft', g:testlinter1) + AssertEqual [g:testlinter1], ale#linter#Get('testft') + +Execute (You should be able get select a single linter): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['testlinter1']} + + AssertEqual [g:testlinter1], ale#linter#Get('testft') + +Execute (You should be able to select a linter by an alias): + let g:testlinter1.aliases = ['foo', 'linter1alias'] + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['linter1alias']} + + AssertEqual [g:testlinter1], ale#linter#Get('testft') + +Execute (You should be able to select linters with a buffer option): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['testlinter1', 'testlinter2']} + let b:ale_linters = {'testft': ['testlinter1']} + + AssertEqual [g:testlinter1], ale#linter#Get('testft') + +Execute (b:ale_linters should work when set to a List): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['testlinter1', 'testlinter2']} + let b:ale_linters = ['testlinter1'] + + AssertEqual [g:testlinter1], ale#linter#Get('testft') + +Execute (b:ale_linters should disable all linters when set to an empty List): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['testlinter1', 'testlinter2']} + let b:ale_linters = [] + + AssertEqual [], ale#linter#Get('testft') + +Execute (b:ale_linters should enable all available linters when set to 'all'): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['testlinter1']} + let b:ale_linters = 'all' + + AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft') + +Execute (Buffer settings shouldn't completely replace global settings): + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft', g:testlinter2) + let g:ale_linters = {'testft': ['testlinter1']} + let b:ale_linters = {'testft2': ['testlinter1', 'testlinter2']} + + AssertEqual [g:testlinter1], ale#linter#Get('testft') + +Execute (You should be able to alias linters from one filetype to another): + call ale#linter#Define('testft1', g:testlinter1) + let g:ale_linter_aliases = {'testft2': 'testft1'} + + AssertEqual [g:testlinter1], ale#linter#Get('testft2') + +Execute (You should be able to filter aliased linters): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft1', g:testlinter2) + let g:ale_linters = {'testft1': ['testlinter1'], 'testft2': ['testlinter2']} + let g:ale_linter_aliases = {'testft2': 'testft1'} + + AssertEqual [g:testlinter1], ale#linter#Get('testft1') + AssertEqual [g:testlinter2], ale#linter#Get('testft2') + +Execute (Dot-separated filetypes should be handled correctly): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + + AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft1.testft2') + +Execute (Linters for multiple aliases should be loaded): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + let ale_linter_aliases = {'testft3': ['testft1', 'testft2']} + + AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft3') + +Execute (You should be able to alias filetypes to themselves and another): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + let ale_linter_aliases = {'testft1': ['testft1', 'testft2']} + + AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft1') + +Execute (Buffer-local overrides for aliases should be used): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + let g:ale_linter_aliases = {'testft1': ['testft2']} + let b:ale_linter_aliases = {'testft1': ['testft1', 'testft2']} + + AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft1') + +Execute (The local alias option shouldn't completely replace the global one): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + let g:ale_linter_aliases = {'testft1': ['testft1', 'testft2']} + " This is a key set for a different filetype. + " We should look for a key in this Dictionary first, and then check the + " global Dictionary. + let b:ale_linter_aliases = {'testft3': ['testft1']} + + AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft1') + +Execute (Lists should be accepted for local aliases): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + let g:ale_linter_aliases = {'testft1': ['testft1', 'testft2']} + " We should load the testft2 linters for this buffer, with no duplicates. + let b:ale_linter_aliases = ['testft2'] + + AssertEqual [g:testlinter2], ale#linter#Get('anything.else') + +Execute (Strings should be accepted for local aliases): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + let g:ale_linter_aliases = {'testft1': ['testft1', 'testft2']} + " We should load the testft2 linters for this buffer, with no duplicates. + let b:ale_linter_aliases = 'testft2' + + AssertEqual [g:testlinter2], ale#linter#Get('anything.else') + +Execute (Buffer-local overrides for aliases should be used): + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + let g:ale_linter_aliases = {'testft1': ['testft2']} + let b:ale_linter_aliases = {'testft1': ['testft1', 'testft2']} + + AssertEqual [g:testlinter1, g:testlinter2], ale#linter#Get('testft1') + +Execute (Linters new linters with the same name should replace old ones): + let g:testlinter1.name = g:testlinter2.name + + call ale#linter#Define('testft1', g:testlinter1) + call ale#linter#Define('testft1', g:testlinter2) + + AssertEqual [g:testlinter2], ale#linter#GetAll(['testft1']) + +Execute (Linters should be loaded from disk appropriately): + call ale#linter#Reset() + AssertEqual [{'name': 'testlinter', 'output_stream': 'stdout', 'executable': 'testlinter', 'command': 'testlinter', 'callback': 'testCB', 'read_buffer': 1, 'lint_file': 0, 'aliases': [], 'lsp': ''}], ale#linter#Get('testft') + + +Execute (Linters for later filetypes should replace the former ones): + call ale#linter#Define('javascript', { + \ 'name': 'eslint', + \ 'executable': 'y', + \ 'command': 'y', + \ 'callback': 'y', + \}) + call ale#linter#Define('typescript', { + \ 'name': 'eslint', + \ 'executable': 'x', + \ 'command': 'x', + \ 'callback': 'x', + \}) + + AssertEqual [ + \ {'output_stream': 'stdout', 'lint_file': 0, 'read_buffer': 1, 'name': 'eslint', 'executable': 'x', 'lsp': '', 'aliases': [], 'command': 'x', 'callback': 'x'} + \], ale#linter#Get('javascript.typescript') diff --git a/sources_non_forked/ale/test/test_linter_type_mapping.vader b/sources_non_forked/ale/test/test_linter_type_mapping.vader new file mode 100644 index 00000000..0ec22a56 --- /dev/null +++ b/sources_non_forked/ale/test/test_linter_type_mapping.vader @@ -0,0 +1,120 @@ +Before: + Save g:ale_type_map + +After: + Restore + unlet! b:ale_type_map + +Execute(It should be possible to remap errors to style errors): + let g:ale_type_map = {'foo': {'E': 'ES'}} + + AssertEqual + \ [ + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ ], + \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ ]) + +Execute(It should be possible to remap errors to style errors with buffer-local variables): + let b:ale_type_map = {'foo': {'E': 'ES'}} + + AssertEqual + \ [ + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ ], + \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ ]) + +Execute(It should be possible to remap warnings to style warnings): + let g:ale_type_map = {'foo': {'W': 'WS'}} + + AssertEqual + \ [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ ], + \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ ]) + +Execute(It should be possible to remap style errors to errors): + let g:ale_type_map = {'foo': {'ES': 'E'}} + + AssertEqual + \ [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ ], + \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ ]) + +Execute(It should be possible to remap style warnings to warnings): + let g:ale_type_map = {'foo': {'WS': 'W'}} + + AssertEqual + \ [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ ], + \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ ]) + +Execute(It should be possible to info problems to warnings): + let g:ale_type_map = {'foo': {'I': 'W'}} + + AssertEqual + \ [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'}, + \ ], + \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [ + \ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1}, + \ ]) diff --git a/sources_non_forked/ale/test/test_linting_blacklist.vader b/sources_non_forked/ale/test/test_linting_blacklist.vader new file mode 100644 index 00000000..2bcc9576 --- /dev/null +++ b/sources_non_forked/ale/test/test_linting_blacklist.vader @@ -0,0 +1,16 @@ +Before: + let g:ale_buffer_info = {} + +After: + call ale#engine#Cleanup(bufnr('')) + + let g:ale_buffer_info = {} + +Given unite (A Unite.vim file): + anything + +Execute(Running ALE on a blacklisted file shouldn't change anything): + call ale#Queue(0) + call ale#test#WaitForJobs(2000) + + AssertEqual {}, g:ale_buffer_info diff --git a/sources_non_forked/ale/test/test_linting_updates_loclist.vader b/sources_non_forked/ale/test/test_linting_updates_loclist.vader new file mode 100644 index 00000000..41c86522 --- /dev/null +++ b/sources_non_forked/ale/test/test_linting_updates_loclist.vader @@ -0,0 +1,96 @@ +Before: + Save g:ale_echo_cursor + Save g:ale_set_highlights + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + Save g:ale_run_synchronously + Save g:ale_set_lists_synchronously + Save g:ale_buffer_info + Save g:ale_sign_offset + + " We want to check that sign IDs are set for this test. + let g:ale_set_signs = 1 + let g:ale_set_loclist = 1 + let g:ale_sign_offset = 2000000 + " Disable features we don't need for these tests. + let g:ale_set_quickfix = 0 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + + let g:ale_run_synchronously = 1 + let g:ale_set_lists_synchronously = 1 + let g:ale_buffer_info = {} + + function! TestCallback(buffer, output) + return [ + \ { + \ 'lnum': 1, + \ 'type': 'W', + \ 'col': 10, + \ 'text': 'Infix operators must be spaced. [Warning/space-infix-ops]', + \ }, + \ { + \ 'lnum': 2, + \ 'type': 'E', + \ 'col': 10, + \ 'text': 'Missing semicolon. [Error/semi]', + \ } + \] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd': 'true', + \ 'command': 'true', + \ 'read_buffer': 0, + \}) + + sign unplace * + + call ale#engine#Cleanup(bufnr('')) + +After: + Restore + + delfunction TestCallback + + call ale#linter#Reset() + + sign unplace * + +Given foobar (Some JavaScript with problems): + var y = 3+3; + var y = 3 + +Execute(The loclist should be updated after linting is done): + ALELint + call ale#test#FlushJobs() + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'testlinter', + \ 'nr': -1, + \ 'type': 'W', + \ 'col': 10, + \ 'text': 'Infix operators must be spaced. [Warning/space-infix-ops]', + \ 'sign_id': 2000001, + \ }, + \ { + \ 'lnum': 2, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'linter_name': 'testlinter', + \ 'nr': -1, + \ 'type': 'E', + \ 'col': 10, + \ 'text': 'Missing semicolon. [Error/semi]', + \ 'sign_id': 2000002, + \ } + \ ], + \ get(get(g:ale_buffer_info, bufnr('%'), {}), 'loclist', []) diff --git a/sources_non_forked/ale/test/test_list_formatting.vader b/sources_non_forked/ale/test/test_list_formatting.vader new file mode 100644 index 00000000..eaa67a9d --- /dev/null +++ b/sources_non_forked/ale/test/test_list_formatting.vader @@ -0,0 +1,188 @@ +Before: + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_loclist_msg_format + Save g:ale_open_list + Save g:ale_buffer_info + Save g:ale_set_lists_synchronously + + let g:ale_set_lists_synchronously = 1 + let g:ale_loclist_msg_format = '%code: %%s' + let g:ale_open_list = 0 + let g:loclist = [] + let g:ale_buffer_info = {bufnr(''): {'loclist': g:loclist}} + + function! AddItem(data) abort + let l:item = { + \ 'bufnr': bufnr(''), + \ 'lnum': 1, + \ 'col': 1, + \ 'type': 'E', + \ 'linter_name': 'some_linter', + \} + + call add(g:loclist, extend(l:item, a:data)) + endfunction + +After: + Restore + + unlet! g:loclist + unlet! b:ale_loclist_msg_format + + delfunction AddItem + + call setloclist(0, []) + call setqflist([]) + +Execute(Formatting with codes should work for the loclist): + call AddItem({'text': "nocode\r"}) + call ale#list#SetLists(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': 'nocode', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + + call remove(g:loclist, 0) + call AddItem({'text': 'withcode', 'code': 'E123'}) + call ale#list#SetLists(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': 'E123: withcode', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(Formatting with codes should work for the quickfix list): + let g:ale_set_loclist = 0 + let g:ale_set_quickfix = 1 + + call AddItem({'text': "nocode\r"}) + call ale#list#SetLists(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': 'nocode', + \ }, + \ ], + \ ale#test#GetQflistWithoutNewerKeys() + + call remove(g:loclist, 0) + call AddItem({'text': 'withcode', 'code': 'E123'}) + call ale#list#SetLists(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': 'E123: withcode', + \ }, + \ ], + \ ale#test#GetQflistWithoutNewerKeys() + +Execute(Formatting with the linter name should work for the loclist): + let g:ale_loclist_msg_format = '(%linter%) %s' + + call AddItem({'text': 'whatever'}) + call ale#list#SetLists(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': '(some_linter) whatever', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(Formatting with the linter name should work for the quickfix list): + let g:ale_loclist_msg_format = '(%linter%) %s' + let g:ale_set_loclist = 0 + let g:ale_set_quickfix = 1 + + call AddItem({'text': 'whatever'}) + call ale#list#SetLists(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': '(some_linter) whatever', + \ }, + \ ], + \ ale#test#GetQflistWithoutNewerKeys() + +Execute(The buffer loclist format option should take precedence): + let g:ale_loclist_msg_format = '(%linter%) %s' + let b:ale_loclist_msg_format = 'FOO %s' + + call AddItem({'text': 'whatever'}) + call ale#list#SetLists(bufnr(''), g:loclist) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 1, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': 'FOO whatever', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() diff --git a/sources_non_forked/ale/test/test_list_opening.vader b/sources_non_forked/ale/test/test_list_opening.vader new file mode 100644 index 00000000..44004182 --- /dev/null +++ b/sources_non_forked/ale/test/test_list_opening.vader @@ -0,0 +1,290 @@ +" Author: Yann Fery +Before: + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_open_list + Save g:ale_keep_list_window_open + Save g:ale_list_window_size + Save g:ale_list_vertical + Save g:ale_buffer_info + Save g:ale_set_lists_synchronously + + let g:ale_set_loclist = 1 + let g:ale_set_quickfix = 0 + let g:ale_open_list = 0 + let g:ale_keep_list_window_open = 0 + let g:ale_list_window_size = 10 + let g:ale_list_vertical = 0 + let g:ale_set_lists_synchronously = 1 + + let g:loclist = [ + \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x'}, + \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 4, 'text': 'x'}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 10, 'text': 'x'}, + \ {'bufnr': bufnr(''), 'lnum': 3, 'col': 2, 'text': 'x'}, + \] + let g:ale_buffer_info = {bufnr(''): {'loclist': g:loclist}} + + function GetQuickfixHeight() abort + for l:win in range(1, winnr('$')) + if getwinvar(l:win, '&buftype') ==# 'quickfix' + return winheight(l:win) + endif + endfor + + return 0 + endfunction + + " If the window is vertical, window size should match column size/width + function GetQuickfixIsVertical(cols) abort + for l:win in range(1, winnr('$')) + if getwinvar(l:win, '&buftype') is# 'quickfix' + return winwidth(l:win) == a:cols + endif + endfor + + return 0 + endfunction + +After: + Restore + + unlet! g:loclist + unlet! b:ale_list_vertical + unlet! b:ale_list_window_size + unlet! b:ale_open_list + unlet! b:ale_keep_list_window_open + unlet! b:ale_save_event_fired + + delfunction GetQuickfixHeight + delfunction GetQuickfixIsVertical + + " Close quickfix window after every execute block + lcl + ccl + call setloclist(0, []) + call setqflist([]) + +Execute(IsQuickfixOpen should return the right output): + AssertEqual 0, ale#list#IsQuickfixOpen() + call setloclist(0, g:loclist) + lopen + AssertEqual 1, ale#list#IsQuickfixOpen() + lcl + AssertEqual 0, ale#list#IsQuickfixOpen() + call setqflist(g:loclist) + copen + AssertEqual 1, ale#list#IsQuickfixOpen() + ccl + AssertEqual 0, ale#list#IsQuickfixOpen() + +Execute(The quickfix window should not open by default for the loclist): + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert !ale#list#IsQuickfixOpen() + +Execute(The quickfix window should open for just the loclist): + let g:ale_open_list = 1 + + " It should not open for an empty list. + call ale#list#SetLists(bufnr('%'), []) + Assert !ale#list#IsQuickfixOpen() + + " With a non-empty loclist, the window must open. + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert ale#list#IsQuickfixOpen() + + " Clear the list and it should close again. + call ale#list#SetLists(bufnr('%'), []) + Assert !ale#list#IsQuickfixOpen() + +Execute(The quickfix window should open on the correct threshold): + " The window should open for a value lower than number of entries. + let g:ale_open_list = len(g:loclist) - 1 + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert ale#list#IsQuickfixOpen() + + " Clear the list to be ready for a new value. + call ale#list#SetLists(bufnr('%'), []) + Assert !ale#list#IsQuickfixOpen() + + " It should also open for a value equal to the number of entries. + let g:ale_open_list = len(g:loclist) + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert ale#list#IsQuickfixOpen() + + " Clear the list again, preparing for a final value. + call ale#list#SetLists(bufnr('%'), []) + Assert !ale#list#IsQuickfixOpen() + + " Window should not open for values higher than number of loclist entries. + let g:ale_open_list = len(g:loclist) + 1 + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert !ale#list#IsQuickfixOpen() + + " Clear the list just to clean up. + call ale#list#SetLists(bufnr('%'), []) + Assert !ale#list#IsQuickfixOpen() + +Execute(The quickfix window height should be correct for the loclist): + let g:ale_open_list = 1 + let g:ale_list_window_size = 7 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 7, GetQuickfixHeight() + +Execute(The quickfix window height should be correct for the loclist with buffer variables): + let g:ale_open_list = 1 + let b:ale_list_window_size = 8 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 8, GetQuickfixHeight() + +Execute(The quickfix window should be vertical for the loclist with appropriate variables): + let g:ale_open_list = 1 + let b:ale_list_window_size = 8 + let b:ale_list_vertical = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 1, GetQuickfixIsVertical(8) + +Execute(The quickfix window should be horizontal for the loclist with appropriate variables): + let g:ale_open_list = 1 + let b:ale_list_window_size = 8 + let b:ale_list_vertical = 0 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 0, GetQuickfixIsVertical(8) + +Execute(The quickfix window should stay open for just the loclist): + let g:ale_open_list = 1 + let g:ale_keep_list_window_open = 1 + + " The window should stay open after even after it is made blank again. + call ale#list#SetLists(bufnr('%'), g:loclist) + call ale#list#SetLists(bufnr('%'), []) + Assert ale#list#IsQuickfixOpen() + +Execute(The quickfix window should not open by default when quickfix is on): + let g:ale_set_quickfix = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert !ale#list#IsQuickfixOpen() + +Execute(The quickfix window should open for the quickfix list): + let g:ale_set_quickfix = 1 + let g:ale_open_list = 1 + + let g:ale_buffer_info[bufnr('') + 1] = { + \ 'loclist': [{'bufnr': -1, 'filename': '/foo/bar', 'lnum': 5, 'col': 5, 'text': 'x'}], + \} + + " It should not open for an empty list. + call ale#list#SetLists(bufnr('%'), []) + Assert !ale#list#IsQuickfixOpen(), 'The quickfix window was opened when the list was empty' + + " With a non-empty quickfix list, the window must open. + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert ale#list#IsQuickfixOpen(), 'The quickfix window was closed when the list was not empty' + + " Clear this List. The window should stay open, as there are other items. + let g:ale_buffer_info[bufnr('')].loclist = [] + call ale#list#SetLists(bufnr('%'), []) + Assert ale#list#IsQuickfixOpen(), 'The quickfix window closed even though there are items in another buffer' + + " Clear the other List now. Now the window should close. + call remove(g:ale_buffer_info, bufnr('') + 1) + call ale#list#SetLists(bufnr('%'), []) + Assert !ale#list#IsQuickfixOpen(), 'The quickfix window was not closed' + +Execute(The quickfix window should stay open for the quickfix list): + let g:ale_set_quickfix = 1 + let g:ale_open_list = 1 + let g:ale_keep_list_window_open = 1 + + " The window should stay open after even after it is made blank again. + call ale#list#SetLists(bufnr('%'), g:loclist) + call ale#list#SetLists(bufnr('%'), []) + Assert ale#list#IsQuickfixOpen() + +Execute(The quickfix window height should be correct for the quickfix list): + let g:ale_set_quickfix = 1 + let g:ale_open_list = 1 + let g:ale_list_window_size = 7 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 7, GetQuickfixHeight() + +Execute(The quickfix window height should be correct for the quickfix list with buffer variables): + let g:ale_set_quickfix = 1 + let g:ale_open_list = 1 + let b:ale_list_window_size = 8 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 8, GetQuickfixHeight() + +Execute(The quickfix window should be vertical for the quickfix with appropriate variables): + let g:ale_open_list = 1 + let b:ale_list_window_size = 8 + let b:ale_list_vertical = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 1, GetQuickfixIsVertical(8) + +Execute(The quickfix window should be horizontal for the quickfix with appropriate variables): + let g:ale_open_list = 1 + let b:ale_list_window_size = 8 + let b:ale_list_vertical = 0 + + call ale#list#SetLists(bufnr('%'), g:loclist) + + AssertEqual 0, GetQuickfixIsVertical(8) + +Execute(The buffer ale_open_list option should be respected): + let b:ale_open_list = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert ale#list#IsQuickfixOpen() + +Execute(The buffer ale_keep_list_window_open option should be respected): + let b:ale_open_list = 1 + let b:ale_keep_list_window_open = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + call ale#list#SetLists(bufnr('%'), []) + + Assert ale#list#IsQuickfixOpen() + +Execute(The ale_open_list='on_save' option should work): + let b:ale_open_list = 'on_save' + + call ale#list#SetLists(bufnr('%'), g:loclist) + " The list shouldn't open yet, the event wasn't fired. + Assert !ale#list#IsQuickfixOpen() + + " Turn this option off, to ensure that we update lists immediately when we + " save buffers. + let g:ale_set_lists_synchronously = 0 + let b:ale_save_event_fired = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + " Now the list should have opened. + Assert ale#list#IsQuickfixOpen() + + call ale#list#SetLists(bufnr('%'), []) + " The window should close again when the loclist is empty. + Assert !ale#list#IsQuickfixOpen() + +Execute(The window shouldn't open on save when ale_open_list=0): + let b:ale_open_list = 0 + let b:ale_save_event_fired = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + " Now the list should have opened. + Assert !ale#list#IsQuickfixOpen() diff --git a/sources_non_forked/ale/test/test_list_titles.vader b/sources_non_forked/ale/test/test_list_titles.vader new file mode 100644 index 00000000..dfb042f5 --- /dev/null +++ b/sources_non_forked/ale/test/test_list_titles.vader @@ -0,0 +1,77 @@ +Before: + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_buffer_info + Save g:ale_set_lists_synchronously + + let g:ale_buffer_info = {} + let g:ale_set_loclist = 0 + let g:ale_set_quickfix = 0 + let g:ale_set_lists_synchronously = 1 + + call ale#test#SetDirectory('/testplugin/test') + +After: + Restore + + call setloclist(0, []) + call setqflist([]) + + call ale#test#RestoreDirectory() + +Execute(The loclist titles should be set appropriately): + silent noautocmd file foo + + let g:ale_set_loclist = 1 + + call ale#list#SetLists(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'}, + \]) + + AssertEqual [{ + \ 'lnum': 5, + \ 'bufnr': bufnr(''), + \ 'col': 5, + \ 'text': 'x', + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \}], ale#test#GetLoclistWithoutNewerKeys() + + if !has('nvim') + AssertEqual + \ {'title': ale#path#Simplify(getcwd() . '/foo')}, + \ getloclist(0, {'title': ''}) + endif + +Execute(The quickfix titles should be set appropriately): + silent noautocmd file foo + + let g:ale_set_quickfix = 1 + + let g:ale_buffer_info[bufnr('')] = { + \ 'loclist': [{'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'}], + \} + + call ale#list#SetLists(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'}, + \]) + AssertEqual [{ + \ 'lnum': 5, + \ 'bufnr': bufnr(''), + \ 'col': 5, + \ 'text': 'x', + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \}], ale#test#GetQflistWithoutNewerKeys() + + if !has('nvim') + AssertEqual + \ {'title': ale#path#Simplify(getcwd() . '/foo')}, + \ getqflist({'title': ''}) + endif diff --git a/sources_non_forked/ale/test/test_load_all_linters.vader b/sources_non_forked/ale/test/test_load_all_linters.vader new file mode 100644 index 00000000..6806719a --- /dev/null +++ b/sources_non_forked/ale/test/test_load_all_linters.vader @@ -0,0 +1,6 @@ +Execute(Exceptions shouldn't be thrown when loading all linters): + " This test will look for errors when loading any of the linter files. + runtime! ale_linters/*/*.vim + +After: + call ale#linter#Reset() diff --git a/sources_non_forked/ale/test/test_loclist_binary_search.vader b/sources_non_forked/ale/test/test_loclist_binary_search.vader new file mode 100644 index 00000000..219fb314 --- /dev/null +++ b/sources_non_forked/ale/test/test_loclist_binary_search.vader @@ -0,0 +1,66 @@ +Before: + let g:loclist = [ + \ {'bufnr': 1, 'lnum': 2, 'col': 10}, + \ {'bufnr': 1, 'lnum': 3, 'col': 2}, + \ {'bufnr': 1, 'lnum': 3, 'col': 10}, + \ {'bufnr': 1, 'lnum': 3, 'col': 12}, + \ {'bufnr': 1, 'lnum': 3, 'col': 25}, + \ {'bufnr': 1, 'lnum': 5, 'col': 4}, + \ {'bufnr': 1, 'lnum': 5, 'col': 5}, + \ {'bufnr': 1, 'lnum': 9, 'col': 5}, + \ {'bufnr': 1, 'lnum': 10, 'col': 1}, + \ {'bufnr': 2, 'lnum': 7, 'col': 10}, + \ {'bufnr': 2, 'lnum': 9, 'col': 2}, + \ {'bufnr': 2, 'lnum': 10, 'col': 2}, + \ {'bufnr': 2, 'lnum': 11, 'col': 2}, + \] + +After: + unlet g:loclist + +Execute(Exact column matches should be correct): + AssertEqual 1, ale#util#BinarySearch(g:loclist, 1, 3, 2) + +Execute(Off lines, there should be no match): + AssertEqual -1, ale#util#BinarySearch(g:loclist, 1, 4, 2) + +Execute(Near column matches should be taken): + AssertEqual 2, ale#util#BinarySearch(g:loclist, 1, 3, 11) + AssertEqual 3, ale#util#BinarySearch(g:loclist, 1, 3, 13) + +Execute(Columns before should be taken when the cursor is far ahead): + AssertEqual 4, ale#util#BinarySearch(g:loclist, 1, 3, 300) + +Execute(The only problems on lines in later columns should be matched): + AssertEqual 7, ale#util#BinarySearch(g:loclist, 1, 9, 1) + +Execute(The only problems on lines in earlier columns should be matched): + AssertEqual 8, ale#util#BinarySearch(g:loclist, 1, 10, 30) + +Execute(Lines for other buffers should not be matched): + AssertEqual -1, ale#util#BinarySearch(g:loclist, 1, 7, 10) + +Execute(Searches for buffers later in the list should work): + AssertEqual 10, ale#util#BinarySearch(g:loclist, 2, 9, 10) + +Execute(Searches should work with just one item): + let g:loclist = [{'bufnr': 1, 'lnum': 3, 'col': 10}] + + AssertEqual 0, ale#util#BinarySearch(g:loclist, 1, 3, 2) + +Execute(Searches should return the last item on a single column): + let g:loclist = [ + \ {'bufnr': 1, 'lnum': 1, 'col': 10, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 10, 'type': 'E'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 11, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 11, 'type': 'E'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 20, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 20, 'type': 'E'}, + \] + + " We should return the index for the last item at some column to the right. + AssertEqual 1, ale#util#BinarySearch(g:loclist, 1, 1, 1) + " We should return the index for the last item at the column we are on. + AssertEqual 3, ale#util#BinarySearch(g:loclist, 1, 1, 11) + " We should prefer items to the left of the cursor, over the right. + AssertEqual 3, ale#util#BinarySearch(g:loclist, 1, 1, 19) diff --git a/sources_non_forked/ale/test/test_loclist_corrections.vader b/sources_non_forked/ale/test/test_loclist_corrections.vader new file mode 100644 index 00000000..60b1eba7 --- /dev/null +++ b/sources_non_forked/ale/test/test_loclist_corrections.vader @@ -0,0 +1,469 @@ +Before: + Save g:ale_filename_mappings + + let g:ale_filename_mappings = {} + +After: + unlet! b:temp_name + unlet! b:other_bufnr + + Restore + + +Execute(FixLocList should map filenames): + " Paths converted back into temporary filenames shouldn't be included. + let g:ale_filename_mappings = { + \ 'linter2': [['/xxx/', '/data/']], + \ 'linter1': [ + \ ['/bar/', '/data/special/'], + \ ['/foo/', '/data/'], + \ [ + \ ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h')) . '/', + \ '/x-tmp/', + \ ], + \ ], + \} + + AssertEqual + \ [ + \ '/foo/file.txt', + \ v:null, + \ '/bar/file.txt', + \ ], + \ map( + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'linter1', + \ 0, + \ [ + \ {'text': 'x', 'lnum': 1, 'filename': '/data/file.txt'}, + \ {'text': 'x', 'lnum': 1, 'filename': '/x-tmp/file.txt'}, + \ {'text': 'x', 'lnum': 1, 'filename': '/data/special/file.txt'}, + \ ], + \ ), + \ 'get(v:val, ''filename'', v:null)', + \ ) + + +Given foo (Some file with lines to count): + foo12345678 + bar12345678 + baz12345678 + four12345678 + five12345678 + six12345678 + seven12345678 + eight12345678 + nine12345678 + ten12345678 + +Execute(FixLocList should set all the default values correctly): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 2, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'b', + \ 'lnum': 2, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}], + \ ) + +Execute(FixLocList should use the values we supply): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 3, + \ 'col': 4, + \ 'bufnr': 10000, + \ 'vcol': 0, + \ 'type': 'W', + \ 'nr': 42, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [{ + \ 'text': 'a', + \ 'lnum': 3, + \ 'col': 4, + \ 'bufnr': 10000, + \ 'vcol': 1, + \ 'type': 'W', + \ 'nr': 42, + \ }], + \ ) + +Execute(FixLocList should set items with lines beyond the end to the last line): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 0, + \ 'end_lnum': 10, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [{'text': 'a', 'lnum': 11, 'end_lnum': 12}], + \ ) + +Execute(FixLocList should move line 0 to line 1): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 1, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [{'text': 'a', 'lnum': 0}], + \ ) + +Execute(FixLocList should convert line and column numbers correctly): + " The numbers should be 10, not 8 as octals. + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 10, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [{'text': 'a', 'lnum': '010', 'col': '010'}], + \ ) + +Execute(FixLocList should pass on end_col values): + " The numbers should be 10, not 8 as octals. + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 10, + \ 'end_col': 12, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 11, + \ 'end_col': 12, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [ + \ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012'}, + \ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12}, + \ ], + \ ) + +Execute(FixLocList should pass on end_lnum values): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 7, + \ 'col': 10, + \ 'end_lnum': 10, + \ 'end_col': 12, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 7, + \ 'col': 11, + \ 'end_lnum': 10, + \ 'end_col': 12, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [ + \ {'text': 'a', 'lnum': '07', 'col': '010', 'end_col': '012', 'end_lnum': '010'}, + \ {'text': 'a', 'lnum': '07', 'col': '011', 'end_col': 12, 'end_lnum': 10}, + \ ], + \ ) + +Execute(FixLocList should allow subtypes to be set): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'sub_type': 'style', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [{'text': 'a', 'lnum': 11, 'sub_type': 'style'}], + \ ) + +Execute(FixLocList should accept filenames): + let b:other_bufnr = bufnr('/foo/bar/baz', 1) + + " Make sure we actually get another buffer number, or the test is invalid. + AssertNotEqual -1, b:other_bufnr + + call ale#test#SetFilename('test.txt') + + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 2, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'filename': expand('%:p'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 3, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'filename': expand('%:p'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 4, + \ 'col': 0, + \ 'bufnr': b:other_bufnr, + \ 'filename': '/foo/bar/baz', + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 5, + \ 'col': 0, + \ 'bufnr': b:other_bufnr, + \ 'filename': '/foo/bar/baz', + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [ + \ {'text': 'a', 'lnum': 2, 'filename': expand('%:p')}, + \ {'text': 'a', 'lnum': 3, 'filename': expand('%:p')}, + \ {'text': 'a', 'lnum': 4, 'filename': '/foo/bar/baz'}, + \ {'text': 'a', 'lnum': 5, 'filename': '/foo/bar/baz'}, + \ ], + \ ) + +Execute(FixLocList should interpret temporary filenames as being the current buffer): + let b:temp_name = tempname() + + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 2, + \ 'col': 0, + \ 'bufnr': bufnr(''), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 3, + \ 'col': 0, + \ 'bufnr': bufnr(''), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr(''), + \ 'foobar', + \ 0, + \ [ + \ {'text': 'a', 'lnum': 2, 'filename': b:temp_name}, + \ {'text': 'a', 'lnum': 3, 'filename': substitute(b:temp_name, '\\', '/', 'g')}, + \ ], + \ ) + +Execute(The error code should be passed on): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ 'code': 'some-code' + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [{'text': 'a', 'lnum': 11, 'code': 'some-code'}], + \ ) + +Execute(FixLocList should mark problems as coming from other sources if requested): + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 2, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ 'from_other_source': 1, + \ }, + \ { + \ 'text': 'b', + \ 'lnum': 2, + \ 'col': 0, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ 'from_other_source': 1, + \ }, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 1, + \ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}], + \ ) + +Given(A file with Japanese multi-byte text): + はじめまして! + -私はワープです。 +Execute(character positions should be converted to byte positions): + AssertEqual + \ [ + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 0, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 1, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 4, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 13, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 13, 'end_lnum': 1, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 17, 'end_lnum': 2, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ {'lnum': 2, 'bufnr': bufnr(''), 'col': 17, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'}, + \ ], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ 'foobar', + \ 0, + \ [ + \ {'text': 'a', 'lnum': 1, 'col': 0, 'vcol': 1}, + \ {'text': 'a', 'lnum': 1, 'col': 1, 'vcol': 1}, + \ {'text': 'a', 'lnum': 1, 'col': 2, 'vcol': 1}, + \ {'text': 'a', 'lnum': 1, 'col': 3, 'vcol': 1}, + \ {'text': 'a', 'lnum': 1, 'col': 3, 'end_col': 5, 'vcol': 1}, + \ {'text': 'a', 'lnum': 1, 'col': 3, 'end_col': 5, 'end_lnum': 1, 'vcol': 1}, + \ {'text': 'a', 'lnum': 1, 'col': 3, 'end_col': 7, 'end_lnum': 2, 'vcol': 1}, + \ {'text': 'a', 'lnum': 2, 'col': 7, 'vcol': 1}, + \ ], + \ ) diff --git a/sources_non_forked/ale/test/test_loclist_jumping.vader b/sources_non_forked/ale/test/test_loclist_jumping.vader new file mode 100644 index 00000000..8ec4e583 --- /dev/null +++ b/sources_non_forked/ale/test/test_loclist_jumping.vader @@ -0,0 +1,121 @@ +Before: + let g:ale_buffer_info = { + \ bufnr(''): { + \ 'loclist': [ + \ {'type': 'E', 'bufnr': bufnr('') - 1, 'lnum': 3, 'col': 2}, + \ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 1, 'col': 2}, + \ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 1, 'col': 3}, + \ {'type': 'W', 'sub_type': 'style', 'bufnr': bufnr(''), 'lnum': 2, 'col': 1}, + \ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 2, 'col': 2}, + \ {'type': 'W', 'sub_type': 'style', 'bufnr': bufnr(''), 'lnum': 2, 'col': 3}, + \ {'type': 'W', 'bufnr': bufnr(''), 'lnum': 2, 'col': 6}, + \ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 2, 'col': 700}, + \ {'type': 'E', 'bufnr': bufnr('') + 1, 'lnum': 3, 'col': 2}, + \ ], + \ }, + \} + + function! TestJump(position, wrap, filter, subtype_filter, pos) + call cursor(a:pos) + + if type(a:position) == type(0) + call ale#loclist_jumping#JumpToIndex(a:position) + else + call ale#loclist_jumping#Jump(a:position, a:wrap, a:filter, + \ a:subtype_filter) + endif + + return getcurpos()[1:2] + endfunction + +After: + let g:ale_buffer_info = {} + delfunction TestJump + +Given foobar (Some imaginary filetype): + 12345678 + 12345678 + +Execute(loclist jumping should jump correctly when not wrapping): + AssertEqual [2, 1], TestJump('before', 0, 'any', 'any', [2, 2]) + AssertEqual [1, 3], TestJump('before', 0, 'any', 'any', [2, 1]) + AssertEqual [2, 3], TestJump('after', 0, 'any', 'any', [2, 2]) + AssertEqual [2, 1], TestJump('after', 0, 'any', 'any', [1, 3]) + AssertEqual [2, 6], TestJump('after', 0, 'any', 'any', [2, 4]) + AssertEqual [2, 8], TestJump('after', 0, 'any', 'any', [2, 6]) + +Execute(loclist jumping should jump correctly when wrapping): + AssertEqual [2, 1], TestJump('before', 1, 'any', 'any', [2, 2]) + AssertEqual [1, 3], TestJump('before', 1, 'any', 'any', [2, 1]) + AssertEqual [2, 3], TestJump('after', 1, 'any', 'any', [2, 2]) + AssertEqual [2, 1], TestJump('after', 1, 'any', 'any', [1, 3]) + AssertEqual [2, 6], TestJump('after', 1, 'any', 'any', [2, 4]) + + AssertEqual [1, 2], TestJump('after', 1, 'any', 'any', [2, 8]) + AssertEqual [2, 8], TestJump('before', 1, 'any', 'any', [1, 2]) + +Execute(loclist jumping should jump correctly with warning filters): + AssertEqual [2, 1], TestJump('after', 0, 'W', 'any', [1, 2]) + AssertEqual [2, 6], TestJump('after', 0, 'W', 'any', [2, 3]) + AssertEqual [2, 1], TestJump('after', 1, 'W', 'any', [2, 6]) + +Execute(loclist jumping should jump correctly with error filters): + AssertEqual [1, 2], TestJump('after', 1, 'E', 'any', [2, 700]) + AssertEqual [2, 2], TestJump('before', 0, 'E', 'any', [2, 700]) + AssertEqual [2, 2], TestJump('after', 1, 'E', 'any', [1, 3]) + +Execute(loclist jumping should jump correctly with sub type filters): + AssertEqual [2, 3], TestJump('after', 0, 'any', 'style', [2, 1]) + AssertEqual [2, 2], TestJump('after', 0, 'any', '', [1, 3]) + AssertEqual [2, 1], TestJump('after', 1, 'any', 'style', [2, 6]) + +Execute(loclist jumping not jump when the loclist is empty): + let g:ale_buffer_info[bufnr('%')].loclist = [] + + AssertEqual [1, 6], TestJump('before', 0, 'any', 'any', [1, 6]) + AssertEqual [1, 6], TestJump('before', 1, 'any', 'any', [1, 6]) + AssertEqual [1, 6], TestJump('after', 0, 'any', 'any', [1, 6]) + AssertEqual [1, 6], TestJump('after', 1, 'any', 'any', [1, 6]) + +Execute(We should be able to jump to the last item): + AssertEqual [2, 8], TestJump(-1, 0, 'any', 'any', [1, 6]) + +Execute(We shouldn't move when jumping to the last item where there are none): + let g:ale_buffer_info[bufnr('%')].loclist = [] + + AssertEqual [1, 6], TestJump(-1, 0, 'any', 'any', [1, 6]) + +Execute(We should be able to jump to the first item): + AssertEqual [1, 2], TestJump(0, 0, 'any', 'any', [1, 6]) + +Execute(We shouldn't move when jumping to the first item where there are none): + let g:ale_buffer_info[bufnr('%')].loclist = [] + + AssertEqual [1, 6], TestJump(0, 0, 'any', 'any', [1, 6]) + +Execute(We should be able to jump when the error line is blank): + " Add a blank line at the end. + call setline(1, getline('.', '$') + ['']) + " Add a problem on the blank line. + call add(g:ale_buffer_info[bufnr('%')].loclist, {'type': 'E', 'bufnr': bufnr(''), 'lnum': 3, 'col': 1}) + + AssertEqual 0, len(getline(3)) + AssertEqual [2, 8], TestJump('before', 0, 'any', 'any', [3, 1]) + AssertEqual [2, 8], TestJump('before', 1, 'any', 'any', [3, 1]) + AssertEqual [3, 1], TestJump('after', 0, 'any', 'any', [3, 1]) + AssertEqual [1, 2], TestJump('after', 1, 'any', 'any', [3, 1]) + +Execute(ALE should jump to column 1 instead of 0): + let g:ale_buffer_info = { + \ bufnr(''): { + \ 'loclist': [ + \ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 1, 'col': 5}, + \ {'type': 'E', 'bufnr': bufnr(''), 'lnum': 2, 'col': 0}, + \ ], + \ }, + \} + + AssertEqual [2, 1], TestJump('after', 1, 'any', 'any', [1, 5]) + AssertEqual [1, 5], TestJump('after', 1, 'any', 'any', [2, 1]) + AssertEqual [2, 1], TestJump('before', 1, 'any', 'any', [1, 5]) + AssertEqual [1, 5], TestJump('before', 1, 'any', 'any', [2, 1]) diff --git a/sources_non_forked/ale/test/test_loclist_sorting.vader b/sources_non_forked/ale/test/test_loclist_sorting.vader new file mode 100644 index 00000000..376e743a --- /dev/null +++ b/sources_non_forked/ale/test/test_loclist_sorting.vader @@ -0,0 +1,43 @@ +Execute(loclist item should be sorted): + AssertEqual [ + \ {'bufnr': -1, 'filename': 'b', 'lnum': 4, 'col': 2}, + \ {'bufnr': -1, 'filename': 'b', 'lnum': 5, 'col': 2}, + \ {'bufnr': -1, 'filename': 'c', 'lnum': 3, 'col': 2}, + \ {'bufnr': 1, 'lnum': 2, 'col': 10}, + \ {'bufnr': 1, 'lnum': 3, 'col': 2}, + \ {'bufnr': 1, 'lnum': 5, 'col': 4}, + \ {'bufnr': 1, 'lnum': 5, 'col': 5}, + \ {'bufnr': 2, 'lnum': 1, 'col': 2}, + \ {'bufnr': 2, 'lnum': 1, 'col': 5}, + \ {'bufnr': 2, 'lnum': 5, 'col': 5}, + \ {'bufnr': 3, 'lnum': 1, 'col': 1}, + \ ], + \ sort([ + \ {'bufnr': 3, 'lnum': 1, 'col': 1}, + \ {'bufnr': -1, 'filename': 'b', 'lnum': 5, 'col': 2}, + \ {'bufnr': 1, 'lnum': 5, 'col': 5}, + \ {'bufnr': 2, 'lnum': 5, 'col': 5}, + \ {'bufnr': -1, 'filename': 'b', 'lnum': 4, 'col': 2}, + \ {'bufnr': 1, 'lnum': 5, 'col': 4}, + \ {'bufnr': 1, 'lnum': 2, 'col': 10}, + \ {'bufnr': 2, 'lnum': 1, 'col': 5}, + \ {'bufnr': 1, 'lnum': 3, 'col': 2}, + \ {'bufnr': 2, 'lnum': 1, 'col': 2}, + \ {'bufnr': -1, 'filename': 'c', 'lnum': 3, 'col': 2}, + \], 'ale#util#LocItemCompare') + +Execute(Items should be sorted in by their problem priority when they lie on the same column): + AssertEqual [ + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'I'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'E'}, + \ ], + \ sort([ + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'E'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'I'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 1, 'type': 'W', 'sub_type': 'style'}, + \], 'ale#util#LocItemCompare') diff --git a/sources_non_forked/ale/test/test_maven_build_classpath_command.vader b/sources_non_forked/ale/test/test_maven_build_classpath_command.vader new file mode 100644 index 00000000..c10f457b --- /dev/null +++ b/sources_non_forked/ale/test/test_maven_build_classpath_command.vader @@ -0,0 +1,53 @@ +Before: + Save $PATH + Save $PATHEXT + + let $PATHEXT = '.' + + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/java/javac.vim + let g:expected_wrapper = '' + if has('unix') + let g:expected_wrapper = 'mvnw' + else + let g:expected_wrapper = 'mvnw.cmd' + endif + +After: + Restore + + unlet! g:expected_wrapper + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should use 'mvnw' in classpath command if available): + call ale#test#SetFilename('test-files/maven/maven-java-project/module1/src/main/java/dummy1.java') + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1'), + \ ale#Escape(ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1/' . g:expected_wrapper)) + \ . ' dependency:build-classpath', + \ ], + \ ale#maven#BuildClasspathCommand(bufnr('')) + +Execute(Should use 'mvn' in classpath command if it is executable and 'mvnw' is unavailable): + call ale#test#SetFilename('test-files/maven/maven-java-project/module2/src/main/java/dummy2.java') + let $PATH .= (has('win32') ? ';' : ':') + \ . ale#path#Simplify(g:dir . '/test-files/maven') + + AssertEqual + \ [ + \ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module2'), + \ ale#Escape('mvn') + \ . ' dependency:build-classpath', + \ ], + \ ale#maven#BuildClasspathCommand(bufnr('')) + +Execute(Should return empty string if maven cannot be executed): + call ale#test#SetFilename('test-files/maven/non-maven-project/src/main/java/dummy.java') + + AssertEqual + \ ['', ''], + \ ale#maven#BuildClasspathCommand(bufnr('')) diff --git a/sources_non_forked/ale/test/test_maven_find_executable.vader b/sources_non_forked/ale/test/test_maven_find_executable.vader new file mode 100644 index 00000000..f0f06b12 --- /dev/null +++ b/sources_non_forked/ale/test/test_maven_find_executable.vader @@ -0,0 +1,46 @@ +Before: + Save $PATH + Save $PATHEXT + + " Count the maven executable without .exe as executable on Windows + let $PATHEXT = '.' + + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/java/javac.vim + let g:expected_wrapper = '' + if has('unix') + let g:expected_wrapper = 'mvnw' + else + let g:expected_wrapper = 'mvnw.cmd' + endif + +After: + Restore + + unlet! g:expected_wrapper + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return 'mvnw' if found in parent directory): + call ale#test#SetFilename('test-files/maven/maven-java-project/module1/src/main/java/dummy1.java') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1/' . g:expected_wrapper), + \ ale#maven#FindExecutable(bufnr('')) + +Execute(Should return 'mvn' if 'mvnw' not found in parent directory): + call ale#test#SetFilename('test-files/maven/maven-java-project/module2/src/main/java/dummy2.java') + let $PATH .= (has('win32') ? ';' : ':') + \ . ale#path#Simplify(g:dir . '/test-files/maven') + + AssertEqual + \ 'mvn', + \ ale#maven#FindExecutable(bufnr('')) + +Execute(Should return empty string if 'mvnw' not in parent directory and mvn not in path): + call ale#test#SetFilename('mvn-test-files/java-maven-project/module2/src/main/java/dummy2.java') + + AssertEqual + \ '', + \ ale#gradle#FindExecutable(bufnr('')) diff --git a/sources_non_forked/ale/test/test_maven_find_project_root.vader b/sources_non_forked/ale/test/test_maven_find_project_root.vader new file mode 100644 index 00000000..f761b2ef --- /dev/null +++ b/sources_non_forked/ale/test/test_maven_find_project_root.vader @@ -0,0 +1,28 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + runtime ale_linters/kotlin/javac.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(Should return directory for 'mvnw' if found in parent directory): + call ale#test#SetFilename('test-files/maven/maven-java-project/module1/src/main/java/dummy1.java') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1'), + \ ale#maven#FindProjectRoot(bufnr('')) + +Execute(Should return directory for 'pom.xml' if found in parent directory): + call ale#test#SetFilename('test-files/maven/maven-java-project/module2/src/main/java/dummy2.java') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module2'), + \ ale#maven#FindProjectRoot(bufnr('')) + +Execute(Should return empty string if maven files are not found in parent directory): + call ale#test#SetFilename('test-files/maven/non-maven-project/src/main/java/dummy.java') + + AssertEqual + \ '', + \ ale#maven#FindProjectRoot(bufnr('')) diff --git a/sources_non_forked/ale/test/test_nearest_file_search.vader b/sources_non_forked/ale/test/test_nearest_file_search.vader new file mode 100644 index 00000000..f5c12de4 --- /dev/null +++ b/sources_non_forked/ale/test/test_nearest_file_search.vader @@ -0,0 +1,15 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + +Execute(We should be able to find a configuration file further up): + call ale#test#SetFilename('test-files/top/middle/bottom/dummy.txt') + + AssertEqual + \ ale#path#Simplify(expand('%:p:h:h:h:h:h') . '/test-files/top/example.ini'), + \ ale#path#FindNearestFile(bufnr('%'), 'example.ini') + +Execute(We shouldn't find anything for files which don't match): + AssertEqual '', ale#path#FindNearestFile(bufnr('%'), 'cantfindthis') diff --git a/sources_non_forked/ale/test/test_nimlsp_project_root.vader b/sources_non_forked/ale/test/test_nimlsp_project_root.vader new file mode 100644 index 00000000..d10989b3 --- /dev/null +++ b/sources_non_forked/ale/test/test_nimlsp_project_root.vader @@ -0,0 +1,19 @@ +Before: + runtime ale_linters/nim/nimlsp.vim + call ale#test#SetDirectory('/testplugin/test') + +After: + if isdirectory(g:dir . '/.git') + call delete(g:dir . '/.git', 'd') + endif + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + +Execute(Detect root of nim project with .git/ correctly): + call ale#test#SetFilename('test-files/nim/with-git/src/source.nim') + call mkdir(g:dir . '/.git') + AssertEqual + \ ale#path#Simplify(g:dir), + \ ale_linters#nim#nimlsp#GetProjectRoot(bufnr('')) diff --git a/sources_non_forked/ale/test/test_no_linting_on_write_quit.vader b/sources_non_forked/ale/test/test_no_linting_on_write_quit.vader new file mode 100644 index 00000000..161e6165 --- /dev/null +++ b/sources_non_forked/ale/test/test_no_linting_on_write_quit.vader @@ -0,0 +1,118 @@ +Before: + Save g:ale_echo_cursor + Save g:ale_fix_on_save + Save g:ale_fixers + Save g:ale_lint_on_save + Save g:ale_set_highlights + Save g:ale_set_lists_synchronously + Save g:ale_set_loclist + Save g:ale_set_quickfix + Save g:ale_set_signs + + let g:ale_run_synchronously = 1 + let g:ale_set_lists_synchronously = 1 + " Disable the things we don't need, but leave enabled what we do. + let g:ale_echo_cursor = 0 + let g:ale_set_signs = 0 + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 1 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + + function! TestCallback(buffer, output) + return [{'lnum': 1, 'col': 1, 'text': 'xxx'}] + endfunction + + function AddLine(buffer, lines) abort + return a:lines + ['x'] + endfunction + + let g:ale_fixers = { + \ 'testft': ['AddLine'], + \} + + call ale#linter#PreventLoading('testft') + call ale#linter#Define('testft', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'true', + \ 'command': 'true', + \}) + +Given testft (An empty file): + +After: + Restore + + unlet! g:ale_run_synchronously + unlet! b:ale_quitting + delfunction TestCallback + delfunction AddLine + + call ale#linter#Reset() + call setloclist(0, []) + +Execute(No linting should be done on :wq or :x): + let g:ale_lint_on_save = 1 + let g:ale_fix_on_save = 0 + + " First try just the SaveEvent, to be sure that we set errors in the test. + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual 1, len(ale#test#GetLoclistWithoutNewerKeys()) + + " Now try doing it again, but where we run the quit event first. + call setloclist(0, []) + call ale#events#QuitEvent(bufnr('')) + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + +Execute(No linting should be for :w after :q fails): + let g:ale_lint_on_save = 1 + let g:ale_fix_on_save = 0 + + call ale#events#QuitEvent(bufnr('')) + call ale#test#FlushJobs() + + " Simulate 2 seconds passing. + let b:ale_quitting -= 1000 + + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual 1, len(ale#test#GetLoclistWithoutNewerKeys()) + +Execute(No linting should be done on :wq or :x after fixing files): + let g:ale_lint_on_save = 1 + let g:ale_fix_on_save = 1 + + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual 1, len(ale#test#GetLoclistWithoutNewerKeys()) + + " Now try doing it again, but where we run the quit event first. + call setloclist(0, []) + call ale#events#QuitEvent(bufnr('')) + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + +Execute(Linting should be done after :q fails and fixing files): + let g:ale_lint_on_save = 1 + let g:ale_fix_on_save = 1 + + call ale#events#QuitEvent(bufnr('')) + call ale#test#FlushJobs() + + " Simulate 2 seconds passing. + let b:ale_quitting -= 1000 + + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + AssertEqual 1, len(ale#test#GetLoclistWithoutNewerKeys()) diff --git a/sources_non_forked/ale/test/test_organize_imports.vader b/sources_non_forked/ale/test/test_organize_imports.vader new file mode 100644 index 00000000..87cd295a --- /dev/null +++ b/sources_non_forked/ale/test/test_organize_imports.vader @@ -0,0 +1,172 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.txt') + + let g:old_filename = expand('%:p') + let g:Callback = '' + let g:expr_list = [] + let g:message_list = [] + let g:handle_code_action_called = 0 + let g:code_actions = [] + let g:options = {} + let g:capability_checked = '' + let g:conn_id = v:null + let g:InitCallback = v:null + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/organize_imports.vim + runtime autoload/ale/code_action.vim + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + + if a:linter.lsp is# 'tsserver' + call ale#lsp#MarkConnectionAsTsserver(g:conn_id) + endif + + let l:details = { + \ 'command': 'foobar', + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \} + + let g:InitCallback = {-> ale#lsp_linter#OnInit(a:linter, l:details, a:Callback)} + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#Execute(expr) abort + call add(g:expr_list, a:expr) + endfunction + + function! ale#code_action#HandleCodeAction(code_action, options) abort + let g:handle_code_action_called = 1 + AssertEqual !&hidden, get(a:options, 'should_save') + call add(g:code_actions, a:code_action) + endfunction + +After: + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + call ale#references#SetMap({}) + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:capability_checked + unlet! g:InitCallback + unlet! g:old_filename + unlet! g:conn_id + unlet! g:Callback + unlet! g:message_list + unlet! g:expr_list + unlet! b:ale_linters + unlet! g:options + unlet! g:code_actions + unlet! g:handle_code_action_called + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/organize_imports.vim + runtime autoload/ale/code_action.vim + +Execute(Other messages for the tsserver handler should be ignored): + call ale#organize_imports#HandleTSServerResponse(1, {'command': 'foo'}) + AssertEqual g:handle_code_action_called, 0 + +Execute(Failed organizeImports responses should be handled correctly): + call ale#organize_imports#HandleTSServerResponse( + \ 1, + \ {'command': 'organizeImports', 'request_seq': 3} + \) + AssertEqual g:handle_code_action_called, 0 + +Execute(Code actions from tsserver should be handled): + call ale#organize_imports#HandleTSServerResponse(1, { + \ 'command': 'organizeImports', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': [], + \}) + AssertEqual g:handle_code_action_called, 1 + AssertEqual [{ + \ 'description': 'Organize Imports', + \ 'changes': [], + \}], g:code_actions + +Given typescript(Some typescript file): + foo + somelongerline + bazxyzxyzxyz + +Execute(tsserver organize imports requests should be sent): + call ale#linter#Reset() + runtime ale_linters/typescript/tsserver.vim + + ALEOrganizeImports + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual + \ 'function(''ale#organize_imports#HandleTSServerResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@organizeImports', { + \ 'scope': { + \ 'type': 'file', + \ 'args': { + \ 'file': expand('%:p'), + \ }, + \ }, + \ }] + \ ], + \ g:message_list + +Given python(Some Python file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Should result in error message): + call ale#linter#Reset() + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + + ALEOrganizeImports + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual [ + \ 'echom ''OrganizeImports currently only works with tsserver''', + \], g:expr_list diff --git a/sources_non_forked/ale/test/test_other_sources.vader b/sources_non_forked/ale/test/test_other_sources.vader new file mode 100644 index 00000000..b397788d --- /dev/null +++ b/sources_non_forked/ale/test/test_other_sources.vader @@ -0,0 +1,153 @@ +Before: + Save g:ale_buffer_info + Save g:ale_set_signs + Save g:ale_set_quickfix + Save g:ale_set_loclist + Save g:ale_set_highlights + Save g:ale_echo_cursor + + let g:ale_buffer_info = {} + let g:ale_run_synchronously = 1 + let g:ale_set_lists_synchronously = 1 + let g:ale_set_signs = 0 + let g:ale_set_quickfix = 0 + let g:ale_set_loclist = 1 + let g:ale_set_highlights = 0 + let g:ale_echo_cursor = 0 + + function! TestCallback(buffer, output) + return [] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''', + \}) + +After: + Restore + + unlet! b:ale_linters + unlet! g:want_results_signaled + unlet! g:want_results_buffer_value + unlet! g:lint_pre_signaled + unlet! g:ale_run_synchronously + unlet! g:ale_set_lists_synchronously + + delfunction TestCallback + + augroup VaderTest + autocmd! + augroup END + + augroup! VaderTest + + call ale#linter#Reset() + call setloclist(0, []) + +Given foobar (Some imaginary filetype): +Execute(StartChecking should mark a buffer as being actively checked): + Assert !ale#engine#IsCheckingBuffer(bufnr('')) + + call ale#other_source#StartChecking(bufnr(''), 'other-source-linter') + + Assert ale#engine#IsCheckingBuffer(bufnr('')) + +Execute(ShowResults sould make a buffer inactive): + call ale#other_source#StartChecking(bufnr(''), 'other-source-linter') + call ale#other_source#StartChecking(bufnr(''), 'second-other-source-linter') + + call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', []) + + Assert ale#engine#IsCheckingBuffer(bufnr('')) + + call ale#other_source#ShowResults(bufnr(''), 'second-other-source-linter', []) + + Assert !ale#engine#IsCheckingBuffer(bufnr('')) + +Execute(ShowResults should show results at any time): + call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [ + \ {'text': 'xyz', 'lnum': 1}, + \]) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 0, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': -1, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': 'xyz', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + + call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', []) + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + +Execute(A regular lint cycle shouldn't clear results from other sources): + call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [ + \ {'text': 'xyz', 'lnum': 1}, + \]) + ALELint + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 0, + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': -1, + \ 'type': 'E', + \ 'pattern': '', + \ 'text': 'xyz', + \ }, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() + +Execute(ALEWantResults should be signaled when a buffer is checked): + augroup VaderTest + autocmd! + autocmd User ALEWantResults let g:want_results_signaled = 1 + autocmd User ALELintPre let g:lint_pre_signaled = 1 + augroup END + + " Even when all linters are disabled, we should send the signal. + let b:ale_linters = [] + ALELint + + Assert get(g:, 'want_results_signaled') + Assert !get(g:, 'lint_pre_signaled') + +Execute(ALEWantResults should set a variable indicating which buffer is being checked): + augroup VaderTest + autocmd! + autocmd User ALEWantResults let g:want_results_buffer_value = g:ale_want_results_buffer + augroup END + + let b:ale_linters = [] + ALELint + + AssertEqual bufnr(''), g:want_results_buffer_value + +Execute(ALEWantResults should lead to an ALELintPre signal if another source responds): + augroup VaderTest + autocmd! + autocmd User ALEWantResults call ale#other_source#StartChecking(bufnr(''), 'other-source-linter') + autocmd User ALELintPre let g:lint_pre_signaled = 1 + augroup END + + " Even when all linters are disabled, we should send the signal. + let b:ale_linters = [] + ALELint + + Assert get(g:, 'lint_pre_signaled') diff --git a/sources_non_forked/ale/test/test_parse_command_args.vader b/sources_non_forked/ale/test/test_parse_command_args.vader new file mode 100644 index 00000000..0103b967 --- /dev/null +++ b/sources_non_forked/ale/test/test_parse_command_args.vader @@ -0,0 +1,52 @@ +After: + unlet! b:parse_result + + if exists(':ParseTest') + delcommand ParseTest + endif + +Execute(ale#args#Parse should handle empty input): + AssertEqual + \ [{}, ''], + \ ale#args#Parse([], '') + AssertEqual + \ [{}, ''], + \ ale#args#Parse(['foo', 'bar'], '') + +Execute(ale#args#Parse should parse commands correctly): + AssertEqual + \ [{'foo': '', 'bar': ''}, 'leave these alone'], + \ ale#args#Parse(['foo', 'bar'], '-foo -bar leave these alone') + AssertEqual + \ [{'foo': ''}, 'leave these alone'], + \ ale#args#Parse(['foo', 'bar'], '-foo leave these alone') + +Execute(ale#args#Parse should raise errors for unknown arguments): + AssertThrows call ale#args#Parse(['foo', 'bar'], '-nope leave these alone') + AssertEqual 'Invalid argument: -nope', g:vader_exception + +Execute(ale#args#Parse should stop parsing arguments after --): + AssertEqual + \ [{'foo': ''}, ' --nope leave these alone'], + \ ale#args#Parse(['foo', 'bar'], '-foo -- --nope leave these alone') + AssertEqual + \ [{}, '--'], + \ ale#args#Parse(['foo', 'bar'], '-- --') + AssertEqual + \ [{}, ''], + \ ale#args#Parse(['foo', 'bar'], '--') + +Execute(ale#args#Parse should work for an example command): + command! -nargs=* ParseTest let b:parse_result = ale#args#Parse(['foo', 'bar'], ) + + ParseTest + AssertEqual [{}, ''], b:parse_result + + ParseTest -foo + AssertEqual [{'foo': ''}, ''], b:parse_result + + ParseTest -foo -bar + AssertEqual [{'foo': '', 'bar': ''}, ''], b:parse_result + + ParseTest -foo -bar leave these alone + AssertEqual [{'foo': '', 'bar': ''}, 'leave these alone'], b:parse_result diff --git a/sources_non_forked/ale/test/test_path_dirname.vader b/sources_non_forked/ale/test/test_path_dirname.vader new file mode 100644 index 00000000..818a62a8 --- /dev/null +++ b/sources_non_forked/ale/test/test_path_dirname.vader @@ -0,0 +1,13 @@ +Execute(ale#path#Dirname should return empty strings should be returned for empty values): + AssertEqual '', ale#path#Dirname('') + AssertEqual '', ale#path#Dirname(0) + AssertEqual '', ale#path#Dirname(v:null) + +Execute(ale#path#Dirname should return the dirname of paths): + AssertEqual '/foo', ale#path#Dirname('/foo/bar') + AssertEqual '/foo', ale#path#Dirname('/foo/bar/') + + if has('win32') + AssertEqual 'C:\foo', ale#path#Dirname('C:\foo\bar') + AssertEqual 'C:\foo', ale#path#Dirname('C:\foo\bar\') + endif diff --git a/sources_non_forked/ale/test/test_path_equality.vader b/sources_non_forked/ale/test/test_path_equality.vader new file mode 100644 index 00000000..ee6ae2c5 --- /dev/null +++ b/sources_non_forked/ale/test/test_path_equality.vader @@ -0,0 +1,82 @@ +Before: + function! CheckPath(path) abort + return ale#path#IsBufferPath(bufnr(''), ale#path#Simplify(a:path)) + endfunction + +After: + delfunction CheckPath + +Execute(ale#path#Simplify should adjust paths correctly): + if has('unix') + " Multiple slashes should be removed correctly. + AssertEqual '/foo/bar/baz', ale#path#Simplify('////foo///bar///baz') + " Back slashes should be converted to forward slashes. + " This means some valid filenames are adjusted incorrectly, but in practice + " no filenames for code should contain back slashes, and adjusting slashes + " like this makes ALE work in MSYS. + AssertEqual 'foo/bar/baz', ale#path#Simplify('foo\bar\baz') + else + " Multiple slashes should be removed correctly. + AssertEqual '\foo\bar\baz', ale#path#Simplify('\\\foo\bar\baz') + " Forward slashes should be replaced with back slashes. + AssertEqual 'foo\bar\baz', ale#path#Simplify('foo/bar/baz') + endif + +Execute(ale#path#IsBufferPath should match simple relative paths): + call ale#test#SetFilename('app/foo.txt') + + Assert CheckPath('app/foo.txt'), 'No match for foo.txt' + Assert !CheckPath('app/bar.txt'), 'Bad match for bar.txt' + +Execute(ale#path#IsBufferPath should match relative paths with dots): + call ale#test#SetFilename('app/foo.txt') + + " Skip these checks on Windows. + if !has('win32') + Assert CheckPath('../../app/foo.txt'), 'No match for ../../app/foo.txt' + endif + +Execute(ale#path#IsBufferPath should match absolute paths): + silent file! foo.txt + + Assert CheckPath(getcwd() . '/foo.txt'), 'No match for foo.txt' + Assert !CheckPath(getcwd() . '/bar.txt'), 'Bad match for bar.txt' + +Execute(ale#path#IsBufferPath should match paths beginning with ./): + silent file! foo.txt + + if !has('win32') + Assert ale#path#IsBufferPath(bufnr(''), './foo.txt'), 'No match for ./foo.txt' + endif + +Execute(ale#path#IsBufferPath should match if our path ends with the test path): + silent file! foo/bar/baz.txt + + Assert CheckPath('bar/baz.txt'), 'No match for bar/baz.txt' + +Execute(ale#path#IsBufferPath should match paths with redundant slashes): + silent file! foo.txt + + Assert CheckPath(getcwd() . '////foo.txt'), 'No match for foo.txt' + +Execute(ale#path#IsBufferPath should accept various names for stdin): + Assert ale#path#IsBufferPath(bufnr(''), '-') + Assert ale#path#IsBufferPath(bufnr(''), 'stdin') + Assert ale#path#IsBufferPath(bufnr(''), '') + Assert ale#path#IsBufferPath(bufnr(''), '') + +Execute(ale#path#IsBufferPath should match files in /tmp): + call ale#test#SetFilename('app/test.ts') + + Assert ale#path#IsBufferPath(bufnr(''), tempname() . '/test.ts') + +Execute(ale#path#IsBufferPath should match Windows paths on Unix): + " This test should pass Unix. + " + " Back slashes in paths should be replaced with forward slashes, even though + " back slashes are valid in filenames on Unix. + if has('unix') + call ale#test#SetFilename('app/foo/test.ts') + + Assert ale#path#IsBufferPath(bufnr(''), 'foo\test.ts') + endif diff --git a/sources_non_forked/ale/test/test_path_upwards.vader b/sources_non_forked/ale/test/test_path_upwards.vader new file mode 100644 index 00000000..cd461a28 --- /dev/null +++ b/sources_non_forked/ale/test/test_path_upwards.vader @@ -0,0 +1,48 @@ +Execute(ale#path#Upwards should return the correct path components): + if has('unix') + " Absolute paths should include / on the end. + AssertEqual + \ ['/foo/bar/baz', '/foo/bar', '/foo', '/'], + \ ale#path#Upwards('/foo/bar/baz') + AssertEqual + \ ['/foo/bar/baz', '/foo/bar', '/foo', '/'], + \ ale#path#Upwards('/foo/bar/baz///') + " Relative paths do not. + AssertEqual + \ ['foo/bar/baz', 'foo/bar', 'foo'], + \ ale#path#Upwards('foo/bar/baz') + AssertEqual + \ ['foo2/bar', 'foo2'], + \ ale#path#Upwards('foo//..////foo2////bar') + " Expect an empty List for empty strings. + AssertEqual [], ale#path#Upwards('') + endif + + if has('win32') + AssertEqual + \ ['C:\foo\bar\baz', 'C:\foo\bar', 'C:\foo', 'C:\'], + \ ale#path#Upwards('C:\foo\bar\baz') + AssertEqual + \ ['C:\foo\bar\baz', 'C:\foo\bar', 'C:\foo', 'C:\'], + \ ale#path#Upwards('C:\foo\bar\baz\\\') + AssertEqual + \ ['/foo\bar\baz', '/foo\bar', '/foo', '/'], + \ ale#path#Upwards('/foo/bar/baz') + AssertEqual + \ ['foo\bar\baz', 'foo\bar', 'foo'], + \ ale#path#Upwards('foo/bar/baz') + AssertEqual + \ ['foo\bar\baz', 'foo\bar', 'foo'], + \ ale#path#Upwards('foo\bar\baz') + " simplify() is used internally, and should sort out \ paths when actually + " running Windows, which we can't test here. + AssertEqual + \ ['foo2\bar', 'foo2'], + \ ale#path#Upwards('foo//..///foo2////bar') + " Expect an empty List for empty strings. + AssertEqual [], ale#path#Upwards('') + " Paths starting with // return / + AssertEqual + \ ['/foo2\bar', '/foo2', '/'], + \ ale#path#Upwards('//foo//..///foo2////bar') + endif diff --git a/sources_non_forked/ale/test/test_path_uri.vader b/sources_non_forked/ale/test/test_path_uri.vader new file mode 100644 index 00000000..e2daccf4 --- /dev/null +++ b/sources_non_forked/ale/test/test_path_uri.vader @@ -0,0 +1,73 @@ +Before: + scriptencoding utf-8 + +Execute(ale#path#ToFileURI should work for Windows paths): + AssertEqual 'file:///C:/foo/bar/baz.tst', ale#path#ToFileURI('C:\foo\bar\baz.tst') + AssertEqual 'foo/bar/baz.tst', ale#path#ToFileURI('foo\bar\baz.tst') + +Execute(ale#path#FromFileURI should work for Unix paths): + AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('file:///foo/bar/baz.tst') + AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('file:/foo/bar/baz.tst') + AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('FILE:///foo/bar/baz.tst') + AssertEqual '/foo/bar/baz.tst', ale#path#FromFileURI('FILE:/foo/bar/baz.tst') + +Execute(ale#path#FromFileURI should work for Windows paths): + if has('win32') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:///C:/foo/bar/baz.tst') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:/C:/foo/bar/baz.tst') + AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:///c:/foo/bar/baz.tst') + AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:/c:/foo/bar/baz.tst') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:///C:/foo/bar/baz.tst') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:/C:/foo/bar/baz.tst') + else + AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('file:///C:/foo/bar/baz.tst') + AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('file:/C:/foo/bar/baz.tst') + AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromFileURI('file:///c:/foo/bar/baz.tst') + AssertEqual '/c:/foo/bar/baz.tst', ale#path#FromFileURI('file:/c:/foo/bar/baz.tst') + AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('FILE:///C:/foo/bar/baz.tst') + AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('FILE:/C:/foo/bar/baz.tst') + endif + +Execute(ale#path#FromFileURI parse Windows paths with a pipe): + if has('win32') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:///C|/foo/bar/baz.tst') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:/C|/foo/bar/baz.tst') + AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:///c|/foo/bar/baz.tst') + AssertEqual 'c:\foo\bar\baz.tst', ale#path#FromFileURI('file:/c|/foo/bar/baz.tst') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:///C|/foo/bar/baz.tst') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('FILE:/C|/foo/bar/baz.tst') + else + AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('file:///C|/foo/bar/baz.tst') + AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('file:/C|/foo/bar/baz.tst') + AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromFileURI('file:///c|/foo/bar/baz.tst') + AssertEqual '/c|/foo/bar/baz.tst', ale#path#FromFileURI('file:/c|/foo/bar/baz.tst') + AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('FILE:///C|/foo/bar/baz.tst') + AssertEqual '/C|/foo/bar/baz.tst', ale#path#FromFileURI('FILE:/C|/foo/bar/baz.tst') + endif + +Execute(ale#path#FromFileURI should handle the colon for the drive letter being encoded): + " These URIs shouldn't be created, but we'll handle them anyway. + if has('win32') + AssertEqual 'C:\foo\bar\baz.tst', ale#path#FromFileURI('file:///C%3A/foo/bar/baz.tst') + else + AssertEqual '/C:/foo/bar/baz.tst', ale#path#FromFileURI('file:///C%3A/foo/bar/baz.tst') + endif + +Execute(ale#path#ToFileURI should work for Unix paths): + AssertEqual 'file:///foo/bar/baz.tst', ale#path#ToFileURI('/foo/bar/baz.tst') + AssertEqual 'foo/bar/baz.tst', ale#path#ToFileURI('foo/bar/baz.tst') + +Execute(ale#path#ToFileURI should keep safe characters): + AssertEqual '//a-zA-Z0-9$-_.!*''(),', ale#path#ToFileURI('\/a-zA-Z0-9$-_.!*''(),') + +Execute(ale#path#ToFileURI should percent encode unsafe characters): + AssertEqual '%20%2b%3a%3f%26%3d', ale#path#ToFileURI(' +:?&=') + +Execute(ale#path#FromFileURI should decode percent encodings): + AssertEqual ' +:?&=', ale#path#FromFileURI('%20%2b%3a%3f%26%3d') + +Execute(ale#path#ToFileURI should handle UTF-8): + AssertEqual 'file:///T%c3%a9l%c3%a9chargement', ale#path#ToFileURI('/Téléchargement') + +Execute(ale#path#FromFileURI should handle UTF-8): + AssertEqual '/Téléchargement', ale#path#FromFileURI('file:///T%C3%A9l%C3%A9chargement') diff --git a/sources_non_forked/ale/test/test_pattern_options.vader b/sources_non_forked/ale/test/test_pattern_options.vader new file mode 100644 index 00000000..3b6500e5 --- /dev/null +++ b/sources_non_forked/ale/test/test_pattern_options.vader @@ -0,0 +1,107 @@ +Before: + Save g:ale_pattern_options + Save g:ale_pattern_options_enabled + Save b:ale_quitting + Save b:ale_original_filetype + Save &filetype + + unlet! b:ale_file_changed + + let g:ale_pattern_options_enabled = 1 + let g:ale_pattern_options = {} + + let b:ale_enabled = 0 + let b:some_option = 0 + + call ale#test#SetDirectory('/testplugin/test') + +After: + Restore + + unlet! b:ale_enabled + unlet! b:some_option + + call ale#test#RestoreDirectory() + +Execute(The pattern options function should work when there are no patterns): + call ale#test#SetFilename('foobar.js') + call ale#events#ReadOrEnterEvent(bufnr('')) + +Execute(Buffer variables should be set when filename patterns match): + let g:ale_pattern_options = { + \ 'baz.*\.js': { + \ 'ale_enabled': 1, + \ 'some_option': 347, + \ '&filetype': 'pattern_option_set_filetype', + \ }, + \} + + call ale#test#SetFilename('foobar.js') + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 0, b:ale_enabled + AssertEqual 0, b:some_option + + call ale#test#SetFilename('bazboz.js') + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 1, b:ale_enabled + AssertEqual 347, b:some_option + AssertEqual 'pattern_option_set_filetype', &filetype + +Execute(Multiple pattern matches should be applied): + let g:ale_pattern_options = { + \ 'foo': { + \ 'some_option': 666, + \ }, + \ 'bar': { + \ 'ale_enabled': 1, + \ 'some_option': 123, + \ }, + \ 'notmatched': { + \ 'some_option': 489, + \ 'ale_enabled': 0, + \ }, + \} + + call ale#test#SetFilename('foobar.js') + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 1, b:ale_enabled + AssertEqual 666, b:some_option + +Execute(Patterns should not be applied when the setting is disabled): + let g:ale_pattern_options_enabled = 0 + let g:ale_pattern_options = {'foo': {'some_option': 666}} + + call ale#test#SetFilename('foobar.js') + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 0, b:some_option + +" This test is important for making sure we update the sorted items. +Execute(Patterns should be applied after the Dictionary changes): + call ale#test#SetFilename('foobar.js') + + let g:ale_pattern_options = {} + + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 0, b:some_option + + let g:ale_pattern_options['foo'] = {'some_option': 666} + + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 666, b:some_option + +Execute(SetOptions should tolerate settings being unset): + " This might happen if ALE is loaded in a weird way, so tolerate it. + unlet! g:ale_pattern_options + unlet! g:ale_pattern_options_enabled + + call ale#events#ReadOrEnterEvent(bufnr('')) + + let g:ale_pattern_options_enabled = 1 + + call ale#events#ReadOrEnterEvent(bufnr('')) diff --git a/sources_non_forked/ale/test/test_prepare_command.vader b/sources_non_forked/ale/test/test_prepare_command.vader new file mode 100644 index 00000000..4e963b82 --- /dev/null +++ b/sources_non_forked/ale/test/test_prepare_command.vader @@ -0,0 +1,96 @@ +Before: + Save &shell + Save &shellcmdflag + Save g:ale_shell + Save g:ale_shell_arguments + + Save b:ale_shell + Save b:ale_shell_arguments + + unlet! b:ale_shell + unlet! b:ale_shell_arguments + + unlet! g:ale_shell + unlet! g:ale_shell_arguments + +After: + Restore + +Execute(sh should be used when the shell is fish): + if !has('win32') + " Set something else, so we will replace that too. + let &shellcmdflag = '-f' + let &shell = 'fish' + + AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') + + let &shell = '/usr/bin/fish' + + AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') + + let &shell = '/usr/local/bin/fish' + + AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') + endif + +Execute(sh should be used when the shell is powershell): + if !has('win32') + " Set something else, so we will replace that too. + let &shellcmdflag = '-f' + let &shell = 'pwsh' + + AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') + + let &shell = '/usr/bin/pwsh' + + AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') + + let &shell = '/usr/local/bin/pwsh' + + AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') + endif + +Execute(Other shells should be used when set): + if !has('win32') + let &shell = '/bin/bash' + let &shellcmdflag = '-c' + let g:ale_shell = &shell + + AssertEqual ['/bin/bash', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') + endif + +Execute(cmd /s/c as a string should be used on Windows): + if has('win32') + let &shell = 'who cares' + let &shellcmdflag = 'whatever' + + AssertEqual 'cmd /s/c "foobar"', ale#job#PrepareCommand(bufnr(''), 'foobar') + endif + +Execute(Setting g:ale_shell should cause ale#job#PrepareCommand to use set shell): + let g:ale_shell = '/foo/bar' + + if has('win32') + AssertEqual ['/foo/bar', '/c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar") + else + AssertEqual ['/foo/bar', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar") + endif + + let g:ale_shell_arguments = '-x' + + AssertEqual ['/foo/bar', '-x', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar") + +Execute(Setting b:ale_shell should cause ale#job#PrepareCommand to use set shell): + let g:ale_shell = '/wrong/foo/bar' + let b:ale_shell = '/foo/bar' + + if has('win32') + AssertEqual ['/foo/bar', '/c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar") + else + AssertEqual ['/foo/bar', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar") + endif + + let g:ale_shell_arguments = '--verbose -x' + let b:ale_shell_arguments = '-x' + + AssertEqual ['/foo/bar', '-x', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar") diff --git a/sources_non_forked/ale/test/test_puppet_path_detection.vader b/sources_non_forked/ale/test/test_puppet_path_detection.vader new file mode 100644 index 00000000..e918e916 --- /dev/null +++ b/sources_non_forked/ale/test/test_puppet_path_detection.vader @@ -0,0 +1,22 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + + runtime ale_linters/puppet/languageserver.vim + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(old-style module should find its root correctly): + call ale#test#SetFilename('test-files/puppet/old-style-module/manifests/init.pp') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/puppet/old-style-module'), + \ ale_linters#puppet#languageserver#GetProjectRoot(bufnr('')) + +Execute(new-style module should find its root correctly): + call ale#test#SetFilename('test-files/puppet/new-style-module/lib/puppet/types/exampletype.rb') + + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/puppet/new-style-module'), + \ ale_linters#puppet#languageserver#GetProjectRoot(bufnr('')) diff --git a/sources_non_forked/ale/test/test_python_find_project_root.vader b/sources_non_forked/ale/test/test_python_find_project_root.vader new file mode 100644 index 00000000..e323c866 --- /dev/null +++ b/sources_non_forked/ale/test/test_python_find_project_root.vader @@ -0,0 +1,11 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + +Execute(Detect root of Python project with .flake8 correctly): + call ale#test#SetFilename('test-files/python/python-package-project/package-name/module.py') + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/python/python-package-project'), + \ ale#python#FindProjectRoot(bufnr('')) diff --git a/sources_non_forked/ale/test/test_python_pipenv.vader b/sources_non_forked/ale/test/test_python_pipenv.vader new file mode 100644 index 00000000..041e2874 --- /dev/null +++ b/sources_non_forked/ale/test/test_python_pipenv.vader @@ -0,0 +1,19 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + +Execute(ale#python#PipenvPresent is true when a pipenv environment is present): + call ale#test#SetFilename('test-files/python/pipenv/whatever.py') + + AssertEqual + \ ale#python#PipenvPresent(bufnr('%')), + \ 1 + +Execute(ale#python#PipenvPresent is false when no pipenv environment is present): + call ale#test#SetFilename('test-files/python/no_pipenv/whatever.py') + + AssertEqual + \ ale#python#PipenvPresent(bufnr('%')), + \ 0 diff --git a/sources_non_forked/ale/test/test_python_poetry.vader b/sources_non_forked/ale/test/test_python_poetry.vader new file mode 100644 index 00000000..8197b786 --- /dev/null +++ b/sources_non_forked/ale/test/test_python_poetry.vader @@ -0,0 +1,19 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + +Execute(ale#python#poetryPresent is true when a poetry environment is present): + call ale#test#SetFilename('test-files/python/poetry/whatever.py') + + AssertEqual + \ ale#python#PoetryPresent(bufnr('%')), + \ 1 + +Execute(ale#python#poetryPresent is false when no poetry environment is present): + call ale#test#SetFilename('test-files/python/no_poetry/whatever.py') + + AssertEqual + \ ale#python#PoetryPresent(bufnr('%')), + \ 0 diff --git a/sources_non_forked/ale/test/test_python_traceback.vader b/sources_non_forked/ale/test/test_python_traceback.vader new file mode 100644 index 00000000..6a659986 --- /dev/null +++ b/sources_non_forked/ale/test/test_python_traceback.vader @@ -0,0 +1,79 @@ +Execute(ale#python#HandleTraceback returns empty List for empty lines): + AssertEqual + \ [], + \ ale#python#HandleTraceback([], 10) + +Execute(ale#python#HandleTraceback returns traceback, when present): + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'Exception: Example error (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in ', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], "\n"), + \ }], + \ ale#python#HandleTraceback([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in ', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], 1) + +" SyntaxError has extra output lines about the source +Execute(ale#python#HandleTraceback returns SyntaxError traceback): + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'SyntaxError: invalid syntax (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "", line 1, in ', + \ ' File "example.py", line 5', + \ ' +', + \ ' ^', + \ 'SyntaxError: invalid syntax', + \ ], "\n"), + \ }], + \ ale#python#HandleTraceback([ + \ 'Traceback (most recent call last):', + \ ' File "", line 1, in ', + \ ' File "example.py", line 5', + \ ' +', + \ ' ^', + \ 'SyntaxError: invalid syntax', + \ ], 1) + +Execute(ale#python#HandleTraceback ignores traceback after line limit): + AssertEqual + \ [], + \ ale#python#HandleTraceback([ + \ '', + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in ', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], 1) + +Execute(ale#python#HandleTraceback doesn't include later lines in detail): + AssertEqual + \ [{ + \ 'lnum': 1, + \ 'text': 'Exception: Example error (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in ', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ ], "\n"), + \ }], + \ ale#python#HandleTraceback([ + \ 'Traceback (most recent call last):', + \ ' File "./example.py", line 5, in ', + \ ' raise Exception(''Example message'')', + \ 'Exception: Example error', + \ 'file:1:2: Style issue', + \ 'file:3:4: Non-style issue', + \ ], 1) diff --git a/sources_non_forked/ale/test/test_python_virtualenv.vader b/sources_non_forked/ale/test/test_python_virtualenv.vader new file mode 100644 index 00000000..b44c5fa2 --- /dev/null +++ b/sources_non_forked/ale/test/test_python_virtualenv.vader @@ -0,0 +1,12 @@ +Before: + Save $VIRTUAL_ENV + let $VIRTUAL_ENV = "/opt/example/" + +After: + Restore + +Execute(ale#python#FindVirtualenv falls back to $VIRTUAL_ENV when no directories match): + AssertEqual + \ ale#python#FindVirtualenv(bufnr('%')), + \ '/opt/example/', + \ 'Expected VIRTUAL_ENV environment variable to be used, but it was not' diff --git a/sources_non_forked/ale/test/test_quickfix_deduplication.vader b/sources_non_forked/ale/test/test_quickfix_deduplication.vader new file mode 100644 index 00000000..9cb8b931 --- /dev/null +++ b/sources_non_forked/ale/test/test_quickfix_deduplication.vader @@ -0,0 +1,50 @@ +Before: + Save g:ale_buffer_info + +After: + Restore + +Execute: + " Results from multiple buffers should be gathered together. + " Equal problems should be de-duplicated. + let g:ale_buffer_info = { + \ '1': {'loclist': [ + \ {'type': 'E', 'bufnr': 2, 'lnum': 1, 'col': 2, 'text': 'foo'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 1, 'col': 5, 'text': 'bar'}, + \ {'type': 'E', 'bufnr': -1, 'filename': 'c', 'lnum': 3, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 5, 'col': 4, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'foo'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 2, 'col': 10, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 3, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 5, 'col': 5, 'text': 'x'}, + \ {'type': 'E', 'bufnr': -1, 'filename': 'b', 'lnum': 4, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': -1, 'filename': 'b', 'lnum': 5, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 3, 'lnum': 1, 'col': 1, 'text': 'foo'}, + \ ]}, + \ '2': {'loclist': [ + \ {'type': 'E', 'bufnr': 1, 'lnum': 2, 'col': 10, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 5, 'col': 5, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 1, 'col': 2, 'text': 'foo'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 3, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 5, 'col': 4, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 1, 'col': 5, 'text': 'bar'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'another error'}, + \ ]}, + \} + + AssertEqual + \ [ + \ {'type': 'E', 'bufnr': -1, 'filename': 'b', 'lnum': 4, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': -1, 'filename': 'b', 'lnum': 5, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': -1, 'filename': 'c', 'lnum': 3, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 2, 'col': 10, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 3, 'col': 2, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 5, 'col': 4, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 1, 'lnum': 5, 'col': 5, 'text': 'x'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 1, 'col': 2, 'text': 'foo'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 1, 'col': 5, 'text': 'bar'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'another error'}, + \ {'type': 'E', 'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'foo'}, + \ {'type': 'E', 'bufnr': 3, 'lnum': 1, 'col': 1, 'text': 'foo'}, + \ ], + \ ale#list#GetCombinedList() diff --git a/sources_non_forked/ale/test/test_quitting_variable.vader b/sources_non_forked/ale/test/test_quitting_variable.vader new file mode 100644 index 00000000..32eb0c36 --- /dev/null +++ b/sources_non_forked/ale/test/test_quitting_variable.vader @@ -0,0 +1,39 @@ +Before: + Save g:ale_enabled + + unlet! b:ale_quitting + let g:ale_enabled = 0 + +After: + Restore + + unlet! b:ale_quitting + unlet! b:time_before + +Execute(QuitEvent should set b:ale_quitting some time from the clock): + let b:time_before = ale#events#ClockMilliseconds() + + call ale#events#QuitEvent(bufnr('')) + + Assert b:ale_quitting >= b:time_before + Assert b:ale_quitting <= ale#events#ClockMilliseconds() + +Execute(ReadOrEnterEvent should set b:ale_quitting to 0): + let b:ale_quitting = 1 + + call ale#events#ReadOrEnterEvent(bufnr('')) + + AssertEqual 0, b:ale_quitting + +Execute(The QuitRecently function should work when the variable isn't set): + AssertEqual 0, ale#events#QuitRecently(bufnr('')) + +Execute(The QuitRecently function should return 1 when ALE quit recently): + let b:ale_quitting = ale#events#ClockMilliseconds() + + AssertEqual 1, ale#events#QuitRecently(bufnr('')) + +Execute(The QuitRecently function should return 0 when a second has passed): + let b:ale_quitting = ale#events#ClockMilliseconds() - 1001 + + AssertEqual 0, ale#events#QuitRecently(bufnr('')) diff --git a/sources_non_forked/ale/test/test_redundant_tsserver_rendering_avoided.vader b/sources_non_forked/ale/test/test_redundant_tsserver_rendering_avoided.vader new file mode 100644 index 00000000..05660d4e --- /dev/null +++ b/sources_non_forked/ale/test/test_redundant_tsserver_rendering_avoided.vader @@ -0,0 +1,178 @@ +Before: + Save g:ale_buffer_info + Save g:ale_disable_lsp + Save g:ale_lsp_suggestions + + let g:ale_disable_lsp = 0 + let g:ale_lsp_suggestions = 1 + unlet! b:ale_disable_lsp + + function! CreateError(type, message) abort + let l:diagnostics = [] + + if !empty(a:message) + let l:diagnostics = [{ + \ 'start': {'line': 1, 'offset': 1}, + \ 'end': {'line': 1, 'offset':1}, + \ 'text': a:message, + \ 'code': 1005, + \}] + endif + + return { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': a:type, + \ 'body': {'file': expand('%:p'), 'diagnostics': l:diagnostics}, + \} + endfunction + + function! CreateLoclist(message) abort + let l:list = [] + + if !empty(a:message) + let l:list = [{ + \ 'lnum': 1, + \ 'col': 1, + \ 'end_lnum': 1, + \ 'end_col': 1, + \ 'text': a:message, + \}] + endif + + return l:list + endfunction + + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('filename.ts') + + runtime autoload/ale/engine.vim + + let g:ale_buffer_info = {bufnr(''): {'loclist': [], 'active_linter_list': []}} + let g:ale_handle_loclist_called = 0 + + function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort + let g:ale_handle_loclist_called = 1 + endfunction + +After: + Restore + + delfunction CreateError + delfunction CreateLoclist + + call ale#test#RestoreDirectory() + + runtime autoload/ale/engine.vim + +Execute(An initial empty list of syntax errors should be ignored): + call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', '')) + + Assert !g:ale_handle_loclist_called + +Execute(An initial list of syntax errors should be handled): + call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x')) + + Assert g:ale_handle_loclist_called + +Execute(Subsequent empty lists should be ignored): + let g:ale_buffer_info[bufnr('')].syntax_loclist = [] + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', '')) + + Assert !g:ale_handle_loclist_called + +Execute(Empty then non-empty syntax errors should be handled): + let g:ale_buffer_info[bufnr('')].syntax_loclist = [] + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x')) + + Assert g:ale_handle_loclist_called + +Execute(Non-empty then empty syntax errors should be handled): + let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x') + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', '')) + + Assert g:ale_handle_loclist_called + +Execute(Non-empty then non-empty syntax errors should be handled): + let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x') + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x')) + + Assert g:ale_handle_loclist_called + +Execute(An initial empty list of semantic errors should be ignored): + call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', '')) + + Assert !g:ale_handle_loclist_called + +Execute(An initial list of semantic errors should be handled): + call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x')) + + Assert g:ale_handle_loclist_called + +Execute(Subsequent empty lists should be ignored - semantic): + let g:ale_buffer_info[bufnr('')].semantic_loclist = [] + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', '')) + + Assert !g:ale_handle_loclist_called + +Execute(Empty then non-empty semantic errors should be handled): + let g:ale_buffer_info[bufnr('')].semantic_loclist = [] + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x')) + + Assert g:ale_handle_loclist_called + +Execute(Non-empty then empty semantic errors should be handled): + let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x') + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', '')) + + Assert g:ale_handle_loclist_called + +Execute(Non-empty then non-empty semantic errors should be handled): + let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x') + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x')) + + Assert g:ale_handle_loclist_called + +Execute(Subsequent empty lists should be ignored - suggestion): + let g:ale_buffer_info[bufnr('')].suggestion_loclist = [] + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', '')) + + Assert !g:ale_handle_loclist_called + +Execute(You should be able to disable suggestions): + let g:ale_lsp_suggestions = 0 + let g:ale_buffer_info[bufnr('')].suggestion_loclist = [] + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x')) + + Assert !g:ale_handle_loclist_called + +Execute(Empty then non-empty suggestion messages should be handled): + let g:ale_buffer_info[bufnr('')].suggestion_loclist = [] + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x')) + + Assert g:ale_handle_loclist_called + +Execute(Non-empty then empt suggestion messages should be handled): + let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x') + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', '')) + + Assert g:ale_handle_loclist_called + +Execute(Non-empty then non-empty suggestion messages should be handled): + let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x') + + call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x')) + + Assert g:ale_handle_loclist_called diff --git a/sources_non_forked/ale/test/test_regex_escaping.vader b/sources_non_forked/ale/test/test_regex_escaping.vader new file mode 100644 index 00000000..b79b8c56 --- /dev/null +++ b/sources_non_forked/ale/test/test_regex_escaping.vader @@ -0,0 +1,4 @@ +Execute(ale#util#EscapePCRE should escape strings for PCRE or RE2 appropriately): + AssertEqual '\\\^\$\*\+\?\.\(\)\|\{\}\[\]', ale#util#EscapePCRE('\^$*+?.()|{}[]') + AssertEqual 'abcABC09', ale#util#EscapePCRE('abcABC09') + AssertEqual '/', ale#util#EscapePCRE('/') diff --git a/sources_non_forked/ale/test/test_rename.vader b/sources_non_forked/ale/test/test_rename.vader new file mode 100644 index 00000000..83f0aa7e --- /dev/null +++ b/sources_non_forked/ale/test/test_rename.vader @@ -0,0 +1,504 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.txt') + + let g:old_filename = expand('%:p') + let g:Callback = '' + let g:expr_list = [] + let g:message_list = [] + let g:handle_code_action_called = 0 + let g:code_actions = [] + let g:options = {} + let g:capability_checked = '' + let g:conn_id = v:null + let g:InitCallback = v:null + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/rename.vim + runtime autoload/ale/code_action.vim + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + + if a:linter.lsp is# 'tsserver' + call ale#lsp#MarkConnectionAsTsserver(g:conn_id) + endif + + let l:details = { + \ 'command': 'foobar', + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \} + + let g:InitCallback = {-> ale#lsp_linter#OnInit(a:linter, l:details, a:Callback)} + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#Execute(expr) abort + call add(g:expr_list, a:expr) + endfunction + + function! ale#code_action#HandleCodeAction(code_action, options) abort + let g:handle_code_action_called = 1 + AssertEqual !&hidden, get(a:options, 'should_save', 0) + call add(g:code_actions, a:code_action) + endfunction + + function! ale#util#Input(message, value) abort + return 'a-new-name' + endfunction + + call ale#rename#SetMap({ + \ 3: { + \ 'old_name': 'oldName', + \ 'new_name': 'aNewName', + \ }, + \}) + +After: + if g:conn_id isnot v:null + call ale#lsp#RemoveConnectionWithID(g:conn_id) + endif + + call ale#rename#SetMap({}) + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:capability_checked + unlet! g:InitCallback + unlet! g:old_filename + unlet! g:conn_id + unlet! g:Callback + unlet! g:message_list + unlet! g:expr_list + unlet! b:ale_linters + unlet! g:options + unlet! g:code_actions + unlet! g:handle_code_action_called + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/rename.vim + runtime autoload/ale/code_action.vim + +Execute(Other messages for the tsserver handler should be ignored): + call ale#rename#HandleTSServerResponse(1, {'command': 'foo'}) + AssertEqual g:handle_code_action_called, 0 + +Execute(Failed rename responses should be handled correctly): + call ale#rename#SetMap({3: {'old_name': 'oldName', 'new_name': 'a-test'}}) + call ale#rename#HandleTSServerResponse( + \ 1, + \ {'command': 'rename', 'request_seq': 3} + \) + AssertEqual g:handle_code_action_called, 0 + +Given typescript(Some typescript file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Code actions from tsserver should be handled): + call ale#rename#HandleTSServerResponse(1, { + \ 'command': 'rename', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'locs': [ + \ { + \ 'file': '/foo/bar/file1.ts', + \ 'locs': [ + \ { + \ 'start': { + \ 'line': 1, + \ 'offset': 2, + \ }, + \ 'end': { + \ 'line': 3, + \ 'offset': 4, + \ }, + \ }, + \ ], + \ }, + \ { + \ 'file': '/foo/bar/file2.ts', + \ 'locs': [ + \ { + \ 'start': { + \ 'line': 10, + \ 'offset': 20, + \ }, + \ 'end': { + \ 'line': 30, + \ 'offset': 40, + \ }, + \ }, + \ ], + \ }, + \ ] + \ }, + \}) + + AssertEqual + \ [ + \ { + \ 'description': 'rename', + \ 'changes': [ + \ { + \ 'fileName': '/foo/bar/file1.ts', + \ 'textChanges': [ + \ { + \ 'start': { + \ 'line': 1, + \ 'offset': 2, + \ }, + \ 'end': { + \ 'line': 3, + \ 'offset': 4, + \ }, + \ 'newText': 'aNewName', + \ }, + \ ], + \ }, + \ { + \ 'fileName': '/foo/bar/file2.ts', + \ 'textChanges': [ + \ { + \ 'start': { + \ 'line': 10, + \ 'offset': 20, + \ }, + \ 'end': { + \ 'line': 30, + \ 'offset': 40, + \ }, + \ 'newText': 'aNewName', + \ }, + \ ], + \ }, + \ ], + \ } + \ ], + \ g:code_actions + +Execute(HandleTSServerResponse does nothing when no data in rename_map): + call ale#rename#HandleTSServerResponse(1, { + \ 'command': 'rename', + \ 'request_seq': -9, + \ 'success': v:true, + \ 'body': {} + \}) + + AssertEqual g:handle_code_action_called, 0 + +Execute(Prints a tsserver error message when unsuccessful): + call ale#rename#HandleTSServerResponse(1, { + \ 'command': 'rename', + \ 'request_seq': 3, + \ 'success': v:false, + \ 'message': 'This symbol cannot be renamed', + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''Error renaming "oldName" to: "aNewName". ' . + \ 'Reason: This symbol cannot be renamed'''], g:expr_list + +Execute(Does nothing when no changes): + call ale#rename#HandleTSServerResponse(1, { + \ 'command': 'rename', + \ 'request_seq': 3, + \ 'success': v:true, + \ 'body': { + \ 'locs': [] + \ } + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''Error renaming "oldName" to: "aNewName"'''], g:expr_list + +Execute(tsserver rename requests should be sent): + call ale#rename#SetMap({}) + call ale#linter#Reset() + + runtime ale_linters/typescript/tsserver.vim + call setpos('.', [bufnr(''), 2, 5, 0]) + + ALERename + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'rename', g:capability_checked + AssertEqual + \ 'function(''ale#rename#HandleTSServerResponse'')', + \ string(g:Callback) + AssertEqual + \ [ + \ ale#lsp#tsserver_message#Change(bufnr('')), + \ [0, 'ts@rename', { + \ 'file': expand('%:p'), + \ 'line': 2, + \ 'offset': 5, + \ 'arguments': { + \ 'findInComments': g:ale_rename_tsserver_find_in_comments, + \ 'findInStrings': g:ale_rename_tsserver_find_in_strings, + \ }, + \ }] + \ ], + \ g:message_list + AssertEqual {'42': {'old_name': 'somelongerline', 'new_name': 'a-new-name'}}, + \ ale#rename#GetMap() + +Given python(Some Python file): + foo + somelongerline + bazxyzxyzxyz + +Execute(Code actions from LSP should be handled): + call ale#rename#HandleLSPResponse(1, { + \ 'id': 3, + \ 'result': { + \ 'changes': { + \ 'file:///foo/bar/file1.ts': [ + \ { + \ 'range': { + \ 'start': { + \ 'line': 1, + \ 'character': 2, + \ }, + \ 'end': { + \ 'line': 3, + \ 'character': 4, + \ }, + \ }, + \ 'newText': 'bla123' + \ }, + \ ], + \ }, + \ }, + \}) + + AssertEqual + \ [ + \ { + \ 'description': 'rename', + \ 'changes': [ + \ { + \ 'fileName': '/foo/bar/file1.ts', + \ 'textChanges': [ + \ { + \ 'start': { + \ 'line': 2, + \ 'offset': 3, + \ }, + \ 'end': { + \ 'line': 4, + \ 'offset': 5, + \ }, + \ 'newText': 'bla123', + \ }, + \ ], + \ }, + \ ], + \ } + \ ], + \ g:code_actions + +Execute(DocumentChanges from LSP should be handled): + call ale#rename#HandleLSPResponse(1, { + \ 'id': 3, + \ 'result': { + \ 'documentChanges': [ + \ { + \ 'textDocument': { + \ 'version': 1.0, + \ 'uri': 'file:///foo/bar/file1.ts', + \ }, + \ 'edits': [ + \ { + \ 'range': { + \ 'start': { + \ 'line': 1, + \ 'character': 2, + \ }, + \ 'end': { + \ 'line': 3, + \ 'character': 4, + \ }, + \ }, + \ 'newText': 'bla123', + \ }, + \ ], + \ }, + \ ], + \ }, + \}) + + AssertEqual + \ [ + \ { + \ 'description': 'rename', + \ 'changes': [ + \ { + \ 'fileName': '/foo/bar/file1.ts', + \ 'textChanges': [ + \ { + \ 'start': { + \ 'line': 2, + \ 'offset': 3, + \ }, + \ 'end': { + \ 'line': 4, + \ 'offset': 5, + \ }, + \ 'newText': 'bla123', + \ }, + \ ], + \ }, + \ ], + \ } + \ ], + \ g:code_actions + +Execute(Single DocumentChange from LSP should be handled): + call ale#rename#HandleLSPResponse(1, { + \ 'id': 3, + \ 'result': { + \ 'documentChanges': { + \ 'textDocument': { + \ 'version': 1.0, + \ 'uri': 'file:///foo/bar/file1.ts', + \ }, + \ 'edits': [ + \ { + \ 'range': { + \ 'start': { + \ 'line': 1, + \ 'character': 2, + \ }, + \ 'end': { + \ 'line': 3, + \ 'character': 4, + \ }, + \ }, + \ 'newText': 'bla123', + \ }, + \ ], + \ }, + \ }, + \}) + + AssertEqual + \ [ + \ { + \ 'description': 'rename', + \ 'changes': [ + \ { + \ 'fileName': '/foo/bar/file1.ts', + \ 'textChanges': [ + \ { + \ 'start': { + \ 'line': 2, + \ 'offset': 3, + \ }, + \ 'end': { + \ 'line': 4, + \ 'offset': 5, + \ }, + \ 'newText': 'bla123', + \ }, + \ ], + \ }, + \ ], + \ } + \ ], + \ g:code_actions +Execute(LSP should perform no action when no result): + call ale#rename#HandleLSPResponse(1, { + \ 'id': 3, + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''No rename result received from server'''], g:expr_list + +Execute(LSP should perform no action when no changes): + call ale#rename#HandleLSPResponse(1, { + \ 'id': 3, + \ 'result': {}, + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''No changes received from server'''], g:expr_list + +Execute(LSP should perform no action when changes is empty): + call ale#rename#HandleLSPResponse(1, { + \ 'id': 3, + \ 'result': { + \ 'changes': [], + \ }, + \}) + + AssertEqual g:handle_code_action_called, 0 + AssertEqual ['echom ''No changes received from server'''], g:expr_list + +Execute(LSP rename requests should be sent): + call ale#rename#SetMap({}) + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALERename + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'rename', g:capability_checked + AssertEqual + \ 'function(''ale#rename#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [1, 'textDocument/didChange', { + \ 'textDocument': { + \ 'uri': ale#path#ToFileURI(expand('%:p')), + \ 'version': g:ale_lsp_next_version_id - 1, + \ }, + \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}] + \ }], + \ [0, 'textDocument/rename', { + \ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))}, + \ 'position': {'line': 0, 'character': 2}, + \ 'newName': 'a-new-name', + \ }], + \ ], + \ g:message_list + + AssertEqual {'42': {'old_name': 'foo', 'new_name': 'a-new-name'}}, + \ ale#rename#GetMap() diff --git a/sources_non_forked/ale/test/test_resolve_local_path.vader b/sources_non_forked/ale/test/test_resolve_local_path.vader new file mode 100644 index 00000000..d8a8ec52 --- /dev/null +++ b/sources_non_forked/ale/test/test_resolve_local_path.vader @@ -0,0 +1,17 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + +Execute(We should be able to find the local version of a file): + call ale#test#SetFilename('test-files/top/middle/bottom/dummy.txt') + + AssertEqual + \ ale#path#Simplify(expand('%:p:h:h:h:h:h') . '/test-files/top/example.ini'), + \ ale#path#ResolveLocalPath(bufnr('%'), 'example.ini', '/global/config.ini') + +Execute(We shouldn't find anything for files which don't match): + AssertEqual + \ '/global/config.ini', + \ ale#path#ResolveLocalPath(bufnr('%'), 'missing.ini', '/global/config.ini') diff --git a/sources_non_forked/ale/test/test_results_not_cleared_when_opening_loclist.vader b/sources_non_forked/ale/test/test_results_not_cleared_when_opening_loclist.vader new file mode 100644 index 00000000..c586345a --- /dev/null +++ b/sources_non_forked/ale/test/test_results_not_cleared_when_opening_loclist.vader @@ -0,0 +1,30 @@ +Before: + Save g:ale_buffer_info + + call ale#linter#Reset() + +After: + Restore + + call setloclist(0, []) + call clearmatches() + call ale#sign#Clear() + +Given foobar (Some file): + abc + +Execute(The loclist shouldn't be cleared when opening the loclist): + call ale#engine#InitBufferInfo(bufnr('')) + let g:ale_buffer_info[bufnr('')].loclist = [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2}, + \] + call setloclist(0, g:ale_buffer_info[bufnr('')].loclist) + + " The cleanup function is called when the loclist window is closed. + " If some cleanup is done for this buffer, for which nothing is wrong, + " then the loclist for the window, which is the same window as the window + " we are checking, will be cleared. + :lopen + :q + + AssertEqual 1, len(ale#test#GetLoclistWithoutNewerKeys()), 'The loclist was cleared' diff --git a/sources_non_forked/ale/test/test_sandbox_execution.vader b/sources_non_forked/ale/test/test_sandbox_execution.vader new file mode 100644 index 00000000..cf994ce8 --- /dev/null +++ b/sources_non_forked/ale/test/test_sandbox_execution.vader @@ -0,0 +1,103 @@ +Before: + function! TestCallback(buffer, output) + return [ + \ { + \ 'lnum': 1, + \ 'bufnr': 1, + \ 'vcol': 0, + \ 'linter_name': 'testlinter', + \ 'nr': -1, + \ 'type': 'E', + \ 'col': 1, + \ 'text': 'Test Error', + \ }, + \] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'TestCallback', + \ 'executable': 'echo', + \ 'command': 'echo', + \}) + + let g:ale_buffer_info = {} + +After: + unlet! b:in_sandbox + unlet! b:result + + delfunction TestCallback + call ale#linter#Reset() + let g:ale_buffer_info = {} + + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(ale#util#InSandbox should return 1 when in a sandbox): + sandbox let b:in_sandbox = ale#util#InSandbox() + + Assert b:in_sandbox, 'ale#util#InSandbox() returned 0 for a sandbox command' + +Execute(ALE shouldn't blow up when run from a sandbox): + AssertEqual 'foobar', &filetype + + sandbox call ale#Queue(0) + sandbox call ale#Queue(1) + +Execute(ALE shouldn't blow up if file cleanup happens in a sandbox): + " Make a call to an engine function first, so the function will be defined + " before we make the sandbox call. + " + " You are not allowed to define any functions in the sandbox. + call ale#engine#InitBufferInfo(3) + + let g:ale_buffer_info[3] = { + \ 'temporary_file_list': ['/tmp/foo'], + \ 'temporary_directory_list': ['/tmp/bar'], + \} + sandbox call ale#command#RemoveManagedFiles(3) + + AssertEqual ['/tmp/foo'], g:ale_buffer_info[3].temporary_file_list + AssertEqual ['/tmp/bar'], g:ale_buffer_info[3].temporary_directory_list + +Execute(You shouldn't be able to define linters from the sandbox): + call ale#linter#Reset() + call ale#linter#PreventLoading('testft') + + AssertThrows sandbox call ale#linter#Define('testft', { + \ 'name': 'testlinter', + \ 'output_stream': 'stdout', + \ 'executable': 'testlinter', + \ 'command': 'testlinter', + \ 'callback': 'testCB', + \}) + AssertEqual 'Vim(let):E48: Not allowed in sandbox', g:vader_exception + AssertEqual [], ale#linter#GetAll(['testft']) + +Execute(You shouldn't be able to register fixers from the sandbox): + call ale#fix#registry#Clear() + AssertThrows sandbox call ale#fix#registry#Add('prettier', '', ['javascript'], 'prettier') + AssertEqual 'Vim(let):E48: Not allowed in sandbox', g:vader_exception + AssertEqual [], ale#fix#registry#CompleteFixers('', 'ALEFix ', 7) + +Execute(You shouldn't be able to get linters from the sandbox, to prevent tampering): + AssertThrows sandbox call ale#linter#GetLintersLoaded() + AssertEqual 'Vim(let):E48: Not allowed in sandbox', g:vader_exception + + call ale#linter#Reset() + + sandbox let b:result = ale#linter#GetAll(['testft']) + + AssertEqual 0, len(b:result) + + let b:result = ale#linter#GetAll(['testft']) + + AssertEqual 1, len(b:result) + + sandbox let b:result = ale#linter#GetAll(['testft']) + + AssertEqual 0, len(b:result) diff --git a/sources_non_forked/ale/test/test_semver_utils.vader b/sources_non_forked/ale/test/test_semver_utils.vader new file mode 100644 index 00000000..b38feb06 --- /dev/null +++ b/sources_non_forked/ale/test/test_semver_utils.vader @@ -0,0 +1,43 @@ +After: + call ale#semver#ResetVersionCache() + +Execute(ParseVersion should return the version from the lines of output): + " We should be able to parse the semver string from flake8 + AssertEqual [3, 0, 4], ale#semver#ParseVersion([ + \ '3.0.4 (mccabe: 0.5.2, pyflakes: 1.2.3, pycodestyle: 2.0.0) CPython 2.7.12 on Linux', + \ '1.2.3', + \]) + +Execute(ParseVersion should return an empty list when no vesrion can be found): + AssertEqual [], ale#semver#ParseVersion(['x']) + AssertEqual [], ale#semver#ParseVersion([]) + +Execute(ParseVersion should tolerate missing patch numbers): + " This goes against the semver spec, but we handle it anyway. + AssertEqual [3, 4, 0], ale#semver#ParseVersion(['Version 3.4']) + +Execute(GTE should compare triples correctly): + Assert ale#semver#GTE([3, 0, 4], [3, 0, 0]) + Assert ale#semver#GTE([3, 0, 0], [3, 0, 0]) + Assert ale#semver#GTE([3, 0, 0], [2, 0, 0]) + Assert ale#semver#GTE([3, 1, 0], [3, 1, 0]) + Assert ale#semver#GTE([3, 2, 0], [3, 1, 0]) + Assert ale#semver#GTE([3, 2, 2], [3, 1, 6]) + Assert ale#semver#GTE([3, 2, 5], [3, 2, 5]) + Assert ale#semver#GTE([3, 2, 6], [3, 2, 5]) + Assert !ale#semver#GTE([2, 9, 1], [3, 0, 0]) + Assert !ale#semver#GTE([3, 2, 3], [3, 3, 3]) + Assert !ale#semver#GTE([3, 3, 2], [3, 3, 3]) + +Execute(GTE should compare pairs correctly): + Assert ale#semver#GTE([3, 0], [3, 0, 0]) + Assert ale#semver#GTE([3, 0], [3, 0]) + Assert ale#semver#GTE([3, 1], [3, 0]) + Assert ale#semver#GTE([3, 1], [3, 0, 0]) + Assert ale#semver#GTE([3, 0, 1], [3, 0]) + Assert !ale#semver#GTE([3, 0], [3, 0, 1]) + Assert !ale#semver#GTE([3, 0], [3, 1]) + Assert !ale#semver#GTE([2, 9, 11], [3, 0]) + +Execute(GTE should permit the LHS to be an empty List): + Assert !ale#semver#GTE([], [0, 0, 0]) diff --git a/sources_non_forked/ale/test/test_set_list_timers.vader b/sources_non_forked/ale/test/test_set_list_timers.vader new file mode 100644 index 00000000..07e0202d --- /dev/null +++ b/sources_non_forked/ale/test/test_set_list_timers.vader @@ -0,0 +1,29 @@ +Before: + Save g:ale_set_lists_synchronously + Save g:ale_open_list + + let g:ale_set_lists_synchronously = 0 + +After: + Restore + + sleep 1ms + call setloclist(0, []) + lclose + +Execute(The SetLists function should work when run in a timer): + call ale#list#SetLists(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'}, + \]) + sleep 1ms + AssertEqual [{ + \ 'lnum': 5, + \ 'bufnr': bufnr(''), + \ 'col': 5, + \ 'text': 'x', + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \}], ale#test#GetLoclistWithoutNewerKeys() diff --git a/sources_non_forked/ale/test/test_setting_loclist_from_another_buffer.vader b/sources_non_forked/ale/test/test_setting_loclist_from_another_buffer.vader new file mode 100644 index 00000000..d33fa075 --- /dev/null +++ b/sources_non_forked/ale/test/test_setting_loclist_from_another_buffer.vader @@ -0,0 +1,26 @@ +Before: + Save g:ale_buffer_info + + let g:ale_buffer_info = { + \ bufnr(''): { + \ 'loclist': [{'bufnr': bufnr(''), 'lnum': 4, 'col': 1, 'text': 'foo'}] + \ }, + \} + + let g:original_buffer = bufnr('%') + noautocmd new + +After: + Restore + + unlet! g:original_buffer + +Execute(Errors should be set in the loclist for the original buffer, not the new one): + call ale#list#SetLists( + \ g:original_buffer, + \ g:ale_buffer_info[(g:original_buffer)].loclist, + \ ) + + AssertEqual [], ale#test#GetLoclistWithoutNewerKeys() + AssertEqual 1, len(getloclist(bufwinid(g:original_buffer))) + AssertEqual 'foo', getloclist(bufwinid(g:original_buffer))[0].text diff --git a/sources_non_forked/ale/test/test_setting_problems_found_in_previous_buffers.vader b/sources_non_forked/ale/test/test_setting_problems_found_in_previous_buffers.vader new file mode 100644 index 00000000..f1a31fc1 --- /dev/null +++ b/sources_non_forked/ale/test/test_setting_problems_found_in_previous_buffers.vader @@ -0,0 +1,98 @@ +Before: + Save g:ale_buffer_info + Save &filetype + Save g:ale_set_lists_synchronously + + let g:ale_set_lists_synchronously = 1 + + " Set up items in other buffers which should set in this one. + let g:ale_buffer_info = {} + call ale#engine#InitBufferInfo(bufnr('') + 1) + let g:ale_buffer_info[bufnr('') + 1].loclist = + \ ale#engine#FixLocList(bufnr('') + 1, 'linter_one', 0, [ + \ {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'}, + \ {'lnum': 2, 'filename': expand('%:p'), 'text': 'bar'}, + \ {'lnum': 2, 'text': 'ignore this one'}, + \ ]) + call ale#engine#InitBufferInfo(bufnr('') + 2) + let g:ale_buffer_info[bufnr('') + 2].loclist = + \ ale#engine#FixLocList(bufnr('') + 2, 'linter_one', 0, [ + \ {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'}, + \ {'lnum': 3, 'filename': expand('%:p'), 'text': 'baz'}, + \ {'lnum': 5, 'text': 'ignore this one'}, + \ ]) + + call ale#linter#Define('foobar', { + \ 'name': 'linter_one', + \ 'callback': 'WhoCares', + \ 'executable': 'echo', + \ 'command': 'sleep 1000', + \ 'lint_file': 1, + \}) + +After: + call ale#engine#Cleanup(bufnr('')) + Restore + call ale#linter#Reset() + + " Items and markers, etc. + call setloclist(0, []) + call clearmatches() + call ale#sign#Clear() + +Given foobar(A file with some lines): + foo + bar + baz + +Execute(Problems found from previously opened buffers should be set when linting for the first time): + call ale#engine#RunLinters(bufnr(''), ale#linter#Get(&filetype), 0) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'bufnr': bufnr(''), + \ 'col': 0, + \ 'filename': expand('%:p'), + \ 'linter_name': 'linter_one', + \ 'nr': -1, + \ 'type': 'E', + \ 'vcol': 0, + \ 'text': 'foo', + \ 'sign_id': 1000001, + \ }, + \ { + \ 'lnum': 2, + \ 'bufnr': bufnr(''), + \ 'col': 0, + \ 'filename': expand('%:p'), + \ 'linter_name': 'linter_one', + \ 'nr': -1, + \ 'type': 'E', + \ 'vcol': 0, + \ 'text': 'bar', + \ 'sign_id': 1000002, + \ }, + \ { + \ 'lnum': 3, + \ 'bufnr': bufnr(''), + \ 'col': 0, + \ 'filename': expand('%:p'), + \ 'linter_name': 'linter_one', + \ 'nr': -1, + \ 'type': 'E', + \ 'vcol': 0, + \ 'text': 'baz', + \ 'sign_id': 1000003, + \ }, + \ ], + \ g:ale_buffer_info[bufnr('')].loclist + + AssertEqual + \ [ + \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'foo'}, + \ {'lnum': 2, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'bar'}, + \ {'lnum': 3, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'baz'}, + \ ], + \ ale#test#GetLoclistWithoutNewerKeys() diff --git a/sources_non_forked/ale/test/test_shell_detection.vader b/sources_non_forked/ale/test/test_shell_detection.vader new file mode 100644 index 00000000..11d801c3 --- /dev/null +++ b/sources_non_forked/ale/test/test_shell_detection.vader @@ -0,0 +1,177 @@ +Before: + runtime ale_linters/sh/shell.vim + runtime ale_linters/sh/shellcheck.vim + +After: + call ale#linter#Reset() + + unlet! b:is_bash + unlet! b:is_sh + unlet! b:is_kornshell + +Given(A file with a Bash hashbang): + #!/bin/bash + +Execute(/bin/bash should be detected appropriately): + AssertEqual 'bash', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'bash', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with /bin/sh): + #!/usr/bin/env sh -eu --foobar + +Execute(/bin/sh should be detected appropriately): + AssertEqual 'sh', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'sh', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with bash as an argument to env): + #!/usr/bin/env bash + +Execute(/usr/bin/env bash should be detected appropriately): + AssertEqual 'bash', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'bash', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a tcsh hash bang and arguments): + #!/usr/bin/env tcsh -eu --foobar + +Execute(tcsh should be detected appropriately): + AssertEqual 'tcsh', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'tcsh', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'tcsh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a zsh hash bang and arguments): + #!/usr/bin/env zsh -eu --foobar + +Execute(zsh should be detected appropriately): + AssertEqual 'zsh', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'zsh', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'zsh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a csh hash bang and arguments): + #!/usr/bin/env csh -eu --foobar + +Execute(csh should be detected appropriately): + AssertEqual 'csh', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'csh', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'csh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a ksh hashbang): + #!/bin/ksh + +Execute(/bin/ksh should be detected appropriately): + AssertEqual 'ksh', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'ksh', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a ksh as an argument to env): + #!/usr/bin/env ksh + +Execute(ksh should be detected appropriately): + AssertEqual 'ksh', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'ksh', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a sh hash bang and arguments): + #!/usr/bin/env sh -eu --foobar + +Execute(sh should be detected appropriately): + AssertEqual 'sh', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'sh', ale_linters#sh#shell#GetExecutable(bufnr('')) + AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file without a hashbang): + +Execute(The bash dialect should be used for shellcheck if b:is_bash is 1): + let b:is_bash = 1 + + AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Execute(The sh dialect should be used for shellcheck if b:is_sh is 1): + let b:is_sh = 1 + + AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Execute(The ksh dialect should be used for shellcheck if b:is_kornshell is 1): + let b:is_kornshell = 1 + + AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Execute(The filetype should be used as the default shell type when there is no hashbang line): + set filetype=zsh + AssertEqual 'zsh', ale#handlers#sh#GetShellType(bufnr('')) + + set filetype=tcsh + AssertEqual 'tcsh', ale#handlers#sh#GetShellType(bufnr('')) + + set filetype=python + AssertEqual '', ale#handlers#sh#GetShellType(bufnr('')) + +Given(A file with /bin/ash): + #!/bin/ash + +Execute(The ash dialect should be used for the shell and the base function): + AssertEqual 'ash', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'ash', ale_linters#sh#shell#GetExecutable(bufnr('')) + +Execute(dash should be used for shellcheck, which has no ash dialect): + AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with /bin/dash): + #!/bin/dash + +Execute(The dash dialect should be used for the shell and the base function): + AssertEqual 'dash', ale#handlers#sh#GetShellType(bufnr('')) + AssertEqual 'dash', ale_linters#sh#shell#GetExecutable(bufnr('')) + +Execute(dash should be used for shellcheck): + AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a Bash shellcheck shell directive): + # shellcheck shell=bash + +Execute(bash dialect should be detected appropriately): + AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a sh shellcheck shell directive): + #shellcheck shell=sh + +Execute(sh dialect should be detected appropriately): + AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a tcsh shellcheck shell directive): + # shellcheck shell=tcsh + +Execute(tcsh dialect should be detected appropriately): + AssertEqual 'tcsh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a zsh shellcheck shell directive): + # shellcheck shell=zsh + +Execute(zsh dialect should be detected appropriately): + AssertEqual 'zsh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a csh shellcheck shell directive): + # shellcheck shell=csh + +Execute(zsh dialect should be detected appropriately): + AssertEqual 'csh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a ksh shellcheck shell directive): + # shellcheck shell=ksh + +Execute(ksh dialect should be detected appropriately): + AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a dash shellcheck shell directive): + # shellcheck shell=dash + +Execute(dash dialect should be detected appropriately): + AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) + +Given(A file with a ash shellcheck shell directive): + # shellcheck shell=ash + +Execute(dash dialect should be detected for ash that shellcheck does not support): + AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr('')) diff --git a/sources_non_forked/ale/test/test_should_do_nothing_conditions.vader b/sources_non_forked/ale/test/test_should_do_nothing_conditions.vader new file mode 100644 index 00000000..6dfed555 --- /dev/null +++ b/sources_non_forked/ale/test/test_should_do_nothing_conditions.vader @@ -0,0 +1,88 @@ +Before: + Save g:ale_filetype_blacklist + Save g:ale_maximum_file_size + Save g:ale_enabled + Save &l:statusline + + let b:fake_mode = 'n' + + call ale#test#SetDirectory('/testplugin/test') + + let b:funky_command_created = 0 + + runtime autoload/ale/util.vim + + function! ale#util#Mode(...) abort + return b:fake_mode + endfunction + + " We will test for the existence of this command, so create one if needed. + if !exists(':CtrlPFunky') + command CtrlPFunky echo + let b:funky_command_created = 1 + endif + +After: + Restore + + call ale#test#RestoreDirectory() + + if b:funky_command_created + delcommand CtrlPFunky + let b:funky_command_created = 0 + endif + + unlet! b:funky_command_created + unlet! b:fake_mode + + if &diff is 1 + let &diff = 0 + endif + + runtime autoload/ale/util.vim + +Given foobar(An empty file): +Execute(ALE shouldn't do much of anything for ctrlp-funky buffers): + Assert !ale#ShouldDoNothing(bufnr('')), 'The preliminary check failed' + + let &l:statusline = '%#CtrlPMode2# prt %*%#CtrlPMode1# line %* ={%#CtrlPMode1# funky %*}= <-> %=%<%#CtrlPMode2# %{getcwd()} %*' + + Assert ale#ShouldDoNothing(bufnr('')) + +Execute(ALE shouldn't try to check buffers with '.' as the filename): + AssertEqual + \ 0, + \ ale#ShouldDoNothing(bufnr('')), + \ 'ShouldDoNothing() was 1 for some other reason' + + silent! noautocmd file . + + Assert ale#ShouldDoNothing(bufnr('')) + +Execute(DoNothing should return 1 when the filetype is empty): + AssertEqual + \ 0, + \ ale#ShouldDoNothing(bufnr('')), + \ 'ShouldDoNothing() was 1 for some other reason' + + set filetype= + + AssertEqual 1, ale#ShouldDoNothing(bufnr('')) + +Execute(DoNothing should return 1 when an operator is pending): + let b:fake_mode = 'no' + + AssertEqual 1, ale#ShouldDoNothing(bufnr('')) + +Execute(DoNothing should return 1 for diff buffers): + let &diff = 1 + + AssertEqual 1, ale#ShouldDoNothing(bufnr('')) + +Execute(The DoNothing check should work if the ALE globals aren't defined): + unlet! g:ale_filetype_blacklist + unlet! g:ale_maximum_file_size + unlet! g:ale_enabled + + " This shouldn't throw exceptions. + call ale#ShouldDoNothing(bufnr('')) diff --git a/sources_non_forked/ale/test/test_sml_command.vader b/sources_non_forked/ale/test/test_sml_command.vader new file mode 100644 index 00000000..e89486c4 --- /dev/null +++ b/sources_non_forked/ale/test/test_sml_command.vader @@ -0,0 +1,45 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(smlnj finds CM file if it exists): + call ale#test#SetFilename('test-files/smlnj/cm/foo.sml') + + AssertEqual + \ ale#test#GetFilename('test-files/smlnj/cm/sources.cm'), + \ ale#handlers#sml#GetCmFile(bufnr('%')) + +Execute(smlnj finds CM file by searching upwards): + call ale#test#SetFilename('test-files/smlnj/cm/path/to/bar.sml') + + AssertEqual + \ ale#test#GetFilename('test-files/smlnj/cm/sources.cm'), + \ ale#handlers#sml#GetCmFile(bufnr('%')) + +Execute(smlnj returns '' when no CM file found): + call ale#test#SetFilename('test-files/smlnj/file/qux.sml') + + AssertEqual '', ale#handlers#sml#GetCmFile(bufnr('%')) + +Execute(CM-project mode enabled when CM file found): + call ale#test#SetFilename('test-files/smlnj/cm/foo.sml') + + AssertEqual 'sml', ale#handlers#sml#GetExecutableSmlnjCm(bufnr('%')) + +Execute(single-file mode disabled when CM file found): + call ale#test#SetFilename('test-files/smlnj/cm/foo.sml') + + AssertEqual '', ale#handlers#sml#GetExecutableSmlnjFile(bufnr('%')) + +Execute(CM-project mode disabled when CM file not found): + call ale#test#SetFilename('test-files/smlnj/file/qux.sml') + + AssertEqual '', ale#handlers#sml#GetExecutableSmlnjCm(bufnr('%')) + +Execute(single-file mode enabled when CM file found): + call ale#test#SetFilename('test-files/smlnj/file/qux.sml') + + AssertEqual 'sml', ale#handlers#sml#GetExecutableSmlnjFile(bufnr('%')) diff --git a/sources_non_forked/ale/test/test_socket_connections.vader b/sources_non_forked/ale/test/test_socket_connections.vader new file mode 100644 index 00000000..c59b942d --- /dev/null +++ b/sources_non_forked/ale/test/test_socket_connections.vader @@ -0,0 +1,139 @@ +Before: + let g:can_run_socket_tests = !has('win32') + \ && (exists('*ch_close') || exists('*chanclose')) + + if g:can_run_socket_tests + call ale#test#SetDirectory('/testplugin/test') + + let g:channel_id_received = 0 + let g:data_received = '' + + function! WaitForData(expected_data, timeout) abort + let l:ticks = 0 + + while l:ticks < a:timeout + " Sleep first, so we can switch to the callback. + let l:ticks += 10 + sleep 10ms + + if g:data_received is# a:expected_data + break + endif + endwhile + endfunction + + function! TestCallback(channel_id, data) abort + let g:channel_id_received = a:channel_id + let g:data_received .= a:data + endfunction + + let g:port = 10347 + let g:pid_tcp = str2nr(system( + \ 'python' + \ . ' ' . ale#Escape(g:dir . '/script/dumb_tcp_server.py') + \ . ' ' . g:port + \)) + let g:pipe_path = tempname() + let g:pid_pipe = str2nr(system( + \ 'python' + \ . ' ' . ale#Escape(g:dir . '/script/dumb_named_pipe_server.py') + \ . ' ' . g:pipe_path + \)) + endif + +After: + if g:can_run_socket_tests + call ale#test#RestoreDirectory() + + unlet! g:channel_id_received + unlet! g:data_received + unlet! g:channel_id + + delfunction WaitForData + delfunction TestCallback + + if has_key(g:, 'pid_tcp') + call system('kill ' . g:pid_tcp) + endif + + if has_key(g:, 'pid_pipe') + call system('kill ' . g:pid_pipe) + endif + + unlet! g:pid_tcp + unlet! g:port + unlet! g:pid_pipe + unlet! g:pipe_path + endif + + unlet! g:can_run_socket_tests + +Execute(Sending and receiving connections to tcp sockets should work): + if g:can_run_socket_tests + let g:channel_id = ale#socket#Open( + \ '127.0.0.1:' . g:port, + \ {'callback': function('TestCallback')} + \) + + Assert g:channel_id >= 0, 'The socket was not opened!' + + call ale#socket#Send(g:channel_id, 'hello') + call ale#socket#Send(g:channel_id, ' world') + + AssertEqual 1, ale#socket#IsOpen(g:channel_id) + + " Wait up to 1 second for the expected data to arrive. + call WaitForData('hello world', 1000) + + AssertEqual g:channel_id, g:channel_id_received + AssertEqual 'hello world', g:data_received + AssertEqual '127.0.0.1:' . g:port, ale#socket#GetAddress(g:channel_id) + + call ale#socket#Close(g:channel_id) + + AssertEqual 0, ale#socket#IsOpen(g:channel_id) + AssertEqual '', ale#socket#GetAddress(g:channel_id) + endif + + " NeoVim versions which can't connect to sockets should just fail. + if has('nvim') && !exists('*chanclose') + AssertEqual -1, ale#socket#Open( + \ '127.0.0.1:1111', + \ {'callback': function('function')} + \) + endif + +Execute(Sending and receiving connections to named pipe sockets should work): + if g:can_run_socket_tests && has('nvim-0.4') + let g:channel_id = ale#socket#Open( + \ g:pipe_path, + \ {'callback': function('TestCallback')} + \) + + Assert g:channel_id >= 0, 'The socket was not opened!' + + call ale#socket#Send(g:channel_id, 'hello') + call ale#socket#Send(g:channel_id, ' world') + + AssertEqual 1, ale#socket#IsOpen(g:channel_id) + + " Wait up to 1 second for the expected data to arrive. + call WaitForData('hello world', 1000) + + AssertEqual g:channel_id, g:channel_id_received + AssertEqual 'hello world', g:data_received + AssertEqual g:pipe_path, ale#socket#GetAddress(g:channel_id) + + call ale#socket#Close(g:channel_id) + + AssertEqual 0, ale#socket#IsOpen(g:channel_id) + AssertEqual '', ale#socket#GetAddress(g:channel_id) + endif + + " NeoVim versions which can't connect to sockets should just fail. + if has('nvim-0.4') && !exists('*chanclose') + AssertEqual -1, ale#socket#Open( + \ g:pipe_path, + \ {'callback': function('function')} + \) + endif diff --git a/sources_non_forked/ale/test/test_statusline.vader b/sources_non_forked/ale/test/test_statusline.vader new file mode 100644 index 00000000..f76cbfa9 --- /dev/null +++ b/sources_non_forked/ale/test/test_statusline.vader @@ -0,0 +1,157 @@ +Before: + Save g:ale_statusline_format + Save g:ale_buffer_info + + let g:ale_buffer_info = {} + + " A function for conveniently creating expected count objects. + function! Counts(data) abort + let l:res = { + \ '0': 0, + \ '1': 0, + \ 'error': 0, + \ 'warning': 0, + \ 'info': 0, + \ 'style_error': 0, + \ 'style_warning': 0, + \ 'total': 0, + \} + + for l:key in keys(a:data) + let l:res[l:key] = a:data[l:key] + endfor + + let l:res[0] = l:res.error + l:res.style_error + let l:res[1] = l:res.warning + l:res.style_warning + l:res.info + let l:res.total = l:res[0] + l:res[1] + + return l:res + endfunction + + " A test simplified loclist that will be used for some of the + " tests in this module. + let g:test_buffer_info = { + \ bufnr(''): { + \ 'loclist': [ + \ {'bufnr': bufnr('') - 1, 'type': 'E'}, + \ {'bufnr': bufnr('') - 1, 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') - 1, 'type': 'W'}, + \ {'bufnr': bufnr('') - 1, 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') - 1, 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'E'}, + \ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr('') + 1, 'type': 'E'}, + \ {'bufnr': bufnr('') + 1, 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') + 1, 'type': 'W'}, + \ {'bufnr': bufnr('') + 1, 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') + 1, 'type': 'I'}, + \ ], + \ }, + \} +After: + Restore + + delfunction Counts + unlet g:test_buffer_info + +Execute (Count should be 0 when data is empty): + AssertEqual Counts({}), ale#statusline#Count(bufnr('')) + +Execute (FirstProblem should be 0 when data is empty): + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'error') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'warning') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'style_error') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'style_warning') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'info') + +Execute (Count should read data from the cache): + let g:ale_buffer_info = {'44': {'count': Counts({'error': 1, 'warning': 2})}} + AssertEqual Counts({'error': 1, 'warning': 2}), ale#statusline#Count(44) + +Execute (FirstProblem should read data from the cache): + let g:ale_buffer_info = + \{"44": + \{'count': 0, + \'first_problems': + \{'error': {'lnum': 3}, + \'warning': {'lnum': 44}, + \'style_error': {'lnum': 22}, + \'style_warning': {'lnum': 223}, + \'info': {'lnum': 2} + \} + \} + \} + AssertEqual {'lnum': 3}, ale#statusline#FirstProblem(44, 'error') + AssertEqual {'lnum': 44}, ale#statusline#FirstProblem(44, 'warning') + AssertEqual {'lnum': 223}, ale#statusline#FirstProblem(44, 'style_warning') + AssertEqual {'lnum': 22}, ale#statusline#FirstProblem(44, 'style_error') + AssertEqual {'lnum': 2}, ale#statusline#FirstProblem(44, 'info') + +Execute (The count should be correct after an update): + let g:ale_buffer_info = {'44': {}} + call ale#statusline#Update(44, []) + AssertEqual Counts({}), ale#statusline#Count(44) + +Execute (FirstProblem should be correct after an update): + let g:ale_buffer_info = {'44': {}} + call ale#statusline#Update(44, []) + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'error') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'warning') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'style_error') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'style_warning') + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'info') + +Execute (Count should match the loclist): + let g:ale_buffer_info = g:test_buffer_info + AssertEqual { + \ 'error': 1, + \ 'style_error': 2, + \ 'warning': 3, + \ 'style_warning': 4, + \ 'info': 5, + \ '0': 3, + \ '1': 12, + \ 'total': 15, + \}, ale#statusline#Count(bufnr('')) + +Execute (FirstProblem should pull the first matching value from the loclist): + let g:ale_buffer_info = g:test_buffer_info + AssertEqual {'bufnr': bufnr(''), 'type': 'E'}, ale#statusline#FirstProblem(bufnr(''), 'error') + AssertEqual {'bufnr': bufnr(''), 'type': 'W'}, ale#statusline#FirstProblem(bufnr(''), 'warning') + AssertEqual {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'}, ale#statusline#FirstProblem(bufnr(''), 'style_error') + AssertEqual {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, ale#statusline#FirstProblem(bufnr(''), 'style_warning') + AssertEqual {'bufnr': bufnr(''), 'type': 'I'}, ale#statusline#FirstProblem(bufnr(''), 'info') + +Execute (Output should be empty for non-existent buffer): + let g:ale_buffer_info = g:test_buffer_info + AssertEqual Counts({}), ale#statusline#Count(9001) + AssertEqual {}, ale#statusline#FirstProblem(9001, 'error') + AssertEqual {}, ale#statusline#FirstProblem(9001, 'warning') + AssertEqual {}, ale#statusline#FirstProblem(9001, 'style_error') + AssertEqual {}, ale#statusline#FirstProblem(9001, 'style_warning') + AssertEqual {}, ale#statusline#FirstProblem(9001, 'info') + +Execute(ale#statusline#Update shouldn't blow up when globals are undefined): + unlet! g:ale_statusline_format + call ale#statusline#Update(1, []) + +Execute(ale#statusline#Count should return 0 counts when globals are undefined): + unlet! g:ale_statusline_format + AssertEqual Counts({}), ale#statusline#Count(1) + +Execute(FirstProblem should return an empty dict when globals are undefined): + unlet! g:ale_statusline_format + AssertEqual {}, ale#statusline#FirstProblem(bufnr(''), 'info') diff --git a/sources_non_forked/ale/test/test_swift_find_project_root.vader b/sources_non_forked/ale/test/test_swift_find_project_root.vader new file mode 100644 index 00000000..88a26021 --- /dev/null +++ b/sources_non_forked/ale/test/test_swift_find_project_root.vader @@ -0,0 +1,18 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#test#RestoreDirectory() + +Execute(Detect root of Swift project with Package.swift correctly): + call ale#test#SetFilename('test-files/swift/swift-package-project/src/folder/dummy.swift') + AssertEqual + \ ale#path#Simplify(g:dir . '/test-files/swift/swift-package-project'), + \ ale#swift#FindProjectRoot(bufnr('')) + +Execute(Detect no root in case of non-Package.swift project): + call ale#test#SetFilename('test-files/swift/non-swift-package-project/src/folder/dummy.swift') + AssertEqual + \ '', + \ ale#swift#FindProjectRoot(bufnr('')) + diff --git a/sources_non_forked/ale/test/test_symbol_search.vader b/sources_non_forked/ale/test/test_symbol_search.vader new file mode 100644 index 00000000..754826aa --- /dev/null +++ b/sources_non_forked/ale/test/test_symbol_search.vader @@ -0,0 +1,189 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + call ale#test#SetFilename('dummy.txt') + + let g:Callback = '' + let g:expr_list = [] + let g:message_list = [] + let g:preview_called = 0 + let g:item_list = [] + let g:options = {} + let g:capability_checked = '' + let g:conn_id = v:null + let g:InitCallback = v:null + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/preview.vim + + function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort + let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {}) + call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer) + let l:details = { + \ 'buffer': a:buffer, + \ 'connection_id': g:conn_id, + \ 'project_root': '/foo/bar', + \ 'language_id': 'python', + \} + + let g:InitCallback = {-> a:Callback(a:linter, l:details)} + endfunction + + function! ale#lsp#HasCapability(conn_id, capability) abort + let g:capability_checked = a:capability + + return 1 + endfunction + + function! ale#lsp#RegisterCallback(conn_id, callback) abort + let g:Callback = a:callback + endfunction + + function! ale#lsp#Send(conn_id, message) abort + call add(g:message_list, a:message) + + return 42 + endfunction + + function! ale#util#Execute(expr) abort + call add(g:expr_list, a:expr) + endfunction + + function! ale#preview#ShowSelection(item_list, options) abort + let g:preview_called = 1 + let g:item_list = a:item_list + let g:options = a:options + endfunction + +After: + call ale#test#RestoreDirectory() + call ale#linter#Reset() + + unlet! g:capability_checked + unlet! g:InitCallback + unlet! g:conn_id + unlet! g:Callback + unlet! g:message_list + unlet! g:expr_list + unlet! b:ale_linters + unlet! g:options + unlet! g:item_list + unlet! g:preview_called + + runtime autoload/ale/lsp_linter.vim + runtime autoload/ale/lsp.vim + runtime autoload/ale/util.vim + runtime autoload/ale/preview.vim + +Execute(Other messages for the LSP handler should be ignored): + call ale#symbol#HandleLSPResponse(1, {'command': 'foo'}) + +Execute(Failed symbol responses should be handled correctly): + call ale#symbol#SetMap({3: {}}) + call ale#symbol#HandleLSPResponse(1, {'id': 3}) + AssertEqual {}, ale#symbol#GetMap() + +Execute(LSP symbol responses should be handled): + call ale#symbol#SetMap({3: {}}) + call ale#symbol#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': [ + \ { + \ 'name': 'foo', + \ 'location': { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/completion_dummy_file')), + \ 'range': { + \ 'start': {'line': 2, 'character': 7}, + \ }, + \ }, + \ }, + \ { + \ 'name': 'foobar', + \ 'location': { + \ 'uri': ale#path#ToFileURI(ale#path#Simplify(g:dir . '/other_file')), + \ 'range': { + \ 'start': {'line': 7, 'character': 15}, + \ }, + \ }, + \ }, + \ ], + \ } + \) + + AssertEqual + \ [ + \ { + \ 'filename': ale#path#Simplify(g:dir . '/completion_dummy_file'), + \ 'line': 3, + \ 'column': 8, + \ 'match': 'foo', + \ }, + \ { + \ 'filename': ale#path#Simplify(g:dir . '/other_file'), + \ 'line': 8, + \ 'column': 16, + \ 'match': 'foobar', + \ }, + \ ], + \ g:item_list + AssertEqual {}, ale#symbol#GetMap() + +Execute(Preview windows should not be opened for empty LSP symbol responses): + call ale#symbol#SetMap({3: {}}) + call ale#symbol#HandleLSPResponse( + \ 1, + \ { + \ 'id': 3, + \ 'result': [ + \ ], + \ } + \) + + Assert !g:preview_called + AssertEqual {}, ale#symbol#GetMap() + AssertEqual ['echom ''No symbols found.'''], g:expr_list + +Given python(Some Python file): + foo + somelongerline + bazxyzxyzxyz + +Execute(LSP symbol requests should be sent): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALESymbolSearch foo bar + + " We shouldn't register the callback yet. + AssertEqual '''''', string(g:Callback) + + AssertEqual type(function('type')), type(g:InitCallback) + call g:InitCallback() + + AssertEqual 'symbol_search', g:capability_checked + AssertEqual + \ 'function(''ale#symbol#HandleLSPResponse'')', + \ string(g:Callback) + + AssertEqual + \ [ + \ [0, 'workspace/symbol', {'query': 'foo bar'}], + \ ], + \ g:message_list + + AssertEqual {'42': {'buffer': bufnr(''), 'use_relative_paths': 0}}, ale#symbol#GetMap() + +Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResponse): + runtime ale_linters/python/pylsp.vim + let b:ale_linters = ['pylsp'] + call setpos('.', [bufnr(''), 1, 5, 0]) + + ALESymbolSearch -relative foo bar + + call g:InitCallback() + + AssertEqual {'42': {'buffer': bufnr(''), 'use_relative_paths': 1}}, ale#symbol#GetMap() diff --git a/sources_non_forked/ale/test/test_temporary_file_management.vader b/sources_non_forked/ale/test/test_temporary_file_management.vader new file mode 100644 index 00000000..bb735886 --- /dev/null +++ b/sources_non_forked/ale/test/test_temporary_file_management.vader @@ -0,0 +1,146 @@ +Before: + Save g:ale_buffer_info + + let g:ale_buffer_info = {} + let g:ale_run_synchronously = 1 + + let g:command = 'echo test' + let g:filename = '' + let g:directory = '' + let g:preserved_directory = '' + + function! TestCommandCallback(buffer) abort + " We are registering a temporary file, so we should delete it. + let g:filename = tempname() + call writefile(['foo'], g:filename) + call ale#command#ManageFile(a:buffer, g:filename) + + " We are registering this directory appropriately, so we should delete + " the whole thing. + let g:directory = tempname() + call mkdir(g:directory) + call writefile(['foo'], g:directory . '/bar') + call ale#command#ManageDirectory(a:buffer, g:directory) + + " We are registering this directory as temporary file, so we + " shouldn't delete it. + let g:preserved_directory = tempname() + call mkdir(g:preserved_directory) + call writefile(['foo'], g:preserved_directory . '/bar') + call ale#command#ManageFile(a:buffer, g:preserved_directory) + + return g:command + endfunction + + function! TestCallback(buffer, output) abort + return [] + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'executable': has('win32') ? 'cmd' : 'echo', + \ 'callback': 'TestCallback', + \ 'command': function('TestCommandCallback'), + \}) + call ale#command#ClearData() + +After: + Restore + + if !empty(g:preserved_directory) + call delete(g:preserved_directory, 'rf') + endif + + unlet! g:ale_run_synchronously + unlet! g:command + unlet! g:filename + unlet! g:directory + unlet! g:preserved_directory + delfunction TestCommandCallback + delfunction TestCallback + call ale#linter#Reset() + call ale#command#ClearData() + +Given foobar (Some imaginary filetype): + foo + bar + baz + +Execute(ALE should delete managed files/directories appropriately after linting): + AssertEqual 'foobar', &filetype + + call ale#Queue(0) + call ale#test#FlushJobs() + + Assert !filereadable(g:filename), 'The temporary file was not deleted' + Assert !isdirectory(g:directory), 'The temporary directory was not deleted' + Assert isdirectory(g:preserved_directory), 'The temporary directory was not kept' + +Execute(ALE should delete managed files even if no command is run): + AssertEqual 'foobar', &filetype + + let g:command = '' + + call ale#Queue(0) + call ale#test#WaitForJobs(2000) + + Assert !filereadable(g:filename), 'The temporary file was not deleted' + Assert !isdirectory(g:directory), 'The temporary directory was not deleted' + Assert isdirectory(g:preserved_directory), 'The temporary directory was not kept' + +Execute(ALE should delete managed files when the buffer is removed): + call ale#engine#InitBufferInfo(bufnr('%')) + call TestCommandCallback(bufnr('%')) + call ale#engine#Cleanup(bufnr('%')) + + Assert !filereadable(g:filename), 'The temporary file was not deleted' + Assert !isdirectory(g:directory), 'The temporary directory was not deleted' + Assert isdirectory(g:preserved_directory), 'The tempoary directory was not kept' + +Execute(ALE should create and delete directories for ale#command#CreateDirectory()): + call ale#engine#InitBufferInfo(bufnr('%')) + + let b:dir = ale#command#CreateDirectory(bufnr('%')) + let b:dir2 = ale#command#CreateDirectory(bufnr('%')) + + Assert isdirectory(b:dir), 'The directory was not created' + + " We should get the correct file permissions. + " We want to ensure that the directory is not readable by 'other' + if has('unix') + AssertEqual 'rwxr-x---', getfperm(b:dir) + endif + + " The two directories shouldn't be the same. + AssertNotEqual b:dir2, b:dir + + call ale#engine#Cleanup(bufnr('%')) + + Assert !isdirectory(b:dir), 'The directory was not deleted' + Assert !isdirectory(b:dir2), 'The second directory was not deleted' + +Execute(ale#command#ManageFile should add the file even if the buffer info hasn't been set yet): + call ale#command#ManageFile(bufnr(''), '/foo/bar') + + AssertEqual + \ { + \ bufnr(''): { + \ 'jobs': {}, + \ 'file_list': ['/foo/bar'], + \ 'directory_list': [], + \ }, + \ }, + \ ale#command#GetData() + +Execute(ale#command#ManageDirectory should add the directory even if the buffer info hasn't been set yet): + call ale#command#ManageDirectory(bufnr(''), '/foo/bar') + + AssertEqual + \ { + \ bufnr(''): { + \ 'jobs': {}, + \ 'file_list': [], + \ 'directory_list': ['/foo/bar'], + \ }, + \ }, + \ ale#command#GetData() diff --git a/sources_non_forked/ale/test/test_tmpdir_wrapper.vader b/sources_non_forked/ale/test/test_tmpdir_wrapper.vader new file mode 100644 index 00000000..151b8943 --- /dev/null +++ b/sources_non_forked/ale/test/test_tmpdir_wrapper.vader @@ -0,0 +1,32 @@ +Before: + let g:exists = exists('$TMPDIR') + let g:old_value = $TMPDIR + +After: + if g:exists + let $TMPDIR = g:old_value + else + silent! unlet! $TMPDIR + endif + + unlet! g:exists + unlet! g:old_value + +Execute(ale#util#Tempname shouldn't set $TMPDIR to an empty string if it isn't set): + " You can't run this test twice on old Vim versions. + if has('unix') + Assert ale#util#Tempname() =~# '^/tmp' + Assert !exists('$TMPDIR'), '$TMPDIR exists where it shouldn''t' + endif + +Execute(ale#util#Tempname shouldn't replace $TMPDIR and reset them to an empty string.): + if has('unix') + let $TMPDIR = '' + Assert ale#util#Tempname() =~# '^/tmp' + + if !has('nvim') + Assert exists('$TMPDIR'), '$TMPDIR doesn''t exist where it should' + endif + + AssertEqual '', $TMPDIR + endif diff --git a/sources_non_forked/ale/test/test_vim8_processid_parsing.vader b/sources_non_forked/ale/test/test_vim8_processid_parsing.vader new file mode 100644 index 00000000..26416b15 --- /dev/null +++ b/sources_non_forked/ale/test/test_vim8_processid_parsing.vader @@ -0,0 +1,5 @@ +Execute(Vim8 Process ID parsing should work): + AssertEqual 123, ale#job#ParseVim8ProcessID('process 123 run') + AssertEqual 347, ale#job#ParseVim8ProcessID('process 347 failed') + AssertEqual 789, ale#job#ParseVim8ProcessID('process 789 dead') + AssertEqual 0, ale#job#ParseVim8ProcessID('no process') diff --git a/sources_non_forked/ale/test/test_windows_escaping.vader b/sources_non_forked/ale/test/test_windows_escaping.vader new file mode 100644 index 00000000..22cad888 --- /dev/null +++ b/sources_non_forked/ale/test/test_windows_escaping.vader @@ -0,0 +1,42 @@ +Before: + Save &shell + let &shell = 'cmd.exe' + +After: + Restore + +Execute(ale#Escape for cmd.exe should allow not escape paths without special characters): + AssertEqual 'C:', ale#Escape('C:') + AssertEqual 'C:\', ale#Escape('C:\') + AssertEqual 'python', ale#Escape('python') + AssertEqual 'C:\foo\bar', ale#Escape('C:\foo\bar') + AssertEqual '/bar/baz', ale#Escape('/bar/baz') + AssertEqual 'nul', ale#Escape('nul') + AssertEqual '''foo''', ale#Escape('''foo''') + +Execute(ale#Escape for cmd.exe should escape Windows paths with spaces appropriately): + AssertEqual '"C:\foo bar\baz"', ale#Escape('C:\foo bar\baz') + AssertEqual '"^foo bar^"', ale#Escape('^foo bar^') + AssertEqual '"&foo bar&"', ale#Escape('&foo bar&') + AssertEqual '"|foo bar|"', ale#Escape('|foo bar|') + AssertEqual '"foo bar>"', ale#Escape('>foo bar>') + AssertEqual '"^foo bar^"', ale#Escape('^foo bar^') + AssertEqual '"''foo'' ''bar''"', ale#Escape('''foo'' ''bar''') + +Execute(ale#Escape for cmd.exe should use caret escapes on special characters): + AssertEqual '^^foo^^', ale#Escape('^foo^') + AssertEqual '^&foo^&', ale#Escape('&foo&') + AssertEqual '^|foo^|', ale#Escape('|foo|') + AssertEqual '^foo^>', ale#Escape('>foo>') + AssertEqual '^^foo^^', ale#Escape('^foo^') + AssertEqual '''foo''^^''bar''', ale#Escape('''foo''^''bar''') + +Execute(ale#Escape for cmd.exe should escape percent characters): + AssertEqual '%%foo%%', ale#Escape('%foo%') + AssertEqual 'C:\foo%%\bar\baz%%', ale#Escape('C:\foo%\bar\baz%') + AssertEqual '"C:\foo bar%%\baz%%"', ale#Escape('C:\foo bar%\baz%') + AssertEqual '^^%%foo%%', ale#Escape('^%foo%') + AssertEqual '"^%%foo%% %%bar%%"', ale#Escape('^%foo% %bar%') + AssertEqual '"^%%foo%% %%bar%% """""', ale#Escape('^%foo% %bar% ""') diff --git a/sources_non_forked/ale/test/test_wrap_comand.vader b/sources_non_forked/ale/test/test_wrap_comand.vader new file mode 100644 index 00000000..7ddb06a1 --- /dev/null +++ b/sources_non_forked/ale/test/test_wrap_comand.vader @@ -0,0 +1,48 @@ +Before: + Save g:ale_command_wrapper + + let g:ale_command_wrapper = '' + + function! TestCommand(expected_part, input) abort + let l:expected = has('win32') + \ ? 'cmd /s/c "' . a:expected_part . '"' + \ : split(&shell) + split(&shellcmdflag) + [a:expected_part] + + AssertEqual l:expected, ale#job#PrepareCommand(bufnr(''), a:input) + endfunction + +After: + Restore + + unlet! b:ale_command_wrapper + + delfunction TestCommand + +Execute(The command wrapper should work with a nice command): + let b:ale_command_wrapper = 'nice -n 5' + + call TestCommand('nice -n 5 foo bar', 'foo bar') + +Execute(The command wrapper should work with a nice command with an explicit marker): + let b:ale_command_wrapper = 'nice -n 5 %*' + + call TestCommand('nice -n 5 foo bar', 'foo bar') + +Execute(Wrappers with spread arguments in the middle should be suppported): + let b:ale_command_wrapper = 'wrap %* --' + + call TestCommand('wrap foo bar --', 'foo bar') + +Execute(Wrappers with the command as one argument should be supported): + let b:ale_command_wrapper = 'wrap -c %@ -x' + + call TestCommand('wrap -c ' . ale#Escape('foo bar') . ' -x', 'foo bar') + +Execute(&& and ; should be moved to the front): + let b:ale_command_wrapper = 'wrap -c %@ -x' + + call TestCommand('foo && bar; wrap -c ' . ale#Escape('baz') . ' -x', 'foo && bar;baz') + + let b:ale_command_wrapper = 'nice -n 5' + + call TestCommand('foo && bar; nice -n 5 baz -z', 'foo && bar;baz -z') diff --git a/sources_non_forked/ale/test/test_writefile_function.vader b/sources_non_forked/ale/test/test_writefile_function.vader new file mode 100644 index 00000000..53a88331 --- /dev/null +++ b/sources_non_forked/ale/test/test_writefile_function.vader @@ -0,0 +1,117 @@ +Before: + call ale#test#SetDirectory('/testplugin/test') + + let g:new_line_test_file = tempname() + +After: + noautocmd :e! ++ff=unix + setlocal buftype=nofile + + if filereadable(g:new_line_test_file) + call delete(g:new_line_test_file) + endif + + unlet! g:new_line_test_file + + call ale#test#RestoreDirectory() + +Given(A file with Windows line ending characters): + first + second + third + +Execute(Carriage returns should be included for ale#util#Writefile): + call ale#test#SetFilename(g:new_line_test_file) + + setlocal buftype= + noautocmd :w + noautocmd :e! ++ff=dos + + call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file) + + AssertEqual + \ ["first\r", "second\r", "third\r", ''], + \ readfile(g:new_line_test_file, 'b') + +Given(A file with extra carriage returns): + first + second + third + fourth + +Execute(Carriage returns should be de-depulicated): + call ale#test#SetFilename(g:new_line_test_file) + + setlocal buftype= + noautocmd :w + noautocmd :e! ++ff=dos + + call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file) + + AssertEqual + \ ["first\r", "second\r", "third\r", "fourth\r", ''], + \ readfile(g:new_line_test_file, 'b') + +Given(A file with Unix line ending characters): + first + second + third + +Execute(Unix file lines should be written as normal): + call ale#test#SetFilename(g:new_line_test_file) + + setlocal buftype= + noautocmd :w + noautocmd :e! ++ff=unix + + call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file) + + AssertEqual + \ ['first', 'second', 'third', ''], + \ readfile(g:new_line_test_file, 'b') + +Execute(Newline at end of file should be preserved even when nofixeol): + call ale#test#SetFilename(g:new_line_test_file) + + setlocal buftype= + noautocmd :w + noautocmd :e! ++ff=unix + set eol + set nofixeol + + call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file) + + AssertEqual + \ ['first', 'second', 'third', ''], + \ readfile(g:new_line_test_file, 'b') + +Execute(Newline should not be appended on write when noeol and nofixeol): + call ale#test#SetFilename(g:new_line_test_file) + + setlocal buftype= + noautocmd :w + noautocmd :e! ++ff=unix + set noeol + set nofixeol + + call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file) + + AssertEqual + \ ['first', 'second', 'third'], + \ readfile(g:new_line_test_file, 'b') + +Execute(Newline should be appended on write when noeol and fixeol): + call ale#test#SetFilename(g:new_line_test_file) + + setlocal buftype= + noautocmd :w + noautocmd :e! ++ff=unix + set noeol + set fixeol + + call ale#util#Writefile(bufnr(''), getline(1, '$'), g:new_line_test_file) + + AssertEqual + \ ['first', 'second', 'third', ''], + \ readfile(g:new_line_test_file, 'b') + diff --git a/sources_non_forked/ale/test/util/test_cd_string_commands.vader b/sources_non_forked/ale/test/util/test_cd_string_commands.vader new file mode 100644 index 00000000..d854214a --- /dev/null +++ b/sources_non_forked/ale/test/util/test_cd_string_commands.vader @@ -0,0 +1,20 @@ +Before: + silent! cd /testplugin/test/util + let g:dir = getcwd() + +After: + silent execute 'cd ' . fnameescape(g:dir) + unlet! g:dir + +Execute(CdString should output the correct command string): + " We will check that escaping is done correctly for each platform. + AssertEqual + \ has('unix') ? 'cd ''/foo bar/baz'' && ' : 'cd /d "/foo bar/baz" && ', + \ ale#command#CdString('/foo bar/baz') + +Execute(CdString handle substitution and formatting): + call ale#test#SetFilename('foo.txt') + + AssertEqual + \ has('unix') ? 'cd %s:h && ' : 'cd /d %s:h && ', + \ ale#command#CdString('%s:h') diff --git a/sources_non_forked/ale/test/v_files/testfile.v b/sources_non_forked/ale/test/v_files/testfile.v new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/ale/test/vimrc b/sources_non_forked/ale/test/vimrc new file mode 100644 index 00000000..3f80c636 --- /dev/null +++ b/sources_non_forked/ale/test/vimrc @@ -0,0 +1,42 @@ +" vint: -ProhibitSetNoCompatible + +" Make most tests just set lists synchronously when run in Docker, etc. +let g:ale_set_lists_synchronously = 1 + +" This lowercase highlight definition is needed for highlight tests. +hi link aleerrorline spellbad + +" Load builtin plugins +" We need this because run_vim.sh sets -i NONE +if has('win32') + set runtimepath=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,C:\vader,C:\testplugin +else + set runtimepath=/home/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,/testplugin,/vader +endif + +" The following is just an example +filetype plugin indent on +syntax on + +if !has('win32') + set shell=/bin/sh + set shellcmdflag=-c +endif + +set nocompatible +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set backspace=2 +set nofoldenable +set foldmethod=syntax +set foldlevelstart=10 +set foldnestmax=10 +set ttimeoutlen=0 +" The encoding must be explicitly set for tests for Windows. +execute 'set encoding=utf-8' + +let g:mapleader=',' + +let g:ale_ignore_2_4_warnings = 1