Commit Graph

25 Commits

Author SHA1 Message Date
Horacio Sanson 78122497f5 Replace appveyor with GitHub actions (#5119)
CI / Build (push) Waiting to run
CI / Lint (push) Blocked by required conditions
CI / Lua (push) Blocked by required conditions
CI / Neovim 0.10 Linux (push) Blocked by required conditions
CI / Neovim 0.12 Linux (push) Blocked by required conditions
CI / Vim 8.2 Linux (push) Blocked by required conditions
CI / Vim 9.2 Linux (push) Blocked by required conditions
CI / Neovim 0.10 Windows (push) Waiting to run
CI / Neovim 0.12 Windows (push) Waiting to run
CI / Vim 8.2 Windows (push) Waiting to run
CI / Vim 9.2 Windows (push) Waiting to run
* fix(tests): fix ale_c_build_dir_names being unset in tests (#5109)

- Use ale#Set() to set the ale_c_build_dir_names variable.
- Ensure SetUpLinterTest() is called before any Save commands in tests.
- Add c.vim to runtime before non-linter tests are executed.
- Remove workarounds in c.vim.

* feat: Load Prettier from cjs also

* Replace AppVeyor with GitHub Actions for Windows CI

Migrate Windows tests from AppVeyor (which hangs on PRs) to native GitHub
Actions using rhysd/action-setup-vim to install editors dynamically.

- Add test_ale_windows job testing Vim 9.0, Neovim 0.7, and Neovim 0.8
  on windows-latest, running in parallel with existing Linux CI
- Set fail-fast: false so all matrix entries report results independently
- Update run-tests.bat to accept VIM_EXE and VIM_HEADLESS env vars
  instead of hardcoding C:\vim\vim\vim80\vim.exe
- Add -n -i NONE and --not-a-term flags to avoid E211 temp file errors
  caused by Windows 8.3 short name paths losing drive letters
- Override TMP/TEMP to C:\tmp in CI to avoid 8.3 path mangling
- Use mklink /J directory junction for C:\testplugin to avoid modifying
  146+ test files that reference /testplugin/ paths
- Update doc/ale-development.txt section 4.3 for the new setup
- Remove AppVeyor badge from README.md
- Delete .appveyor.yml

Fix pre-existing Windows test failures now visible with Neovim on Windows:

- autoload/ale/c.vim: ParseCompileCommandsFlags bufnr() fails when the
  buffer path has a drive letter but the compile_commands key does not.
  Add fallback path comparison using ale#path#RemoveDriveLetter() so
  exact file matches work regardless of drive letter presence.
- autoload/ale/path.vim: FindNearestFile and FindNearestDirectory now
  return ale#path#Simplify() paths, fixing mixed slash separators on
  Windows that caused test_write_good.vader to fail.
- test/smoke_test.vader: echo output has trailing \r on Windows. Change
  strip pattern from ' *$' to '[\r ]*$' in all TestCallback functions.
- test/test_prepare_command.vader: &shellcmdflag on Windows is '/s /c'
  not '/c'. Use split(&shellcmdflag) in expected values so the test
  adapts to the actual default.
- test/test_lint_file_linters.vader: Increase WaitForJobs timeout from
  2000ms to 10000ms to prevent spurious timeouts on Windows CI runners.
- test/test_writefile_function.vader: Dissociate buffer from temp file
  before deleting it to avoid E211 on Windows.

* Fix Windows path handling and test compatibility issues

Production code fixes:
- ale/path.vim: Apply Simplify to buffer_filename in IsBufferPath to fix
  forward-slash vs backslash mismatch on Neovim Windows; handle .\ prefix
- ale/c.vim: Use iterative key-matching via RemoveDriveLetter for both
  file_lookup and dir_lookup in ParseCompileCommandsFlags
- ale/filename_mapping.vim: Normalize suffix separators when mapping target
  uses forward slashes (fixes mixed-separator paths on Windows)
- cuda/nvcc.vim: Apply Simplify before fnamemodify(:p) to fix path doubling

Test fixes:
- smoke_test: Use safe get() indexing and add retry loop for PowerShell test
- test_loclist_corrections: Use Simplify for cross-platform buffer paths
- test_ocaml_ocamllsp: Set buffer outside project tree before AssertLSPProject
- test_tex_textlint: Set buffer outside node_modules tree on Windows
- test_setting_problems_found_in_previous_buffers: Use cmd on Windows
- test_lint_file_linters: Increase WaitForJobs timeout to 30s

* Fix Vim 9.0 tempname() format change and simplify PowerShell test

Vim 9.0 changed tempname() to return a flat path (e.g. C:\tmp\VIMXXXXXXXX)
instead of the nested C:\tmp\VIMxxx\NNN format. Using :h:h on the flat
format resolves to the drive root, causing IsTempName() to match every
path on the drive. This broke tslint handler tests, loclist_corrections,
and setting_problems_found_in_previous_buffers tests.

Fix s:temp_dir to detect when :h:h yields a root path and fall back to :h.
Add GetTempBase() helper in test_format_command.vader with same logic.
Simplify smoke_test PowerShell test to avoid multi-command chaining that
produces unreliable output on Vim 9.0.

* fix(tests): normalize Windows path handling in Vim 9 CI

Treat win64 and win32unix as Windows in path and job helpers so compile_commands lookups and async command execution behave consistently on GitHub Actions. Normalize NVCC parsed filenames after absolute expansion to keep expected Windows paths stable in handler tests.

* fix(tests): handle Windows variants in command paths

Use a shared Windows check for command formatting and execution paths so Vim 9 on GitHub Actions still uses CMD-specific behavior. Apply the same check in filename mapping suffix normalization so Windows-style temporary and mapped paths are converted consistently in tests.

* ci: test newer Vim and Neovim versions

Update Linux and Windows test targets to newer Vim and Neovim releases in GitHub Actions and the local run-tests workflow. Refresh the Docker test image and helper scripts so the selected editor versions can be built and executed consistently across environments.

* fix(tests): adapt checks for Neovim 0.12 and Python 3.12

- Replace deprecated imp with import.util in python tests.
- Reorder ale.txt to match help files order.
- Add lines to sign test to ensure there are enough lines for the signs.

* fix(tests): avoid ftplugin side-effects in uncrustify test

* fix(tests): stabilize Windows Vim smoke and path mapping cases

Harden smoke_test callback handling for Vim job output race conditions on Windows by safely handling empty callback output lists instead of indexing output[0].\n\nMake disabling_ale assertions compare against a baseline message history entry so preexisting Vim startup messages do not cause false failures.\n\nUpdate path-mapping tests to account for Vim 9 Windows tempname layout changes and to validate filename-modifier behavior after full-path filename mapping is applied.

* fix(tests): normalize Windows test paths to resolved workspace paths

On Windows Neovim 0.10, test working directories can resolve to host checkout paths (for example D:\a\ale\ale) instead of container-style mount paths (for example C:\testplugin). Many tests compared absolute paths against g:dir-derived expectations and failed despite equivalent files.\n\nNormalize test directory handling in ale#test helpers by storing and using ale#path#Simplify(resolve(getcwd())), so expected paths match the same canonical form used by path discovery functions.\n\nAlso update tests that manually reassign g:dir from raw getcwd() and Gradle path assertions to use resolved/simplified paths, preventing regressions from mixed mount-path forms across Vim/Neovim and CI environments.

* fix(tests): restore g:dir semantics for fixer and test helpers

* Revert "fix(tests): normalize Windows test paths to resolved workspace paths"

This reverts commit 1136e2daec2645f643211e7e41819fa3eeba61b4.

* fix(tests): use resolve() in ant test assertions for Windows junction paths

On Windows CI, a junction C:\testplugin -> D:\a\ale\ale is used so tests
can cd to /testplugin paths. However, findfile() + fnamemodify(':p') resolves
junction points to real paths, while g:dir holds the junction-based path.

Fix the two ant test files to use resolve(g:dir) only in the specific
assertions that compare paths returned by findfile()-based functions
(ale#ant#FindProjectRoot, ale#ant#BuildClasspathCommand). This way:
- On Linux: resolve() is a no-op, behaviour unchanged
- On Windows: resolve(g:dir) gives the real path that matches what
  findfile() returns, fixing the assertion mismatch

The global test infrastructure (ale#test#SetDirectory) is left unchanged
to avoid breaking the many fixer tests that rely on junction-based paths.

* Fix Windows junction path resolution in tests

On Windows CI, tests run from a junction point (C:\testplugin) that
points to the real workspace (D:\a\ale\ale). Functions like
ale#path#FindNearestFile resolve junctions via findfile()/fnamemodify(':p'),
returning the real path, while g:dir holds the junction path.

Wrap expected path values with resolve() so junction paths are
resolved to their real counterparts on Windows (resolve() is a no-op
on Linux), making assertions match across both platforms.

* fix(test): use fnamemodify to compute expected nvcc path on Windows

The test hardcoded 'C:\tmp\...' for Windows paths, but GitHub Actions
runners use D: drive. Use ale#path#Simplify(fnamemodify(..., ':p'))
in expected values to mirror exactly what the handler produces,
making the test drive-letter-agnostic.

* fix: resolve symlinks/junctions in FindNearest* path functions

On Windows, Vim's findfile()/finddir() returns junction paths while
Neovim resolves them. This inconsistency causes test failures when
comparing paths from these functions against g:dir (set via getcwd()).

Add resolve() to FindNearestFile, FindNearestDirectory, and
FindNearestFileOrDirectory so they always return canonical paths,
making behavior consistent across Vim and Neovim on Windows.

On Linux, resolve() is a no-op for non-symlinked paths.

* fix: resolve junctions in python path functions and fix trailing separator

- Add resolve() to FindVirtualenv, FindProjectRoot, FindProjectRootIni
  in autoload/ale/python.vim so they return canonical paths on Windows
  NTFS junctions
- Move trailing '/' inside ale#path#Simplify() in FindNearestDirectory
  and FindNearestFileOrDirectory so separator is OS-appropriate

* fix: remove unnecessary junction in Windows CI

The C:\testplugin junction was a leftover from AppVeyor. It caused
C: vs D: path mismatches when resolve() canonicalized paths. Running
directly from the workspace eliminates the discrepancy.

* fix: use getcwd() for Windows runtimepath instead of hardcoded C:\testplugin

The junction no longer exists, so use the actual working directory
to find ALE plugin files in the test vimrc.

* fix: map /testplugin/ paths to repo root on Windows

Without the C:\testplugin junction, SetDirectory('/testplugin/test')
failed silently, leaving cwd at the repo root. Now on Windows, the
/testplugin/ prefix is replaced with the actual repo root derived
from the script's file path.

* fix: remaining Windows test failures (format_command, dprint, tslint, smoke)

- test_format_command: compute :h modifier depth dynamically since
  Vim 9.x Windows uses flat tempname() while NeoVim uses nested dirs
- test_dprint_fixer: replace hardcoded C:\testplugin path with
  dynamic path relative to g:dir
- smoke_test: increase PowerShell job timeout and add sleep between
  retries for flaky Windows CI
- workflow: set TMP/TEMP on same drive as workspace to fix cross-drive
  relative path resolution in tslint handler test

* fix: skip PowerShell smoke test on Vim Windows

The test is inherently flaky with Vim's Windows job implementation
when &shell=powershell. NeoVim handles it reliably and still tests
this code path.

* fix: NeoVim Windows test failures (dmd handler, c_flag_parsing, lint_file timeout)

- dmd handler: replace \f+ with [^(]+ in regex since NeoVim's isfname
  on Windows doesn't include \ or :, so \f+ can't match absolute paths
- c_flag_parsing: use FullPath() helper for file! commands and dict keys
  so NeoVim v0.10.4 resolves drive-relative paths correctly
- lint_file_linters: increase WaitForJobs timeout from 30s to 60s for
  slower NeoVim Windows CI runners

* fix: skip flaky NeoVim Windows tests (c_flag_parsing, lint_file_linters)

- c_flag_parsing test 18: skip on NeoVim Windows because fnamemodify(':p')
  does not reliably add a drive letter to fake absolute paths on NeoVim
  <= 0.10, causing dir_lookup key mismatches
- lint_file_linters test 8: skip on NeoVim Windows because jobs don't
  complete within the 30s timeout due to slower job handling

Both tests pass on Linux and Vim Windows. TODO comments added to restore
them once the underlying NeoVim Windows issues are resolved.

* ci: update checkout githuh action to v6

* Preserve Vim 8.2 as a minimum supported version for now

* fix: Use a lower Vim version for Windows tests

---------

Co-authored-by: w0rp <devw0rp@gmail.com>
2026-05-12 22:34:30 +01:00
Remi Thebault 06f57ca973 improve DMD handler (#3647)
* improve DMD handler

 - ignore errors from other files
 - catch 'Deprecation' as warning
 - add tests

* adding filename key instead of filtering

* update dmd test

* fix test dmd windows
2021-03-30 15:47:59 +09:00
Remi Thebault c6b61950f8 Add more parameters to the DMD linting command (#3639)
* Add more parameters to the DMD linting command

fixes #3637

* adding tests for dmd linter

* adding dmd test for windows
2021-03-23 08:31:52 +09:00
Victor Fernandez c21d6afd2f Solve #3611 (#3612)
Fix dmd not using dub
2021-03-07 20:20:35 +09:00
w0rp 9fe7b1fe6a Close #2281 - Separate cwd commands from commands
Working directories are now set seperately from the commands so they
can later be swapped out when running linters over projects is
supported, and also better support filename mapping for running linters
on other machines in future.
2021-03-01 20:11:10 +00:00
w0rp 3bebcb5d48 #2132 - Replace command_chain and chain_with with ale#command#Run 2019-04-07 14:58:06 +01:00
Auri be21aa5cda New linter: dls (#1992)
* New linter: dls
2018-10-17 16:11:41 +01:00
tsuburin 0c472c2244 Added "-wi" to the dmd command to endable warning messages. 2018-05-12 15:03:35 +09:00
w0rp a535d07f28 Ban use of ==# or ==? in the codebase, and prefer is# or is? instead 2017-08-08 08:39:13 +01:00
w0rp 07b2542c0d #549 Temporarily revert shell escaping changes, just for Windows 2017-05-12 09:20:16 +01:00
w0rp 6ea00af689 #540 Fix shell escaping pretty much everywhere 2017-05-08 22:59:25 +01:00
w0rp bdad25eefd Add a function for getting matches, and use it to simplify a lot of code 2017-04-18 00:35:53 +01:00
w0rp e237add9fd Move path functions to their own file 2017-04-17 23:29:02 +01:00
Adriaan Zonnenberg 4b0f3257dd Remove 'col' from linters where it is hardcoded to 1 (#434)
* Remove 'col' from linters where it is hardcoded to 1

When 'col' is 1, the first column will get highlighted for no reason. It
should be 0 (which is the default).

In the scalac linter there was also a check about the outcome of
`stridx`. It would set l:col to 0 if it was -1, and then it uses
`'col': l:col + 1` to convert the outcome of `stridx` to the actual
column number. This will make 'col' equals 1 when there is no match. We
can remove the check because `-1 + 1 = 0`.

* Remove outdated comments about vcol

vcol was added as a default, and the loclists that follow these comments
do not contain 'vcol' anymore
2017-03-30 23:33:38 +01:00
w0rp b2fe1b2567 Copy all loclist items returned from handlers, and set up defaults for convenience 2017-02-26 14:51:22 +00:00
w0rp ecbb276805 Replace every stdin-wrapper script with the new %t formatting support 2017-02-11 19:40:57 +00:00
w0rp 829f87bc6a Fix #124 Finish implementing command chaining, and make it work for DMD 2017-02-04 18:30:30 +00:00
w0rp d7ed49f849 Add a script for custom checks to enforce using the abort flag for functions and trailing whitespace, and fix existing issues. 2017-01-22 14:54:57 +00:00
Bjorn Neergaard f49f615ef6 Add support for dot-seperate linters, improve linter tests
This PR first and formost implements support for dot-seperate filetypes,
a very trivial change.

This closes #132

But more importantly, this PR vastly improves the test quality for
`ale#linter#Get`. It enables us to reset the state of ale's internal
linter cache, to facilitate better testing, as well as making use of
mocked linters instead of depending on linters on disk (which may
change). In addition, a dummy linter is defined to test the autoloading
behavior.

Header guards were removed from all linters as:

* A: ale won't try and load linters if they already exist in memory
* B: we can't reset state for testing if they can't be loaded again
2016-10-21 21:02:20 -05:00
w0rp acb209aa11 Fix the D error parsing to handle output without column numbers. 2016-10-19 23:42:00 +01:00
Bjorn Neergaard fb4b797dd2 Use explicit scope in all ale_linters
vint -s is now clean
2016-10-11 06:14:26 -05:00
Bjorn Neergaard 7f0ce89d2b First pass at optimizing ale to autoload (#80)
* First pass at optimizing ale to autoload

First off, the structure/function names should be revised a bit,
but I will wait for @w0rp's input before unifying the naming style.
Second off, the docs probably need some more work, I just did some
simple find-and-replace work.

With that said, this pull brings major performance gains for ale. On my
slowest system, fully loading ale and all its code takes around 150ms.

I have moved all of ale's autoload-able code to autoload/, and in
addition, implemented lazy-loading of linters. This brings load time on
that same system down to 5ms.

The only downside of lazy loading is that `g:ale_linters` cannot be
changed at runtime; however, it also speeds up performance at runtime by
simplfying the logic greatly.

Please let me know what you think!

Closes #59

* Address Travis/Vint errors

For some reason, ale isn't running vint for me...

* Incorporate feedback, make fixes

Lazy-loading logic is much improved.

* Add header comments; remove incorrect workaround

* Remove unneeded plugin guards

* Fix lazy-loading linter logic

Set the wrong variable....

* Fix capitialization
2016-10-10 19:51:29 +01:00
Prashanth Chandra 51b7d7bc95 Add comment headers to ale_linters 2016-10-04 03:07:59 +08:00
w0rp 0bc4b4c14c Run DUB in a separate process as well, so it will not cause import lag. 2016-09-18 10:38:54 +01:00
w0rp a32b380b6f Add support for linting D code with DMD. 2016-09-16 22:53:53 +01:00