-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crjvm205 #122
base: main
Are you sure you want to change the base?
Crjvm205 #122
Conversation
Create ForceLazyFetchTypeUse.java
Crjvm205 sls
… into CRJVM205-WKR
Crjvm205 wkr
… into CRJVM205-WKR
Crjvm205 wkr
code review fix ok |
Kudos, SonarCloud Quality Gate passed! |
This PR has been automatically marked as stale because it has no activity for 30 days. |
Any news ? |
Kudos, SonarCloud Quality Gate passed! |
Hi @dirdr, |
This PR has been automatically marked as stale because it has no activity for 30 days. |
Hi @dirdr, |
This PR has been automatically marked as stale because it has no activity for 30 days. |
* OneToOne: Eager | ||
* reporting the issues if necessary | ||
*/ | ||
private void performsCheck(Arguments arguments, AnnotationTree annotationTree, Tree tree) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, no need to give arguments
as input parameter because it already is present inside annotationTree
input parameter
|
||
import java.util.List; | ||
|
||
@Rule(key = "EC80", name = "Developpement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a new way to declare configuration of one rule : please see other rules as example
@@ -0,0 +1,16 @@ | |||
{ | |||
"title": "Force the use of FetchType LAZY on collections in Entity JPA", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now, it isn't the good way to declare rule properties but inside ecocode-rules-specifications
(please see another rule as example)
|
||
@Column(name = "ORDER", length = 50, nullable = false, unique = false) | ||
private Set<OrderItem> items = new HashSet<OrderItem>(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please as a new use case with default value for fetch keywork (thus, without "fetch" variable assigned)
import javax.persistence.Temporal; | ||
import javax.persistence.TemporalType; | ||
import javax.persistence.Transient; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you give all use cases in a single file ? why several test files ?
@@ -30,7 +30,7 @@ void checkNumberRules() { | |||
final JavaCheckRegistrar registrar = new JavaCheckRegistrar(); | |||
registrar.register(context); | |||
|
|||
assertThat(context.checkClasses()).hasSize(19); | |||
assertThat(context.checkClasses()).hasSize(20); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe value has to be changed. to recheck locally, please
PR on java-test-project : https://github.com/green-code-initiative/ecoCode-java-test-project/pull/5 |
to discuss in core-team :
but I think we can't force developers not to use EAGER key word if they really need it. do we refuse this rule or not ? |
Hello, we do not force the user to not use "EAGER", it is just a code smell. He can always ignore it. The true question is, when we use JPA entities, is the "EAGER" keyword a classic use? If in 90% of the case its use is justified may be we should not raise the code smell to avoid to pollute the analysis. |
This PR has been automatically marked as stale because it has no activity for 60 days. |
CRJVM205 - Force the use of FetchType LAZY on collections in Entity JPA
Pitch : Consider using LAZY mode on your FetchType for collections in JPA type entities. This will reduce the amount of data loaded into memory. And having less data loaded into memory reduces power consumption. Any electricity not produced is good for our planet.