Skip to content

[Feature][Doc] Improve the description of code inspection specification. #9449

@czeming

Description

@czeming

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

The code review CI contains restrictions on the order of automatic import packages. Developers who are not familiar with the configuration may turn off automatic import or ignore it.

org.apache.dolphinscheduler.spi.params.base.PluginParams

Adding the description of automatic import package sequence configuration is expected to improve the code audit CI pass rate or development efficiency.

To this page https://dolphinscheduler.apache.org/zh-cn/community/development/pull-request.html

It's the current configuration.

        <module name="ImportOrder">
            <property name="staticGroups" value="org.apache.dolphinscheduler,org.apache,java,javax,org,com"/>
            <property name="separatedStaticGroups" value="true"/>

            <property name="groups" value="org.apache.dolphinscheduler,org.apache,java,javax,org,com"/>
            <property name="ordered" value="true"/>
            <property name="separated" value="true"/>
            <property name="option" value="top"/>
            <property name="sortStaticImportsAlphabetically" value="true"/>
        </module>

After I imported checkstyle.xml, it looked like this.

It will lead like this. (org.apache.dolphinscheduler.spi.params.base.PluginParams when I used shortcut option+command+O)

I think this's what the configuration we hope.

Before now, I've tried make it work, but it didn't work on it. So I found the source.

https://github.com/jshiell/checkstyle-idea/blob/ac7a6b16c065848d0de9d1985e0f97fda38634c8/src/main/java/org/infernus/idea/checkstyle/importer/modules/ImportOrderImporter.java

        switch (staticImportPosition) {
            case TOP:
                // remove other instances of PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY from the table
                // iterate from the end so we can remove elements without having to modify the index afterwards
                for (int x = settings.IMPORT_LAYOUT_TABLE.getEntryCount() - 1; x >= 0; x--) {
                    if (settings.IMPORT_LAYOUT_TABLE.getEntryAt(x) == PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY) {
                        settings.IMPORT_LAYOUT_TABLE.removeEntryAt(x);
                    }
                }
                settings.IMPORT_LAYOUT_TABLE.insertEntryAt(PackageEntry.ALL_OTHER_STATIC_IMPORTS_ENTRY, 0);
                break;
            case BOTTOM:

At present, I think there are two possible ways to deal with it.

  1. make an issue for checkstyle-idea
  2. Modify checkstyle.xml or accept the status quo.

Look forward to other solutions.

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions