How to set tab width in source code display?

(Jukka Aro) #1


I am starting to use to SonarQube after a few years of inactivity. I am struggling with a very silly and basic setting, but since I could not find any information on this neither by googling nor in this community, I decided to post my question here.

I am working with a code base that uses tabs for indenting code. Please do not comment on tabs vs. spaces :wink: as the choice is not my own and it has its reasons. However, when SonarQube is showing the source code, it uses a fixed tab width / tab spacing of 8 characters. As the source code has been written with tab width 4, the indentation is shown totally off and unaligned in SonarQube, which is very annoying when browsing the source code.

Changing the displayed tab width is easy in any editor / IDE / graphical tool I can think of. However, I could not find any option for changing this display in SonarQube. It would be also nice to visualize whitespace (spaces and tabs) when needed, sometimes you have issues with those and it is cumbersome to need to go out of SonarQube if you are already working there.

(G Ann Campbell) #4


I’m trying to figure out where in the process the translation to 8 spaces happens. Do you see this on every language or just some?


(Jukka Aro) #5

Hi and thanks for your reply,

I could quickly check that with C++, Java, JavaScript and TypeScript. In all of them, tabs get visualized with a width of 8 characters without any apparent possibility to change that setting. Unfortunately I could not quickly test that with other programming languages, but it very much looks like a language-independent thing.


(G Ann Campbell) #6

Thanks @Jukka, That’s what I needed.

(G Ann Campbell) #11

Hi again,

We’ve created this ticket: SONAR-11552, but I can’t give you an E.T.A.