ZeroBrane studio
#26
@xoft, you can run this plugin that implements Analyze All for a particular project. Just save it as packages/analyzeall.lua and you should see a new menu item under Analyze that will run the analysis through all lua files in your project. You'll need to get the latest ZBS from github as there were some API changes to make this work. Let me know how it works for you. Thanks.

local G = ...
local id = G.ID("analyzeall.analyzeall")
local menuid

local function analyzeProject()
  local frame = ide:GetMainFrame()
  local menubar = ide:GetMenuBar()
  if menubar:IsChecked(ID_CLEAROUTPUT) then ClearOutput() end
  DisplayOutputLn("Analyzing the project code.")
  frame:Update()

  local errors, warnings = 0, 0
  local projectPath = ide:GetProject()
  if projectPath then
    for _, filePath in ipairs(FileSysGetRecursive(projectPath, true, "*.lua")) do
      local warn, err, line = AnalyzeFile(filePath)
      if err then
        DisplayOutputNoMarker(filePath..\'(\'..line..\'): \'..err.."\n")
        errors = errors + 1
      elseif #warn > 0 then
        DisplayOutputNoMarker(table.concat(warn, "\n") .. "\n")
        warnings = warnings + #warn
      end
      frame:Update() -- refresh the output with new results
    end
  end

  DisplayOutputLn(("%s error%s and %s warning%s."):format(
    errors > 0 and errors or \'no\', errors == 1 and \'\' or \'s\',
    warnings > 0 and warnings or \'no\', warnings == 1 and \'\' or \'s\'
  ))
end

return {
  name = "Analyze all files",
  description = "Analyzes all files in a project.",
  author = "Paul Kulchenko",
  version = 0.1,

  onRegister = function(self)
    local menu = ide:GetMenuBar():GetMenu(ide:GetMenuBar():FindMenu(TR("&Project")))
    local _, analyzepos = ide:FindMenuItem(menu, ID_ANALYZE)
    if analyzepos then
      menu:Insert(analyzepos+1, id, TR("Analyze All")..KSC(id), TR("Analyze the project source code"))
    end
    ide:GetMainFrame():Connect(id, wx.wxEVT_COMMAND_MENU_SELECTED, analyzeProject)
  end,

  onUnRegister = function(self)
    local menu = ide:GetMenuBar():GetMenu(ide:GetMenuBar():FindMenu(TR("&Project")))
    ide:GetMainFrame():Disconnect(id, wx.wxID_ANY, wx.wxEVT_COMMAND_MENU_SELECTED)
    if menuid then menu:Destroy(menuid) end
  end,
}
Reply
Thanks given by:


Messages In This Thread
ZeroBrane studio - by xoft - 02-22-2014, 11:10 PM
RE: ZeroBrane studio - by FakeTruth - 02-23-2014, 12:14 AM
RE: ZeroBrane studio - by xoft - 02-23-2014, 12:30 AM
RE: ZeroBrane studio - by paulclinger - 02-24-2014, 04:01 PM
RE: ZeroBrane studio - by xoft - 02-24-2014, 05:19 PM
RE: ZeroBrane studio - by paulclinger - 02-25-2014, 09:02 AM
RE: ZeroBrane studio - by FakeTruth - 02-25-2014, 04:39 PM
RE: ZeroBrane studio - by paulclinger - 02-26-2014, 05:54 AM
RE: ZeroBrane studio - by FakeTruth - 02-24-2014, 10:54 PM
RE: ZeroBrane studio - by xoft - 02-25-2014, 08:36 AM
RE: ZeroBrane studio - by xoft - 02-25-2014, 09:25 AM
RE: ZeroBrane studio - by paulclinger - 02-25-2014, 01:56 PM
RE: ZeroBrane studio - by FakeTruth - 02-27-2014, 04:40 AM
RE: ZeroBrane studio - by paulclinger - 02-28-2014, 08:55 AM
RE: ZeroBrane studio - by xoft - 02-28-2014, 01:08 AM
RE: ZeroBrane studio - by xoft - 02-28-2014, 06:27 AM
RE: ZeroBrane studio - by xoft - 03-01-2014, 01:29 AM
RE: ZeroBrane studio - by paulclinger - 03-01-2014, 03:58 AM
RE: ZeroBrane studio - by xoft - 03-01-2014, 11:53 AM
RE: ZeroBrane studio - by paulclinger - 03-01-2014, 04:43 PM
RE: ZeroBrane studio - by xoft - 03-01-2014, 09:45 PM
RE: ZeroBrane studio - by FakeTruth - 03-01-2014, 11:00 PM
RE: ZeroBrane studio - by xoft - 03-01-2014, 11:15 PM
RE: ZeroBrane studio - by FakeTruth - 03-02-2014, 12:17 AM
RE: ZeroBrane studio - by paulclinger - 03-02-2014, 04:24 AM
RE: ZeroBrane studio - by paulclinger - 03-03-2014, 10:43 AM
RE: ZeroBrane studio - by xoft - 03-04-2014, 06:44 PM
RE: ZeroBrane studio - by paulclinger - 03-05-2014, 03:07 AM
RE: ZeroBrane studio - by xoft - 03-05-2014, 03:37 AM
RE: ZeroBrane studio - by xoft - 03-17-2014, 06:17 AM
RE: ZeroBrane studio - by paulclinger - 03-17-2014, 01:09 PM
RE: ZeroBrane studio - by xoft - 03-17-2014, 07:20 PM
RE: ZeroBrane studio - by xoft - 03-20-2014, 07:47 AM
RE: ZeroBrane studio - by xoft - 04-01-2014, 02:14 AM
RE: ZeroBrane studio - by bearbin - 04-01-2014, 05:04 AM
RE: ZeroBrane studio - by NiLSPACE - 04-12-2015, 03:33 AM
RE: ZeroBrane studio - by xoft - 04-12-2015, 03:48 AM
RE: ZeroBrane studio - by NiLSPACE - 04-12-2015, 03:51 AM
RE: ZeroBrane studio - by xoft - 07-25-2015, 04:09 PM



Users browsing this thread: 2 Guest(s)