Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checkstyle regexp pattern to work correctly in NVim on Windows #3467

Merged
merged 1 commit into from
Dec 28, 2020

Conversation

fwy
Copy link

@fwy fwy commented Nov 26, 2020

This patch fixes a problem I found recently in Ale's support for the Java checkstyler linter. The problem is seen only when using checkstyle in Neovim on the Windows platform. It is not raised on Vim running on Windows, or in either Nvim or Vim running on Linux. (I don't have a Mac and did not test on that platform.)

Versions:
NVim 0.4.4
checkstyle 8.37 and 8.36.2
Windows 10

When using checkstyle to lint various Java classes in Ale, I found that no warning/errors were displayed or marked with signs when linting the files in NVim when running on Windows 10. The same files were linted correctly when displayed in Vim on Windows, and on both NVim and Vim on Linux. Also, the :ALEInfo output for all tests were the same, with the same expected warning messages included in the output list and no sign of problems in the checkstyle processing.

After debugging, I found that the regexp pattern used by Ale to match the checkstyle output failed to match any lines when run on NVim and Windows. Removing the final end-of-line anchor "$" from the pattern fixed the problem. With this change, the pattern matching worked in NVim and Vim running on both Windows and Linux. The changed pattern could be set conditionally based on has('Nvim) and has('win32) of course, but I did not find that necessary in my testing.

For reference, here are the Ale-related settings used in my .vimrc and init.vim files on both platforms, which did not require any changes for this issue.

" Ale linting
let g:checkstyle_jar_path = has("win32") ? 'C:/checkstyle/checkstyle-8.37-all.jar' :
'/usr/local/checkstyle/checkstyle-8.37-all.jar'
let g:ale_java_checkstyle_config = has("win32") ? 'C:/checkstyle/sun_checks.xml' :
'/usr/local/checkstyle/sun_checks.xml'
let g:ale_java_checkstyle_executable = 'java'
let g:ale_java_checkstyle_options = '-jar ' . g:checkstyle_jar_path
if has("win32")
" Command line too long on Windows with classpath included for javac
let g:ale_linters_ignore = {'java': ['javac']}
endif

@stale
Copy link

stale bot commented Dec 24, 2020

This pull request has been automatically marked as stale because it has not been updated recently. Make sure to write tests and document your changes. See :help ale-dev for information on writing tests.
If your pull request is good to merge, bother w0rp or another maintainer again, and get them to merge it.

@stale stale bot added the stale PRs a bot will close automatically label Dec 24, 2020
@fwy
Copy link
Author

fwy commented Dec 27, 2020

The stale bot marked this PR as stale, but it is a small bug fix that is still applicable and I think can be merged. Could one of the maintainers review and comment?

@stale stale bot removed the stale PRs a bot will close automatically label Dec 27, 2020
Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot test windows so I trust this PR author (@fwy) on this. I tested the change in Linux environment using NVim and seems to work fine.

@hsanson hsanson merged commit 7fca451 into dense-analysis:master Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants