Skip to content

Commit ea2e121

Browse files
committed
[ISSUE #14815] build(style): align Checkstyle with Spotless and enable spotless:check in CI
- Change lineWrappingIndentation from 0 to 4 to match continuation_indentation=1 - Change arrayInitIndent from 8 to 4 to match continuation_indentation_for_array_initializer=1 - Remove all // @Formatter:off/on workarounds (no longer needed) - Re-format modules affected by continuation_indentation_for_array_initializer change - Add checkstyle:check and spotless:check to CI check step Signed-off-by: cxhello <caixiaohuichn@gmail.com>
1 parent 6271307 commit ea2e121

569 files changed

Lines changed: 5732 additions & 4488 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: "Print maven version"
3434
run: mvn -version
3535
- name: "Check with Maven"
36-
run: mvn -B clean compile apache-rat:check spotbugs:check -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
36+
run: mvn -B clean compile apache-rat:check checkstyle:check spotbugs:check spotless:check -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
3737
- name: "Build and Test with Maven"
3838
run: mvn -B '-Prelease-nacos,!dev' clean install -Drat.skip=true -Dspotbugs.skip=true -DtrimStackTrace=false -U -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
3939
- name: "Upload coverage to Codecov"

ai-registry-adaptor/src/main/java/com/alibaba/nacos/airegistry/controller/SkillsRegistryController.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,10 @@ public SkillsRegistryController(NacosSkillsRegistryService nacosSkillsRegistrySe
6767
* @return well-known index payload
6868
* @throws NacosException if query fails
6969
*/
70-
// @formatter:off
7170
@GetMapping(value = {
72-
WELL_KNOWN_AGENT_SKILLS + "/index.json",
73-
WELL_KNOWN_SKILLS + "/index.json"
71+
WELL_KNOWN_AGENT_SKILLS + "/index.json",
72+
WELL_KNOWN_SKILLS + "/index.json"
7473
}, produces = MediaType.APPLICATION_JSON_VALUE)
75-
// @formatter:on
7674
public WellKnownSkillsIndex getIndex(@PathVariable String namespaceId) throws NacosException {
7775
return nacosSkillsRegistryService.buildIndex(namespaceId);
7876
}
@@ -106,12 +104,10 @@ public SkillsSearchResponse search(@PathVariable String namespaceId, SkillsSearc
106104
* @return skill markdown when the skill is exportable, otherwise 404
107105
* @throws NacosException if query fails
108106
*/
109-
// @formatter:off
110107
@GetMapping(value = {
111-
WELL_KNOWN_AGENT_SKILLS + "/{skillName}/SKILL.md",
112-
WELL_KNOWN_SKILLS + "/{skillName}/SKILL.md"
108+
WELL_KNOWN_AGENT_SKILLS + "/{skillName}/SKILL.md",
109+
WELL_KNOWN_SKILLS + "/{skillName}/SKILL.md"
113110
}, produces = MediaType.TEXT_PLAIN_VALUE)
114-
// @formatter:on
115111
public ResponseEntity<String> getSkillMarkdown(@PathVariable String namespaceId,
116112
@PathVariable String skillName)
117113
throws NacosException {
@@ -135,12 +131,10 @@ public ResponseEntity<String> getSkillMarkdown(@PathVariable String namespaceId,
135131
* @return file content when the skill and file are exportable, otherwise 404
136132
* @throws NacosException if query fails
137133
*/
138-
// @formatter:off
139134
@GetMapping(value = {
140-
WELL_KNOWN_AGENT_SKILLS + "/{skillName}/**",
141-
WELL_KNOWN_SKILLS + "/{skillName}/**"
135+
WELL_KNOWN_AGENT_SKILLS + "/{skillName}/**",
136+
WELL_KNOWN_SKILLS + "/{skillName}/**"
142137
}, produces = MediaType.TEXT_PLAIN_VALUE)
143-
// @formatter:on
144138
public ResponseEntity<String> getSkillFile(@PathVariable String namespaceId,
145139
@PathVariable String skillName,
146140
HttpServletRequest request) throws NacosException {

ai/src/main/java/com/alibaba/nacos/ai/service/repository/AiResourcePersistServiceImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ public boolean updateMetaCas(String namespaceId, String name, String type,
156156
+ " WHERE namespace_id=? AND name=? AND type=? AND meta_version=?";
157157

158158
Object[] args = new Object[] {newValue.getStatus(), newValue.getDesc(),
159-
newValue.getBizTags(), newValue.getExt(),
160-
newValue.getVersionInfo(), normalizeNamespaceId(namespaceId), name, type,
161-
expectedMetaVersion};
159+
newValue.getBizTags(), newValue.getExt(),
160+
newValue.getVersionInfo(), normalizeNamespaceId(namespaceId), name, type,
161+
expectedMetaVersion};
162162
int rows = jt.update(sql, args);
163163
return rows == 1;
164164
}

ai/src/main/java/com/alibaba/nacos/ai/service/repository/EmbeddedAiResourcePersistServiceImpl.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ public long insert(AiResource resource) {
7676
"gmt_modified@NOW()"));
7777

7878
Object[] args = new Object[] {resource.getName(), resource.getType(), resource.getDesc(),
79-
resource.getStatus(),
80-
normalizeNamespaceId(resource.getNamespaceId()), resource.getBizTags(),
81-
resource.getExt(),
82-
resource.getFrom() == null ? "local" : resource.getFrom(),
83-
resource.getVersionInfo(),
84-
resource.getMetaVersion() == null ? 1L : resource.getMetaVersion(),
85-
resource.getScope() == null ? VisibilityConstants.SCOPE_PRIVATE
86-
: resource.getScope(),
87-
resource.getOwner() == null ? "" : resource.getOwner()};
79+
resource.getStatus(),
80+
normalizeNamespaceId(resource.getNamespaceId()), resource.getBizTags(),
81+
resource.getExt(),
82+
resource.getFrom() == null ? "local" : resource.getFrom(),
83+
resource.getVersionInfo(),
84+
resource.getMetaVersion() == null ? 1L : resource.getMetaVersion(),
85+
resource.getScope() == null ? VisibilityConstants.SCOPE_PRIVATE
86+
: resource.getScope(),
87+
resource.getOwner() == null ? "" : resource.getOwner()};
8888

8989
EmbeddedStorageContextHolder.addSqlContext(sql, args);
9090
Boolean success = databaseOperate.blockUpdate();
@@ -146,9 +146,9 @@ public boolean updateMetaCas(String namespaceId, String name, String type,
146146
+ " WHERE namespace_id=? AND name=? AND type=? AND meta_version=?";
147147

148148
Object[] args = new Object[] {newValue.getStatus(), newValue.getDesc(),
149-
newValue.getBizTags(), newValue.getExt(),
150-
newValue.getVersionInfo(), normalizeNamespaceId(namespaceId), name, type,
151-
expectedMetaVersion};
149+
newValue.getBizTags(), newValue.getExt(),
150+
newValue.getVersionInfo(), normalizeNamespaceId(namespaceId), name, type,
151+
expectedMetaVersion};
152152

153153
EmbeddedStorageContextHolder.addSqlContext(sql, args);
154154
Boolean success = databaseOperate.blockUpdate();

ai/src/main/java/com/alibaba/nacos/ai/service/repository/EmbeddedAiResourceVersionPersistServiceImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ public long insert(AiResourceVersion version) {
7676
"storage", "publish_pipeline_info", "gmt_create@NOW()", "gmt_modified@NOW()"));
7777

7878
Object[] args = new Object[] {version.getType(), version.getAuthor(), version.getName(),
79-
version.getDesc(),
80-
version.getStatus(), version.getVersion(),
81-
normalizeNamespaceId(version.getNamespaceId()),
82-
version.getStorage(), version.getPublishPipelineInfo()};
79+
version.getDesc(),
80+
version.getStatus(), version.getVersion(),
81+
normalizeNamespaceId(version.getNamespaceId()),
82+
version.getStorage(), version.getPublishPipelineInfo()};
8383

8484
EmbeddedStorageContextHolder.addSqlContext(sql, args);
8585
Boolean success = databaseOperate.blockUpdate();
@@ -256,7 +256,7 @@ public int updatePublishPipelineInfo(String namespaceId, String name, String typ
256256

257257
EmbeddedStorageContextHolder.addSqlContext(sql,
258258
new Object[] {publishPipelineInfo, normalizeNamespaceId(namespaceId), name, type,
259-
version});
259+
version});
260260
Boolean success = databaseOperate.blockUpdate();
261261
return (success != null && success) ? 1 : 0;
262262
}

