What is the recommend tool for D linting from CI pipelines? Does such a tool exist at all?

Andre Pany andre at s-e-a-p.de
Sat Oct 12 11:37:12 UTC 2019


On Saturday, 12 October 2019 at 04:55:02 UTC, Carsten Schlote 
wrote:
> Hi,
>
> many companies started to use CI pipelines, and as part of 
> their pipelines they introduced mandatory linting for source 
> code.
>
> There are tools for many languages, esp. for C/C++. These tools 
> usually return '0' on success, and something else on linting 
> errors. That is pretty much the standard POSIX way to return a 
> resultcode  back to the calling programm/shell. The CI pipeline 
> aborts, when something else then '0' is returned.
>
> However, for the D language I found only 'dscanner'. It has a 
> report option, but seems to return always a '0'. I have to 
> check the JSON style output to find out, if any issues are 
> reported or not. This makes things more complicated than needed.
>
> So, my simple question are:
>  * What is the recommended way to do automated linting for D 
> sources in CI pipelines or similiar?
>  * Is there any other tool than dscanner to do serious linting 
> for D language?
>
> Carsten

There were many additions in this area in the recent time.

- Jenkins Next Generation Warnings Plugin now supports D-Scanner 
JSON output. Therefore you can instrument the Jenkins plugin to 
stop if there are errors.

- D-Scanner allows you (upcoming version) to output SonarQube 
generic issues json instead of the default json. You can import 
it into a bare SonarQube (no d plugin needed). And also SonarQube 
voter can stop your build depending on your findings.

- With next Dub version, d-scanner is integrated. Just call dub 
lint within your dub project folder. This also makes the CI use 
case much greater.

That said, we are just at the starting point of using d-scanner 
in CI. There might be here and there missing features. 
Contribution in form of suggestions or even pull requests are 
highly welcome.

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list