analyzerzerobrane

How to analyze loaded files correctly


I'm still struggling to get my project analyzed how I would like. Here's what I've tried so far:

Analyze File: Analyzes the current file, but doesn't analyze any loaded files (loadfile, dofile).

Analyze All: Analyzes all of the files in the project individually, but doesn't doesn't recognize the fact they are linked in a project.

Using either method, I get a lot of "first use of unknown global..." warnings. These globals may be unknown to the analyzer, but they are set in other files in the project, and actually work fine. However, the project I'm currently working on is an add-on to another program, so it won't simply run on it's own.

Based on this, it seems like a shortfall of the analyzer where it is ignoring loadfile commands. IMO this is the primary reasons to have a project. Am I missing something fundamental here?

Any suggestions on how to get the project analyzed as a project?


Solution

  • If you need to have more control over which variables are global and what checks to enable/disable, you can use luacheck (already included in the IDE and can be configured with staticanalyzer.luacheck = true) and configure it to skip reporting on certain variables