Skip to content

Commit f2d87f0

Browse files
authored
Merge pull request #1884 from h-east/update-quickfix
Update quickfix.{txt,jax}
2 parents 9054565 + efd016c commit f2d87f0

File tree

2 files changed

+146
-39
lines changed

2 files changed

+146
-39
lines changed

doc/quickfix.jax

Lines changed: 73 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*quickfix.txt* For Vim バージョン 9.1. Last change: 2024 Nov 28
1+
*quickfix.txt* For Vim バージョン 9.1. Last change: 2024 Dec 16
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -1301,7 +1301,7 @@ SpotBugs は、Java のバグを見つけるために使用できる静的解析
13011301
て、`:compiler! spotbugs` はサポートされていない。)
13021302

13031303
よく使用されるコンパイラオプションは、"b:" または "g:spotbugs_makeprg_params"
1304-
変数を設定することで 'makeprg' に追加できる。例: >
1304+
変数を設定することで 'makeprg' に追加できる。例: >vim
13051305

13061306
let b:spotbugs_makeprg_params = "-longBugCodes -effort:max -low"
13071307

@@ -1311,30 +1311,33 @@ SpotBugs は、Java のバグを見つけるために使用できる静的解析
13111311
索される。ただし、一般的な Java プロジェクトでは、ソースファイルとクラスファイ
13121312
ルに別々のディレクトリを使用する。両方を SpotBugs に認識させるには、それらのパ
13131313
ス (共通のルートディレクトリに対して異なる相対パス) を次のプロパティに割り当て
1314-
る (一般的な Maven プロジェクトの例を使用): >
1314+
る (一般的な Maven プロジェクトの例を使用): >vim
13151315

13161316
let g:spotbugs_properties = {
1317-
\ 'sourceDirPath': 'src/main/java',
1318-
\ 'classDirPath': 'target/classes',
1319-
\ 'testSourceDirPath': 'src/test/java',
1320-
\ 'testClassDirPath': 'target/test-classes',
1317+
\ 'sourceDirPath': ['src/main/java'],
1318+
\ 'classDirPath': ['target/classes'],
1319+
\ 'testSourceDirPath': ['src/test/java'],
1320+
\ 'testClassDirPath': ['target/test-classes'],
13211321
\ }
13221322

1323+
Note ソースパスエントリとクラスパスエントリはペアで指定する必要があることに注
1324+
意。少なくとも 1 つを検討する場合は、"sourceDirPath" と "classDirPath" の両方
1325+
を定義し、"testSourceDirPath" と "testClassDirPath" に同じロジックを適用する。
13231326
Note パスのキー値は、SpotBugs がファイルを検索する場所のみを記述することに注
13241327
意。詳細については、特定のコンパイラプラグインのドキュメントを参照。
13251328

13261329
Ant、Maven、および Javac コンパイラプラグインには、デフォルトのプリコンパイラ
13271330
アクションとポストコンパイラアクションが用意されており、コンパイラプラグインの
1328-
名前を "compiler" キーに割り当てることで選択できる: >
1329-
1331+
名前 (`ant`, `maven`, `javac`) を "compiler" キーに割り当てることで選択できる:
1332+
>vim
13301333
let g:spotbugs_properties = {
13311334
\ 'compiler': 'maven',
13321335
\ }
13331336

13341337
この単一の設定は、基本的に以下のすべての設定と同等だが、"PreCompilerAction" お
13351338
よび "PreCompilerTestAction" の値は例外である。リストされている |Funcref|
13361339
no-op 実装を取得するが、"compiler" キーの暗黙的な Funcref は、使用可能な場合は
1337-
要求されたデフォルトを取得する。 >
1340+
要求されたデフォルトを取得する。 >vim
13381341

13391342
let g:spotbugs_properties = {
13401343
\ 'PreCompilerAction':
@@ -1343,35 +1346,53 @@ no-op 実装を取得するが、"compiler" キーの暗黙的な Funcref は、
13431346
\ function('spotbugs#DefaultPreCompilerTestAction'),
13441347
\ 'PostCompilerAction':
13451348
\ function('spotbugs#DefaultPostCompilerAction'),
1346-
\ 'sourceDirPath': 'src/main/java',
1347-
\ 'classDirPath': 'target/classes',
1348-
\ 'testSourceDirPath': 'src/test/java',
1349-
\ 'testClassDirPath': 'target/test-classes',
1349+
\ 'sourceDirPath': ['src/main/java'],
1350+
\ 'classDirPath': ['target/classes'],
1351+
\ 'testSourceDirPath': ['src/test/java'],
1352+
\ 'testClassDirPath': ['target/test-classes'],
13501353
\ }
13511354

13521355
デフォルトのアクションでは、選択されたコンパイラは Java 構文ファイルがロードさ
13531356
れるとすぐにバッファのクラスファイル (おそらくプロジェクト全体) を再構築しよう
13541357
とする。次に、`spotbugs` はバッファのコンパイルユニットの品質を分析しようとす
13551358
る。
13561359

1360+
Vim コマンドは 'makeprg' [0] に習熟していると、デフォルトアクションで構成でき
1361+
る。まず、サポートされているキー "DefaultPreCompilerCommand"、
1362+
"DefaultPreCompilerTestCommand"、または "DefaultPostCompilerCommand" のどれに
1363+
対して実装を記述する必要があるかを検討し、これらの各キーが特定の "*Action" キー
1364+
に対応していることを確認する。次に、常に文字列型の唯一のパラメーターを宣言し、
1365+
|:make| と同等のコマンドを使用する新しい関数を定義し、その |Funcref| を選択し
1366+
たキーに割り当てる。例:
1367+
>vim
1368+
function! GenericPostCompilerCommand(arguments) abort
1369+
execute 'make ' . a:arguments
1370+
endfunction
1371+
1372+
let g:spotbugs_properties = {
1373+
\ 'DefaultPostCompilerCommand':
1374+
\ function('GenericPostCompilerCommand'),
1375+
\ }
1376+
13571377
デフォルトのアクションが目的のワークフローに適していない場合は、任意の関数を自
1358-
分で作成し、その |Funcref| をサポートされているキー "PreCompilerAction"、
1359-
"PreCompilerTestAction"、および "PostCompilerAction" と一致させることを検討す
1360-
ること。
1378+
分で記述し、その Funcref をサポートされているキー "PreCompilerAction"、
1379+
"PreCompilerTestAction"、および "PostCompilerAction" に一致させて続行する。
13611380

13621381
次の例では、Maven プロジェクトのデフォルトのプリコンパイラアクションを再実装
1363-
し、"compiler" エントリを使用して他のデフォルトの Maven 設定を要求する: >
1382+
し、"compiler" エントリを使用して他のデフォルトの Maven 設定を要求する: >vim
13641383

13651384
function! MavenPreCompilerAction() abort
13661385
call spotbugs#DeleteClassFiles()
13671386
compiler maven
13681387
make compile
1388+
cc
13691389
endfunction
13701390

13711391
function! MavenPreCompilerTestAction() abort
13721392
call spotbugs#DeleteClassFiles()
13731393
compiler maven
13741394
make test-compile
1395+
cc
13751396
endfunction
13761397

