Skip to content

Commit

Permalink
refactor: SA1518 use line endings correctly at end of file
Browse files Browse the repository at this point in the history
[SA1518: use line endings correctly at end of file](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1518.md)

Related to #340
  • Loading branch information
JamieMagee committed Sep 1, 2023
1 parent 70991eb commit 3b34545
Show file tree
Hide file tree
Showing 330 changed files with 511 additions and 515 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,6 @@ dotnet_diagnostic.SA1500.severity = suggestion
# SA1502: Element should not be on a single line
dotnet_diagnostic.SA1502.severity = suggestion

# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1518.md
# SA1518: Use line endings correctly
dotnet_diagnostic.SA1518.severity = suggestion

# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1600.md
# SA1600: Elements should be documented
dotnet_diagnostic.SA1600.severity = suggestion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ internal static class CargoComponentExtensions
FilesAnalyzed = false,
Type = "cargo"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ internal static class CondaComponentExtensions
FilesAnalyzed = false,
Type = "conda"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ internal static class DockerImageComponentExtensions
FilesAnalyzed = false,
Type = "docker"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ internal static class DockerReferenceComponentExtensions
FilesAnalyzed = false,
Type = "docker"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ internal static class GitComponentExtensions
FilesAnalyzed = false,
Type = "git-package"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ internal static class GoComponentExtensions
FilesAnalyzed = false,
Type = "go"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ internal static class LinuxComponentExtensions
FilesAnalyzed = false,
Type = "linux"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public static void LogNoConversionFound(this AdapterReport report, Type received
{
report.LogFailure($"No conversion has been defined for type {receivedType}. Could not convert component id '{component.Id}'.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ internal static class MavenComponentExtensions
FilesAnalyzed = false,
Type = "maven"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ internal static class NpmComponentExtensions
};

/// <summary>
/// Converts the <see cref="NpmAuthor"/> to an SPDX Supplier.
/// Converts the <see cref="NpmAuthor"/> to an SPDX Supplier.
/// </summary>
private static string AsSupplier(this NpmAuthor npmAuthor) => (npmAuthor.Name, npmAuthor.Email) switch
{
(string name, string email) => $"Organization: {name} ({email})",
(string name, _) => $"Organization: {name}"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ internal static class NuGetComponentExtensions
FilesAnalyzed = false,
Type = "nuget"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ internal static class OtherComponentExtensions
PackageName = otherComponent.Name,
PackageVersion = otherComponent.Version,
PackageSource = otherComponent.DownloadUrl?.ToString(),
Checksum = new[]
Checksum = new[]
{
new Checksum { ChecksumValue = otherComponent.Hash },
},
FilesAnalyzed = false,
Type = "other"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ internal static class PipComponentExtensions
FilesAnalyzed = false,
Type = "python"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ internal static class PodComponentExtensions
FilesAnalyzed = false,
Type = "pod"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ internal static class RubyGemsComponentExtensions
FilesAnalyzed = false,
Type = "ruby"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public static class ScannedComponentExtensions
return null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ internal static class SpdxComponentExtensions
FilesAnalyzed = false,
Type = "spdx"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ internal static class VcpkgComponentExtensions
FilesAnalyzed = false,
Type = "vcpkg"
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ public class ComponentDetectionToSBOMPackageAdapter

return (report, packages);
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Adapters/Report/AdapterReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public void LogWarning(string details)
{
Report.Add(new AdapterReportItem(AdapterReportItemType.Warning, details));
}
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.Sbom.Adapters/Report/AdapterReportItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public enum AdapterReportItemType
public class AdapterReportItem
{
public AdapterReportItemType Type { get; set; }

public string Details { get; set; }

public AdapterReportItem(AdapterReportItemType type, string details)
{
Type = type;
Details = details ?? throw new ArgumentNullException(nameof(details));
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/ApiConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@ private static RuntimeConfiguration SanitiseRuntimeConfiguration(RuntimeConfigur

return runtimeConfiguration;
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/ArgRevivers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ public static AlgorithmName ReviveAlgorithmName(string _, string value)
throw new ValidationArgException($"Unable to parse algorithm name: {value}. Error: {e.Message}");
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/Args/CommonArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ public abstract class CommonArgs
[ArgDescription("A list of the name and version of the manifest format that we are using.")]
[ArgShortcut("mi")]
public IList<ManifestInfo> ManifestInfo { get; set; }
}
}
6 changes: 3 additions & 3 deletions src/Microsoft.Sbom.Api/Config/Args/GenerationArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public class GenerationArgs : CommonArgs

/// <summary>
/// Gets or sets the file path containing a list of files for which the manifest file will be generated.
/// List file is an unordered set of files formated as one file per line separated
/// List file is an unordered set of files formated as one file per line separated
/// by Environment.NewLine. Blank lines are discarded.
/// </summary>
[ArgShortcut("bl")]
[ArgDescription("The file path to a file containing a list of files one file per line for which the SBOM" +
[ArgDescription("The file path to a file containing a list of files one file per line for which the SBOM" +
" file will be generated. Only files listed in the file will be inlcuded in the generated SBOM.")]
public string BuildListFile { get; set; }

Expand Down Expand Up @@ -108,4 +108,4 @@ public class GenerationArgs : CommonArgs
"asking the user for confirmation. The new manifest directory will then be created at this location and the generated SBOM " +
"will be stored there.")]
public bool? DeleteManifestDirIfPresent { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/Args/ValidationArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ public class ValidationArgs : CommonArgs
/// </summary>
[ArgDescription("The Hash algorithm to use while verifying or generating the hash value of a file")]
public AlgorithmName HashAlgorithm { get; set; }
}
}
6 changes: 3 additions & 3 deletions src/Microsoft.Sbom.Api/Config/ConfigFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.Sbom.Api.Config;

/// <summary>
/// This is the schema for the config file that is used to provide
/// the validator with additional params in a JSON format. Most of
/// the validator with additional params in a JSON format. Most of
/// these fields can also be provided through the command line. In case
/// of a conflict (same value provided in config file and command line, we
/// throw an input error.
Expand Down Expand Up @@ -121,7 +121,7 @@ public class ConfigFile
/// <summary>
/// Gets or sets if specified, we will store the generated telemetry for the execution
/// of the SBOM tool at this path.
/// </summary>
/// </summary>
public string TelemetryFilePath { get; set; }

/// <summary>
Expand Down Expand Up @@ -171,4 +171,4 @@ public class ConfigFile
/// If set to true, we will fail the validation if no packages are found in the build drop.
/// </summary>
public bool? FailIfNoPackages { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/ConfigFileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ public async Task<ConfigFile> ParseFromJsonFile(string filePath)
using Stream openStream = fileSystemUtils.OpenRead(filePath);
return await JsonSerializer.DeserializeAsync<ConfigFile>(openStream);
}
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.Sbom.Api/Config/ConfigPostProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void SetDefaultValue(IConfiguration destination, object value, PropertyD
});
}

// Fall through, only primitive types are currently supported.
// Fall through, only primitive types are currently supported.
// Add more primitive types if needed here.
}
}
}
8 changes: 4 additions & 4 deletions src/Microsoft.Sbom.Api/Config/ConfigSanitizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private ConfigurationSetting<string> GetNamespaceBaseUri(IConfiguration configur
};
}

