mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Fix IDisposable contract violation
This commit is contained in:
@@ -240,7 +240,7 @@ namespace Semmle.Autobuild.Shared
|
||||
SourceArchiveDir = RequireEnvironmentVariable(EnvVars.SourceArchiveDir(this.Options.Language));
|
||||
DiagnosticsDir = RequireEnvironmentVariable(EnvVars.DiagnosticDir(this.Options.Language));
|
||||
|
||||
this.diagnostics = DiagnosticsStream.ForFile(Path.Combine(DiagnosticsDir, $"autobuilder-{DateTime.UtcNow:yyyyMMddHHmm}.jsonc"));
|
||||
this.diagnostics = new DiagnosticsStream(Path.Combine(DiagnosticsDir, $"autobuilder-{DateTime.UtcNow:yyyyMMddHHmm}.jsonc"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -157,18 +157,10 @@ namespace Semmle.Util
|
||||
/// Initialises a new <see cref="DiagnosticsStream" /> for a file at <paramref name="path" />.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the file that should be created.</param>
|
||||
/// <returns>
|
||||
/// A <see cref="DiagnosticsStream" /> object which allows diagnostics to be
|
||||
/// written to a file at <paramname name="path" />.
|
||||
/// </returns>
|
||||
public static DiagnosticsStream ForFile(string path)
|
||||
public DiagnosticsStream(string path)
|
||||
{
|
||||
var stream = File.CreateText(path);
|
||||
return new DiagnosticsStream(stream);
|
||||
}
|
||||
this.writer = File.CreateText(path);
|
||||
|
||||
public DiagnosticsStream(StreamWriter streamWriter)
|
||||
{
|
||||
var contractResolver = new DefaultContractResolver
|
||||
{
|
||||
NamingStrategy = new CamelCaseNamingStrategy()
|
||||
@@ -179,8 +171,6 @@ namespace Semmle.Util
|
||||
ContractResolver = contractResolver,
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
};
|
||||
|
||||
writer = streamWriter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user