Our great sponsors
-
scc
Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
name: cloc on: pull_request: jobs: cloc: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 with: path: pr - name: Checkout base code uses: actions/checkout@v2 with: ref: ${{ github.event.pull_request.base.sha }} path: base - name: Count Lines Of Code id: loc run: | curl -OL https://github.com/vearutop/sccdiff/releases/download/v1.0.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz OUTPUT=$(cd pr && ../sccdiff -basedir ../base) OUTPUT="${OUTPUT//'%'/'%25'}" OUTPUT="${OUTPUT//$'\n'/'%0A'}" OUTPUT="${OUTPUT//$'\r'/'%0D'}" echo "::set-output name=diff::$OUTPUT" - name: Comment Code Lines uses: marocchino/sticky-pull-request-comment@v2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} header: LOC message: | ### Lines Of Code ${{ steps.loc.outputs.diff }}
Such a comment can be added to a PR using GitHub Action and a small tool built on top of an awesome scc.
Related posts
- Scc: A fast code counter with complexity calculations and COCOMO estimates
- Building a custom code search index in Go for searchcode.com
- A fast accurate code counter with complexity calculations and COCOMO estimates
- Introducing next generation of no-code application builder with fullstack codebase export. Offering free application build service and 50% off for limited time.
- Lines of code per *repo* from command line