2023-05-03 11:06:20 +02:00
== Why is this an issue?
2021-04-28 16:49:39 +02:00
Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule allows to check that all ``++abstract++`` class names match a provided regular expression. If a non-abstract class match the regular expression, an issue is raised to suggest to either make it abstract or to rename it.
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
With the default regular expression: ``++^Abstract[A-Z][a-zA-Z0-9]*$++``:
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
abstract class MyClass { // Noncompliant
}
class AbstractLikeClass { // Noncompliant
}
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
abstract class AbstractClass {
}
class LikeClass {
}
----
2021-04-28 18:08:03 +02:00
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== Message
Rename this abstract class name to match the regular expression ${format}
=== Parameters
.format
****
_String_
----
^Abstract[A-Z][a-zA-Z0-9]*$
----
Regular expression used to check the abstract class names against.
****
2021-09-20 15:38:42 +02:00
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== on 8 May 2013, 10:15:22 Freddy Mallet wrote:
Dedicated issue message when the regular expression matches a class name which is not abstract :
Make this class abstract or rename it, since it matches the regular expression ${format}
=== on 20 May 2013, 12:08:29 Fabrice Bellingard wrote:
Implementation: \http://jira.codehaus.org/browse/SONARJAVA-147
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]