Skip to content

Commit

Permalink
Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
na1307 committed Dec 19, 2024
1 parent 6ac272f commit ab0c983
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 55 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Deploy GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Cache NuGet
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Directory.Packages.props') }} #hash of project files
restore-keys: ${{ runner.os }}-nuget-
- name: Prepare Blazor WASM for GitHub Pages
uses: na1307/blazor-github-pages@v1
id: prepare
with:
project-path: Bluehill.Analyzers.Pages/Bluehill.Analyzers.Pages.csproj
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ steps.prepare.outputs.wwwroot-path }}

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions Bluehill.Analyzers.Pages/Bluehill.Analyzers.Pages.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ItemGroup>
<PackageReference Include="Bluehill.Blazor" />
<PackageReference Include="Bluehill.Blazor.GHPage" />
<PackageReference Include="HighlightBlazor" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" PrivateAssets="all" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Bluehill.Analyzers.Pages/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@using Bluehill.Blazor.Layout
@inherits LayoutComponentBase

<TopRowBluehillLayout HeadLinks="@([])" Body="@Body"/>
<TopRowBluehillLayout HeadLinks="@([new("Home", "."), new("Rules", "rules")])" Body="@Body"/>
33 changes: 33 additions & 0 deletions Bluehill.Analyzers.Pages/Pages/BH0001.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@page "/BH0001"

<h1>BH0001: Classes without derived types should be sealed</h1>

<p>Classes without derived types should be sealed. Note: Sealed or abstract classes, and static classes are not included in this rule.</p>

<h2>Code with violation</h2>

<CodeHighlight>
public class TestClass {
public void TestMethod() {
Console.WriteLine("Test");
}
}

public class AnotherClass;

public class InheritedClass : AnotherClass;
</CodeHighlight>

<h2>Fixed Code</h2>

<CodeHighlight>
public sealed class TestClass {
public void TestMethod() {
Console.WriteLine("Test");
}
}

public class AnotherClass;

public sealed class InheritedClass : AnotherClass;
</CodeHighlight>
37 changes: 37 additions & 0 deletions Bluehill.Analyzers.Pages/Pages/BH0002.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@page "/BH0002"

<h1>BH0002: Fields should be at the top of the type definition</h1>

<p>Fields should be at the top of the type definition.</p>

<h2>Code with violation</h2>

<CodeHighlight>
public class TestClass {
public TestClass(string name) {
this.name = name;
}

public void TestMethod() {
Console.WriteLine(name);
}

private readonly string name;
}
</CodeHighlight>

<h2>Fixed Code</h2>

<CodeHighlight>
public class TestClass {
private readonly string name;

public TestClass(string name) {
this.name = name;
}

public void TestMethod() {
Console.WriteLine(name);
}
}
</CodeHighlight>
4 changes: 4 additions & 0 deletions Bluehill.Analyzers.Pages/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
<PageTitle>Bluehill.Analyzers</PageTitle>

<h1>Bluehill.Analyzers</h1>

<p>These pages describe the Bluehill.Analyzers analyzer.</p>

<p><NavLink href="Rules">Rules</NavLink></p>
8 changes: 8 additions & 0 deletions Bluehill.Analyzers.Pages/Pages/Rules.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/rules"

<h1>Rules</h1>

<ul>
<li><NavLink href="BH0001">BH0001</NavLink></li>
<li><NavLink href="BH0002">BH0002</NavLink></li>
</ul>
1 change: 1 addition & 0 deletions Bluehill.Analyzers.Pages/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@using Microsoft.JSInterop
@using Bluehill.Analyzers.Pages
@using Bluehill.Analyzers.Pages.Layout
@using HighlightBlazor
10 changes: 10 additions & 0 deletions Bluehill.Analyzers.Pages/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
"Microsoft.AspNetCore.Components.WebAssembly": "8.0.11"
}
},
"HighlightBlazor": {
"type": "Direct",
"requested": "[0.1.10, )",
"resolved": "0.1.10",
"contentHash": "Se6/AvDiBm8K0k+rWVxP/nFnkmjqBTEOuFowAiAHum0zYZw/q18jZNc6gKviFvDaLeXjXNzzn+qIjrLT3udgIA==",
"dependencies": {
"Microsoft.AspNetCore.Components": "3.1.19",
"Microsoft.AspNetCore.Components.Web": "3.1.19"
}
},
"Microsoft.AspNetCore.Components.WebAssembly": {
"type": "Direct",
"requested": "[9.0.0, )",
Expand Down
2 changes: 2 additions & 0 deletions Bluehill.Analyzers.Pages/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/app.css" />
<link href="Bluehill.Analyzers.Pages.styles.css" rel="stylesheet" />
<link href="_content/HighlightBlazor/highlight-blazor-styles.css" rel="stylesheet">
<script src="_content/HighlightBlazor/highlight-blazor.js"></script>
</head>

<body>
Expand Down
63 changes: 15 additions & 48 deletions Bluehill.Analyzers/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Bluehill.Analyzers/Resources.ko.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="BH0001AnalyzerDescription" xml:space="preserve">
<value>파생 형식이 없는 형식은 봉인되어야 합니다.</value>
<value>파생 형식이 없는 클래스는 봉인되어야 합니다.</value>
<comment>An optional longer localizable description of the diagnostic.</comment>
</data>
<data name="BH0001AnalyzerMessageFormat" xml:space="preserve">
<value>'{0}' 형식에서 파생된 형식이 없음</value>
<value>'{0}' 클래스에서 파생된 형식이 없음</value>
<comment>The format-able message the diagnostic displays.</comment>
</data>
<data name="BH0001AnalyzerTitle" xml:space="preserve">
<value>파생 형식이 없는 형식은 봉인되어야 함</value>
<value>파생 형식이 없는 클래스는 봉인되어야 함</value>
<comment>The title of the diagnostic.</comment>
</data>
<data name="BH0002AnalyzerDescription" xml:space="preserve">
Expand Down
6 changes: 3 additions & 3 deletions Bluehill.Analyzers/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="BH0001AnalyzerDescription" xml:space="preserve">
<value>Types without derived types should be sealed.</value>
<value>Classes without derived types should be sealed.</value>
<comment>An optional longer localizable description of the diagnostic.</comment>
</data>
<data name="BH0001AnalyzerMessageFormat" xml:space="preserve">
<value>No types are derived from type '{0}'</value>
<value>No types are derived from class '{0}'</value>
<comment>The format-able message the diagnostic displays.</comment>
</data>
<data name="BH0001AnalyzerTitle" xml:space="preserve">
<value>Types without derived types should be sealed</value>
<value>Classes without derived types should be sealed</value>
<comment>The title of the diagnostic.</comment>
</data>
<data name="BH0002AnalyzerDescription" xml:space="preserve">
Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ItemGroup>
<PackageVersion Include="Bluehill.Blazor" Version="0.8.1" />
<PackageVersion Include="Bluehill.Blazor.GHPage" Version="0.8.1" />
<PackageVersion Include="HighlightBlazor" Version="0.1.10" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
Expand Down

0 comments on commit ab0c983

Please sign in to comment.