2.10.0 • Published 2 months ago

@codecoach/cli v2.10.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Lightweight code review tool. Provide lint output to CodeCoach, it will automatically review pull requests. CodeCoach uses node.js as run time. It can be run from any command line. So it can be integrated with any CI with ease.

Supported linters.

  • ESLint
  • TSLint
  • MSBuild (both msbuild.exe and dotnet build commands)
  • ScalaStyle
  • AndroidLint
  • DartLint
  • SwiftLint (0.49.1 or later)

Supported code duplication detectors.

  • jscpd

Supported source controls

  • GitHub
  • GitHub Enterprise
  • GitLab

Prerequisite

Node.js v14 or later

Installation

Install it globally using npm

$ npm i -g @codecoach/cli

or Yarn

$ yarn global add @codecoach/cli

Usage

Use command codecoach with required config.

Configs

Configuration could be supplied by arguments options or config JSON file.

Example: Supplying config by options
$ codecoach \
  -g="github"
  --githubRepoUrl="https://github.com/codeleague/codecoach" \
  --githubPr=99 \
  --githubToken="yourtoken" \
  -f="eslint;/path/to/eslintoutput.json" \
  -f="dotnetbuild;/path/to/dotnetbuild;/repo/src" \
  -r
Example: Supplying config by json
$ codecoach --config="codecoach.json"

and in codecoach.json

{
  "vcs": "github",
  "githubRepoUrl": "https://github.com/codeleague/codecoach",
  "githubPr": 99,
  "githubToken": "yourtoken",
  "buildLogFile": [
    "eslint;/path/to/eslintoutput.json",
    "dotnetbuild;/path/to/dotnetbuild;/repo/src"
  ],
  "removeOldComment": true
}

Will do the same thing.

Warning: If both config file and options are supplied, options will override config in file.

OptionRequiredValueDescription
vcs / -gwhen dryRun is falsegithub or gitlab
githubRepoUrlwhen vcs is githubRepository's HTTPS URL
githubPrwhen vcs is githubPull request ID
githubTokenwhen vcs is githubPersonal Access Token
gitlabHostwhen vcs is gitlabhttps://gitlab.company.comGitLab Server (Could also be https://gitlab.com)
gitlabProjectIdwhen vcs is gitlabProject ID
gitlabMrIidwhen vcs is gitlabMergeRequest IID (not to be confused with ID)
gitlabTokenwhen vcs is gitlabAccess Token
buildLogFile / -fyes, repeatableRead below
output / -onoCodeCoach parsed output for debugging
removeOldComment / -rnotrue or falseRemove CodeCoach's old comments before adding new one
failOnWarningsnotrue or falseFail the job when warnings are found
dryRunnotrue or falseRunning CodeCoach without reporting to VCS
silentnotrue or falseDisable the comment but still report job status to the VCS
suppressRulesnorule-group-1/.* rule-id-1 rule-id-2Rule IDs that CodeCoach will still comment but no longer treated as errors or warnings
outputFormatnodefault, gitlabOutput file format
--buildLogFile or -f
Required, Repeatable

Build log content files config. Splitted in to 3 part, formatted in <type>;<path>[;<cwd>]

  • Type: one of dotnetbuild, msbuild, tslint, eslint, scalastyle, androidlint or dartlint
  • Path: Path to lint output file to be processed
  • cwd: Linter context repository root (optional, will use current directory if not provided)

For example,
Case 1: Run CodeCoach from repo root for eslint and dotnetbuild in the same lint context directory

--buildLogFile="eslint;./src/client/eslint-out.json" --buildLogFile="dotnetbuild;./src/api/msbuild.log"

Case 2: Run CodeCoach from somewhere else for androidlint (linter context root was /path/to/project/root)

--buildLogFile="androidlint;./android-lint.xml;/path/to/project/root"

How to get lint output for CodeCoach

ESLint

Use -o <filename> to output lint result to file and -f json to format logs as JSON. (ref.)

TSLint

Use -o <filename> to output lint result to file and -t json or --format json to format logs as JSON. (ref.)

MSBuild and dotnet build

Use -fileLoggerParameters or -flp switch with msbuild, dotnet build or dotnet msbuild command to send logs to file. (ref.)

ScalaStyle

Result is already written to target/scalastyle-result.xml when project is built (ref.)

AndroidLint

Use -o <filename> to output lint result to file (ref.)

DartLint

Use -o <filename> on output lint result created by command dart analyze > <filename> in dart project (ref.)

SwiftLint

Use --output <filename> to output lint result to file and --reporter json to format logs as JSON. (ref.)

Contribute

For contribution guidelines and project dev setup. Please see CONTRIBUTING.md

2.10.0

2 months ago

0.0.0-rc15

2 months ago

2.5.0

10 months ago

2.4.0

10 months ago

2.7.0

8 months ago

2.6.0

9 months ago

2.9.0

6 months ago

2.7.2

7 months ago

2.8.0

7 months ago

2.7.1

8 months ago

0.0.0-rc3

10 months ago

0.0.0-rc4

10 months ago

0.0.0-rc5

10 months ago

0.0.0-rc6

9 months ago

0.0.0-rc7

8 months ago

0.0.0-rc8

8 months ago

0.0.0-rc9

7 months ago

2.9.2

6 months ago

2.9.1

6 months ago

0.0.0-rc14

6 months ago

0.0.0-rc13

6 months ago

0.0.0-rc12

6 months ago

0.0.0-rc11

6 months ago

0.0.0-rc10

7 months ago

0.0.0-rc2

11 months ago

2.3.0

11 months ago

0.0.0-rc1

11 months ago

2.2.0

1 year ago

2.0.2

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago