Repository navigation
feat: 设置页加入 Java 代码校验,并修一批可用性问题 - #2
Merged
Merged
Conversation
added 12 commits
November 18, 2026 17:04
Add a Java code check block to settings with Checkstyle, PMD and SpotBugs. Enabling a checker downloads its package from the matching GitHub release into plugin-data/lint, verifying the archive magic before an atomic rename, and the version chip can check for a newer release. Running the checks resolves the source directories of the registered services, executes each enabled checker and parses its text report into findings; the summary and the last run are exposed in the panel and through java_ops_lint action=run. Checkstyle also honours a report threshold, and enabling SpotBugs forces the build switch on because it needs compiled classes.
Add the Java code-check section to settings: enable a checker, pick a rule set (Google / Sun / Alibaba guide / external XML), watch the download and run the enabled checkers from the panel or java_ops_lint. - bundle the Alibaba-style Checkstyle rules, since the p3c repo ships PMD rules only - validate an external rule file (extension, existence, XML shape per tool) before saving and again before running - share one save path between the panel action and the tool verb - point the agent at the tools through a system-prompt section
Append the enabled checkers' findings to the edit result, so a violation is in front of the model before it plans the next change. - run the enabled checkers from a tools/post-execute listener on .java - append the report as an extra text block, keeping the original result - keep the system prompt honest: checkstyle is automatic, pmd/spotbugs are not
DSH answers approval prompts on its own when prompts are disabled, so the old confirm path ran high-risk statements without asking anyone. Queue the statement on the host and let the panel dialog decide instead; a timeout blocks the statement rather than reporting a user cancel. Also keep the stop spinner on its own service and stop the VM args textarea from resizing the dialog while it scrolls.
Both checkers reported zero findings without ever running: the archives were never unpacked, the PMD ruleset path did not exist, and SpotBugs could not load its classpath on Windows. Each layer turned a failure into an empty result, so the panel looked green. - unpack the downloaded archive with tar and remember the top directory - treat a tool as installed only when its bin directory exists - reuse an already downloaded archive instead of fetching it again - point PMD at rulesets/java/quickstart.xml - fail the run when PMD prints an [ERROR] line, since it exits with 0 - call the PMD and SpotBugs classes directly instead of their .bat wrappers - pass the SpotBugs aux classpath through -auxclasspathFromFile - run the PMD CPD subcommand and merge its duplications into the report - parse the real SpotBugs text output, including line ranges
javac writes its diagnostics in the console code page, so on a Chinese Windows build every line arrived as mojibake. - add the UTF-8 output flags to MAVEN_OPTS for the wrapper and PATH mvn - pass them to the bundled Maven launcher as JVM arguments
Scrolling inside the VM args box also scrolled the panel behind it, and the panel re-measured itself on every scroll event, so the centered dialog visibly moved up and down. - lock the wheel to the textarea that has focus - keep the overlay from scrolling its own content - skip the panel re-measure while a dialog is open - ignore the dialog textarea when looking for the composer
Clicking a suggestion in the class name dropdown did nothing, because the input's blur closed the list before the click landed. Picking a class also left the port and the module empty, and nothing verified that the class exists. - choose a suggestion on mousedown so the list survives the blur - fill the port, module and context path from the chosen application - verify the class exists in the project before saving - require a class name, a service name and a port - refuse a class that is already registered - let the dropdown overflow the dialog instead of being clipped
- 新增 src/client.js 与 scripts/build-client.mjs:esbuild 打包回 __ModuleLoader__ 形态,prepack 自动重建 - 引入 Radix Dialog / Tabs / Switch:弹窗有焦点陷阱和 Esc 关闭、页签用 aria-selected 驱动下划线、开关用 role="switch" - 建立设计 token 层(间距 4-24、圆角 4-999、控件统一 28px 高、细边框 + 极轻阴影),四个页签统一到同一套观感 - 服务空态改为居中的引导块;服务列表改卡片式选中;六个操作按钮改为淡底 + 同色描边 + 同色文字 - 停止中把「停止」就地换成「强制停止」,跳过 30 秒优雅等待 - SQL 与接口记录表固定列宽,SQL 单元格可点开「执行详情」弹窗看完整语句 - 日志工具栏新增「跟踪最新」开关:关掉后新日志不打扰当前滚动位置 - 修掉非激活 tabpanel 被类选择器盖掉 display:none、四个面板各占四分之一高度的排版问题 - 修掉英文表头 Time 与耗时列重名
- 检查一轮要 30 秒左右,同步请求会撞上浏览器 fetch 超时,面板点了没反应 - 运行改到后台:面板传 wait:false 立即返回,靠 1.5 秒轮询看结果;工具调用仍等结论 - viewState 暴露 lintRunning 与 lintError,面板据此显示「检查中…」和失败原因
- 构建参数去掉 -q:静默模式成功时一行都不打印,面板整个构建过程都是空日志 - 失败与成功的输出都进日志,配合已有的增量读取就能实时看到进度
- stopPipeline 增加 options.force:跳过 Ctrl+C 与 30 秒等待,直接终止 JVM - killPid 收到 force 时不再先试软 taskkill,接管遗留进程的路径同样生效 - java_ops_service_stop 新增 force 参数,工具描述同步说明 - 面板在「停止中」把停止按钮就地换成「强制停止」,避免只能干等
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
设置页新增「Java 代码校验」:Checkstyle / PMD / SpotBugs 三选,启用后自动下载规则包,跑完在设置页和工具返回里给出结果;顺带修了添加服务、构建输出、弹窗滚动的几个可用性问题。
包含的提交
d945199java_ops_lint与设置页校验卡片,跑启用的检查器并解析报告ed9509f8b02df832bd12d21d7a51aa8af7cf740cda24abeb9验证
node --check lib/index.js、node --check lib/client.js通过java_ops_lint {action:'run'}(工作区D:/project/ctiop-cruise):Checkstyle 1017 条 / 6.5s、PMD 895 条 / 6.5s、SpotBugs 97 条 / 17.1s,三者ok: truejava_ops_lint {action:'install'}对 pmd / spotbugs 复用已下载包,只解压注意
lib/lint/ali-checks.xml(官方 p3c 只提供 PMD 规则)