Skip to content

Commit

Permalink
chore(workflows): add linting job
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Dec 31, 2024
1 parent 4294afd commit 4d52563
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,61 @@ jobs:

# Cleanup
- name: Cleanup temporary files
run: rm -rf _temp
run: rm -rf _temp

lint:
name: Run Code Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Create temporary solution
run: |
mkdir -p _temp
cd _temp
# Create solution and project
dotnet new sln -n TempSolution
dotnet new classlib -n TempProject
rm ./TempProject/Class1.cs
# Add StyleCop.Analyzers package
cd TempProject
dotnet add package StyleCop.Analyzers
# Configure project settings
cat > stylecop.json << EOF
{
"\$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"documentationRules": {
"companyName": "Your Company",
"documentInterfaces": false,
"documentInternalElements": false,
"documentPrivateElements": false,
"documentPrivateFields": false,
"documentationCulture": "en-US"
}
}
}
EOF
# Add stylecop.json to project
echo '<Project><ItemGroup><AdditionalFiles Include="stylecop.json" /></ItemGroup></Project>' > Directory.Build.props
# Copy all .cs files
find ../../Assets -name "*.cs" -exec cp {} ./ \;
cd ..
dotnet sln add ./TempProject/TempProject.csproj
cd ..
- name: Run Code Analysis
run: |
cd _temp
dotnet build /p:TreatWarningsAsErrors=false /p:EnforceCodeStyleInBuild=true

0 comments on commit 4d52563

Please sign in to comment.