-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathpackage-audit.lua
More file actions
67 lines (61 loc) · 1.81 KB
/
package-audit.lua
File metadata and controls
67 lines (61 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-- package-audit.lua
-- Audit a package: lint all objects, check dependencies, report quality
--
-- Usage: vsp -s dev lua examples/scripts/package-audit.lua
local PKG = "$ZADT_VSP"
print("=== Package Audit: " .. PKG .. " ===")
print()
-- 1. Find all classes in the package
local classes = searchObject(PKG .. "*", "CLAS")
print("Classes found: " .. #classes)
for _, c in ipairs(classes) do
print(" " .. c.name)
end
print()
-- 2. Lint each class
print("=== Lint Results ===")
local total_issues = 0
for _, cls in ipairs(classes) do
local source = getSource("CLAS", cls.name)
if source then
local issues = lint(source)
if issues and #issues > 0 then
print(cls.name .. ": " .. #issues .. " issues")
for _, iss in ipairs(issues) do
print(" r" .. iss.row .. " [" .. iss.key .. "] " .. iss.message)
end
total_issues = total_issues + #issues
else
print(cls.name .. ": clean")
end
end
end
print()
print("Total issues: " .. total_issues)
-- 3. Parse statistics
print()
print("=== Code Structure ===")
for _, cls in ipairs(classes) do
local source = getSource("CLAS", cls.name)
if source then
local stmts = parse(source)
local types = {}
for _, s in ipairs(stmts) do
types[s.type] = (types[s.type] or 0) + 1
end
print(cls.name .. ": " .. #stmts .. " statements")
if types["MethodImplementation"] then
print(" methods: " .. types["MethodImplementation"])
end
if types["Data"] then
print(" data declarations: " .. types["Data"])
end
end
end
-- 4. System info
print()
print("=== System ===")
local info = systemInfo()
if info then
print("System: " .. info.systemId .. " (" .. info.sapRelease .. ")")
end