summaryrefslogtreecommitdiff
path: root/server-beta/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/core')
-rw-r--r--server-beta/src/core/diagnostics/ambiguity-1.lua3
-rw-r--r--server-beta/src/core/diagnostics/duplicate-index.lua3
-rw-r--r--server-beta/src/core/diagnostics/duplicate-method.lua3
-rw-r--r--server-beta/src/core/diagnostics/emmy-lua.lua3
-rw-r--r--server-beta/src/core/diagnostics/empty-block.lua3
-rw-r--r--server-beta/src/core/diagnostics/global-in-nil-env.lua3
-rw-r--r--server-beta/src/core/diagnostics/init.lua29
-rw-r--r--server-beta/src/core/diagnostics/lowercase-global.lua3
-rw-r--r--server-beta/src/core/diagnostics/newfield-call.lua3
-rw-r--r--server-beta/src/core/diagnostics/newline-call.lua3
-rw-r--r--server-beta/src/core/diagnostics/redefined-local.lua3
-rw-r--r--server-beta/src/core/diagnostics/redundant-parameter.lua3
-rw-r--r--server-beta/src/core/diagnostics/redundant-value.lua3
-rw-r--r--server-beta/src/core/diagnostics/set-const.lua3
-rw-r--r--server-beta/src/core/diagnostics/trailing-space.lua3
-rw-r--r--server-beta/src/core/diagnostics/undefined-env-child.lua3
-rw-r--r--server-beta/src/core/diagnostics/undefined-global.lua3
-rw-r--r--server-beta/src/core/diagnostics/unused-function.lua3
-rw-r--r--server-beta/src/core/diagnostics/unused-label.lua3
-rw-r--r--server-beta/src/core/diagnostics/unused-local.lua38
-rw-r--r--server-beta/src/core/diagnostics/unused-vararg.lua3
21 files changed, 124 insertions, 0 deletions
diff --git a/server-beta/src/core/diagnostics/ambiguity-1.lua b/server-beta/src/core/diagnostics/ambiguity-1.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/ambiguity-1.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/duplicate-index.lua b/server-beta/src/core/diagnostics/duplicate-index.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/duplicate-index.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/duplicate-method.lua b/server-beta/src/core/diagnostics/duplicate-method.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/duplicate-method.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/emmy-lua.lua b/server-beta/src/core/diagnostics/emmy-lua.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/emmy-lua.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/empty-block.lua b/server-beta/src/core/diagnostics/empty-block.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/empty-block.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/global-in-nil-env.lua b/server-beta/src/core/diagnostics/global-in-nil-env.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/global-in-nil-env.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/init.lua b/server-beta/src/core/diagnostics/init.lua
new file mode 100644
index 00000000..69815003
--- /dev/null
+++ b/server-beta/src/core/diagnostics/init.lua
@@ -0,0 +1,29 @@
+local files = require 'files'
+local define = require 'proto.define'
+local config = require 'config'
+
+local function check(uri, name, level, results)
+ if config.config.diagnostics.disable[name] then
+ return
+ end
+ level = config.config.diagnostics.severity[name] or level
+ require('core.diagnostics.' .. name)(uri, function (result)
+ result.level = level or result.level
+ result.code = name
+ results[#results+1] = result
+ end)
+end
+
+return function (uri)
+ local ast = files.getAst(uri)
+ if not ast then
+ return nil
+ end
+ local results = {}
+
+ for name, level in pairs(define.DiagnosticDefaultSeverity) do
+ check(uri, name, level, results)
+ end
+
+ return results
+end
diff --git a/server-beta/src/core/diagnostics/lowercase-global.lua b/server-beta/src/core/diagnostics/lowercase-global.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/lowercase-global.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/newfield-call.lua b/server-beta/src/core/diagnostics/newfield-call.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/newfield-call.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/newline-call.lua b/server-beta/src/core/diagnostics/newline-call.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/newline-call.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/redefined-local.lua b/server-beta/src/core/diagnostics/redefined-local.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/redefined-local.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/redundant-parameter.lua b/server-beta/src/core/diagnostics/redundant-parameter.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/redundant-parameter.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/redundant-value.lua b/server-beta/src/core/diagnostics/redundant-value.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/redundant-value.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/set-const.lua b/server-beta/src/core/diagnostics/set-const.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/set-const.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/trailing-space.lua b/server-beta/src/core/diagnostics/trailing-space.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/trailing-space.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/undefined-env-child.lua b/server-beta/src/core/diagnostics/undefined-env-child.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/undefined-env-child.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/undefined-global.lua b/server-beta/src/core/diagnostics/undefined-global.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/undefined-global.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/unused-function.lua b/server-beta/src/core/diagnostics/unused-function.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/unused-function.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/unused-label.lua b/server-beta/src/core/diagnostics/unused-label.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/unused-label.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end
diff --git a/server-beta/src/core/diagnostics/unused-local.lua b/server-beta/src/core/diagnostics/unused-local.lua
new file mode 100644
index 00000000..9b97ca88
--- /dev/null
+++ b/server-beta/src/core/diagnostics/unused-local.lua
@@ -0,0 +1,38 @@
+local files = require 'files'
+local guide = require 'parser.guide'
+local define = require 'proto.define'
+local lang = require 'language'
+
+local function hasGet(loc)
+ if not loc.ref then
+ return false
+ end
+ for _, ref in ipairs(loc.ref) do
+ if ref.type == 'get' then
+ return true
+ end
+ end
+ return false
+end
+
+return function (uri, callback)
+ local ast = files.getAst(uri)
+ if not ast then
+ return
+ end
+ guide.eachSourceType(ast.ast, 'local', function (source)
+ local name = source[1]
+ if name == '_'
+ or name == '_ENV' then
+ return
+ end
+ if not hasGet(source) then
+ callback {
+ start = source.start,
+ finish = source.finish,
+ tags = { define.DiagnosticTag.Unnecessary },
+ message = lang.script('DIAG_UNUSED_LOCAL', name),
+ }
+ end
+ end)
+end
diff --git a/server-beta/src/core/diagnostics/unused-vararg.lua b/server-beta/src/core/diagnostics/unused-vararg.lua
new file mode 100644
index 00000000..b3d19c21
--- /dev/null
+++ b/server-beta/src/core/diagnostics/unused-vararg.lua
@@ -0,0 +1,3 @@
+return function ()
+
+end