Skip to content

Commit

Permalink
Get clean on warnings (#43)
Browse files Browse the repository at this point in the history
More meaningful warnings were being obscured by 1334 warnings being triggered during build. This gets it to 0 and sets TreatWarningsAsErrors. Most of getting to 0 was just via broad suppression.
  • Loading branch information
stephentoub authored Jun 12, 2024
1 parent e6fe89c commit 45fc4d7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Custom/Assistants/Internal/GeneratorStubs.Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ internal partial class MessageDeltaContentImageUrlObjectImageUrl
}

[CodeGenModel("MessageDeltaContentImageFileObject")]
internal partial class MessageDeltaContentImageFileObject { private readonly string Type; }
internal partial class MessageDeltaContentImageFileObject { private readonly new string Type; }

[CodeGenModel("MessageDeltaContentImageUrlObject")]
internal partial class MessageDeltaContentImageUrlObject { private readonly string Type; }
internal partial class MessageDeltaContentImageUrlObject { private readonly new string Type; }

[CodeGenModel("MessageDeltaObjectDelta")]
internal partial class MessageDeltaObjectDelta
Expand Down
2 changes: 2 additions & 0 deletions src/Custom/Audio/TranscribedSegment.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace OpenAI.Audio;

[CodeGenModel("TranscriptionSegment")]
[StructLayout(LayoutKind.Auto)]
public readonly partial struct TranscribedSegment
{
// CUSTOM: Rename.
Expand Down
6 changes: 3 additions & 3 deletions src/Custom/Chat/ChatMessageContentPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ namespace OpenAI.Chat;
public partial class ChatMessageContentPart
{
private readonly ChatMessageContentPartKind _kind;
private readonly string _text = default;
private readonly InternalChatCompletionRequestMessageContentPartImageImageUrl _imageUrl = default;
private readonly string _dataUri = default;
private readonly string _text;
private readonly InternalChatCompletionRequestMessageContentPartImageImageUrl _imageUrl;
private readonly string _dataUri;

internal ChatMessageContentPart(string text)
{
Expand Down
16 changes: 12 additions & 4 deletions src/OpenAI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,22 @@

<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<!-- Normalize stored file paths in symbols when in a CI build. -->
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<!-- Disable missing XML documentation warnings -->
<NoWarn>$(NoWarn),1570,1573,1574,1591</NoWarn>

<!-- Disable obsolete warnings -->
<NoWarn>$(NoWarn),0618</NoWarn>

<!-- Disable unused fields warnings -->
<NoWarn>$(NoWarn),0169</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<!-- Normalize stored file paths in symbols when in a CI build. -->
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Utility/CustomSerializationHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable enable

using System;
using System.ClientModel.Primitives;
using System.Collections;
using System.Collections.Generic;
using System.Text.Json;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if !NET8_0_OR_GREATER
#nullable enable

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
Expand Down

0 comments on commit 45fc4d7

Please sign in to comment.