13771398
let g:spotbugs_properties = {
@@ -1384,14 +1405,46 @@ no-op 実装を取得するが、"compiler" キーの暗黙的な Funcref は、
13841405

13851406
Note 入力されたすべてのカスタム設定は、"g:spotbugs_properties" 内の一致するデ
13861407
フォルト設定よりも優先されることに注意。
1408+
Note さらに作業を進める前に、プリコンパイラアクションの結果をプラグインに通知
1409+
する必要があることに注意。アクションの最後のコマンドとして、|:make| の後に
1410+
|:cc| (または |:lmake| の後に |:ll|) を使用することがこのような通信のサポート
1411+
されている手段である。
1412+
1413+
バッファローカル自動コマンドのアクションを切り替えるために、
1414+
"SpotBugsRemoveBufferAutocmd" と "SpotBugsDefineBufferAutocmd" という 2 つのコ
1415+
マンドが用意されてる。例えば、|BufWritePost| および |SigUSR1| イベントでもアク
1416+
ションを実行するには、次の行を `~/.vim/after/ftplugin/java.vim` に追加する:
1417+
>vim
1418+
if exists(':SpotBugsDefineBufferAutocmd') == 2
1419+
SpotBugsDefineBufferAutocmd BufWritePost SigUSR1
1420+
endif
1421+
1422+
それ以外の場合は、いつでも `:doautocmd java_spotbugs User` にアクセスできる。
13871423

13881424
"g:spotbugs_properties" 変数は、Java ファイルタイププラグイン
13891425
(|ft-java-plugin|) によって参照され、説明されている自動化を調整する。したがっ
13901426
て、Java ソースファイルがロードされたバッファに対して |FileType| イベントが発
1391-
生する前に定義する必要がある。例えば、[0] によってロードされるプロジェクトロー
1427+
生する前に定義する必要がある。例えば、[1] によってロードされるプロジェクトロー
13921428
カルの |vimrc| で設定できる。
13931429

1394-
[0] https://github.com/MarcWeber/vim-addon-local-vimrc/
1430+
"g:spotbugs_properties" と "b:spotbugs_properties" は両方とも認識され、変更可
1431+
能である必要がある (|:unlockvar|)。"*Command" エントリは常に、すべての Java
1432+
バッファ間で共有されるグローバル関数として扱われる。
1433+
1434+
SpotBugs Java ライブラリと、その拡張として配布されたシェルスクリプトは
1435+
`-textui` モードでは、空白文字を含むディレクトリファイル名を持つパス名をサポー
1436+
トしていない [2]。この制限を回避するには、名前に空白文字を含まないディレクトリ
1437+
からそのようなディレクトリへのシンボリックリンクを作成し、この情報を SpotBugs
1438+
に渡すことを検討する: >vim
1439+
1440+
let g:spotbugs_alternative_path = {
1441+
\ 'fromPath': 'path/to/dir_without_blanks',
1442+
\ 'toPath': 'path/to/dir with blanks',
1443+
\ }
1444+
1445+
[0] https://github.com/Konfekt/vim-compilers
1446+
[1] https://github.com/MarcWeber/vim-addon-local-vimrc
1447+
[2] https://github.com/spotbugs/spotbugs/issues/909
13951448

13961449
GNU MAKE *compiler-make*
13971450

en/quickfix.txt

Lines changed: 73 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*quickfix.txt* For Vim version 9.1. Last change: 2024 Nov 28
1+
*quickfix.txt* For Vim version 9.1. Last change: 2024 Dec 16
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1349,7 +1349,7 @@ It scans the Java bytecode of all classes in the currently open buffer.
13491349
(Therefore, `:compiler! spotbugs` is not supported.)
13501350

13511351
Commonly used compiler options can be added to 'makeprg' by setting the
1352-
"b:" or "g:spotbugs_makeprg_params" variable. For example: >
1352+
"b:" or "g:spotbugs_makeprg_params" variable. For example: >vim
13531353

13541354
let b:spotbugs_makeprg_params = "-longBugCodes -effort:max -low"
13551355

@@ -1359,22 +1359,25 @@ By default, the class files are searched in the directory where the source
13591359
files are placed. However, typical Java projects use distinct directories
13601360
for source files and class files. To make both known to SpotBugs, assign
13611361
their paths (distinct and relative to their common root directory) to the
1362-
following properties (using the example of a common Maven project): >
1362+
following properties (using the example of a common Maven project): >vim
13631363

13641364
let g:spotbugs_properties = {
1365-
\ 'sourceDirPath': 'src/main/java',
1366-
\ 'classDirPath': 'target/classes',
1367-
\ 'testSourceDirPath': 'src/test/java',
1368-
\ 'testClassDirPath': 'target/test-classes',
1365+
\ 'sourceDirPath': ['src/main/java'],
1366+
\ 'classDirPath': ['target/classes'],
1367+
\ 'testSourceDirPath': ['src/test/java'],
1368+
\ 'testClassDirPath': ['target/test-classes'],
13691369
\ }
13701370

1371+
Note that source and class path entries are expected to come in pairs: define
1372+
both "sourceDirPath" and "classDirPath" when you are considering at least one,
1373+
and apply the same logic to "testSourceDirPath" and "testClassDirPath".
13711374
Note that values for the path keys describe only for SpotBugs where to look
13721375
for files; refer to the documentation for particular compiler plugins for more
13731376
information.
13741377

13751378
The default pre- and post-compiler actions are provided for Ant, Maven, and
13761379
Javac compiler plugins and can be selected by assigning the name of a compiler
1377-
plugin to the "compiler" key: >
1380+
plugin (`ant`, `maven`, or `javac`) to the "compiler" key: >vim
13781381

13791382
let g:spotbugs_properties = {
13801383
\ 'compiler': 'maven',
@@ -1384,7 +1387,7 @@ This single setting is essentially equivalent to all the settings below, with
13841387
the exception made for the "PreCompilerAction" and "PreCompilerTestAction"
13851388
values: their listed |Funcref|s will obtain no-op implementations whereas the
13861389
implicit Funcrefs of the "compiler" key will obtain the requested defaults if
1387-
available. >
1390+
available. >vim
13881391

13891392
let g:spotbugs_properties = {
13901393
\ 'PreCompilerAction':
@@ -1393,34 +1396,53 @@ available. >
13931396
\ function('spotbugs#DefaultPreCompilerTestAction'),
13941397
\ 'PostCompilerAction':
13951398
\ function('spotbugs#DefaultPostCompilerAction'),
1396-
\ 'sourceDirPath': 'src/main/java',
1397-
\ 'classDirPath': 'target/classes',
1398-
\ 'testSourceDirPath': 'src/test/java',
1399-
\ 'testClassDirPath': 'target/test-classes',
1399+
\ 'sourceDirPath': ['src/main/java'],
1400+
\ 'classDirPath': ['target/classes'],
1401+
\ 'testSourceDirPath': ['src/test/java'],
1402+
\ 'testClassDirPath': ['target/test-classes'],
14001403
\ }
14011404

14021405
With default actions, the compiler of choice will attempt to rebuild the class
14031406
files for the buffer (and possibly for the whole project) as soon as a Java
14041407
syntax file is loaded; then, `spotbugs` will attempt to analyze the quality of
14051408
the compilation unit of the buffer.
14061409

1407-
When default actions are not suited to a desired workflow, consider writing
1408-
arbitrary functions yourself and matching their |Funcref|s to the supported
1410+
Vim commands proficient in 'makeprg' [0] can be composed with default actions.
1411+
Begin by considering which of the supported keys, "DefaultPreCompilerCommand",
1412+
"DefaultPreCompilerTestCommand", or "DefaultPostCompilerCommand", you need to
1413+
write an implementation for, observing that each of these keys corresponds to
1414+
a particular "*Action" key. Follow it by defining a new function that always
1415+
declares an only parameter of type string and puts to use a command equivalent
1416+
of |:make|, and assigning its |Funcref| to the selected key. For example:
1417+
>vim
1418+
function! GenericPostCompilerCommand(arguments) abort
1419+
execute 'make ' . a:arguments
1420+
endfunction
1421+
1422+
let g:spotbugs_properties = {
1423+
\ 'DefaultPostCompilerCommand':
1424+
\ function('GenericPostCompilerCommand'),
1425+
\ }
1426+
1427+
When default actions are not suited to a desired workflow, proceed by writing
1428+
arbitrary functions yourself and matching their Funcrefs to the supported
14091429
keys: "PreCompilerAction", "PreCompilerTestAction", and "PostCompilerAction".
14101430

14111431
The next example re-implements the default pre-compiler actions for a Maven
1412-
project and requests other default Maven settings with the "compiler" entry: >
1413-
1432+
project and requests other default Maven settings with the "compiler" entry:
1433+
>vim
14141434
function! MavenPreCompilerAction() abort
14151435
call spotbugs#DeleteClassFiles()
14161436
compiler maven
14171437
make compile
1438+
cc
14181439
endfunction
14191440

14201441
function! MavenPreCompilerTestAction() abort
14211442
call spotbugs#DeleteClassFiles()
14221443
compiler maven
14231444
make test-compile
1445+
cc
14241446
endfunction
14251447

14261448
let g:spotbugs_properties = {
@@ -1433,14 +1455,46 @@ project and requests other default Maven settings with the "compiler" entry: >
14331455

14341456
Note that all entered custom settings will take precedence over the matching
14351457
default settings in "g:spotbugs_properties".
1458+
Note that it is necessary to notify the plugin of the result of a pre-compiler
1459+
action before further work can be undertaken. Using |:cc| after |:make| (or
1460+
|:ll| after |:lmake|) as the last command of an action is the supported means
1461+
of such communication.
1462+
1463+
Two commands, "SpotBugsRemoveBufferAutocmd" and "SpotBugsDefineBufferAutocmd",
1464+
are provided to toggle actions for buffer-local autocommands. For example, to
1465+
also run actions on any |BufWritePost| and |SigUSR1| event, add these lines to
1466+
`~/.vim/after/ftplugin/java.vim`: >vim
1467+
1468+
if exists(':SpotBugsDefineBufferAutocmd') == 2
1469+
SpotBugsDefineBufferAutocmd BufWritePost SigUSR1
1470+
endif
1471+
1472+
Otherwise, you can turn to `:doautocmd java_spotbugs User` at any time.
14361473

14371474
The "g:spotbugs_properties" variable is consulted by the Java filetype plugin
14381475
(|ft-java-plugin|) to arrange for the described automation, and, therefore, it
14391476
must be defined before |FileType| events can take place for the buffers loaded
14401477
with Java source files. It could, for example, be set in a project-local
1441-
|vimrc| loaded by [0].
1478+
|vimrc| loaded by [1].
1479+
1480+
Both "g:spotbugs_properties" and "b:spotbugs_properties" are recognized and
1481+
must be modifiable (|:unlockvar|). The "*Command" entries are always treated
1482+
as global functions to be shared among all Java buffers.
1483+
1484+
The SpotBugs Java library and, by extension, its distributed shell scripts do
1485+
not support in the `-textui` mode listed pathnames with directory filenames
1486+
that contain blank characters [2]. To work around this limitation, consider
1487+
making a symbolic link to such a directory from a directory that does not have
1488+
blank characters in its name and passing this information to SpotBugs: >vim
1489+
1490+
let g:spotbugs_alternative_path = {
1491+
\ 'fromPath': 'path/to/dir_without_blanks',
1492+
\ 'toPath': 'path/to/dir with blanks',
1493+
\ }
14421494

1443-
[0] https://github.com/MarcWeber/vim-addon-local-vimrc/
1495+
[0] https://github.com/Konfekt/vim-compilers
1496+
[1] https://github.com/MarcWeber/vim-addon-local-vimrc
1497+
[2] https://github.com/spotbugs/spotbugs/issues/909
14441498

14451499
GNU MAKE *compiler-make*
14461500

0 commit comments

Comments
 (0)