ai/src/test/java/com/alibaba/nacos/ai/pipeline/PublishPipelineBackwardCompatibilityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void testSkillPluginOrderPreservedAfterAgentspecAddition() {
169169

170170
List<PipelineNodeConfig> nodes = new ArrayList<>();
171171
for (String id : new String[] {PLUGIN_SKILL_HIGH_ORDER_ID, PLUGIN_AGENTSPEC_ID,
172-
PLUGIN_SKILL_LOW_ORDER_ID}) {
172+
PLUGIN_SKILL_LOW_ORDER_ID}) {
173173
PipelineNodeConfig node = new PipelineNodeConfig();
174174
node.setPipelineId(id);
175175
node.setProperties(new Properties());

ai/src/test/java/com/alibaba/nacos/ai/pipeline/PublishPipelineExecutorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ private static List<CallbackTestInput> sampleCallbackTestInputs() {
445445
List<CallbackTestInput> list = new ArrayList<>();
446446
List<String> ids = Arrays.asList("x", "y", "z");
447447
for (PublishPipelineResourceType rt : new PublishPipelineResourceType[] {
448-
PublishPipelineResourceType.SKILL, PublishPipelineResourceType.PROMPT}) {
448+
PublishPipelineResourceType.SKILL, PublishPipelineResourceType.PROMPT}) {
449449
for (int failAt : new int[] {-1, 0, 1}) {
450450
list.add(new CallbackTestInput(ids, rt, failAt));
451451
}

ai/src/test/java/com/alibaba/nacos/ai/pipeline/PublishPipelineManagerRoutingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void setUp() {
7373
// Plugin C: supports both SKILL and AGENTSPEC
7474
builders.add(createBuilder(PLUGIN_C_ID, 3,
7575
new PublishPipelineResourceType[] {PublishPipelineResourceType.SKILL,
76-
PublishPipelineResourceType.AGENTSPEC}));
76+
PublishPipelineResourceType.AGENTSPEC}));
7777

