From 331e2ceaf927f49262f3e131a2ccd4127dcf177b Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sat, 4 Nov 2023 08:54:02 +0000 Subject: [PATCH] feat(shell): add codeclimate wrapper There are two wrapper scripts for running codeclimate locally in docker. This script is adapted from their website. There is also a script that will output the results in vimgrep format, so they can be easily loaded into the quickfix list. --- site-modules/core/files/bin/codeclimate | 11 +++++++++++ site-modules/core/files/bin/codeclimate-vimgrep | 5 +++++ 2 files changed, 16 insertions(+) create mode 100755 site-modules/core/files/bin/codeclimate create mode 100755 site-modules/core/files/bin/codeclimate-vimgrep diff --git a/site-modules/core/files/bin/codeclimate b/site-modules/core/files/bin/codeclimate new file mode 100755 index 0000000..5f666c8 --- /dev/null +++ b/site-modules/core/files/bin/codeclimate @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +docker run \ + --interactive --rm \ + --env CODECLIMATE_CODE="$PWD" \ + --env CODECLIMATE_DEBUG="$CODECLIMATE_DEBUG" \ + --volume "$PWD":/code \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + --volume /tmp/cc:/tmp/cc \ + codeclimate/codeclimate $@ diff --git a/site-modules/core/files/bin/codeclimate-vimgrep b/site-modules/core/files/bin/codeclimate-vimgrep new file mode 100755 index 0000000..fc440c3 --- /dev/null +++ b/site-modules/core/files/bin/codeclimate-vimgrep @@ -0,0 +1,5 @@ +#! /bin/bash + +codeclimate analyze -f json $@ \ + | jq -r '.[] | "\(.location.path):\(.location.lines.begin): \(.description)"' \ + | grep -v '^null'