sccdiff

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 17 Imported by: 0

README

sccdiff

Build Status Coverage Status GoDevDoc Time Tracker Code lines Comments

A tool to show the stats of code changes grouped by language, based on scc.

Usage

sccdiff -help
Usage of sccdiff:
  -all
        Include unmodified records in report.
  -basedir string
        Base directory.
  -baseref string
        Base reference. (default "HEAD")
  -version
        Show app version and exit.

Result is an ASCII formatted table, suitable for Markdown.

| Language  | Files  |   Lines    |    Code    | Comments |  Blanks  | Complexity |    Bytes     |
|-----------|--------|------------|------------|----------|----------|------------|--------------|
| Go        | 2 (+2) | 385 (+385) | 298 (+298) | 1 (+1)   | 86 (+86) | 51 (+51)   | 7.4K (+7.4K) |
| Go (test) | 2 (+1) | 78 (+75)   | 58 (+56)   | 0        | 20 (+19) | 1 (+1)     | 1.8K (+1.7K) |
| License   | 1      | 21         | 17         | 0        | 4        | 0          | 1.1K (+13B)  |
| Makefile  | 1      | 40 (+1)    | 29 (+1)    | 4        | 7        | 2          | 1.2K (+42B)  |
| Markdown  | 1      | 30 (+13)   | 24 (+12)   | 0        | 6 (+1)   | 0          | 1.7K (+759B) |
| Shell     | 0 (-1) | 0 (-22)    | 0 (-15)    | 0 (-2)   | 0 (-5)   | 0          | 0B (-764B)   |
| YAML      | 5      | 308 (+3)   | 267 (+3)   | 25       | 16       | 0          | 9.8K (+49B)  |
Example GitHub Actions configuration to report code stats changes in pull request comment.
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/builds/releases/download/sccdiff-v0/sccdiff && chmod +x sccdiff
          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 }}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL