iccheck

command module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 2 Imported by: 0

README

ICCheck - Inconsistent Change Checker

Reports possible inconsistent changes in pre-commit files, commited files, and/or Pull Requests.

ICCheck lists (pre-commit) changes made on a git repository and checks missing changes on cloned codes (i.e. copy-pasted codes).

The plugin and the method for detecting cloned code is still in development and being improved. While ICCheck detects many cloned codes correctly, note that it may also detect many false-positives.

Installation

To be filled

Usage

Finds inconsistent changes in your git changes

Usage:
  iccheck [flags]

Flags:
      --fail-code int      Exit code if it detects any inconsistent changes (default: 0)
      --format string      Format type (console, json, github) (default "console")
  -f, --from string        Target git ref to compare against. Usually earlier in time. (default "main")
  -h, --help               help for iccheck
      --log-level string   Log level (debug, info, warn, error) (default "info")
  -r, --repo string        Source git directory (default ".")
  -t, --to string          Source git ref to compare from. Usually later in time. Set to 'WORKTREE' to specify worktree. (default "HEAD")
Output Format

ICCheck outputs detected inconsistent changes to stdout, and other logging outputs to stderr.

Output format can be changed via the --format argument. Make sure to check --format json out for ease integration with other systems such as review bots.

For example, one can utilize jq to process the JSON stdout into the GitHub Actions annotation format.

iccheck --format json | jq -r '":::notice file=\(.filename),line=\(.start_l),endLine=\(.end_l),title=Possible missing change::Possible missing a consistent change here (L\(.start_l) - L\(.end_l), distance \(.distance))"'
In GitHub Actions

An example workflow file:

name: Change Check

on:
  push:
    branches:
      - 'main'
  pull_request:

env:
  ICCHECK_FROM: "origin/main"
  ICCHECK_TO: "HEAD"

jobs:
  iccheck:
    name: Change Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: '0'
      - uses: actions/setup-go@v5
        with:
          go-version: "1.22"
      - name: Set different base commit on main branch
        if: github.ref == 'refs/heads/main'
        run: echo "ICCHECK_FROM=HEAD~" >> "$GITHUB_ENV"
      - run: go install github.com/salab/iccheck@latest
      - run: iccheck --from "$ICCHECK_FROM" --to "$ICCHECK_TO" --format github

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
fleccs
Package fleccs contains a golang re-implementation of the tool "FLeCCS" - "Fragment Level Similar Co-Change Suggester" by Manishankar Mondal, et al., on ICPC 2021.
Package fleccs contains a golang re-implementation of the tool "FLeCCS" - "Fragment Level Similar Co-Change Suggester" by Manishankar Mondal, et al., on ICPC 2021.
lsp
Package lsp contains JSON-RPC 2.0 implementation for Language Server Protocol.
Package lsp contains JSON-RPC 2.0 implementation for Language Server Protocol.
ncdsearch
Package ncdsearch contains a basic golang re-implementation of the tool "NCDSearch" by Takashi Ishio, et al.
Package ncdsearch contains a basic golang re-implementation of the tool "NCDSearch" by Takashi Ishio, et al.
utils/ds
Package ds provides some utilities relating to data structures.
Package ds provides some utilities relating to data structures.

Jump to

Keyboard shortcuts

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