// If the user provides the parameter even when the assembly attribute is provided,
// If the user provides the parameter even when the assembly attribute is provided,
// show a warning on the console.
if (!string.IsNullOrWhiteSpace(configuration.NamespaceUriBase?.Value))
{
Expand Down Expand Up @@ -223,8 +223,8 @@ private ConfigurationSetting<string> GetPackageSupplierFromAssembly(IConfigurati
return configuration.PackageSupplier;
}

return new ConfigurationSetting<string>
{
return new ConfigurationSetting<string>
{
Source = SettingSource.Default,
Value = assemblyConfig.DefaultPackageSupplier
};
Expand Down Expand Up @@ -261,4 +261,4 @@ private string EnsurePathEndsWithManifestFolderForGenerate(string value, Manifes

return value;
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/ConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ await configFileParser.ParseFromJsonFile(commandLineArgs.ConfigFilePath.Value) :
public interface IConfigurationBuilder<T>
{
Task<InputConfiguration> GetConfiguration(T args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ public static Configuration ToConfiguration(this InputConfiguration inputConfig)
new MapperConfiguration(cfg => cfg.CreateMap<InputConfiguration, Configuration>())
.CreateMapper()
.Map<Configuration>(inputConfig);
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.Sbom.Api/Config/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Generator : ISbomService<GenerationArgs>

public Generator(
IWorkflow<SbomGenerationWorkflow> generationWorkflow,
IRecorder recorder)
IRecorder recorder)
{
this.generationWorkflow = generationWorkflow;
this.recorder = recorder;
Expand Down Expand Up @@ -51,4 +51,4 @@ public Generator(

return (IsFailed: isFailed, IsAccessError: isAccessError);
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/ISbomService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ namespace Microsoft.Sbom.Api.Config;
public interface ISbomService<T>
where T : CommonArgs
{
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Config/SbomToolCmdRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ public void Version()
Console.WriteLine("Encountered error while getting the version of the tool.");
}
}
}
}
6 changes: 3 additions & 3 deletions src/Microsoft.Sbom.Api/Config/Validator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public Validator(
IConfiguration configuration,
IWorkflow<SbomValidationWorkflow> validationWorkflow,
IWorkflow<SbomParserBasedValidationWorkflow> parserValidationWorkflow,
IRecorder recorder)
{
IRecorder recorder)
{
this.validationWorkflow = validationWorkflow;
this.parserValidationWorkflow = parserValidationWorkflow;
this.configuration = configuration;
Expand Down Expand Up @@ -60,4 +60,4 @@ public async Task<bool> Validate()

return !result;
}
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.Sbom.Api/Config/Validators/ConfigValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Microsoft.Sbom.Common.Config.Validators;

/// <summary>
/// Abstract class from which all validators must inherit.
/// Abstract class from which all validators must inherit.
/// This class only validates configuration properties that are of the type <see cref="ConfigurationSetting{T}"/>.
/// </summary>
public abstract class ConfigValidator
Expand Down Expand Up @@ -111,4 +111,4 @@ private bool NamespaceUriBaseIsNullOrHasDefaultValue(object propertyValue)
}

public abstract void ValidateInternal(string paramName, object paramValue, Attribute attribute);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ public override void ValidateInternal(string paramName, object paramValue, Attri
}
}
}
}
}
Loading

0 comments on commit 3b34545

Please sign in to comment.