Skip to content

Commit

Permalink
Accolades sur le "if liste null". Plus respectueux des bonnes pratiqu…
Browse files Browse the repository at this point in the history
…es (voir issue Sonar java:S121)
  • Loading branch information
kevin.buntrock committed Oct 1, 2024
1 parent a263ddf commit f452543
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ public void WriteGetter(JavaWriter fw, Class classe, string tag, IProperty prope
var type = _config.GetType(ap, _classes, useClassForAssociation: useClassForAssociation).Split('<').First();
if (_newableTypes.TryGetValue(type, out var newableType))
{
fw.WriteLine(indentLevel + 1, $"if(this.{propertyName} == null)");
fw.WriteLine(indentLevel + 1, $"if(this.{propertyName} == null) {");

Check failure on line 128 in TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Unexpected token 'fw'

Check failure on line 128 in TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Newline in constant
fw.AddImport($"java.util.{newableType}");
fw.WriteLine(indentLevel + 2, $"this.{propertyName} = new {newableType}<>();");
fw.WriteLine(indentLevel + 1, $"}");

Check failure on line 131 in TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs

View workflow job for this annotation

GitHub Actions / build

A '}' character must be escaped (by doubling) in an interpolated string.
}

Check failure on line 132 in TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Unterminated string literal

Check failure on line 132 in TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs

View workflow job for this annotation

GitHub Actions / build

) expected

Check failure on line 132 in TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs

View workflow job for this annotation

GitHub Actions / build

; expected
}

Expand Down

0 comments on commit f452543

Please sign in to comment.