Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Format projects #14664

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class MethodInfoApiCommonExtensions
{
MapToApiVersionAttribute[] mapToApis = methodInfo.GetCustomAttributes(typeof(MapToApiVersionAttribute), inherit: true).Cast<MapToApiVersionAttribute>().ToArray();

return string.Join("|", mapToApis.SelectMany(x=>x.Versions));
return string.Join("|", mapToApis.SelectMany(x => x.Versions));
}

public static string? GetMapToApiAttributeValue(this MethodInfo methodInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Umbraco.Cms.Api.Delivery.Configuration;

public class ConfigureUmbracoDeliveryApiSwaggerGenOptions: IConfigureOptions<SwaggerGenOptions>
public class ConfigureUmbracoDeliveryApiSwaggerGenOptions : IConfigureOptions<SwaggerGenOptions>
{
public void Configure(SwaggerGenOptions swaggerGenOptions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public PagedModel<Guid> ExecuteQuery(SelectorOption selectorOption, IList<Filter

public SelectorOption AllContentSelectorOption() => new()
{
FieldName = UmbracoExamineFieldNames.CategoryFieldName, Values = new[] { "content" }
FieldName = UmbracoExamineFieldNames.CategoryFieldName,
Values = new[] { "content" }
};

private IBooleanOperation BuildSelectorOperation(SelectorOption selectorOption, IIndex index, string culture, bool preview)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public Attempt<PagedModel<Guid>, ApiContentQueryOperationStatus> ExecuteQuery(st
// Reusing the boolean operation of the "Descendants" selector, as we want to get all the nodes from the given starting point
return new SelectorOption
{
FieldName = DescendantsSelectorIndexer.FieldName, Values = new[] { startItem.Key.ToString() }
FieldName = DescendantsSelectorIndexer.FieldName,
Values = new[] { startItem.Key.ToString() }
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SqlServerDistributedLockingMechanism(

/// <inheritdoc />
public bool Enabled => _connectionStrings.CurrentValue.IsConnectionStringConfigured() &&
string.Equals(_connectionStrings.CurrentValue.ProviderName,Constants.ProviderName, StringComparison.InvariantCultureIgnoreCase);
string.Equals(_connectionStrings.CurrentValue.ProviderName, Constants.ProviderName, StringComparison.InvariantCultureIgnoreCase);

/// <inheritdoc />
public IDistributedLock ReadLock(int lockId, TimeSpan? obtainLockTimeout = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public virtual void ClearOfType<T>(Func<string, T, bool> predicate)
return (isInterface ? value is T : value.GetType() == typeOfT)

// run predicate on the 'public key' part only, ie without prefix
&& predicate(((string) x.Key).Substring(plen), (T) value);
&& predicate(((string)x.Key).Substring(plen), (T)value);
}))
{
RemoveEntry((string)entry.Key);
Expand Down
3 changes: 2 additions & 1 deletion src/Umbraco.Core/Configuration/ITypeFinderSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Umbraco.Cms.Core.Configuration;

[Obsolete("Not used anymore, will be removed in Umbraco 12")]public interface ITypeFinderSettings
[Obsolete("Not used anymore, will be removed in Umbraco 12")]
public interface ITypeFinderSettings
{
string AssembliesAcceptingLoadExceptions { get; }
}
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Configuration/Models/BasicAuthSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class BasicAuthSettings

public class SharedSecret
{
private const string StaticHeaderName = "X-Authentication-Shared-Secret";
private const string StaticHeaderName = "X-Authentication-Shared-Secret";

[DefaultValue(StaticHeaderName)]
public string? HeaderName { get; set; } = StaticHeaderName;
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Configuration/Models/GlobalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public string UmbracoPath
/// - https://www.umbraco.com/ar/4/3/2/1
/// </example>
[DefaultValue(StaticForceCombineUrlPathLeftToRight)]
public bool ForceCombineUrlPathLeftToRight { get; set; } = StaticForceCombineUrlPathLeftToRight;
public bool ForceCombineUrlPathLeftToRight { get; set; } = StaticForceCombineUrlPathLeftToRight;

[DefaultValue(StaticShowMaintenancePageWhenInUpgradeState)]
public bool ShowMaintenancePageWhenInUpgradeState { get; set; } = StaticShowMaintenancePageWhenInUpgradeState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public class MarketplaceSettings
/// <summary>
/// Gets or sets the additional parameters that are sent to the Marketplace.
/// </summary>
public Dictionary<string, string> AdditionalParameters { get; set; } = new ();
public Dictionary<string, string> AdditionalParameters { get; set; } = new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public bool FlagOutOfDateModels
{
get
{
if (ModelsMode == ModelsMode.Nothing ||ModelsMode.IsAuto())
if (ModelsMode == ModelsMode.Nothing || ModelsMode.IsAuto())
{
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Constants-PropertyEditors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static class Aliases
/// </summary>
public const string BlockGrid = "Umbraco.BlockGrid";

/// <summary>
/// <summary>
/// CheckBox List.
/// </summary>
public const string CheckBoxList = "Umbraco.CheckBoxList";
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Dashboards/ModelsBuilderDashboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ModelsBuilderDashboard : IDashboard
{
public string Alias => "settingsModelsBuilder";

public string[] Sections => new[] {Constants.Applications.Settings };
public string[] Sections => new[] { Constants.Applications.Settings };

public string View => "views/dashboard/settings/modelsbuildermanagement.html";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void AddMultipleUnique<TService1, TService2, TImplementing>(
services.AddUnique<TService2>(factory => (TImplementing)factory.GetRequiredService<TService1>(), lifetime);
}

/// <summary>
/// <summary>
/// Adds a service of type <typeparamref name="TService" /> with an implementation factory method to the specified
/// <see cref="IServiceCollection" />.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal static void AddAllCoreCollectionBuilders(this IUmbracoBuilder builder)
{
builder.CacheRefreshers().Add(() => builder.TypeLoader.GetCacheRefreshers());
builder.DataEditors().Add(() => builder.TypeLoader.GetDataEditors());
builder.Actions().Add(() => builder .TypeLoader.GetActions());
builder.Actions().Add(() => builder.TypeLoader.GetActions());

// register known content apps
builder.ContentApps()
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Dictionary/ICultureDictionaryFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ public interface ICultureDictionaryFactory
{
ICultureDictionary CreateDictionary();

ICultureDictionary CreateDictionary(CultureInfo specificCulture) => throw new NotImplementedException();
ICultureDictionary CreateDictionary(CultureInfo specificCulture) => throw new NotImplementedException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static IEnumerable<CharItem> GetCharReplacements(this RequestHandlerSetti
return RequestHandlerSettings.DefaultCharCollection;
}

/// Merges CharCollection and UserDefinedCharCollection, prioritizing UserDefinedCharCollection.
/// Merges CharCollection and UserDefinedCharCollection, prioritizing UserDefinedCharCollection.
return MergeUnique(requestHandlerSettings.UserDefinedCharCollection, RequestHandlerSettings.DefaultCharCollection);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public static bool IsUpperCase(this char ch) => ch.ToString(CultureInfo.Invarian
/// returns <see langword="false" />.
/// </returns>
public static bool IsNullOrWhiteSpace([NotNullWhen(false)] this string? value) => string.IsNullOrWhiteSpace(value);

[return: NotNullIfNotNull("defaultValue")]
public static string? IfNullOrWhiteSpace(this string? str, string? defaultValue) =>
str.IsNullOrWhiteSpace() ? defaultValue : str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected async Task<HealthCheckStatus> CheckForHeader()
}
else
{
resultType = success ? StatusResultType.Success : StatusResultType.Error;
resultType = success ? StatusResultType.Success : StatusResultType.Error;
}
}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Core/IO/FileSystems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void SetStylesheetFilesystem(IFileSystem fileSystem)
//TODO this is fucked, why do PhysicalFileSystem has a root url? Mvc views cannot be accessed by url!
var macroPartialFileSystem = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, logger, _hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.MacroPartials), _hostingEnvironment.ToAbsolute(Constants.SystemDirectories.MacroPartials));
var partialViewsFileSystem = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, logger, _hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.PartialViews), _hostingEnvironment.ToAbsolute(Constants.SystemDirectories.PartialViews));
var scriptsFileSystem = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, logger, _hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoScriptsPath), _hostingEnvironment.ToAbsolute(_globalSettings.UmbracoScriptsPath));
var scriptsFileSystem = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, logger, _hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoScriptsPath), _hostingEnvironment.ToAbsolute(_globalSettings.UmbracoScriptsPath));
var mvcViewsFileSystem = new PhysicalFileSystem(_ioHelper, _hostingEnvironment, logger, _hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.MvcViews), _hostingEnvironment.ToAbsolute(Constants.SystemDirectories.MvcViews));

_macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, _ioHelper, _hostingEnvironment, _loggerFactory, "macro-partials", IsScoped);
Expand Down Expand Up @@ -350,7 +350,7 @@ private ShadowWrapper CreateShadowWrapperInternal(IFileSystem filesystem, string
{
lock (_shadowLocker)
{
var wrapper = new ShadowWrapper(filesystem, _ioHelper, _hostingEnvironment, _loggerFactory, shadowPath,() => IsScoped?.Invoke());
var wrapper = new ShadowWrapper(filesystem, _ioHelper, _hostingEnvironment, _loggerFactory, shadowPath, () => IsScoped?.Invoke());
if (_shadowCurrentId != null)
{
wrapper.Shadow(_shadowCurrentId);
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/IO/PhysicalFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ protected void WithRetry(Action action)
const int count = 10;
const int pausems = 100;

for (var i = 0;; i++)
for (var i = 0; ; i++)
{
try
{
Expand Down
11 changes: 6 additions & 5 deletions src/Umbraco.Core/IO/ViewHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text;

Check warning on line 1 in src/Umbraco.Core/IO/ViewHelper.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (contrib)

❌ New issue: String Heavy Function Arguments

In this module, 40.0% of all arguments to its 9 functions are strings. The threshold for string arguments is 39.0%. The functions in this file have a high ratio of strings as arguments. Avoid adding more.
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models;
Expand All @@ -11,11 +11,12 @@
private readonly IDefaultViewContentProvider _defaultViewContentProvider;
private readonly IFileSystem _viewFileSystem;

public ViewHelper(FileSystems fileSystems, IDefaultViewContentProvider defaultViewContentProvider)
{
_viewFileSystem = fileSystems.MvcViewsFileSystem ?? throw new ArgumentNullException(nameof(fileSystems));
_defaultViewContentProvider = defaultViewContentProvider ?? throw new ArgumentNullException(nameof(defaultViewContentProvider));
}[Obsolete("Inject IDefaultViewContentProvider instead")]
public ViewHelper(FileSystems fileSystems, IDefaultViewContentProvider defaultViewContentProvider)
{
_viewFileSystem = fileSystems.MvcViewsFileSystem ?? throw new ArgumentNullException(nameof(fileSystems));
_defaultViewContentProvider = defaultViewContentProvider ?? throw new ArgumentNullException(nameof(defaultViewContentProvider));
}
[Obsolete("Inject IDefaultViewContentProvider instead")]
public static string GetDefaultFileContent(string? layoutPageAlias = null, string? modelClassName = null, string? modelNamespace = null, string? modelNamespaceAlias = null)
{
IDefaultViewContentProvider viewContentProvider =
Expand Down
10 changes: 5 additions & 5 deletions src/Umbraco.Core/Install/InstallSteps/TelemetryIdentifierStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public TelemetryIdentifierStep(
_siteIdentifierService = siteIdentifierService;
}

public override Task<InstallSetupResult?> ExecuteAsync(object model)
{
_siteIdentifierService.TryCreateSiteIdentifier(out _);
return Task.FromResult<InstallSetupResult?>(null);
}
public override Task<InstallSetupResult?> ExecuteAsync(object model)
{
_siteIdentifierService.TryCreateSiteIdentifier(out _);
return Task.FromResult<InstallSetupResult?>(null);
}

public override bool RequiresExecution(object model)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Umbraco.Core/Logging/DisposableTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ internal DisposableTimer(
var args = new object[startMessageArgs.Length + 1];
startMessageArgs.CopyTo(args, 0);
args[^1] = _timingId;

if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
{
logger.LogDebug(startMessage + " [Timing {TimingId}]", args);
logger.LogDebug(startMessage + " [Timing {TimingId}]", args);
}
}

Expand Down Expand Up @@ -163,7 +163,7 @@ protected override void DisposeResources()
args[^1] = _timingId;
if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
{
_logger.LogDebug(_endMessage + " ({Duration}ms) [Timing {TimingId}]", args);
_logger.LogDebug(_endMessage + " ({Duration}ms) [Timing {TimingId}]", args);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Manifest/PackageManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public string? PackageName
{
return _packageName;
}

if (!PackageId.IsNullOrWhiteSpace())
{
_packageName = PackageId;
Expand Down
14 changes: 7 additions & 7 deletions src/Umbraco.Core/Models/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public Language(string isoCode, string cultureName)
_cultureName = cultureName ?? throw new ArgumentNullException(nameof(cultureName));
}

/// <inheritdoc />
[DataMember]
public string IsoCode
/// <inheritdoc />
[DataMember]
public string IsoCode
{
get => _isoCode;
set
{
get => _isoCode;
set
{
ArgumentNullException.ThrowIfNull(value);
ArgumentNullException.ThrowIfNull(value);

SetPropertyValueAndDetectChanges(value, ref _isoCode!, nameof(IsoCode));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Core/Models/Mapping/ContentVariantMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private static bool IsDefaultLanguage(ContentVariantDisplay variant) =>
{
// The default segment (null) is always there,
// even when there is no property data at all yet
var segments = new List<string?> {null};
var segments = new List<string?> { null };

// Add actual segments based on the property values
segments.AddRange(content.Properties.SelectMany(p => p.Values.Select(v => v.Segment)));
Expand Down Expand Up @@ -243,7 +243,7 @@ private IEnumerable<string> GetLanguagePermissions<TVariant>(IContent content, M
{
currentUser = currentIUserBackofficeUser;
}
else if(_backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser is not null)
else if (_backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser is not null)
{
currentUser = _backOfficeSecurityAccessor.BackOfficeSecurity.CurrentUser;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public override IEnumerable<Tab<ContentPropertyDisplay>> Map(IMember source, Map
}

// We need this because we call GetCustomGenericProperties from TabsAndPropertiesMapper
// and we have no access to MapMembershipProperties from the base class without casting
// and we have no access to MapMembershipProperties from the base class without casting
protected override IEnumerable<ContentPropertyDisplay> GetCustomGenericProperties(IContentBase content)
{
var member = (IMember)content;
Expand Down Expand Up @@ -176,7 +176,7 @@ internal static ContentPropertyDisplay GetLoginProperty(IMember member, ILocaliz
var prop = new ContentPropertyDisplay
{
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}login",
Label = localizedText.Localize(null,"login"),
Label = localizedText.Localize(null, "login"),
Value = member.Username
};

Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Models/Mapping/UserMapDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private void Map(UserSave source, IUser target, MapperContext context)
}
}

// Umbraco.Code.MapAll -ContentStartNode -UserCount -MediaStartNode -Key -Languages -Sections
// Umbraco.Code.MapAll -ContentStartNode -UserCount -MediaStartNode -Key -Languages -Sections
// Umbraco.Code.MapAll -Notifications -Udi -Trashed -AdditionalData -IsSystemUserGroup
private void Map(IReadOnlyUserGroup source, UserGroupBasic target, MapperContext context)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Models/Membership/IReadOnlyUserGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ public interface IReadOnlyUserGroup

IEnumerable<int> AllowedLanguages => Enumerable.Empty<int>();

public bool HasAccessToLanguage( int languageId) => HasAccessToAllLanguages || AllowedLanguages.Contains(languageId);
public bool HasAccessToLanguage(int languageId) => HasAccessToAllLanguages || AllowedLanguages.Contains(languageId);
}
4 changes: 2 additions & 2 deletions src/Umbraco.Core/Models/Membership/MemberExportModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ public class MemberExportModel
public string? Name { get; set; }
public string? Username { get; set; }
public string? Email { get; set; }
public List<string> Groups { get; set; } = new ();
public List<string> Groups { get; set; } = new();
public string? ContentTypeAlias { get; set; }
public DateTime CreateDate { get; set; }
public DateTime UpdateDate { get; set; }
public List<MemberExportProperty> Properties { get; set; } = new ();
public List<MemberExportProperty> Properties { get; set; } = new();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void InitializeLocked()
}

// otherwise use the old magic null & string comparisons
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string)value) == false);
}

/// <inheritdoc />
Expand Down
3 changes: 2 additions & 1 deletion src/Umbraco.Core/Models/RelationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public RelationType(string alias, string name)
{
}

public RelationType(string? name, string? alias, bool isBidrectional, Guid? parentObjectType, Guid? childObjectType, bool isDependency){
public RelationType(string? name, string? alias, bool isBidrectional, Guid? parentObjectType, Guid? childObjectType, bool isDependency)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Models/Trees/CreateChildEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Umbraco.Cms.Core.Models.Trees;

/// <summary>
/// Represents the refresh node menu item
/// Represents the refresh node menu item
/// </summary>
public sealed class CreateChildEntity : ActionMenuItem
{
Expand Down
Loading