7878
PipelineConfig config = new PipelineConfig();
7979
config.setEnabled(true);

ai/src/test/java/com/alibaba/nacos/ai/pipeline/PublishPipelineManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private static List<FilterTestInput> sampleFilterTestInputs() {
116116
new ServiceDescriptor("a", 1,
117117
new PublishPipelineResourceType[] {PublishPipelineResourceType.SKILL}),
118118
new ServiceDescriptor("b", 2, new PublishPipelineResourceType[] {
119-
PublishPipelineResourceType.SKILL, PublishPipelineResourceType.AGENTSPEC}));
119+
PublishPipelineResourceType.SKILL, PublishPipelineResourceType.AGENTSPEC}));
120120
list.add(
121121
new FilterTestInput(svc1, PublishPipelineResourceType.SKILL, Arrays.asList("a", "b")));
122122
list.add(new FilterTestInput(svc1, PublishPipelineResourceType.SKILL,

ai/src/test/java/com/alibaba/nacos/ai/pipeline/repository/PipelineExecutionRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private static List<PipelineExecution> samplePipelineExecutions() {
8787
long t = 1_700_000_000_000L;
8888
for (String resType : new String[] {"SKILL", "PROMPT", "CONFIG"}) {
8989
for (PipelineExecutionStatus status : new PipelineExecutionStatus[] {
90-
PipelineExecutionStatus.APPROVED, PipelineExecutionStatus.REJECTED}) {
90+
PipelineExecutionStatus.APPROVED, PipelineExecutionStatus.REJECTED}) {
9191
PipelineExecution execution = new PipelineExecution();
9292
execution.setExecutionId(UUID.randomUUID().toString());
9393
execution.setResourceType(resType);

0 commit comments

Comments
 (0)