Commit graph

68 commits

Author SHA1 Message Date
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
NiBo
65bfb07e43 fix(eclipselsp): org.eclipse.equinox.launcher_xxxx.jar file matching failed 2021-01-24 14:48:54 +08:00
fwy
0a2ad516d4 Fix regexp pattern to work correctly in nvim and vim on windows and linux 2020-11-26 15:29:23 -06:00
fenuks
7186b0437f Add maven helper file; use maven wrapper if available instead of global 'mvn' executable 2020-09-30 00:11:57 +02:00
NiBo
a4f70163eb fix(eclipselsp): Get jar file path failed
Error: Unable to access jarfile
2020-08-13 23:12:12 +08:00
w0rp
68b484a49f
Merge pull request #2914 from hsanson/2913-fix-checkstyle-config-with-options
Fix 2913 - checkstyle config file ignored.
2020-07-21 12:49:55 +01:00
w0rp
c1c3bd9227
Merge pull request #3137 from hsanson/3132-fix-eclipselsp-command
Fix eclipselsp command function.
2020-07-21 12:43:28 +01:00
NiBo
0b5d72fecd refactor(javac): ale_java_javac_sourcepath variable defaults to String 2020-05-19 11:25:54 +08:00
NiBo
e61e1147b0 refactor(javac): ale_java_javac_classpath variable supports String and List types 2020-05-19 10:43:16 +08:00
NiBo
ff6bfc3d37 refactor(javac): ale_java_javac_sourcepath variable supports String and List types 2020-05-19 10:41:35 +08:00
NiBo
3635285c02 style(javac): Code formatting 2020-05-15 11:21:00 +08:00
NiBo
3b4193175e feat(javac): Add java_javac_sourcepath variable
This variable can set multiple source code
paths, the source code path is a relative
path (relative to the project root directory)
2020-05-15 10:48:03 +08:00
Horacio Sanson
e641fe0c5d Fix eclipselsp command function.
Changes in eclipselsp and java caused the command needed to run the
language server fail to build properly.

Thi PR fixes those issues.
2020-04-25 15:21:09 +09:00
puritys
9edefa724b Fix code convention 2020-03-26 07:54:12 +00:00
puritys
fa19bca80e To support javaagent on eclipselsp 2020-03-26 06:40:07 +00:00
Horacio Sanson
8fbcba0091 Fix 2913 - checkstyle config file ignored.
If checkstyle is configured with custom options that contain "-c" then
the checkstyle config file option is ignored. This PR modifies the
regular expression when creating the checkstyle command to avoid this.
2019-11-27 23:19:44 +09:00
Horacio Sanson
40bf6e6b5c Add support for javalsp configuration options.
This MR adds a new configuration variable `g:ale_java_javalsp_config`
that allows to configure external dependencies and class paths to the
language server.

