Skip to content

Commit 1136713

Browse files
committed
Updated .editorconfig to the newest version and reformatted the C# files accordingly
1 parent 5f0db22 commit 1136713

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

src/.editorconfig

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ csharp_style_unused_value_assignment_preference = discard_variable:suggestion
105105
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
106106

107107
# 'using' directive preferences
108-
csharp_using_directive_placement = outside_namespace:silent
108+
csharp_using_directive_placement = outside_namespace:warning
109109

110110
#### C# Formatting Rules ####
111111

@@ -127,7 +127,7 @@ csharp_indent_labels = no_change
127127
csharp_indent_switch_labels = true
128128

129129
# Space preferences
130-
csharp_space_after_cast = false
130+
csharp_space_after_cast = true
131131
csharp_space_after_colon_in_inheritance_clause = true
132132
csharp_space_after_comma = true
133133
csharp_space_after_dot = false
@@ -194,4 +194,13 @@ dotnet_naming_style.pascal_case.capitalization = pascal_case
194194
dotnet_naming_style.begins_with_i.required_prefix = I
195195
dotnet_naming_style.begins_with_i.required_suffix =
196196
dotnet_naming_style.begins_with_i.word_separator =
197-
dotnet_naming_style.begins_with_i.capitalization = pascal_case
197+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
198+
199+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
200+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
201+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
202+
203+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
204+
205+
dotnet_naming_style.instance_field_style.capitalization = camel_case
206+
dotnet_naming_style.instance_field_style.required_prefix = _

src/Skybrud.Umbraco.MultiNodeTreePicker/Composers/MntpComposer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
using Umbraco.Cms.Core.WebAssets;
55

66
namespace Skybrud.Umbraco.MultiNodeTreePicker.Composers {
7-
7+
88
internal sealed class MntpComposer : IComposer {
9-
9+
1010
public void Compose(IUmbracoBuilder builder) {
1111
builder.WithCollectionBuilder<MntpConverterCollectionBuilder>().Add(() => builder.TypeLoader.GetTypes<IMntpItemConverter>());
1212
builder.BackOfficeAssets().Append<BackOfficeJavaScriptAsset>();
1313
}
1414

1515
public class BackOfficeJavaScriptAsset : IAssetFile {
16-
16+
1717
public AssetType DependencyType => AssetType.Javascript;
1818

1919
public string FilePath { get; set; }

src/Skybrud.Umbraco.MultiNodeTreePicker/Controllers/MntpController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Umbraco.Cms.Web.Common.Attributes;
55

66
namespace Skybrud.Umbraco.MultiNodeTreePicker.Controllers {
7-
7+
88
[PluginController("Skybrud")]
99
public class MntpController : UmbracoAuthorizedApiController {
1010

src/Skybrud.Umbraco.MultiNodeTreePicker/PropertyEditors/MntpEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
using Umbraco.Cms.Core.PropertyEditors;
33

44
namespace Skybrud.Umbraco.MultiNodeTreePicker.PropertyEditors {
5-
5+
66
[DataEditor(EditorAlias, "Skybrud Multinode Treepicker", EditorView, ValueType = ValueTypes.Text, Group = "Skybrud.dk", Icon = "icon-page-add color-skybrud")]
77
public class MntpEditor : MultiNodeTreePickerPropertyEditor {
88

99
internal const string EditorAlias = "Skybrud.Umbraco.MultiNodeTreePicker";
1010

1111
internal const string EditorView = "contentpicker";
12-
12+
1313
private readonly IIOHelper _iOHelper;
1414

1515
public MntpEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper iOHelper) : base(dataValueEditorFactory, iOHelper) {

src/Skybrud.Umbraco.MultiNodeTreePicker/PropertyEditors/ValueConverters/MntpValueConverter.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ public override object ConvertIntermediateToObject(IPublishedElement owner, IPub
5757
// Return "value" if the data type isn't configured with an item converter
5858
if (propertyType.DataType.Configuration is not MntpConfiguration config) return value;
5959
if (config.ItemConverter == null) return value;
60-
60+
6161
// Get the key of the converter
6262
string key = config.ItemConverter.GetString("key");
63-
63+
6464
// Return "value" if item converter wasn't found
6565
if (!_converterCollection.TryGet(key, out IMntpItemConverter converter)) return value;
66-
66+
6767
switch (value) {
68-
68+
6969
// If "value" is a single item, we can call the converter directly
7070
case IPublishedContent item:
7171
return converter.Convert(propertyType, item);
@@ -110,13 +110,13 @@ public override Type GetPropertyValueType(IPublishedPropertyType propertyType) {
110110
}
111111

112112
private object GetPickerValue(IPublishedPropertyType propertyType, object source, bool preview) {
113-
113+
114114
if (source == null) return null;
115115

116116
Udi[] udis = source as Udi[] ?? Array.Empty<Udi>();
117117
if (propertyType.Alias.Equals(Constants.Conventions.Content.InternalRedirectId)) return udis.FirstOrDefault();
118118
if (propertyType.Alias.Equals(Constants.Conventions.Content.Redirect)) return udis.FirstOrDefault();
119-
119+
120120
// Get a reference to the current published snapshot
121121
_publishedSnapshotAccessor.TryGetPublishedSnapshot(out IPublishedSnapshot publishedSnapshot);
122122
if (publishedSnapshot == null) return source;
@@ -134,7 +134,7 @@ private object GetPickerValue(IPublishedPropertyType propertyType, object source
134134
if (guidUdi == null) continue;
135135

136136
IPublishedContent item = null;
137-
137+
138138
switch (udi.EntityType) {
139139
case Constants.UdiEntityType.Document:
140140
item = publishedSnapshot.Content.GetById(preview, guidUdi.Guid);

0 commit comments

Comments
 (0)