Skip to content

Commit b35f1cf

Browse files
committed
feat: init commit
1 parent 206a4ea commit b35f1cf

File tree

6 files changed

+452
-2
lines changed

6 files changed

+452
-2
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release Package
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
pack:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Setup NuGet.exe for use with actions
15+
uses: NuGet/[email protected]
16+
with:
17+
nuget-api-key: ${{ secrets.NUGETAPIKEY }}
18+
19+
- name: Nuget Push
20+
run: |
21+
Version=${GITHUB_REF:10}
22+
sed -i "s/\(<RuleSetVersion>\)[^<]*\(<\/RuleSetVersion>\)/\1$Version\2/" ./src/build/Cnblogs.CodeQuality.props
23+
nuget pack ./src/Cnblogs.CodeQuality.nuspec -Version "$Version"
24+
nuget push ./Cnblogs.CodeQuality.$Version.nupkg -NonInteractive -Source https://api.nuget.org/v3/index.json

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
1-
# code-quality
2-
A bunch of ruleset used by cnblogs
1+
# Cnblogs.CodeQuality
2+
A bunch of rulesets used by Cnblogs, including StyleCop (`SA-XXXX`) and some other rules (`CA-XXXX`, `IDE-XXXX`, `DOC-XXXX`).
3+
4+
## How to use
5+
6+
If you just want to apply style check in several projects, just install the `Cnblogs.CodeQuality` package on them.
7+
8+
If you want to apply it solution wide, add the code below to your `Directory.Build.props` file.
9+
10+
```xml
11+
<ItemGroup>
12+
<PackageReference Include="Cnblogs.CodeQuality" Version="1.1.0">
13+
<PrivateAssets>all</PrivateAssets>
14+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15+
</PackageReference>
16+
</ItemGroup>
17+
```
18+
19+
Rebuild you project/solution, `SA-XXXX` warnings or errors (if any) should appeared in your build output.
20+
21+
If you are using Rider or Visual Studio, you may get quick fixes by enable the Roslyn analyzers in your IDE settings.
22+
23+
**Rider Settings:** Editor -> Inspection Settings -> Roslyn Analyzers ([.NET Compiler Platform (Roslyn) Analyzers—JetBrains Rider](https://www.jetbrains.com/help/rider/Using_NET_Compiler_Analyzers.html))

src/Cnblogs.CodeQuality.nuspec

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
3+
<metadata>
4+
<id>Cnblogs.CodeQuality</id>
5+
<title>Cnblogs.CodeQuality</title>
6+
<version>$Version$</version>
7+
<authors>Cnblogs</authors>
8+
<owners>Cnblogs</owners>
9+
<developmentDependency>true</developmentDependency>
10+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
11+
<license type="expression">MIT</license>
12+
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
13+
<projectUrl>https://github.com/cnblogs/code-quality</projectUrl>
14+
<releaseNotes>https://github.com/cnblogs/code-quality/releases</releaseNotes>
15+
<description>Roslyn analyzer rulesets used by Cnblogs</description>
16+
<dependencies>
17+
<dependency id="StyleCop.Analyzers" version="[1.2.0-beta.312,1.3.0)" />
18+
</dependencies>
19+
</metadata>
20+
</package>

0 commit comments

Comments
 (0)