Skip to content

Commit

Permalink
Ignore warnings about using obsolete members in Umbraco.Tests.UnitTes…
Browse files Browse the repository at this point in the history
…ts.csproj and Umbraco.Core.csproj

LocalFileSystemTemporaryFileRepository: Don't pass null to a method that doesn't accept nullable argument - https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2264
Fix remaining warning marked as error
  • Loading branch information
nul800sebastiaan committed Oct 2, 2024
1 parent 0a70beb commit 4090829
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 120 deletions.
23 changes: 17 additions & 6 deletions src/Umbraco.Core/Extensions/PublishedContentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -999,10 +999,12 @@ public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(
/// </summary>
/// <param name="parentNodes"></param>
/// <param name="variationContextAccessor">Variation context accessor.</param>
/// <param name="navigationQueryService"></param>
/// <param name="culture">
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="publishedCache"></param>
/// <returns></returns>
/// <remarks>
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
Expand Down Expand Up @@ -1357,14 +1359,14 @@ public static IEnumerable<IPublishedContent> Children(
/// Gets the children of the content, of any of the specified types.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="publishedCache"></param>
/// <param name="navigationQueryService"></param>
/// <param name="variationContextAccessor">The accessor for the VariationContext</param>
/// <param name="culture">
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="contentTypeAlias">The content type alias.</param>
/// <param name="publishedContentCache"></param>
/// <returns>The children of the content, of any of the specified types.</returns>
public static IEnumerable<IPublishedContent> ChildrenOfType(
this IPublishedContent content,
Expand All @@ -1382,10 +1384,12 @@ public static IEnumerable<IPublishedContent> ChildrenOfType(
/// <typeparam name="T">The content type.</typeparam>
/// <param name="content">The content.</param>
/// <param name="variationContextAccessor">The accessor for the VariationContext</param>
/// <param name="navigationQueryService"></param>
/// <param name="culture">
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="publishedCache"></param>
/// <returns>The children of content, of the given content type.</returns>
/// <remarks>
/// <para>Children are sorted by their sortOrder.</para>
Expand Down Expand Up @@ -1488,12 +1492,13 @@ public static IEnumerable<IPublishedContent> Siblings(
/// Gets the siblings of the content, of a given content type.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="publishedSnapshot">Published snapshot instance</param>
/// <param name="variationContextAccessor">Variation context accessor.</param>
/// <param name="culture">
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="publishedCache"></param>
/// <param name="navigationQueryService"></param>
/// <param name="contentTypeAlias">The content type alias.</param>
/// <returns>The siblings of the content, of the given content type.</returns>
/// <remarks>
Expand All @@ -1514,8 +1519,9 @@ public static IEnumerable<IPublishedContent> SiblingsOfType(
/// </summary>
/// <typeparam name="T">The content type.</typeparam>
/// <param name="content">The content.</param>
/// <param name="publishedSnapshot">Published snapshot instance</param>
/// <param name="variationContextAccessor">Variation context accessor.</param>
/// <param name="publishedCache"></param>
/// <param name="navigationQueryService"></param>
/// <param name="culture">
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
Expand Down Expand Up @@ -1577,13 +1583,14 @@ public static IEnumerable<T> Siblings<T>(
/// Gets the siblings of the content including the node itself to indicate the position, of a given content type.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="publishedSnapshot">Published snapshot instance</param>
/// <param name="variationContextAccessor">Variation context accessor.</param>
/// <param name="culture">
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="navigationQueryService"></param>
/// <param name="contentTypeAlias">The content type alias.</param>
/// <param name="publishedCache"></param>
/// <returns>The siblings of the content including the node itself, of the given content type.</returns>
public static IEnumerable<IPublishedContent> SiblingsAndSelfOfType(
this IPublishedContent content,
Expand All @@ -1593,7 +1600,6 @@ public static IEnumerable<IPublishedContent> SiblingsAndSelfOfType(
string contentTypeAlias,
string? culture = null)
{

var parentSuccess = navigationQueryService.TryGetParentKey(content.Key, out Guid? parentKey);

IPublishedContent? parent = parentKey is null ? null : publishedCache.GetById(parentKey.Value);
Expand All @@ -1620,12 +1626,13 @@ public static IEnumerable<IPublishedContent> SiblingsAndSelfOfType(
/// </summary>
/// <typeparam name="T">The content type.</typeparam>
/// <param name="content">The content.</param>
/// <param name="publishedSnapshot">Published snapshot instance</param>
/// <param name="variationContextAccessor">Variation context accessor.</param>
/// <param name="navigationQueryService"></param>
/// <param name="culture">
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="publishedCache"></param>
/// <returns>The siblings of the content including the node itself, of the given content type.</returns>
public static IEnumerable<T> SiblingsAndSelf<T>(
this IPublishedContent content,
Expand Down Expand Up @@ -1728,6 +1735,7 @@ public static string GetWriterName(this IPublishedContent content, IUserService
/// </summary>
/// <param name="content">The content.</param>
/// <param name="variationContextAccessor">Variation context accessor.</param>
/// <param name="navigationQueryService"></param>
/// <param name="contentTypeService">The content type service.</param>
/// <param name="mediaTypeService">The media type service.</param>
/// <param name="memberTypeService">The member type service.</param>
Expand All @@ -1737,6 +1745,7 @@ public static string GetWriterName(this IPublishedContent content, IUserService
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="publishedCache"></param>
/// <returns>The children of the content.</returns>
public static DataTable ChildrenAsTable(
this IPublishedContent content,
Expand All @@ -1756,6 +1765,7 @@ public static DataTable ChildrenAsTable(
/// </summary>
/// <param name="content">The content.</param>
/// <param name="variationContextAccessor">Variation context accessor.</param>
/// <param name="navigationQueryService"></param>
/// <param name="contentTypeService">The content type service.</param>
/// <param name="mediaTypeService">The media type service.</param>
/// <param name="memberTypeService">The member type service.</param>
Expand All @@ -1765,6 +1775,7 @@ public static DataTable ChildrenAsTable(
/// The specific culture to filter for. If null is used the current culture is used. (Default is
/// null)
/// </param>
/// <param name="publishedCache"></param>
/// <returns>The children of the content.</returns>
private static DataTable GenerateDataTable(
IPublishedContent content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public interface IPublishedMemberCache
/// <summary>
/// Get an <see cref="IPublishedContent" /> from an <see cref="IMember" />
/// </summary>
/// <param name="key">The key of the member to fetch</param>
/// <param name="preview">Will fetch draft if this is set to true</param>
/// <returns></returns>
Task<IPublishedMember?> GetAsync(IMember member);
}
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Services/IDocumentUrlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace Umbraco.Cms.Core.Services;

public interface IDocumentUrlService
{

/// <summary>
/// Initializes the service and ensure the content in the database is correct with the current configuration.
/// </summary>
/// <param name="forceEmpty"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task InitAsync(bool forceEmpty, CancellationToken cancellationToken);
Expand Down
8 changes: 4 additions & 4 deletions src/Umbraco.Core/Umbraco.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
[SA1111] adjust parenthesis, [SA1649] file name match type name, [CA2017] match parameters number,
[CS0108] hidden inherited member, [CS0649] default value always null, [CS1574] unresolveable cref,
[CS1998] remove async or make method synchronous, [CS8073] result always true/false, [IDE0060]
remove unused parameter, [IDE1006] naming prefix, [SA1306] fieold name, [CS1723] XML TEntity,
[CS0419] ambiguous cref, and remove overrides -->
remove unused parameter, [IDE1006] naming prefix, [SA1306] field name, [CS1723] XML TEntity,
[CS0419] ambiguous cref, [CS0612] obsolete, and remove overrides -->
<WarningsNotAsErrors>
SA1117,SA1401,SA1134,SA1649,CS0618,CS0067,SA1405,SA1600,CS0168,CS0169,CS0183,SYSLIB0045,SYSLIB0051,
SYSLIB0044,SYSLIB0023,SYSLIB0003,SA1111,SA1649,CA2017,CS0108,CS0649,CS0672,CS1574,CS1998,CS8073,IDE0060,
IDE1006,SA1306,CS1723,CS0419
SYSLIB0044,SYSLIB0023,SYSLIB0003,SA1111,SA1649,CA2017,CS0108,CS0612,CS0649,CS0672,CS1574,CS1998,CS8073,
IDE0060,IDE1006,SA1306,CS1723,CS0419
</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
7 changes: 0 additions & 7 deletions src/Umbraco.Core/Web/IUmbracoContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,4 @@ public interface IUmbracoContext : IDisposable
/// Gets a value indicating whether the current user is in a preview mode and browsing the site (ie. not in the admin UI)
/// </summary>
bool InPreviewMode { get; }

// TODO: Do we need this?
/// <summary>
/// Forces the context into preview
/// </summary>
/// <returns>A <see cref="IDisposable" /> instance to be disposed to exit the preview context</returns>
// IDisposable ForcedPreview(bool preview);
}
3 changes: 1 addition & 2 deletions src/Umbraco.Infrastructure/Examine/ExamineExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public static IEnumerable<PublishedSearchResult> ToPublishedSearchResults(
}

/// <summary>
/// Creates an <see cref="IEnumerable{PublishedSearchResult}" /> containing all content, media or members from the
/// <paramref name="snapshot" />.
/// Creates an <see cref="IEnumerable{PublishedSearchResult}" /> containing all content, media or members from the snapshot.
/// </summary>
/// <param name="results">The search results.</param>
/// <param name="cacheManager">The caches.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public static Sql<ISqlContext> WhereIn<TDto>(this Sql<ISqlContext> sql, Expressi
/// <param name="sql">The Sql statement.</param>
/// <param name="field">An expression specifying the field.</param>
/// <param name="values">The values.</param>
/// <param name="alias"></param>
/// <returns>The Sql statement.</returns>
public static Sql<ISqlContext> WhereIn<TDto>(this Sql<ISqlContext> sql, Expression<Func<TDto, object?>> field, IEnumerable? values, string alias)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ private DirectoryInfo GetRootDirectory()

public async Task SaveAsync(TemporaryFileModel model)
{
ArgumentNullException.ThrowIfNull(nameof(model));

// Ensure folder does not exist
await DeleteAsync(model.Key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public UserKind Kind
/// <param name="culture"></param>
/// <param name="name"></param>
/// <param name="id"></param>
/// <param name="kind"></param>
public static BackOfficeIdentityUser CreateNew(GlobalSettings globalSettings, string? username, string email, string culture, string? name = null, Guid? id = null, UserKind kind = UserKind.Default)
{
if (string.IsNullOrWhiteSpace(username))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ public static T WithSupportsPublishing<T>(this T builder, bool supportsPublishin
return builder;
}

public static T WithPropertyValues<T>(this T builder, object propertyValues, string? culture = null,
string? segment = null)
public static T WithPropertyValues<T>(this T builder, object propertyValues, string? culture = null, string? segment = null)
where T : IWithPropertyValues
{
builder.PropertyValues = propertyValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public static MediaTypeCreateModel CreateBasicMediaType(string alias = "umbImage
.Build();
}

public static MediaTypeCreateModel CreateBasicFolderMediaType(string alias = "basicFolder",
string name = "BasicFolder")
public static MediaTypeCreateModel CreateBasicFolderMediaType(string alias = "basicFolder", string name = "BasicFolder")
{
var builder = new MediaTypeEditingBuilder();
return (MediaTypeCreateModel)builder
Expand Down
Loading

0 comments on commit 4090829

Please sign in to comment.