Skip to content

Commit

Permalink
Modify rule S6745: Add first rule description
Browse files Browse the repository at this point in the history
  • Loading branch information
irina-batinic-sonarsource committed Sep 26, 2023
1 parent 62b4757 commit b0fcb3c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 39 deletions.
10 changes: 5 additions & 5 deletions rules/S6745/java/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"title": "FIXME",
"title": "Detection of the Local Butterfly object dependencies anti-pattern",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
Expand All @@ -8,16 +8,16 @@
},
"tags": [
],
"defaultSeverity": "Major",
"defaultSeverity": "Info",
"ruleSpecification": "RSPEC-6745",
"sqKey": "S6745",
"scope": "All",
"defaultQualityProfiles": ["Sonar way"],
"quickfix": "unknown",
"quickfix": "infeasible",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH",
"RELIABILITY": "MEDIUM",
"MAINTAINABILITY": "LOW",
"RELIABILITY": "LOW",
"SECURITY": "LOW"
},
"attribute": "CONVENTIONAL"
Expand Down
49 changes: 15 additions & 34 deletions rules/S6745/java/rule.adoc
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
FIXME: add a description
Local Butterfly is a structural anti-pattern for a component with many immediate dependents.
The scope of dependents is limited to immediate dependents that directly access, use, reference, or contain the Local Butterfly.

// If you want to factorize the description uncomment the following line and create the file.
//include::../description.adoc[]
These issues arise from the tight coupling between the component and its dependents, which can lead to a lack of flexibility, maintainability, and scalability in the system.

== Why is this an issue?

FIXME: remove the unused optional headers (that are commented out)
Any changes or modifications to the component with a large number of immediate dependents may require updates in multiple places.
This can make it challenging to introduce new features or make changes without impacting the entire system.
The lack of flexibility can hinder adapting to evolving requirements or business needs.

//=== What is the potential impact?
The tight coupling between the component and its immediate dependents can make the codebase more complex and harder to understand.
This can lead to difficulties in maintaining and debugging the system.
When a change is required, it may be challenging to identify all the affected areas, increasing the risk of introducing bugs or unintended side effects.

== How to fix it
//== How to fix it in FRAMEWORK NAME

=== Code examples

==== Noncompliant code example

[source,text,diff-id=1,diff-type=noncompliant]
----
FIXME
----
As the number of immediate dependents increases, the component's scalability can be compromised.

==== Compliant solution
Only basic Interfaces or utility classes should be allowed to become Local Butterflies.

[source,text,diff-id=1,diff-type=compliant]
----
FIXME
----

//=== How does this work?

//=== Pitfalls

//=== Going the extra mile
== How to fix it

To mitigate these issues, it is recommended to consider alternative design patterns that promote loose coupling and separation of concerns.
By decoupling the component from its immediate dependents, such as using interfaces or abstractions, it becomes easier to modify, maintain, and test the system.
This promotes better flexibility, maintainability, and scalability in the long run.

//== Resources
//=== Documentation
//=== Articles & blog posts
//=== Conference presentations
//=== Standards
//=== External coding guidelines
//=== Benchmarks

0 comments on commit b0fcb3c

Please sign in to comment.