Possible to blanket exclude file types?

I’m analysing a massive legacy project that contains files of lots of different types. When I run an analysis, I got the following error partway through:

INFO: Could not find files for the given pattern(s).

Task :sonar
Node.js not found in PATH. PATH value was: [snipped]

There’s no information on what files are causing this, or what patterns it means. From research I’ve found that node is required when analysing js, ts or css files - there are some of those in this project, but I don’t want them to be analysed.

Since I don’t know what files specifically are causing the error, and hunting manually through this huge project isn’t feasible, I’m wondering if it’s possible to blanket exclude file types, so I can fix this issue and also cut down on the number of files being analysed, since we also have performance concerns.

I think you’re looking for File exclusions, including the ability to set glob patterns like **/*.js,**/*.css,**/*.ts)

1 Like

Hi Colin,

Unfortunately that hasn’t solved the problem I’m having - I’m still seeing this node error, even though we’re no longer supposed to be analysing ts, js or css files.

Hm. It’s possible there could be some other file types, such as .tsx.

Can you try excluding .js,.jsx,.cjs,.mjs,.vue,.ts,.tsx,.cts,.mts,.css,.less,.scss?

Hi Colin, apologies for the delay in getting back to you on this. I’ve since added node to our project to remove this error, however I still want to blanket exclude html, cs and javascript. Unfortunately, the exclusions I’ve added don’t seem to be working.

A subset of my exclusions are the following (the rest are individual files):

**/*.XML,**/*.xml,**/*.CSS,**/*.css**/*.JSON,**/*.json,**/*.PHP,**/*.php,**/*.HTML,**/*.html,**/*.JS,**/*.js,

And in the logs, we’re seeing things like:

11:19:15  Sensor JavaScript inside HTML analysis [javascript]
11:19:28  Detected os: Windows Server 2016 arch: amd64 alpine: false. Platform: WIN_X64
11:19:28  Using Node.js executable: 'C:\Program Files\nodejs\node.exe'.
11:20:24  
11:20:24  1 source file to be analyzed
11:20:24  1/1 source file has been analyzed
11:20:24  
11:20:24  > Task :sonar
11:20:24  Hit the cache for 0 out of 1
11:20:24  Miss the cache for 1 out of 1: ANALYSIS_MODE_INELIGIBLE [1/1]
11:20:24  Sensor JavaScript inside HTML analysis [javascript] (done) | time=61721ms
11:20:24  Sensor CSS Rules [javascript]
11:20:24  
11:20:24  11 source files to be analyzed
11:20:24  11/11 source files have been analyzed
11:20:24  14 source files to be analyzed
11:20:24  14/14 source files have been analyzed
11:20:24  960 source files to be analyzed
11:20:24  

Which to me indicates that HTML or JS files are being analysed despite the exclusions. Do you know why this might be? This post ERROR: INFO: Could not find files for the given pattern(s) implies that setting sonar.verbose to true prints detail of individual files being analysed ,but that’s not the case for me.