haskell / haskell/haskell-language-server

[Feature request] Support for code complexity measurements

Open
#1,849 1 comment 1 reaction 0 assignees View on GitHub
level: hard status: in discussion type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

https://gitlab.com/migamake/homplexity is a tool that spits out measurements on "code complexity" at the function level. I thought it would be nice to integrate it to HLS so in VSCode I can see these measurement warnings adjacent to individual functions.

Running it on [neuron](https://neuron.zettel.page) code base, I see measurement warnings like this:

```
[...]
Warning:/prj/src/Neuron/Backend.hs:SrcLoc "/prj/src/Neuron/Backend.hs" 33 1: function serve has 22 lines of code should be kept below 20 lines of code.
Warning:/prj/src/Neuron/Plugin.hs:SrcLoc "/prj/src/Neuron/Plugin.hs" 128 1: type signature for routePluginData has 7 arguments should be less than 5
Warning:/prj/src/Neuron/Zettelkasten/Graph/Build.hs:SrcLoc "/prj/src/Neuron/Zettelkasten/Graph/Build.hs" 38 1: function buildZettelkasten has 23 lines of code should be kept below 20 lines of code.
Warning:/prj/src/Neuron/Zettelkasten/Zettel/Parser.hs:SrcLoc "/prj/src/Neuron/Zettelkasten/Zettel/Parser.hs" 27 1: type signature for parseZettel has 6 arguments should be less than 5
Warning:/prj/src/Neuron/Zettelkasten/Zettel/Parser.hs:SrcLoc "/prj/src/Neuron/Zettelkasten/Zettel/Parser.hs" 34 1: function parseZettel has 22 lines of code should be kept below 20 lines of code.
Warning:/prj/src/Neuron/Zettelkasten/Zettel.hs:SrcLoc "/prj/src/Neuron/Zettelkasten/Zettel.hs" 133 18: data ZettelT has record fields count of 8 should be less than 6
Warning:/prj/src/Neuron/CLI/Query.hs:SrcLoc "/prj/src/Neuron/CLI/Query.hs" 32 1: function runQuery has 34 lines of code should be kept below 20 lines of code.
Critical:/prj/src/Neuron/CLI/Parser.hs:SrcLoc "/prj/src/Neuron/CLI/Parser.hs" 39 1: function commandParser has 103 lines of code this function exceeds 40 lines of code.
Critical:/prj/src/Neuron/CLI/New.hs:SrcLoc "/prj/src/Neuron/CLI/New.hs" 39 1: function newZettelFile has 41 lines of code this function exceeds 40 lines of code.
Warning:/prj/src/Neuron/CLI/App.hs:SrcLoc "/prj/src/Neuron/CLI/App.hs" 59 1: function runAppCommand has 22 lines of code should be kept below 20 lines of code.
Warning:/prj/src/Data/Structured/OpenGraph/Render.hs:SrcLoc "/prj/src/Data/Structured/OpenGraph/Render.hs" 20 1: function renderOpenGraph has 28 lines of code should be kept below 20 lines of code.
Warning:/prj/src/Data/Structured/OpenGraph.hs:SrcLoc "/prj/src/Data/Structured/OpenGraph.hs" 21 18: data OpenGraph has record fields count of 7 should be less than 6
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.