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));
|
SourceArchiveDir = RequireEnvironmentVariable(EnvVars.SourceArchiveDir(this.Options.Language));
|
||||||
DiagnosticsDir = RequireEnvironmentVariable(EnvVars.DiagnosticDir(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>
|
/// <summary>
|
||||||
|
|||||||
@@ -157,18 +157,10 @@ namespace Semmle.Util
|
|||||||
/// Initialises a new <see cref="DiagnosticsStream" /> for a file at <paramref name="path" />.
|
/// Initialises a new <see cref="DiagnosticsStream" /> for a file at <paramref name="path" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to the file that should be created.</param>
|
/// <param name="path">The path to the file that should be created.</param>
|
||||||
/// <returns>
|
public DiagnosticsStream(string path)
|
||||||
/// 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)
|
|
||||||
{
|
{
|
||||||
var stream = File.CreateText(path);
|
this.writer = File.CreateText(path);
|
||||||
return new DiagnosticsStream(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiagnosticsStream(StreamWriter streamWriter)
|
|
||||||
{
|
|
||||||
var contractResolver = new DefaultContractResolver
|
var contractResolver = new DefaultContractResolver
|
||||||
{
|
{
|
||||||
NamingStrategy = new CamelCaseNamingStrategy()
|
NamingStrategy = new CamelCaseNamingStrategy()
|
||||||
@@ -179,8 +171,6 @@ namespace Semmle.Util
|
|||||||
ContractResolver = contractResolver,
|
ContractResolver = contractResolver,
|
||||||
NullValueHandling = NullValueHandling.Ignore
|
NullValueHandling = NullValueHandling.Ignore
|
||||||
};
|
};
|
||||||
|
|
||||||
writer = streamWriter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user