Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: code analysis #2454

Closed
swharden opened this issue Mar 5, 2023 · 2 comments · Fixed by #2455
Closed

CI: code analysis #2454

swharden opened this issue Mar 5, 2023 · 2 comments · Fixed by #2455

Comments

@swharden
Copy link
Member

swharden commented Mar 5, 2023

There exists a GitHub Action which uploads files to the ScottPlot developer site http://dev.scottplot.net hosted by GitHub Pages

name: Update Developer Website
# This script copies contents of /dev/www to dev.scottplot.net (hosted by GitHub Pages)
on:
workflow_dispatch:
push: # only runs on commits to main branch (typically after a merge)
branches:
- main
paths:
- "dev/www/**"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
publish:
name: Deploy
runs-on: ubuntu-latest
environment:
name: Cookbook
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
- name: 🛠️ Configure Pages
uses: actions/configure-pages@v2
- name: 📦 Upload Artifact
uses: actions/upload-pages-artifact@v1
with:
path: "./dev/www"
- name: 🚀 Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

It would be interesting to have the CI system generate basic code analysis statistics and update a page on that website. I would be interested to know the total lines of code (separated by ScottPlot 4 and ScottPlot 5) and perhaps cyclomatic complexity by class or namespace would be useful too.

It looks like official packages can be used to evaluate code metrics

Rabbit Hole

Generate Code Analysis Metrics from the Command Line

Note: this may not work on multi-target csproj files

dotnet add package Microsoft.CodeAnalysis.Metrics
dotnet build -target:Metrics

multi-targeted projects must specify a framework:

dotnet build --framework net6.0 -target:Metrics

indicate private assets to avoid the package from being included in NuGet packages

<PackageReference Include="Microsoft.CodeAnalysis.Metrics" Version="*" >
    <PrivateAssets>all</PrivateAssets>
</PackageReference>
@swharden
Copy link
Member Author

swharden commented Mar 5, 2023

@swharden
Copy link
Member Author

swharden commented Mar 9, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant