Skip to content

Commit 793c94d

Browse files
committed
Refactor InstallPlaywrightBackgroundService and add linter
Reordered constructor parameters in `InstallPlaywrightBackgroundService` for clarity. Updated exception handling variable name for consistency. Expanded template engine options in `index.html` to include Handlebars. Added a GitHub Actions workflow in `linter.yml` to set up a linting job for code quality checks.
1 parent 176fa51 commit 793c94d

File tree

3 files changed

+58
-5
lines changed

3 files changed

+58
-5
lines changed

.github/workflows/linter.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Lint Code Base
2+
3+
permissions:
4+
contents: read
5+
6+
#############################
7+
# Start the job on all push #
8+
#############################
9+
on:
10+
push:
11+
branches-ignore: [ master ]
12+
# Remove the line above to run when pushing to master
13+
paths: [ 'src/**' ]
14+
pull_request:
15+
branches: [ master, develop ]
16+
paths: [ 'src/**' ]
17+
workflow_dispatch:
18+
19+
###############
20+
# Set the Job #
21+
###############
22+
jobs:
23+
build:
24+
# Name the Job
25+
name: Lint Code Base
26+
# Set the agent to run on
27+
runs-on: ubuntu-latest
28+
29+
##################
30+
# Load all steps #
31+
##################
32+
steps:
33+
##########################
34+
# Checkout the code base #
35+
##########################
36+
- name: Checkout Code
37+
uses: actions/checkout@v4
38+
with:
39+
# Full git history is needed to get a proper list of changed files within `super-linter`
40+
fetch-depth: 0
41+
42+
################################
43+
# Run Linter against code base #
44+
################################
45+
- name: Lint Code Base
46+
uses: super-linter/super-linter@v7.2.0
47+
env:
48+
LINTER_RULES_PATH: '.'
49+
EDITORCONFIG_FILE_NAME: '.editorconfig'
50+
VALIDATE_ALL_CODEBASE: false
51+
VALIDATE_CSHARP: true
52+
DEFAULT_BRANCH: master
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

src/PdfSmith/BackgroundServices/InstallPlaywrightBackgroundService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace PdfSmith.BackgroundServices;
55

6-
public class InstallPlaywrightBackgroundService(ILogger<InstallPlaywrightBackgroundService> logger, PlaywrightHealthCheck playwrightHealthCheck) : BackgroundService
6+
public class InstallPlaywrightBackgroundService(PlaywrightHealthCheck playwrightHealthCheck, ILogger<InstallPlaywrightBackgroundService> logger) : BackgroundService
77
{
88
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
99
{
@@ -15,12 +15,12 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
1515
{
1616
return Microsoft.Playwright.Program.Main(["install", "chromium"]);
1717
}
18-
catch (PlaywrightException playwrightException)
18+
catch (PlaywrightException ex)
1919
{
20-
logger.LogError(playwrightException, "Error while installing Chromium");
20+
logger.LogError(ex, "Error while installing Chromium");
2121
return -1;
2222
}
23-
});
23+
}, stoppingToken);
2424

2525
var playwrightStatus = returnCode switch
2626
{

src/PdfSmith/wwwroot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h3>Lightning Fast</h3>
4848
<div class="feature-card">
4949
<div class="feature-icon">🎨</div>
5050
<h3>Multiple Template Engines</h3>
51-
<p>Choose between Razor and Scriban template engines for maximum flexibility and power</p>
51+
<p>Choose between Razor, Scriban and Handlebars template engines for maximum flexibility and power</p>
5252
</div>
5353
<div class="feature-card">
5454
<div class="feature-icon">🔐</div>

0 commit comments

Comments
 (0)