Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.
 
 

Repository files navigation

Codiga CLI

This CLI tool is intended to make interacting with Codiga as smooth as possible.

Getting Started

Ensure you have Node.js installed first. You can do that by running the following in your terminal.

If you don't have it installed, go to download Node.js now.

node -v

Now you can install our CLI tool with either of the following.

# if you want to add it to your package.json
npm i --save-dev @codiga/cli

# if you want to install it globally
npm i -g @codiga/cli

Run the following command to see what's available directly in your terminal or keep reading for more.

codiga --help

Commands

Add a Codiga API token

Use the command below to set your Codiga API token. This token will be needed to run certain operations. You can create a Codiga API token on our app.

codiga token-add

Check for a Codiga API token

Use the command below to check if you have a valid Codiga API token set. You can create a new Codiga API token on our app.

codiga token-check

Delete a Codiga API token

Use the command below to delete a Codiga API token from your system. You can manage your Codiga API tokens on our app.

codiga token-delete

Analysis and report issues between two commits

Use the command below to detect any violations between your two commits.

As the command name suggests, this works best in a pre-push git hook. Everytime a git push command is ran, that developer will know that their code doesn't have any violations and if they do, they will need to push new commits to rectify those violations before pushing again.

codiga git-push-hook --remote-sha 1234567 --local-sha 7654321

Git Hook (pre-push)

.git

To utilize the git pre-push hook automatically, you'll need to follow "Getting Started" above and then copy the following into a .git/hooks/pre-push file and then run chmod a+x .git/hooks/pre-push to make it executable.

#!/bin/sh

while read local_ref local_sha remote_ref remote_sha
do
  codiga git-push-hook --remote-sha $remote_sha --local-sha $local_sha
done

exit 0

.husky

If you're already using a tool like husky to handle git hooks the following would go into a .husky/pre-push file and then run chmod +x .husky/pre-push to make it executable.

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

while read local_ref local_sha remote_ref remote_sha
do
  codiga git-push-hook --remote-sha $remote_sha --local-sha $local_sha
done

exit 0

Contributors

Daniel Strong

License

MIT

About

A Codiga CLI used to integrate Codiga easily in your projects

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages