Skip to content

Commit

Permalink
chore(luacheck) re-enable unused vars linting
Browse files Browse the repository at this point in the history
The recent .luacheckrc file disabled both unused args and unused
variables. We make sure to re-enable unused variables linting, and fix
all of the mistakes made in the meanwhile.
  • Loading branch information
thibaultcha committed May 4, 2017
1 parent 3312481 commit d15fb51
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
std = "ngx_lua"
unused = false
unused_args = false
redefined = false
max_line_length = false

Expand Down
2 changes: 1 addition & 1 deletion kong/api/routes/upstreams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ return {
clean_history(self.upstream.id, dao_factory)

-- this is just a wrapper around POSTing a new target with weight=0
local data, err = dao_factory.targets:insert({
local _, err = dao_factory.targets:insert({
target = self.target.target,
upstream_id = self.upstream.id,
weight = 0,
Expand Down
1 change: 0 additions & 1 deletion kong/core/router.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ end

local match_api
local reduce
local empty_t = {}


local function marshall_api(api)
Expand Down
1 change: 0 additions & 1 deletion kong/plugins/request-termination/schema.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
local Errors = require "kong.dao.errors"
local utils = require "kong.tools.utils"

return {
no_consumer = true,
Expand Down
2 changes: 0 additions & 2 deletions kong/plugins/runscope/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ local BasePlugin = require "kong.plugins.base_plugin"
local log = require "kong.plugins.runscope.log"
local public_utils = require "kong.tools.public"

local ngx_log = ngx.log
local ngx_log_ERR = ngx.ERR
local string_find = string.find
local req_read_body = ngx.req.read_body
local req_get_headers = ngx.req.get_headers
Expand Down
1 change: 0 additions & 1 deletion spec/01-unit/11-router_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,6 @@ describe("Router", function()
it("does not read Host header if not required", function()
local _ngx = mock_ngx("GET", "/my-api", {})

local var_mt = getmetatable(_ngx.var)
spy.on(spy_stub, "nop")

local router = assert(Router.new(use_case_apis))
Expand Down
1 change: 0 additions & 1 deletion spec/03-plugins/09-galileo/01-alf_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
_G.ngx = require "spec.03-plugins.09-galileo.ngx"
local json = require "cjson"

-- asserts if an array contains a given table
local function contains(state, args)
Expand Down
4 changes: 2 additions & 2 deletions spec/03-plugins/21-ldap-auth/01-access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ end)

describe("Plugin: ldap-auth (access)", function()

local client, user1, user2, anonymous
local client, user1, anonymous

setup(function()
local api1 = assert(helpers.dao.apis:insert {
Expand Down Expand Up @@ -482,7 +482,7 @@ describe("Plugin: ldap-auth (access)", function()
assert.request(res).has.no.header("x-anonymous-consumer")
local id = assert.request(res).has.header("x-consumer-id")
assert.not_equal(id, anonymous.id)
assert(id == user1.id or id == user2.id)
assert(id == user1.id)
end)

it("passes with only the first credential provided", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/23-aws-lambda/01-access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pending("Plugin: AWS Lambda (access)", function()
-- invocation will take the most time
client = helpers.proxy_client()
client:set_timeout(2 * 60 * 1000) -- 2 minute timeout for the warmup
local res = assert(client:send {
assert(client:send {
method = "GET",
path = "/get?key1=some_value1&key2=some_value2&key3=some_value3",
headers = {
Expand Down
2 changes: 0 additions & 2 deletions spec/03-plugins/27-request-termination/02-access_spec.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
local helpers = require "spec.helpers"
local cache = require "kong.tools.database_cache"
local cjson = require "cjson"

describe("Plugin: request-termination (access)", function()
local plugin_config
local client, admin_client

setup(function()
Expand Down

0 comments on commit d15fb51

Please sign in to comment.