[ 
https://issues.apache.org/jira/browse/MCHECKSTYLE-413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17537193#comment-17537193
 ] 

Björn Lindahl commented on MCHECKSTYLE-413:
-------------------------------------------

Ok, I'll try and run Checkstyle from command line to isolate it from the plugin 
and see. I entered the plugin version when creating the ticket (3.1.2). I use 
latest Checkstyle version (10.2) but the problem shows running earlier version 
of plugin and Checkstyle as well. I'll update when I've tried running 
Checkstyle separately and then try to reproduce it in a minimal project. Thanks 
for the feedback.

> Not grouping according to CustomImportOrder
> -------------------------------------------
>
>                 Key: MCHECKSTYLE-413
>                 URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-413
>             Project: Maven Checkstyle Plugin
>          Issue Type: Bug
>          Components: checkstyle:check
>    Affects Versions: 3.1.2
>         Environment: Windows 10
>            Reporter: Björn Lindahl
>            Priority: Major
>              Labels: import
>
> I'm experiencing issues with getting _CustomImportOrder_ working properly. I 
> have theese imports
> {quote}import se.pkg1.pkgA.pkgX.SomeClass1 // #1
> import se.pkg1.pkgA.pkgX.SomeClass2 // #2
>  
> import se.pkg1.pkgB.pkgNotX.SomeClassX // #3
> {quote}
>  
> My CustomImportOrder definition looks like this:
> {quote}<module name="CustomImportOrder">
>             <property name="severity" value="error"/>
>             <property name="customImportOrderRules"                      
> value="STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###SAME_PACKAGE(3)###STATIC"/>
>             <property name="standardPackageRegExp" 
> value="java|javax|jakarta"/>
>             <property name="thirdPartyPackageRegExp" value=" se.pkg1.pkgA"/>
>             <property name="specialImportsRegExp" value="se.pkg1"/>
>             <property name="sortImportsInGroupAlphabetically" value="true"/>
>             <property name="separateLineBetweenGroups" value="true"/>
>         </module> 
> {quote}
> My interpretation and also how the IntelliJ Checkstyle plugin order the 
> imports is that packages in _se.pkg1.pkgA_ falls within THIRD_PARTY_PACKAGE 
> and so #1 and #2 above is grouped together. 
>  
> #3 on the other hand falls within SPECIAL_IMPORTS and should be grouped 
> separate, below THIRD_PARTY_PACKAGE. The problem is though that if I import 
> checkstyle config in IntelliJ java imports it seem to work as expected but 
> when I run the 
> maven-checkstyle-plugin it think all three imports should belong to the same 
> group as this:
> {quote}import se.pkg1.pkgB.pkgNotX.SomeClassX // #3
> import se.pkg1.pkgA.pkgX.SomeClass1 // #1
> import se.pkg1.pkgA.pkgX.SomeClass2 // #2
> {quote}
> Shouldn't the plugin order the imports like in my first listing (#1,2, 3) in 
> the post?



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to