Skip to content

Commit 26d4132

Browse files
committed
Apply CSharpier formattings
1 parent 2c35589 commit 26d4132

File tree

309 files changed

+5644
-4576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+5644
-4576
lines changed

samples/Samples.DateInput/LocalDateDateInputModelConverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public override object CreateModelFromDate(Type modelType, DateOnly date)
1717
{
1818
var localDate = (LocalDate?)model;
1919

20-
return localDate.HasValue ?
21-
new DateOnly(localDate.Value.Year, localDate.Value.Month, localDate.Value.Day) :
22-
null;
20+
return localDate.HasValue
21+
? new DateOnly(localDate.Value.Year, localDate.Value.Month, localDate.Value.Day)
22+
: null;
2323
}
2424
}

samples/Samples.DateInput/Pages/Index.cshtml.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ public class IndexModel : PageModel
1414
[Required(ErrorMessage = "Enter your date of birth")]
1515
public LocalDate? DateOfBirth { get; set; }
1616

17-
public void OnGet()
18-
{
19-
}
17+
public void OnGet() { }
2018

21-
public void OnPost()
22-
{
23-
}
19+
public void OnPost() { }
2420
}

samples/Samples.DateInput/Startup.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public void ConfigureServices(IServiceCollection services)
2323
options.DateInputModelConverters.Add(new LocalDateDateInputModelConverter());
2424
});
2525

26-
services.AddRazorPages()
27-
.AddViewOptions(options => options.HtmlHelperOptions.ClientValidationEnabled = false);
26+
services.AddRazorPages().AddViewOptions(options => options.HtmlHelperOptions.ClientValidationEnabled = false);
2827
}
2928

3029
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

samples/Samples.MvcStarter/Startup.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5656
{
5757
var pageTemplateHelper = app.ApplicationServices.GetRequiredService<PageTemplateHelper>();
5858

59-
csp.ByDefaultAllow
60-
.FromSelf();
59+
csp.ByDefaultAllow.FromSelf();
6160

62-
csp.AllowScripts
63-
.FromSelf()
61+
csp.AllowScripts.FromSelf()
6462
//.AddNonce()
6563
.From(pageTemplateHelper.GetCspScriptHashes(pathBase: ""));
6664
});

src/GovUk.Frontend.AspNetCore.DocSamples/Pages/TextInput/TextInputWithModelBinding.cshtml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ public class TextInputWithModelBindingModel : PageModel
1111
[Required(ErrorMessage = "Enter the name of the event")]
1212
public string? EventName { get; set; }
1313

14-
public void OnGet()
15-
{
16-
}
14+
public void OnGet() { }
1715
}

src/GovUk.Frontend.AspNetCore.DocSamplesScreenshotter/Program.cs

