Skip to content

Commit

Permalink
Fixing 3 sonar code smells and 1 sonar bug
Browse files Browse the repository at this point in the history
  • Loading branch information
adityanarayanp committed Nov 9, 2023
1 parent f32711f commit c087efd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/LCT.Common/FileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TomlTable ParseTomlFile(string filePath)
table = TOML.Parse(reader);
return table;
}
catch(Exception ex)
catch(TomlParseException)
{
return new TomlTable();
}
Expand Down
2 changes: 1 addition & 1 deletion src/LCT.PackageIdentifier/ConanProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private static void GetDependecyDetails(List<Component> componentsForBOM, List<C
private static void GetPackagesForBom(ref List<Component> lstComponentForBOM, ref int noOfDevDependent, List<ConanPackage> nodePackages)
{
var rootNode = nodePackages.FirstOrDefault();
if (!rootNode.Dependencies.Any() || rootNode.Dependencies == null)
if (rootNode != null && (!rootNode.Dependencies.Any() || rootNode.Dependencies == null))
{
throw new ArgumentNullException(nameof(nodePackages), "Dependency(requires) node name details not present in the root node.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/LCT.PackageIdentifier/NugetDevDependencyParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static NugetDevDependencyParser Instance
}
}

public List<Container> Parse(string configFile)
public static List<Container> Parse(string configFile)
{
List<Container> containerList = new();

Expand Down
3 changes: 1 addition & 2 deletions src/LCT.PackageIdentifier/NugetProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,7 @@ private static string ReferenceTagDetailsForPackageReference(XmlNode childNode,

private static List<NugetPackage> ParseAssetFile(string configFile)
{
NugetDevDependencyParser nugetDevDependencyParser = NugetDevDependencyParser.Instance;
List<Container> containers = nugetDevDependencyParser.Parse(configFile);
List<Container> containers = NugetDevDependencyParser.Parse(configFile);
return ConvertContainerAsNugetPackage(containers, configFile);
}

Expand Down

0 comments on commit c087efd

Please sign in to comment.