跳到正文
cccskills
免费在 GitHub 公开

fe-code-style

Diagnoses and fixes Java style violations in the FE module using Checkstyle, a tool that checks coding rules. It interprets errors, applies the project's formatting and import restrictions, and reruns checks to verify fixes.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Fix FE (Java) code style issues using Checkstyle

查看安装方法

适用场景

  • Checking FE Java changes before committing
  • Fixing build failures caused by Checkstyle violations
  • Understanding project-specific style and import rules
  • Aligning IntelliJ formatting with the project configuration

包含的文件(1)

  • SKILL.md3.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

What I do

Diagnose and fix Java code style issues in the FE module using the project's Checkstyle configuration.

When to use me

  • Before committing FE Java code changes
  • When FE build fails due to checkstyle violations
  • When you need to understand FE style rules

Procedure

Step 1: Run checkstyle

Checkstyle is integrated into the Maven build and runs automatically during mvn validate. To check style only (without full compilation):

cd fe && mvn checkstyle:check -pl fe-core

Or as part of the normal build:

./build.sh --fe -j${DORIS_PARALLELISM}

If checkstyle fails, the build will fail with error messages showing the file, line number, and rule violated.

Step 2: Interpret violations

Checkstyle output looks like:

[ERROR] src/main/java/.../Foo.java:[42:5] (imports) UnusedImports: Unused import - java.util.List.
[ERROR] src/main/java/.../Bar.java:[10] (header) RegexpHeader: Line does not match expected header line...

Each error shows: [file]:[line:col] (category) RuleName: description.

Step 3: Fix common violations

ViolationFix
RegexpHeaderAdd/fix Apache License header at file top
UnusedImportsRemove unused import statements
LineLength (>120 chars)Break long lines
IllegalImport (shaded classes)Use the non-shaded equivalent (see import-control.xml)
FileTabCharacterReplace tabs with spaces
NewlineAtEndOfFileEnsure file ends with a newline
MergeConflictMarkerResolve git merge conflicts

Step 4: Verify fix

After fixing, re-run checkstyle to confirm:

cd fe && mvn checkstyle:check -pl fe-core

Key Configuration

FilePurpose
fe/check/checkstyle/checkstyle.xmlMain rules (license header, line length 120, encoding, imports)
fe/check/checkstyle/suppressions.xmlRule exclusions (test files, nereids, large files)
fe/check/checkstyle/import-control.xmlImport restrictions (no shaded classes, no old logging APIs, no Lombok in nereids)
fe/check/checkstyle/checkstyle-apache-header.txtApache License 2.0 header template
build-support/IntelliJ-code-format.xmlIntelliJ formatter scheme (120 col, import organization)

Suppression Rules

Some files/packages have relaxed rules (see suppressions.xml):

  • Test files: Javadoc rules suppressed
  • Non-nereids code: Some strict rules suppressed
  • Specific large files: Individual suppressions

Excluded Code

The following are excluded from checkstyle (see fe/pom.xml):

  • **/apache/doris/thrift/**/* (generated Thrift code)
  • **/apache/parquet/**/* (generated Parquet code)

Import Restrictions (key rules from import-control.xml)

  • No shaded imports: Do not use org.apache.doris.thirdparty.* directly
  • No old logging: Do not use org.apache.commons.logging or java.util.logging
  • No SimpleDateFormat: Use java.time APIs instead
  • No Lombok in nereids: lombok is disallowed in org.apache.doris.nereids package

Troubleshooting

ProblemSolution
Build fails on validate phaseRun mvn checkstyle:check -pl fe-core to see specific violations
Can't find checkstyle configEnsure you're running from the fe/ directory
IntelliJ formatting differsImport build-support/IntelliJ-code-format.xml via Settings → Editor → Code Style

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Format C++ code in the BE and Cloud modules using the project's clang-format v16 rules. Use the provided scripts to fix formatting or check for violations without changing files, then review the resulting differences before committing.

中文简介正在准备中。当前显示英语简介。

  • Format BE or Cloud C++ code before committing
  • Fix formatting failures reported by CI
  • Check formatting without modifying files
apache/doris1.6万2026年10月18日 更新

Run clang-tidy static analysis, which checks code without executing it, on added or modified BE and Cloud C++ files. Focus diagnostics on changed lines, investigate bug, performance, and readability warnings, and verify fixes with another check.

中文简介正在准备中。当前显示英语简介。

  • Check changed C++ code before committing
  • Investigate clang-tidy warnings reported by CI
  • Review changes against a specific branch
apache/doris1.6万2026年10月18日 更新

Review Doris code changes using project-specific checklists for data correctness, concurrency, memory safety, compatibility, performance, and tests. Trace related code paths and explain findings with concrete failure scenarios, using query plan trees when reviewing optimizer behavior.

中文简介正在准备中。当前显示英语简介。

  • Review newly completed Doris code changes
  • Check concurrency and memory management in related code paths
  • Assess compatibility and test coverage before merging
apache/doris1.6万2026年10月18日 更新

Prepare a clean Doris package and run Docker regression tests, which check whether changes break existing behavior. Restore configuration and startup files from Git, build the test image, and investigate failures using configuration checks and runtime logs.

中文简介正在准备中。当前显示英语简介。

  • Run Docker regression tests before submitting Doris changes
  • Test without local configuration changes affecting results
  • Investigate missing test suites or startup failures
apache/doris1.6万2026年10月18日 更新

查看 apache 的全部技能

报告此技能的问题