Skip to content

dubgeiser/kokwame.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kokwame

Disclaimer: Kokwame is very much pre-alpha!

Code Quality Metrics KOde KWality MEtrics, gettit (I'll get me coat).

Kokwame is a Neovim plugin in Lua that calculates code quality metrics per code unit. A code unit is typically a method or a function. Per code unit following metrics are calculated:

  • Cyclomatic Complexity
  • ... that is all for now :-)

Requirements

Kokwame uses treesitter and Nvim's built in LSP support to do its work.

Install and setup

Kokwame can be installed via the default way of your favorite package manager.

-- The options table is an optional argument,
-- it is shown here with the default value for produce_diagnostics
require('kokwame').setup({
  -- Should Kokwame be a diagnostic producer?
  is_diagnostic_producer = false,

  -- Which type of border?
  -- Will be used for vim.lsp.util.open_floating_preview()
  border = 'rounded',
})

Usage

There are 2 ways you can put Kokwame to work:

:KokwameInfo

This is more of a on-the-fly mode of Kokwame; you issue the command :KokwameInfo and all the metrics of the code unit that the cursor is in will be shown in a popup window.

LSP Diagnostics integration (EXPERIMENTAL!)

When the option produce_diagnostics is set to true in the options that you pass to the setup() function, Kokwame will integrate with Neovim's LSP support and render the metrics inline as LSP diagnostics. Depending on how each metric is configured, these metric will show up as error, hint, warning, etc... or not at all (Cyclomatic complexity of 2 doesn't seem like a good warning or error to show, for instance ;-) )

Help

See :help kokwame in Neovim for the help, or see the kokwame.txt file in the doc/ directory for more info.

Reference

These two links helped me out a lot to get something working with the nvim-treesitter plugin.

Thanks to/for treesitter-playground which helped me out a lot.

About

Kokwame is a Neovim plugin in Lua that calculates code quality metrics per code unit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors