Skip to content

Commit

Permalink
chore(lint): fix lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nehrig <[email protected]>
  • Loading branch information
danielnehrig committed Oct 21, 2023
1 parent 23416a6 commit 34baf8a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 39 deletions.
2 changes: 1 addition & 1 deletion lua/config/core/options.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local globals = require("config.core.global")
local g, opt, go, wo, o = vim.g, vim.opt, vim.go, vim.wo, vim.o
local g, opt, wo, o = vim.g, vim.opt, vim.go, vim.wo
local M = {}

--- Toggle fold on click
Expand Down
5 changes: 4 additions & 1 deletion lua/config/plugins/modules/utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ M.utility = {
lang = {
rust = {
-- grcov cargo install grcov
coverage_command = "grcov ./ -s ./ --binary-path ./target/llvm-cov-target/ -t coveralls --branch --ignore-not-existing --token NO_TOKEN",
coverage_command = table.concat({
"grcov ./ -s ./ --binary-path ./target/llvm-cov-target/ -t",
"coveralls --branch --ignore-not-existing --token NO_TOKEN",
}, " "),
project_files_only = true,
project_files = {
"src/*",
Expand Down
55 changes: 18 additions & 37 deletions lua/config/utils/toml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,6 @@ TOML.parse = function(toml, options)
return str:gsub("^%s*(.-)%s*$", "%1")
end

-- divide a string into a table around a delimiter
local function split(str, delim)
if str == "" then
return {}
end
local result = {}
local append = delim
if delim:match("%%") then
append = delim:gsub("%%", "")
end
for match in (str .. append):gmatch("(.-)" .. delim) do
table.insert(result, match)
end
return result
end

-- produce a parsing error message
-- the error contains the line number of the current position
local function err(message, strictOnly)
Expand Down Expand Up @@ -160,21 +144,21 @@ TOML.parse = function(toml, options)
}
-- utf function from http://stackoverflow.com/a/26071044
-- converts \uXXX into actual unicode
local function utf(char)
local function utf(char2)
local bytemarkers =
{ { 0x7ff, 192 }, { 0xffff, 224 }, { 0x1fffff, 240 } }
if char < 128 then
return string.char(char)
if char2 < 128 then
return string.char(char2)
end
local charbytes = {}
for bytes, vals in pairs(bytemarkers) do
if char <= vals[1] then
if char2 <= vals[1] then
for b = bytes + 1, 2, -1 do
local mod = char % 64
char = (char - mod) / 64
local mod = char2 % 64
char2 = (char2 - mod) / 64
charbytes[b] = string.char(128 + mod)
end
charbytes[1] = string.char(vals[2] + char)
charbytes[1] = string.char(vals[2] + char2)
break
end
end
Expand Down Expand Up @@ -360,19 +344,19 @@ TOML.parse = function(toml, options)
local function parseInlineTable()
step() -- skip opening brace

local buffer = ""
local buffer2 = ""
local quoted = false
local tbl = {}

while bounds() do
if char() == "}" then
break
elseif char() == "'" or char() == '"' then
buffer = parseString().value
buffer2 = parseString().value
quoted = true
elseif char() == "=" then
if not quoted then
buffer = trim(buffer)
buffer2 = trim(buffer2)
end

step() -- skip =
Expand All @@ -383,7 +367,7 @@ TOML.parse = function(toml, options)
end

local v = getValue().value
tbl[buffer] = v
tbl[buffer2] = v

skipWhitespace()

Expand All @@ -394,9 +378,9 @@ TOML.parse = function(toml, options)
end

quoted = false
buffer = ""
buffer2 = ""
else
buffer = buffer .. char()
buffer2 = buffer2 .. char()
step()
end
end
Expand Down Expand Up @@ -456,10 +440,6 @@ TOML.parse = function(toml, options)
end
end

if char():match(nl) then
-- skip
end

if char() == "=" then
step()
skipWhitespace()
Expand All @@ -473,6 +453,7 @@ TOML.parse = function(toml, options)

if buffer == "" and not quotedKey then
err("Empty key name")
return
end

local v = getValue()
Expand Down Expand Up @@ -597,8 +578,8 @@ TOML.encode = function(tbl)

local cache = {}

local function parse(tbl)
for k, v in pairs(tbl) do
local function parse(tbl2)
for k, v in pairs(tbl2) do
if type(v) == "boolean" then
toml = toml .. k .. " = " .. tostring(v) .. "\n"
elseif type(v) == "number" then
Expand Down Expand Up @@ -640,7 +621,7 @@ TOML.encode = function(tbl)
if arrayTable then
-- double bracket syntax go!
table.insert(cache, k)
for kk, vv in pairs(v) do
for _, vv in pairs(v) do
toml = toml .. "[[" .. table.concat(cache, ".") .. "]]\n"
for k3, v3 in pairs(vv) do
if type(v3) ~= "table" then
Expand All @@ -655,7 +636,7 @@ TOML.encode = function(tbl)
else
-- plain ol boring array
toml = toml .. k .. " = [\n"
for kk, vv in pairs(first) do
for _, vv in pairs(first) do
toml = toml .. tostring(vv) .. ",\n"
end
toml = toml .. "]\n"
Expand Down

0 comments on commit 34baf8a

Please sign in to comment.