Skip to content

Commit

Permalink
Merge pull request #35 from mrEDitor/must-use-return
Browse files Browse the repository at this point in the history
Introduce 'MustUseReturnValueAttribute.IsFluentBuilderMethod' property
  • Loading branch information
controlflow authored Aug 30, 2024
2 parents 31fdb4e + 22b0d77 commit 920d4da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/Annotations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,18 @@ public MustUseReturnValueAttribute([NotNull] string justification)
}

[CanBeNull] public string Justification { get; }

/// <summary>
/// Enables the special handling of the "fluent" APIs that perform mutations and return 'this' object.
/// In this case the analysis checks the fluent invocations chain and only warns if the initial receiver value
/// is probably a temporary value - in this case the very last fluent method return assumed to be temporary as well,
/// therefore is a subject of warning if unused. If the initial receiver is a local variable or 'this' reference
/// the analysis assumes that fluent invocations were used to mutate the existing value and warning will not be shown.
/// </summary>
/// <remarks>
/// This property must only be used for methods with the return type matching the receiver type.
/// </remarks>
public bool IsFluentBuilderMethod { get; set; }
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/JetBrains.Annotations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Use 'eap' <VersionSuffix> for EAP builds of annotations
MAJOR and MINOR version numbers should match latest ReSharper version (to avoid confusion),
PATCH version may vary during development and EAPs -->
<VersionPrefix>2024.2.0</VersionPrefix>
<!--<VersionSuffix>eap1</VersionSuffix>-->
<VersionPrefix>2024.3.0</VersionPrefix>
<VersionSuffix>eap1</VersionSuffix>

<!-- versioning -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
Expand Down

0 comments on commit 920d4da

Please sign in to comment.