Vim Plugin

A vim plugin that runs the Code Climate CLI & displays the results in vim.

Code Climate

A Vim plugin for the Code Climate command line tool.

1260

Installation: Code Climate CLI

Note that these instructions assume that you have Docker already installed

To use the Code Climate Vim Plugin you must have the Code Climate command line tool installed.

If you don't already, you can install it like this (assuming Mac OSX with brew - Linux instructions can be found in the CLI repo README):

brew tap codeclimate/formulae
brew install codeclimate

You can test that the installation worked correctly by invoking codeclimate version. If a version number is printed your installation is successful.

Once you have the CLI installed, you'll want to make sure that the engines you need to analyze your code are installed locally. If the repo you want to analyze already has a .codeclimate.yml file, you can run:

cd MYPROJECT
codeclimate engines:install

If you'd like to analyze a project which has never been analyzed by Code Climate before, run:

cd MYPROJECT
codeclimate init
codeclimate engines:install

The CLI will detect the file extensions of the code in your project and turn on engines which are meant to analyze those languages or frameworks.

To test the CLI with your code, make sure you are still in the same directory as your project's .codeclimate.yml and run:

codeclimate analyze

You will see some progress, and analysis results.

Installation: Vim Plugin

Once you have a functioning installation of the Code Climate CLI, you're ready to see the same results within Vim.

Pathogen

$ git clone https://github.com/wfleming/vim-codeclimate ~/.vim/bundle/vim-codeclimate.com

Vundle

Plugin 'wfleming/vim-codeclimate'

Usage

:CodeClimateAnalyzeProject
:CodeClimateAnalyzeOpenFiles
:CodeClimateAnalyzeCurrentFile

The plugin exposes the three commands above.
By default, no shortcuts are bound to these commands to avoid interfering with other plugins, but you can easily add some in your .vimrc or init.vim:

nmap <Leader>aa :CodeClimateAnalyzeProject<CR>
nmap <Leader>ao :CodeClimateAnalyzeOpenFiles<CR>
nmap <Leader>af :CodeClimateAnalyzeCurrentFile<CR>

Limitations

Because of how the CLI is run by the Vim plugin, it expects to find the .codeclimate.yml configuration file in the current working directory.

To ensure that the plugin works properly please start vim from the root of your repository.