Skip to content

Commit 0149c79

Browse files
[CodeQuality] improvements as per SQ suggestions
1 parent 16dc19c commit 0149c79

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

ECoreNetto.Reporting/Generators/ModelInspector.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ public string AnalyzeDocumentation(EPackage package, bool recursive = false)
391391
/// <param name="package">
392392
/// The <see cref="EPackage"/> which needs to be inspected
393393
/// </param>
394+
/// <param name="sb">
395+
/// The <see cref="StringBuilder"/>> to which the analysis results are appended
396+
/// </param>
394397
/// <param name="recursive">
395398
/// A value indicating whether the sub <see cref="EPackage"/>s need to be Analyzed as well
396399
/// </param>
@@ -406,12 +409,10 @@ private void AnalyzeDocumentation(EPackage package, StringBuilder sb, bool recur
406409
sb.AppendLine($"{package.Name}.{eClass.Name}");
407410
}
408411

409-
foreach (var eStructuralFeature in eClass.EStructuralFeaturesOrderByName)
412+
foreach (var eStructuralFeature in eClass.EStructuralFeaturesOrderByName
413+
.Where(f => string.IsNullOrEmpty(f.QueryRawDocumentation())))
410414
{
411-
if (string.IsNullOrEmpty(eStructuralFeature.QueryRawDocumentation()))
412-
{
413-
sb.AppendLine($"{package.Name}.{eClass.Name}:{eStructuralFeature.Name}");
414-
}
415+
sb.AppendLine($"{package.Name}.{eClass.Name}:{eStructuralFeature.Name}");
415416
}
416417
}
417418

ECoreNetto.Tools/Services/VersionChecker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ public async Task<GitHubRelease> QueryLatestReleaseAsync()
8383
return release;
8484
}
8585
}
86-
catch (TaskCanceledException)
86+
catch (TaskCanceledException taskCanceledException)
8787
{
88-
this.logger.LogWarning("Contacting the GitGub API at {Url} timed out", requestUrl);
88+
this.logger.LogWarning(taskCanceledException, "Contacting the GitGub API at {Url} timed out", requestUrl);
8989
}
9090
catch (Exception ex)
9191
{

ECoreNetto/ModelElement/EObject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace ECoreNetto
2626
using System.Xml;
2727

2828
using Microsoft.Extensions.Logging;
29-
29+
3030
/// <summary>
3131
/// An <see cref="EObject"/> is the base of all modeled objects. All the method names start with "e" to distinguish the EMF methods from the client methods.
3232
/// It provides support for the behaviors and features common to all modeled objects.
@@ -89,7 +89,7 @@ public EClass EClass()
8989
{
9090
throw new NotImplementedException();
9191
}
92-
92+
9393
/// <summary>
9494
/// Gets the containing object, or null.
9595
/// </summary>

ECoreNetto/ModelElement/NamedElement/EPackage.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ protected override string BuildIdentifier()
209209
superPackage = superPackage.ESuperPackage;
210210
}
211211

212-
packageHierarchy[packageHierarchy.Count - 1] = $"{packageHierarchy.Last()}.ecore#/";
212+
packageHierarchy[packageHierarchy.Count - 1] = $"{packageHierarchy[packageHierarchy.Count - 1]}.ecore#/";
213+
214+
213215
packageHierarchy.Reverse();
214216

215217
return string.Join("/", packageHierarchy);

ECoreNetto/ModelElement/NamedElement/ETypedElement.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ internal override void SetProperties()
133133

134134
if (this.Attributes.TryGetValue("eType", out output))
135135
{
136-
var typeName = output.Split(' ').Last();
136+
var parts = output.Split(' ');
137+
var typeName = parts[parts.Length - 1];
137138

138139
this.EType = (EClassifier)this.EResource.GetEObject(typeName);
139140
}

0 commit comments

Comments
 (0)