[jira] [Comment Edited] (CASSANDRA-17925) Java source code should have sorted imports as defined in the codestyle

2022-11-30 Thread Josh McKenzie (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17641410#comment-17641410
 ] 

Josh McKenzie edited comment on CASSANDRA-17925 at 11/30/22 3:51 PM:
-

{quote}I am not sure if it is possible to just warn and not error out in 
practice
{quote}
Thinking configuring 
[severity|https://checkstyle.org/property_types.html#SeverityLevel] for the 
check.


was (Author: jmckenzie):
{quote}I am not sure if it is possible to just warn and not error out in 
practice
{quote}
Thinking configuring 
[severity|https://checkstyle.sourceforge.io/config.html#Severity] for the check.

> Java source code should have sorted imports as defined in the codestyle
> ---
>
> Key: CASSANDRA-17925
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17925
> Project: Cassandra
>  Issue Type: Improvement
>Reporter: Stefan Miklosovic
>Assignee: Maxim Muzafarov
>Priority: Normal
>
> After we cleaned all unused imports in CASSANDRA-17876, there is one more 
> task remaining to be done - to add checkstyle for imports order and enforce 
> this on build time.
> When the project is imported into IDEA, there is a helper target on Ant 
> called "generate-idea-files". ide/idea/codeStyleSettings.xml contains this:
> {code:java}
> 
>   
> 
> 
> 
>  static="false" />
>  static="false" />
>  static="false" />
>  static="false" />
> 
> 
> 
> 
> 
> 
>   
> 
> {code}
> This code style is also mentioned in the web page here (minus some details 
> which are present in above configuration snippet but not on the web page): 
> [https://cassandra.apache.org/_/development/code_style.html] (at the very 
> bottom).
> However, when one runs "Optimise imports" in the context menu after 
> right-clicking on org.cassandra.apache package, it will refactor the imports 
> and it results with hundreds of changes.
> This means that the source code, as-is, does not adhere to the self-imposed 
> code style we ship for IDEA.
> If we fix this, we should add checkstyle for it like this:
> {code:java}
> 
>value="/(^java\.|javax)/,/(com\.google\.common|org\.apache\.log4j|org\.apache\.commons|org\.cliffc\.high_scale_lib|org\.junit|org\.slf4j)/"/>
>   
>   
>   
>   
>   
> 
> {code}
> This checkstyle on import order will pass on the source code we run the 
> import optimization in the context menu on.
> There is also no enforcement on "all star" imports (org.some.pkg.*). 
> Checkstyle has specific module for this: 
> [https://checkstyle.org/config_imports.html#AvoidStarImport] 
> I propose we should stop to use all-star imports. Same argument holds as 
> described there: Rationale: Importing all classes from a package or static 
> members from a class leads to tight coupling between packages or classes and 
> might lead to problems when a new version of a library introduces name 
> clashes.
> This should be applied to test checktyle as well and the source code should 
> be refactored on imports too.
> This should be done on cassandra-4.1 as well as for trunk.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Comment Edited] (CASSANDRA-17925) Java source code should have sorted imports as defined in the codestyle

2022-11-15 Thread Michael Semb Wever (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17634302#comment-17634302
 ] 

Michael Semb Wever edited comment on CASSANDRA-17925 at 11/15/22 11:09 AM:
---

IDEA is not the only IDE used. For example it is also defined 
[here|https://github.com/apache/cassandra/blob/trunk/ide/nbproject/project.properties#L13].
 I don't know how Eclipse does it. The project IMHO should be IDE agnostic, 
using checkstyle and a common standard does that.  I can help out with updating 
the project.properties. 

So a big yes to a common standard. I'd also be in favour of only committing to 
trunk (despite the headache that it is going to cause for forward merging).



was (Author: michaelsembwever):
IDEA is not the only IDE used. For example it is also defined 
[here|https://github.com/apache/cassandra/blob/trunk/ide/nbproject/project.properties#L13].
 I don't know how Eclipse does it. The project IMHO should be IDE agnostic, 
using checkstyle and a common standard does that.  I can help out with updating 
the project.properties. 

Yes to a common standard, to only committing to trunk (despite the headache 
that it is going to cause for forward merging).


> Java source code should have sorted imports as defined in the codestyle
> ---
>
> Key: CASSANDRA-17925
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17925
> Project: Cassandra
>  Issue Type: Improvement
>Reporter: Stefan Miklosovic
>Priority: Normal
>
> After we cleaned all unused imports in CASSANDRA-17876, there is one more 
> task remaining to be done - to add checkstyle for imports order and enforce 
> this on build time.
> When the project is imported into IDEA, there is a helper target on Ant 
> called "generate-idea-files". ide/idea/codeStyleSettings.xml contains this:
> {code:java}
> 
>   
> 
> 
> 
>  static="false" />
>  static="false" />
>  static="false" />
>  static="false" />
> 
> 
> 
> 
> 
> 
>   
> 
> {code}
> This code style is also mentioned in the web page here (minus some details 
> which are present in above configuration snippet but not on the web page): 
> [https://cassandra.apache.org/_/development/code_style.html] (at the very 
> bottom).
> However, when one runs "Optimise imports" in the context menu after 
> right-clicking on org.cassandra.apache package, it will refactor the imports 
> and it results with hundreds of changes.
> This means that the source code, as-is, does not adhere to the self-imposed 
> code style we ship for IDEA.
> If we fix this, we should add checkstyle for it like this:
> {code:java}
> 
>value="/(^java\.|javax)/,/(com\.google\.common|org\.apache\.log4j|org\.apache\.commons|org\.cliffc\.high_scale_lib|org\.junit|org\.slf4j)/"/>
>   
>   
>   
>   
>   
> 
> {code}
> This checkstyle on import order will pass on the source code we run the 
> import optimization in the context menu on.
> There is also no enforcement on "all star" imports (org.some.pkg.*). 
> Checkstyle has specific module for this: 
> [https://checkstyle.org/config_imports.html#AvoidStarImport] 
> I propose we should stop to use all-star imports. Same argument holds as 
> described there: Rationale: Importing all classes from a package or static 
> members from a class leads to tight coupling between packages or classes and 
> might lead to problems when a new version of a library introduces name 
> clashes.
> This should be applied to test checktyle as well and the source code should 
> be refactored on imports too.
> This should be done on cassandra-4.1 as well as for trunk.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Comment Edited] (CASSANDRA-17925) Java source code should have sorted imports as defined in the codestyle

2022-11-15 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17634288#comment-17634288
 ] 

Stefan Miklosovic edited comment on CASSANDRA-17925 at 11/15/22 11:05 AM:
--

It is questionable where to land this patch, checkstyle is incorporated into 
4.1 and trunk, this will not be in 4.1.0 for sure and I do not think a patch 
release is a good place either. So trunk remains. I dont have a problem to put 
this into trunk as is right now, again, I would like to gather more feedback 
what people actually think about this and to time it properly.

cc [~mck]


was (Author: smiklosovic):
It is questionable where to land this patch, checkstyle is incorporated into 
4.1 and trunk, this will not be in 4.1.0 for sure and I do not think a patch 
release is a good place either. So trunk remains. Which I would say translates 
to 5.0. I dont have a problem to put this into trunk as is right now, again, I 
would like to gather more feedback what people actually think about this.

cc [~mck]

> Java source code should have sorted imports as defined in the codestyle
> ---
>
> Key: CASSANDRA-17925
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17925
> Project: Cassandra
>  Issue Type: Improvement
>Reporter: Stefan Miklosovic
>Priority: Normal
>
> After we cleaned all unused imports in CASSANDRA-17876, there is one more 
> task remaining to be done - to add checkstyle for imports order and enforce 
> this on build time.
> When the project is imported into IDEA, there is a helper target on Ant 
> called "generate-idea-files". ide/idea/codeStyleSettings.xml contains this:
> {code:java}
> 
>   
> 
> 
> 
>  static="false" />
>  static="false" />
>  static="false" />
>  static="false" />
> 
> 
> 
> 
> 
> 
>   
> 
> {code}
> This code style is also mentioned in the web page here (minus some details 
> which are present in above configuration snippet but not on the web page): 
> [https://cassandra.apache.org/_/development/code_style.html] (at the very 
> bottom).
> However, when one runs "Optimise imports" in the context menu after 
> right-clicking on org.cassandra.apache package, it will refactor the imports 
> and it results with hundreds of changes.
> This means that the source code, as-is, does not adhere to the self-imposed 
> code style we ship for IDEA.
> If we fix this, we should add checkstyle for it like this:
> {code:java}
> 
>value="/(^java\.|javax)/,/(com\.google\.common|org\.apache\.log4j|org\.apache\.commons|org\.cliffc\.high_scale_lib|org\.junit|org\.slf4j)/"/>
>   
>   
>   
>   
>   
> 
> {code}
> This checkstyle on import order will pass on the source code we run the 
> import optimization in the context menu on.
> There is also no enforcement on "all star" imports (org.some.pkg.*). 
> Checkstyle has specific module for this: 
> [https://checkstyle.org/config_imports.html#AvoidStarImport] 
> I propose we should stop to use all-star imports. Same argument holds as 
> described there: Rationale: Importing all classes from a package or static 
> members from a class leads to tight coupling between packages or classes and 
> might lead to problems when a new version of a library introduces name 
> clashes.
> This should be applied to test checktyle as well and the source code should 
> be refactored on imports too.
> This should be done on cassandra-4.1 as well as for trunk.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Comment Edited] (CASSANDRA-17925) Java source code should have sorted imports as defined in the codestyle

2022-11-15 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17634288#comment-17634288
 ] 

Stefan Miklosovic edited comment on CASSANDRA-17925 at 11/15/22 10:50 AM:
--

It is questionable where to land this patch, checkstyle is incorporated into 
4.1 and trunk, this will not be in 4.1.0 for sure and I do not think a patch 
release is a good place either. So trunk remains. Which I would say translates 
to 5.0. I dont have a problem to put this into trunk as is right now, again, I 
would like to gather more feedback what people actually think about this.

cc [~mck]


was (Author: smiklosovic):
It is questionable where to land this patch, checkstyle is incorporated into 
4.1 and trunk, this will not be in 4.1.0 for sure and I do not think a patch 
release is a good place either. So trunk remains. Which I would say translates 
to 5.0. 

cc [~mck]

> Java source code should have sorted imports as defined in the codestyle
> ---
>
> Key: CASSANDRA-17925
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17925
> Project: Cassandra
>  Issue Type: Improvement
>Reporter: Stefan Miklosovic
>Priority: Normal
>
> After we cleaned all unused imports in CASSANDRA-17876, there is one more 
> task remaining to be done - to add checkstyle for imports order and enforce 
> this on build time.
> When the project is imported into IDEA, there is a helper target on Ant 
> called "generate-idea-files". ide/idea/codeStyleSettings.xml contains this:
> {code:java}
> 
>   
> 
> 
> 
>  static="false" />
>  static="false" />
>  static="false" />
>  static="false" />
> 
> 
> 
> 
> 
> 
>   
> 
> {code}
> This code style is also mentioned in the web page here (minus some details 
> which are present in above configuration snippet but not on the web page): 
> [https://cassandra.apache.org/_/development/code_style.html] (at the very 
> bottom).
> However, when one runs "Optimise imports" in the context menu after 
> right-clicking on org.cassandra.apache package, it will refactor the imports 
> and it results with hundreds of changes.
> This means that the source code, as-is, does not adhere to the self-imposed 
> code style we ship for IDEA.
> If we fix this, we should add checkstyle for it like this:
> {code:java}
> 
>value="/(^java\.|javax)/,/(com\.google\.common|org\.apache\.log4j|org\.apache\.commons|org\.cliffc\.high_scale_lib|org\.junit|org\.slf4j)/"/>
>   
>   
>   
>   
>   
> 
> {code}
> This checkstyle on import order will pass on the source code we run the 
> import optimization in the context menu on.
> There is also no enforcement on "all star" imports (org.some.pkg.*). 
> Checkstyle has specific module for this: 
> [https://checkstyle.org/config_imports.html#AvoidStarImport] 
> I propose we should stop to use all-star imports. Same argument holds as 
> described there: Rationale: Importing all classes from a package or static 
> members from a class leads to tight coupling between packages or classes and 
> might lead to problems when a new version of a library introduces name 
> clashes.
> This should be applied to test checktyle as well and the source code should 
> be refactored on imports too.
> This should be done on cassandra-4.1 as well as for trunk.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Comment Edited] (CASSANDRA-17925) Java source code should have sorted imports as defined in the codestyle

2022-09-27 Thread Benedict Elliott Smith (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17610132#comment-17610132
 ] 

Benedict Elliott Smith edited comment on CASSANDRA-17925 at 9/27/22 3:45 PM:
-

If we're going to do this, perhaps we should fix the order that is defined by 
the code style, since it's really a silly order nobody has ever justified?


was (Author: benedict):
If we're going to do this, perhaps we should fix the order as defined in the 
code style, since it's really a silly order nobody has ever justified?

> Java source code should have sorted imports as defined in the codestyle
> ---
>
> Key: CASSANDRA-17925
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17925
> Project: Cassandra
>  Issue Type: Improvement
>Reporter: Stefan Miklosovic
>Priority: Normal
>
> After we cleaned all unused imports in CASSANDRA-17876, there is one more 
> task remaining to be done - to add checkstyle for imports order and enforce 
> this on build time.
> When the project is imported into IDEA, there is a helper target on Ant 
> called "generate-idea-files". ide/idea/codeStyleSettings.xml contains this:
> {code:java}
> 
>   
> 
> 
> 
>  static="false" />
>  static="false" />
>  static="false" />
>  static="false" />
> 
> 
> 
> 
> 
> 
>   
> 
> {code}
> This code style is also mentioned in the web page here (minus some details 
> which are present in above configuration snippet but not on the web page): 
> [https://cassandra.apache.org/_/development/code_style.html] (at the very 
> bottom).
> However, when one runs "Optimise imports" in the context menu after 
> right-clicking on org.cassandra.apache package, it will refactor the imports 
> and it results with hundreds of changes.
> This means that the source code, as-is, does not adhere to the self-imposed 
> code style we ship for IDEA.
> If we fix this, we should add checkstyle for it like this:
> {code:java}
> 
>value="/(^java\.|javax)/,/(com\.google\.common|org\.apache\.log4j|org\.apache\.commons|org\.cliffc\.high_scale_lib|org\.junit|org\.slf4j)/"/>
>   
>   
>   
>   
>   
> 
> {code}
> This checkstyle on import order will pass on the source code we run the 
> import optimization in the context menu on.
> There is also no enforcement on "all star" imports (org.some.pkg.*). 
> Checkstyle has specific module for this: 
> [https://checkstyle.org/config_imports.html#AvoidStarImport] 
> I propose we should stop to use all-star imports. Same argument holds as 
> described there: Rationale: Importing all classes from a package or static 
> members from a class leads to tight coupling between packages or classes and 
> might lead to problems when a new version of a library introduces name 
> clashes.
> This should be applied to test checktyle as well and the source code should 
> be refactored on imports too.
> This should be done on cassandra-4.1 as well as for trunk.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Comment Edited] (CASSANDRA-17925) Java source code should have sorted imports as defined in the codestyle

2022-09-27 Thread Benedict Elliott Smith (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-17925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17610132#comment-17610132
 ] 

Benedict Elliott Smith edited comment on CASSANDRA-17925 at 9/27/22 3:45 PM:
-

If we're going to do this, perhaps we should first fix the order that is 
defined by the code style, since it's really a silly order nobody has ever 
justified?


was (Author: benedict):
If we're going to do this, perhaps we should fix the order that is defined by 
the code style, since it's really a silly order nobody has ever justified?

> Java source code should have sorted imports as defined in the codestyle
> ---
>
> Key: CASSANDRA-17925
> URL: https://issues.apache.org/jira/browse/CASSANDRA-17925
> Project: Cassandra
>  Issue Type: Improvement
>Reporter: Stefan Miklosovic
>Priority: Normal
>
> After we cleaned all unused imports in CASSANDRA-17876, there is one more 
> task remaining to be done - to add checkstyle for imports order and enforce 
> this on build time.
> When the project is imported into IDEA, there is a helper target on Ant 
> called "generate-idea-files". ide/idea/codeStyleSettings.xml contains this:
> {code:java}
> 
>   
> 
> 
> 
>  static="false" />
>  static="false" />
>  static="false" />
>  static="false" />
> 
> 
> 
> 
> 
> 
>   
> 
> {code}
> This code style is also mentioned in the web page here (minus some details 
> which are present in above configuration snippet but not on the web page): 
> [https://cassandra.apache.org/_/development/code_style.html] (at the very 
> bottom).
> However, when one runs "Optimise imports" in the context menu after 
> right-clicking on org.cassandra.apache package, it will refactor the imports 
> and it results with hundreds of changes.
> This means that the source code, as-is, does not adhere to the self-imposed 
> code style we ship for IDEA.
> If we fix this, we should add checkstyle for it like this:
> {code:java}
> 
>value="/(^java\.|javax)/,/(com\.google\.common|org\.apache\.log4j|org\.apache\.commons|org\.cliffc\.high_scale_lib|org\.junit|org\.slf4j)/"/>
>   
>   
>   
>   
>   
> 
> {code}
> This checkstyle on import order will pass on the source code we run the 
> import optimization in the context menu on.
> There is also no enforcement on "all star" imports (org.some.pkg.*). 
> Checkstyle has specific module for this: 
> [https://checkstyle.org/config_imports.html#AvoidStarImport] 
> I propose we should stop to use all-star imports. Same argument holds as 
> described there: Rationale: Importing all classes from a package or static 
> members from a class leads to tight coupling between packages or classes and 
> might lead to problems when a new version of a library introduces name 
> clashes.
> This should be applied to test checktyle as well and the source code should 
> be refactored on imports too.
> This should be done on cassandra-4.1 as well as for trunk.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org