Lines changed: 66 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ static async Task Main()
1919
{
2020
const string baseUrl = "http://localhost:9919";
2121

22-
var repoRoot = typeof(Program).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
22+
var repoRoot = typeof(Program)
23+
.Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
2324
.Single(a => a.Key == "RepoRoot")
2425
.Value!;
2526

@@ -29,69 +30,72 @@ static async Task Main()
2930
using var host = hostBuilder.Build();
3031
await host.StartAsync();
3132

32-
var logger = host.Services.GetRequiredService<ILoggerFactory>()
33+
var logger = host
34+
.Services.GetRequiredService<ILoggerFactory>()
3335
.CreateLogger("GovUk.Frontend.AspNetCore.DocSamplesScreenshotter");
3436

3537
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
36-
var browser = await Puppeteer.LaunchAsync(new LaunchOptions()
37-
{
38-
Headless = true
39-
});
38+
var browser = await Puppeteer.LaunchAsync(new LaunchOptions() { Headless = true });
4039

41-
await WriteScreenshots(new[]
42-
{
43-
("Accordion/AccordionWithSummarySections", "accordion-with-summary-sections.png"),
44-
("BackLink/BackLinkWithDefaultContent", "back-link-with-default-content.png"),
45-
("BackLink/BackLinkWithCustomContent", "back-link-with-custom-content.png"),
46-
("Breadcrumbs/Breadcrumbs", "breadcrumbs.png"),
47-
("Button/DefaultButton", "button-default.png"),
48-
("Button/SecondaryButton", "button-secondary.png"),
49-
("Button/StartButton", "button-start.png"),
50-
("Button/DisabledButton", "button-disabled.png"),
51-
("Checkboxes/Checkboxes", "checkboxes.png"),
52-
("Checkboxes/CheckboxesWithConditional", "checkboxes-with-conditional.png"),
53-
("Checkboxes/CheckboxesWithError", "checkboxes-with-error.png"),
54-
("Checkboxes/CheckboxesWithNone", "checkboxes-with-none.png"),
55-
("Checkboxes/CheckboxesWithoutFieldset", "checkboxes-without-fieldset.png"),
56-
("CharacterCount/CharacterCount", "character-count.png"),
57-
("DateInput/DateInput", "date-input.png"),
58-
("DateInput/DateInputWithCustomItemLabels", "date-input-with-custom-labels.png"),
59-
("DateInput/DateInputWithCustomItemValues", "date-input-with-custom-values.png"),
60-
("DateInput/DateInputWithError", "date-input-with-error.png"),
61-
("DateInput/DateInputWithFieldset", "date-input-with-fieldset.png"),
62-
("Details/Details", "details.png"),
63-
("Details/DetailsExpanded", "details-expanded.png"),
64-
("ErrorSummary/ErrorSummary", "error-summary.png"),
65-
("ErrorSummary/ErrorSummaryWithModelStateError", "error-summary-with-modelstate-error.png"),
66-
("ErrorSummary/ErrorSummaryWithTitle", "error-summary-with-title.png"),
67-
("FileUpload/FileUpload", "file-upload.png"),
68-
("FileUpload/FileUploadWithErrors", "file-upload-with-errors.png"),
69-
("InsetText/InsetText", "inset-text.png"),
70-
("NotificationBanner/NotificationBanner", "notification-banner.png"),
71-
("NotificationBanner/NotificationBannerSuccess", "notification-banner-success.png"),
72-
("NotificationBanner/NotificationBannerWithOverridenTitle", "notification-banner-with-overriden-title.png"),
73-
("Pagination/Pagination", "pagination.png"),
74-
("Pagination/Stacked", "pagination-stacked.png"),
75-
("Pagination/WithEllipsis", "pagination-with-ellipsis.png"),
76-
("Panel/Panel", "panel.png"),
77-
("Radios/Radios", "radios.png"),
78-
("Radios/RadiosWithConditional", "radios-with-conditional.png"),
79-
("Radios/RadiosWithError", "radios-with-error.png"),
80-
("Select/Select", "select.png"),
81-
("SummaryList/SummaryListWithActions", "summary-list-with-actions.png"),
82-
("SummaryList/SummaryListWithCard", "summary-list-with-card.png"),
83-
("SummaryList/SummaryListWithoutActions", "summary-list-without-actions.png"),
84-
("PhaseBanner/PhaseBanner", "phase-banner.png"),
85-
("Tabs/Tabs", "tabs.png"),
86-
("Tag/DefaultTag", "tag-default.png"),
87-
("Tag/TagWithClass", "tag-with-class.png"),
88-
("TextArea/TextArea", "textarea.png"),
89-
("TextInput/TextInput", "text-input.png"),
90-
("TextInput/TextInputWithError", "text-input-with-error.png"),
91-
("TextInput/TextInputWithPrefixAndSuffix", "text-input-with-prefix-and-suffix.png"),
92-
("TextInput/TextInputWithModelBinding", "text-input-with-modelbinding.png"),
93-
("WarningText/WarningText", "warning-text.png")
94-
});
40+
await WriteScreenshots(
41+
new[]
42+
{
43+
("Accordion/AccordionWithSummarySections", "accordion-with-summary-sections.png"),
44+
("BackLink/BackLinkWithDefaultContent", "back-link-with-default-content.png"),
45+
("BackLink/BackLinkWithCustomContent", "back-link-with-custom-content.png"),
46+
("Breadcrumbs/Breadcrumbs", "breadcrumbs.png"),
47+
("Button/DefaultButton", "button-default.png"),
48+
("Button/SecondaryButton", "button-secondary.png"),
49+
("Button/StartButton", "button-start.png"),
50+
("Button/DisabledButton", "button-disabled.png"),
51+
("Checkboxes/Checkboxes", "checkboxes.png"),
52+
("Checkboxes/CheckboxesWithConditional", "checkboxes-with-conditional.png"),
53+
("Checkboxes/CheckboxesWithError", "checkboxes-with-error.png"),
54+
("Checkboxes/CheckboxesWithNone", "checkboxes-with-none.png"),
55+
("Checkboxes/CheckboxesWithoutFieldset", "checkboxes-without-fieldset.png"),
56+
("CharacterCount/CharacterCount", "character-count.png"),
57+
("DateInput/DateInput", "date-input.png"),
58+
("DateInput/DateInputWithCustomItemLabels", "date-input-with-custom-labels.png"),
59+
("DateInput/DateInputWithCustomItemValues", "date-input-with-custom-values.png"),
60+
("DateInput/DateInputWithError", "date-input-with-error.png"),
61+
("DateInput/DateInputWithFieldset", "date-input-with-fieldset.png"),
62+
("Details/Details", "details.png"),
63+
("Details/DetailsExpanded", "details-expanded.png"),
64+
("ErrorSummary/ErrorSummary", "error-summary.png"),
65+
("ErrorSummary/ErrorSummaryWithModelStateError", "error-summary-with-modelstate-error.png"),
66+
("ErrorSummary/ErrorSummaryWithTitle", "error-summary-with-title.png"),
67+
("FileUpload/FileUpload", "file-upload.png"),
68+
("FileUpload/FileUploadWithErrors", "file-upload-with-errors.png"),
69+
("InsetText/InsetText", "inset-text.png"),
70+
("NotificationBanner/NotificationBanner", "notification-banner.png"),
71+
("NotificationBanner/NotificationBannerSuccess", "notification-banner-success.png"),
72+
(
73+
"NotificationBanner/NotificationBannerWithOverridenTitle",
74+
"notification-banner-with-overriden-title.png"
75+
),
76+
("Pagination/Pagination", "pagination.png"),
77+
("Pagination/Stacked", "pagination-stacked.png"),
78+
("Pagination/WithEllipsis", "pagination-with-ellipsis.png"),
79+
("Panel/Panel", "panel.png"),
80+
("Radios/Radios", "radios.png"),
81+
("Radios/RadiosWithConditional", "radios-with-conditional.png"),
82+
("Radios/RadiosWithError", "radios-with-error.png"),
83+
("Select/Select", "select.png"),
84+
("SummaryList/SummaryListWithActions", "summary-list-with-actions.png"),
85+
("SummaryList/SummaryListWithCard", "summary-list-with-card.png"),
86+
("SummaryList/SummaryListWithoutActions", "summary-list-without-actions.png"),
87+
("PhaseBanner/PhaseBanner", "phase-banner.png"),
88+
("Tabs/Tabs", "tabs.png"),
89+
("Tag/DefaultTag", "tag-default.png"),
90+
("Tag/TagWithClass", "tag-with-class.png"),
91+
("TextArea/TextArea", "textarea.png"),
92+
("TextInput/TextInput", "text-input.png"),
93+
("TextInput/TextInputWithError", "text-input-with-error.png"),
94+
("TextInput/TextInputWithPrefixAndSuffix", "text-input-with-prefix-and-suffix.png"),
95+
("TextInput/TextInputWithModelBinding", "text-input-with-modelbinding.png"),
96+
("WarningText/WarningText", "warning-text.png"),
97+
}
98+
);
9599

96100
await browser.CloseAsync();
97101
await host.StopAsync();
@@ -136,7 +140,8 @@ async Task WriteScreenshot(string pagePath, string screenshotPath)
136140
{
137141
throw new ArgumentException(
138142
$"Unsuccessful response ({(int)response.Status}) for '{pagePath}'.",
139-
nameof(pagePath));
143+
nameof(pagePath)
144+
);
140145
}
141146

142147
var container = await page.WaitForSelectorAsync("#container");

src/GovUk.Frontend.AspNetCore/CheckboxesItemBehavior.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
namespace GovUk.Frontend.AspNetCore;
32

43
/// <summary>
@@ -14,5 +13,5 @@ public enum CheckboxesItemBehavior
1413
/// <summary>
1514
/// Indicates that when this item is checked then no other items should be checked.
1615
/// </summary>
17-
Exclusive = 1
16+
Exclusive = 1,
1817
}

src/GovUk.Frontend.AspNetCore/ComponentGeneration/BackLinkOptions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ public class BackLinkOptions
1212
public string? Classes { get; set; }
1313
public IReadOnlyDictionary<string, string?>? Attributes { get; set; }
1414

15-
internal void Validate()
16-
{
17-
}
15+
internal void Validate() { }
1816
}

src/GovUk.Frontend.AspNetCore/ComponentGeneration/ButtonOptions.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ internal void Validate()
2929

3030
if (Element == "input" && IsStartButton == true)
3131
{
32-
throw new InvalidOptionsException(GetType(), $"{nameof(IsStartButton)} cannot be specified for 'input' elements.");
32+
throw new InvalidOptionsException(
33+
GetType(),
34+
$"{nameof(IsStartButton)} cannot be specified for 'input' elements."
35+
);
3336
}
3437

3538
if (Element != "button" && PreventDoubleClick == true)
3639
{
37-
throw new InvalidOptionsException(GetType(), $"{nameof(PreventDoubleClick)} can only be specified for 'button' elements.");
40+
throw new InvalidOptionsException(
41+
GetType(),
42+
$"{nameof(PreventDoubleClick)} can only be specified for 'button' elements."
43+
);
3844
}
3945

4046
if (Element == "a" && Disabled is not null)

src/GovUk.Frontend.AspNetCore/ComponentGeneration/CookieBannerOptions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ public record CookieBannerOptions
1212
public IReadOnlyDictionary<string, string?>? Attributes { get; set; }
1313
public IReadOnlyCollection<CookieBannerOptionsMessage>? Messages { get; set; }
1414

15-
internal void Validate()
16-
{
17-
}
15+
internal void Validate() { }
1816
}
1917

2018
public record CookieBannerOptionsMessage

0 commit comments

Comments
 (0)