Any options for pug and vuex scanning for JS project?

SonarQube Server version: 8.5.1.38104
SonarScanner version: 4.5.0.2216
Version of TypeScript used during analysis: 3.8.3

Hello all! On our JS+PHP project we have encountered with using of vuex and pug.
Those two languages officially not supported by Sonar.
May be someone knows a solution for scanning them and can share?
Searching sonnar-community and google gave null result :frowning:

Hi @Mike_F,

You are correct in that we don’t support Pug, but Pug can be transpiled or converted to HTML, so you could modify your build pipeline to convert Pug to HTML and then use this separate build artifact to be scanned as HTML. Here are a few suggested tools below. Definitely not a great workaround, but this will easily allow you to scan your project still:

Vuex is not a language, it’s a state management pattern and library for Vue.js, correct? So you would be using vue extension then. SonarQube does support vue files, (see image below from version 8.5.1) but not entirely all possible combinations of HTML, CSS, and JS/TS.

Administration > Configuration > Configuration > Languages > JavaScript/TypeScript:
(also described in the docs here)

For example, in this post, you will see that MMF-1441 is a request to allow lang=TS for vue files.

In the worst case, if SonarQube is absolutely necessary, you can separate your CSS and JS from the vue file, for example, as stated here: Single File Components: Separate of Concerns.

Joe

Hello @Joe !

  1. Pug conversion to html “on the fly” is a great idea! Thank you very much! “Not a great workaround” is much better than “no workaround at all” :slight_smile:

  2. You are right, vuex is a state management pattern and library for Vue.js. We have already declared “.vue” extension as TypeScript. The problem is that scanning of specific files with vuex statements is skipped by Sonar.

Hey @Mike_F!

Great! I’m glad the pug to HTML on-the-fly transpilation will work for you then.

Yup, we don’t support TypeScript with .vue yet, so you’ll have to wait on that. Keep your eyes peeled on that MMF Jira ticket and vote up on it.

Joe

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.