Skip to content

Commit

Permalink
Fix StyleCop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Sigmund committed Jun 21, 2022
1 parent 73e0e7e commit 9cf7086
Show file tree
Hide file tree
Showing 41 changed files with 225 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;

namespace Microsoft.Sbom.Adapters.Adapters.ComponentDetection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
using Microsoft.Sbom.Contracts.Enums;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
using Microsoft.Sbom.Contracts.Enums;
using System.Collections.Generic;
Expand All @@ -25,8 +28,7 @@ internal static class DockerImageComponentExtensions
Algorithm = AlgorithmName.SHA256,
ChecksumValue = dockerImageComponent.Digest
},
}
,
},
FilesAnalyzed = false,
Type = "docker"
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
using Microsoft.Sbom.Contracts.Enums;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
using Microsoft.Sbom.Contracts.Enums;
using System.Collections.Generic;
Expand Down Expand Up @@ -29,7 +32,6 @@ internal static class GoComponentExtensions
},
FilesAnalyzed = false,
Type = "go"

};
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;

namespace Microsoft.Sbom.Adapters.Adapters.ComponentDetection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Adapters.Report;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;

namespace Microsoft.Sbom.Adapters.Adapters.ComponentDetection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.Internal;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.Internal;
using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
using System.Linq;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;

namespace Microsoft.Sbom.Adapters.Adapters.ComponentDetection
{
/// <summary>
/// Extensions methods for <see cref="PipComponent"/>.
/// </summary>
internal static class SbomPackageExtensions
internal static class PipComponentExtensions
{
/// <summary>
/// Converts a <see cref="PipComponent"/> to an <see cref="SBOMPackage"/>.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;

namespace Microsoft.Sbom.Adapters.Adapters.ComponentDetection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.ComponentDetection.Contracts.TypedComponent;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;

namespace Microsoft.Sbom.Adapters.Adapters.ComponentDetection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Microsoft.Sbom.Adapters.Report;
using Microsoft.ComponentDetection.Contracts.TypedComponent;
using Microsoft.Sbom.Contracts;
Expand Down Expand Up @@ -44,5 +47,4 @@ public static class ScannedComponentExtensions
}
}
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.Sbom.Adapters.Adapters.ComponentDetection;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Sbom.Adapters.Adapters.ComponentDetection;
using Microsoft.Sbom.Adapters.Report;
using Newtonsoft.Json;
using System.Collections.Generic;
Expand Down Expand Up @@ -42,8 +45,7 @@ public class ComponentDetectionToSBOMPackageAdapter
{
packages = componentDetectionScanResult.ComponentsFound
.Select(component => component.ToSbomPackage(report))
// It is acceptable to return a partial list of values with null filtered out since they should be reported as failures already
.Where(package => package != null)
.Where(package => package != null) // It is acceptable to return a partial list of values with null filtered out since they should be reported as failures already
.Select(package => package!);

report.LogSuccess();
Expand Down
5 changes: 4 additions & 1 deletion src/Microsoft.Sbom.Adapters/Report/AdapterReport.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Collections.Generic;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;

namespace Microsoft.Sbom.Adapters.Report
{
Expand Down
8 changes: 6 additions & 2 deletions src/Microsoft.Sbom.Adapters/Report/AdapterReportItem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

namespace Microsoft.Sbom.Adapters.Report
{
Expand All @@ -17,7 +20,8 @@ public enum AdapterReportItemType
/// </summary>
public class AdapterReportItem
{
public AdapterReportItemType Type { get; set; }
public AdapterReportItemType Type { get; set; }

public string Details { get; set; }

public AdapterReportItem(AdapterReportItemType type, string details)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.Sbom.Common.Config;
using System;

namespace Microsoft.Sbom.Api.Attributes
namespace Microsoft.Sbom.Common.Config.Attributes
{
/// <summary>
/// Validate if the property value is a valid URI.
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.Sbom.Common/Config/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Sbom.Extensions.Entities;
using Microsoft.Sbom.Api.Attributes;
using Microsoft.Sbom.Common.Config.Attributes;
using Microsoft.Sbom.Contracts;
using Microsoft.Sbom.Contracts.Enums;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Common/Config/SettingSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public enum SettingSource
CommandLine,

/// <summary>
/// THe setting was set using the config json file.
/// The setting was set using the config json file.
/// </summary>
JsonConfig,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Sbom.Common;
using Ninject;
using System;

namespace Microsoft.Sbom.Common
namespace Microsoft.Sbom.Common.Extensions
{
/// <summary>
/// FileSystemUtilsExtension class uses FileSystemUtils class to run additional more complex
Expand All @@ -14,7 +15,7 @@ public class FileSystemUtilsExtension : IFileSystemUtilsExtension
{
[Inject]
public IFileSystemUtils FileSystemUtils { get; set; }

[Inject]
public IOSUtils OsUtils { get; set; }

Expand Down
13 changes: 8 additions & 5 deletions src/Microsoft.Sbom.Contracts/Contracts/Checksum.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using Microsoft.Sbom.Contracts.Enums;

Expand All @@ -10,13 +13,13 @@ namespace Microsoft.Sbom.Contracts
public class Checksum : IEquatable<Checksum>
{
/// <summary>
/// The name of the hashing algorithm used to generate this hash.
/// Gets or sets the name of the hashing algorithm used to generate this hash.
/// ex. <see cref="AlgorithmName.SHA256"/>
/// </summary>
public AlgorithmName Algorithm { get; set; }

/// <summary>
/// The generated hash value.
/// Gets or sets the generated hash value.
/// </summary>
public string ChecksumValue { get; set; }

Expand All @@ -35,8 +38,8 @@ public bool Equals(Checksum other)
public override int GetHashCode()
{
int hashCode = 1457973397;
hashCode = hashCode * -1521134295 + Algorithm.GetHashCode();
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(ChecksumValue);
hashCode = (hashCode * -1521134295) + Algorithm.GetHashCode();
hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(ChecksumValue);
return hashCode;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.Sbom.Contracts.Enums;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Sbom.Contracts.Enums;
using Microsoft.Sbom.Contracts.Interfaces;
using System;
using System.Collections.Generic;
Expand Down
7 changes: 5 additions & 2 deletions src/Microsoft.Sbom.Contracts/Contracts/Entities/Entity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.Sbom.Contracts.Enums;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Sbom.Contracts.Enums;

namespace Microsoft.Sbom.Contracts.Entities
{
Expand All @@ -8,7 +11,7 @@ namespace Microsoft.Sbom.Contracts.Entities
public abstract class Entity
{
/// <summary>
/// The type of the entity.
/// Gets the type of the entity.
/// </summary>
public EntityType EntityType { get; private set; }

Expand Down
10 changes: 7 additions & 3 deletions src/Microsoft.Sbom.Contracts/Contracts/Entities/FileEntity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.Sbom.Contracts.Enums;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Sbom.Contracts.Enums;
using System;

namespace Microsoft.Sbom.Contracts.Entities
Expand All @@ -9,12 +12,13 @@ namespace Microsoft.Sbom.Contracts.Entities
public class FileEntity : Entity
{
/// <summary>
/// The path of the file as included in the SBOM.
/// Gets the path of the file as included in the SBOM.
/// </summary>
public string Path { get; private set; }

/// <nodoc />
public FileEntity(string path, string id = null) : base(EntityType.File, id)
public FileEntity(string path, string id = null)
: base(EntityType.File, id)
{
if (string.IsNullOrEmpty(path))
{
Expand Down
11 changes: 6 additions & 5 deletions src/Microsoft.Sbom.Contracts/Contracts/Entities/PackageEntity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Microsoft.Sbom.Contracts.Enums;

namespace Microsoft.Sbom.Contracts.Entities
Expand All @@ -24,10 +27,8 @@ public class PackageEntity : Entity
public string Path { get; private set; }

/// <nodoc />
public PackageEntity(string name,
string version = null,
string path = null,
string id = null) : base(EntityType.Package, id)
public PackageEntity(string name, string version = null, string path = null, string id = null)
: base(EntityType.Package, id)
{
if (string.IsNullOrEmpty(name))
{
Expand Down
Loading

0 comments on commit 9cf7086

Please sign in to comment.