aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/quickfix.txt
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-29 08:54:47 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-11-29 08:57:00 +0800
commit8d7d225caa12e5a25f6853a54a2fd6d144342d3c (patch)
treef456f05a86d76bcb97f3b276d743fab227ef8def /runtime/doc/quickfix.txt
parent146b8300a145efa64e579527da8606546a36162b (diff)
downloadrneovim-8d7d225caa12e5a25f6853a54a2fd6d144342d3c.tar.gz
rneovim-8d7d225caa12e5a25f6853a54a2fd6d144342d3c.tar.bz2
rneovim-8d7d225caa12e5a25f6853a54a2fd6d144342d3c.zip
vim-patch:65311c6: runtime(compiler): include spotbugs Java linter
closes: vim/vim#16001 https://github.com/vim/vim/commit/65311c6f472de67b368d83441ca5e93da86161f4 Co-authored-by: Konfekt <Konfekt@users.noreply.github.com> Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Diffstat (limited to 'runtime/doc/quickfix.txt')
-rw-r--r--runtime/doc/quickfix.txt112
1 files changed, 110 insertions, 2 deletions
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index b3399b2766..4811a51a87 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1317,9 +1317,117 @@ g:compiler_gcc_ignore_unmatched_lines
JAVAC *compiler-javac*
Commonly used compiler options can be added to 'makeprg' by setting the
-g:javac_makeprg_params variable. For example: >
+b/g:javac_makeprg_params variable. For example: >
+
let g:javac_makeprg_params = "-Xlint:all -encoding utf-8"
-<
+
+MAVEN *compiler-maven*
+
+Commonly used compiler options can be added to 'makeprg' by setting the
+b/g:maven_makeprg_params variable. For example: >
+
+ let g:maven_makeprg_params = "-DskipTests -U -X"
+
+SPOTBUGS *compiler-spotbugs*
+
+SpotBugs is a static analysis tool that can be used to find bugs in Java.
+It scans the Java bytecode of all classes in the currently open buffer.
+(Therefore, `:compiler! spotbugs` is not supported.)
+
+Commonly used compiler options can be added to 'makeprg' by setting the
+"b:" or "g:spotbugs_makeprg_params" variable. For example: >
+
+ let b:spotbugs_makeprg_params = "-longBugCodes -effort:max -low"
+
+The global default is "-workHard -experimental".
+
+By default, the class files are searched in the directory where the source
+files are placed. However, typical Java projects use distinct directories
+for source files and class files. To make both known to SpotBugs, assign
+their paths (distinct and relative to their common root directory) to the
+following properties (using the example of a common Maven project): >
+
+ let g:spotbugs_properties = {
+ \ 'sourceDirPath': 'src/main/java',
+ \ 'classDirPath': 'target/classes',
+ \ 'testSourceDirPath': 'src/test/java',
+ \ 'testClassDirPath': 'target/test-classes',
+ \ }
+
+Note that values for the path keys describe only for SpotBugs where to look
+for files; refer to the documentation for particular compiler plugins for more
+information.
+
+The default pre- and post-compiler actions are provided for Ant, Maven, and
+Javac compiler plugins and can be selected by assigning the name of a compiler
+plugin to the "compiler" key: >
+
+ let g:spotbugs_properties = {
+ \ 'compiler': 'maven',
+ \ }
+
+This single setting is essentially equivalent to all the settings below, with
+the exception made for the "PreCompilerAction" and "PreCompilerTestAction"
+values: their listed |Funcref|s will obtain no-op implementations whereas the
+implicit Funcrefs of the "compiler" key will obtain the requested defaults if
+available. >
+
+ let g:spotbugs_properties = {
+ \ 'PreCompilerAction':
+ \ function('spotbugs#DefaultPreCompilerAction'),
+ \ 'PreCompilerTestAction':
+ \ function('spotbugs#DefaultPreCompilerTestAction'),
+ \ 'PostCompilerAction':
+ \ function('spotbugs#DefaultPostCompilerAction'),
+ \ 'sourceDirPath': 'src/main/java',
+ \ 'classDirPath': 'target/classes',
+ \ 'testSourceDirPath': 'src/test/java',
+ \ 'testClassDirPath': 'target/test-classes',
+ \ }
+
+With default actions, the compiler of choice will attempt to rebuild the class
+files for the buffer (and possibly for the whole project) as soon as a Java
+syntax file is loaded; then, `spotbugs` will attempt to analyze the quality of
+the compilation unit of the buffer.
+
+When default actions are not suited to a desired workflow, consider writing
+arbitrary functions yourself and matching their |Funcref|s to the supported
+keys: "PreCompilerAction", "PreCompilerTestAction", and "PostCompilerAction".
+
+The next example re-implements the default pre-compiler actions for a Maven
+project and requests other default Maven settings with the "compiler" entry: >
+
+ function! MavenPreCompilerAction() abort
+ call spotbugs#DeleteClassFiles()
+ compiler maven
+ make compile
+ endfunction
+
+ function! MavenPreCompilerTestAction() abort
+ call spotbugs#DeleteClassFiles()
+ compiler maven
+ make test-compile
+ endfunction
+
+ let g:spotbugs_properties = {
+ \ 'compiler': 'maven',
+ \ 'PreCompilerAction':
+ \ function('MavenPreCompilerAction'),
+ \ 'PreCompilerTestAction':
+ \ function('MavenPreCompilerTestAction'),
+ \ }
+
+Note that all entered custom settings will take precedence over the matching
+default settings in "g:spotbugs_properties".
+
+The "g:spotbugs_properties" variable is consulted by the Java filetype plugin
+(|ft-java-plugin|) to arrange for the described automation, and, therefore, it
+must be defined before |FileType| events can take place for the buffers loaded
+with Java source files. It could, for example, be set in a project-local
+|vimrc| loaded by [0].
+
+[0] https://github.com/MarcWeber/vim-addon-local-vimrc/
+
GNU MAKE *compiler-make*
Since the default make program is "make", the compiler plugin for make,