The variable accepts a dictionary similar to the one supported by the
[vscode/settings.json](https://github.com/georgewfraser/java-language-server#settings)
file.

Deprecates: #2561
2019-06-19 11:38:23 +09:00
Horacio Sanson
eb6a7b7516 Fix checkstyle default configuration.
Checkstyle xml configuration is mandatory and not providing one causes
the tool to fail with the following error:

    Must specify a config XML file.

Checkstyle itself contains a default configuration as part of its
assests named `/google_checks.xml`. Invoking checkstyle with this config
works even if such file does not exists in the file system:

    checkstyle -c /google_checks.xml

This should be the default invocation to allow ALE to use checkstyle
with zero configuration.

Also when a user sets `g:ale_java_checkstyle_config` option, ALE should
use it to invoke checkstyle even such file does not exists in the
filesystem. This is because checkstyle is able to use configuration files
within JAR files defined in the CLASSPATH. The default `/google_checks.xml`
is an example of such configuration available within a JAR resource.
2019-06-12 10:53:28 +09:00
Horacio Sanson
e84c9b300b Do not set default binary.
The default binary "launcher" is too generic and can get mixed with
other tools. To use this linter user must explicitly set the absolute
path of the launcher path.
2019-06-09 14:02:50 +09:00
Horacio Sanson
5ce97f8cdb Fix javalsp command callback.
The command used to invoke the language server is missing some options
to include additional java modules. Without these modules the server
was not working properly.

The correct command can be found in a `launcher` script on the same
directory the `java` executable for the language server is found.

This commit changes the docs to prefer the launcher script over the java
executable. For backward compatibility it also fixes the command
invocation in case the java executable is configured.
2019-06-05 00:50:23 +09:00
w0rp
eb6015c6fd
#2542 - Improve checkstyle project configuration 2019-06-03 23:40:22 +01:00
Andrew Lee
c6a5cbb3c7 Feature/add ant support (#2539)
Use ant files to load Java settings too.
2019-06-03 20:30:18 +01:00
Horacio Sanson
181bc69c8c Fix java checkstyle handler.
The checkstyle handler is capable of parsing the new and old output
formats. Unfortunately there are some particular output messages that
matched both the new and old regular expressions:

   [WARN] whatever:11:7: WhitespaceAround: ''if'' is not followed by whitespace. [WhitespaceAround]

This caused ALE to report extra errors since the message was being
matched twice, once as a warning and another (incorrect) old formatted
error.

This MR fixes this by stopping any parsing using the old format regexp
is any errors of the new format are correcly parsed. There is no reason
to expect checkstyle to output both styles in the same report.
2019-05-28 17:48:27 +09:00
Horacio Sanson
5a8ba75265 Fix eclipse.jdt.ls workspace data path.
We were setting the -data parameter to the project root but this caused
the language server to fail initialization and synch of gradle
dependencies. As consequence ALE failed to work fully on gradle
projects.

This fix sets the workspace to the parent folder of the project root.
Normally this corresponds to the correct Eclipse workspace path.

When this is not the case, this fix also allows users to explicitly set
the absolute path to the workspace via configuration variable.
2019-05-22 09:23:03 +09:00
Grim Kriegor
0427ee84b4 Allow running eclipselsp as installed by system package on GNU/Linux (#2523)
* Search eclipselsp jar and config files within system package path
* Allow setting an alternate eclipselsp configuration directory
* Add test for ale_java_eclipselsp_config_path
2019-05-21 21:13:06 +01:00
w0rp
a223253f35
Merge pull request #2134 from oaue/master
javac linter: fix handling of error messages containing ':' character
2019-05-08 09:50:12 +01:00
Horacio Sanson
53db52e713 Improve eclipselsp jar search logic.
- Set default value to $HOME/eclipse.jdt.ls
 - Make JAR search regexp more specific.
 - Allow to set the VSCode extensions folder as ale_java_eclipselsp_path.
2019-05-08 13:24:34 +09:00
Horacio Sanson
f02e2ec54c Fix 1996 - Add eclipse LSP support. 2019-04-11 08:50:04 +09:00
w0rp
3bebcb5d48
#2132 - Replace command_chain and chain_with with ale#command#Run 2019-04-07 14:58:06 +01:00
w0rp
6aef52f026
Merge pull request #2305 from campbellr/master
javac: Don't assume src/main/java always exists
2019-03-06 10:39:32 +00:00
Ryan Campbell
4fc27f099b
javac: Don't assume src/main/java always exists
Some projects I have only have src/test/java (no /src/main/java), which
seemed to break some incorrect assumptions the linter had.
2019-03-03 14:43:21 -07:00
w0rp
883978ece9
#2132 - Replace all uses of foo_callback with foo 2019-02-22 18:05:04 +00:00
Jan Ouwens
5ce1e9b0b4 Fixes javalsp linter 2019-02-07 11:20:18 +01:00
w0rp
cf14d0aa53
#2132 Unify temporary file management in command.vim 2019-01-26 19:33:52 +00:00
David LANDREAU
c7292ce892 javac linter: fix handling of error messages containing ':' character 2018-12-09 18:22:50 +01:00
Horacio Sanson
3346b200bf Fix javalsp command.
The command used to invoke the LSP process was being escaped wrong.

Also added a new option to set a different java executable and fixed the
documentation.
2018-12-05 21:53:39 +09:00
Johannes Wienke
8e24a1a916 Let checkstyle only lint original files
Temporary files break checks like the one for a missing
package-info.java, as discussed in #1305.
2018-11-07 13:26:54 +01:00
Johannes Wienke
5d6b4ef73f Support older checkstyle versions
The output format used by older checkstyle versions differs from the one
of new versions. This commit adds a second parsing iteration on the
output lines with a suitable pattern to support both versions in
parallel. Due to the differences in the order of matching groups this is
hard to achieve in a single pass through the output lines.

An appropriate test case is added.
2018-11-07 13:25:48 +01:00
Diego Lemos
607750eb02 Fix PMD not working with classes without package
PMD is currently not working properly for Java classes that use [unnamed
packages](https://docs.oracle.com/javase/specs/jls/se11/html/jls-7.html#jls-7.4.2).

Consider the following Java class that does not contain a `package`
declaration:

```java
public class App {
  String getGreeting() {
    return "Hello world.";
  }

  static void main(String... args) {
    System.out.println(new App().getGreeting());
  }
}
```

Running PMD in the command line agaist the Java class above produces an
output with empty string `""` in the `"Package"` column:

```sh
$ pmd -R category/java/bestpractices.xml -f csv -d './src/main/java/App.java'
Oct 02, 2018 9:10:39 PM net.sourceforge.pmd.PMD processFiles
WARNING: This analysis could be faster, please consider using Incremental Analysis: https://pmd.github.io/pmd-6.7.0/pmd_userdocs_incremental_analysis.html
"Problem","Package","File","Priority","Line","Description","Rule set","Rule"
"1","","/Users/diego/Projects/github.com/dlresende/kata-fizz-buzz/src/main/java/App.java","2","7","System.out.println is used","Best Practices","SystemPrintln"
```

But the pmd.vim handler's current pattern refuses everything coming
from a Java class that does not have a package name (2nd column):
```vim
let l:pattern = '"\(\d\+\)",".\+","\(.\+\)","\(\d\+\)","\(\d\+\)","\(.\+\)","\(.\+\)","\(.\+\)"$'
```

The solution I am proposing is to also accept empty strings as package names.
2018-10-02 21:34:11 +01:00
w0rp
d476578a40
Improve ALE project style checking
* The project style linter now runs while you type.
* Now the scripts for checking the project require blank lines.
* Many style issues have been found and fixed.
2018-09-04 16:51:18 +01:00
Horacio Sanson
261c29c3d0 Add vader test and fix command callback. 2018-08-26 22:11:36 +09:00
Horacio Sanson
3afff5a24c Add vscode-java-language-server linter 2018-08-24 16:28:15 +09:00
w0rp
217284360d
Simplify the code for most linters and tests with closures 2018-08-02 23:44:12 +01:00
w0rp
a42999a639
Massively reduce the amount of code needed for linter tests 2018-07-15 18:28:28 +01:00
Johannes Wienke
49c4bfde14 Add support for the java PMD linter 2018-04-09 17:48:00 +02:00
w0rp
2f2dcb8444
Close #1476 - Make the javac executable configurable 2018-04-08 20:35:06 +01:00
w0rp
c9e203e620 Fix #859 Include test and jaxb Java source paths when available 2017-11-20 18:54:57 +00:00
w0rp
7455e2e97d #852 - Capture error codes for checkstyle 2017-11-18 18:29:12 +00:00
w0rp
34674e088d Fix #1061 - Handle the filenames returned by javac 2017-11-05 15:33:31 +00:00
Brayden Banks
d08d2dac79 Gradle support for javac
Based off of #745.
2017-08-29 15:39:23 -07:00