How to change the language despite the extension

We are using the Community Edition Version 10.2.1. One of our projects is mainly using PHP utilizing the laravel framework. This leads to so calles blade files, default extension *.blade.php. Actually these are html files. Sonarqube analyzes them as PHP and complains about long lines.
Is there a way to tell sonarqube to analyze these files as html without renaming the files?

You can adjust file suffixes (either at a project-level or globally) under Administration > General Settings > Languages > PHP and Administration > General Settings > Languages > HTML.

Thanks, but this is not working here. I need to analyze *.php with php, and I configured sonar.php.exclusions = **/*blade.php. This works, no longer php errormessages for ther laravel blade files. However, as soon as I configure .blade.php to be analyzed with html additionally, I get an error fropm sonar
"Language of file …blade.php can not be decided as the file extension matches both HTML: … and PHP …

Ah, I see, the PHP file suffix php is also accounting for .blade.php. That’s annoying.

There is a way around this (and I’m honestly a little surprised this works… but just as happy!)

You can set the following in your file:


With this configured, you can set .blade.php as an HTML suffix, and you’ll have no conflicting file suffixes.

It’s not the most graceful approach, but if just one project is affected, I hope it’s enough for you.


Perfect, not it works as expected. Thanks

Well, not quite. **/*[.blade].php leads to no *.php file to be analyzed with php

That’s why you need the ! (negation!)!