Skip to content

Commit c709578

Browse files
authored
ci: stylua-action (#107)
1 parent b626ac7 commit c709578

File tree

6 files changed

+80
-80
lines changed

6 files changed

+80
-80
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ jobs:
3737
manager: brew
3838
packages: fd elixir
3939
steps:
40-
- uses: actions/checkout@v2
40+
- uses: actions/checkout@v3
41+
- uses: JohnnyMorganz/stylua-action@v3
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
version: latest
45+
args: --check .
4146

4247
- run: date +%F > todays-date
4348
- name: Restore from todays cache

lua/elixir/credo/init.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ function M.setup(opts)
4848
name = "Credo",
4949
cmd = cmd,
5050
cmd_env = {
51-
CREDO_LSP_VERSION = opts.version
52-
51+
CREDO_LSP_VERSION = opts.version,
5352
},
5453
settings = {},
5554
root_dir = vim.fs.dirname(file),

tests/compile_spec.lua

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ local Compile = require("elixir.elixirls.compile")
55
local versions = require("elixir.elixirls.version").get()
66

77
describe("compile", function()
8-
before_each(function()
9-
if not Path:new("tmp/clones/elixir-ls/mix.exs"):exists() then
10-
Path:new("tmp/clones"):mkdir({ mode = 493, parents = true })
11-
vim.fn.system("git -C tmp/clones clone https://github.com/elixir-lsp/elixir-ls.git")
12-
end
8+
before_each(function()
9+
if not Path:new("tmp/clones/elixir-ls/mix.exs"):exists() then
10+
Path:new("tmp/clones"):mkdir { mode = 493, parents = true }
11+
vim.fn.system("git -C tmp/clones clone https://github.com/elixir-lsp/elixir-ls.git")
12+
end
1313

14-
vim.fn.system("rm -rf tmp/installs")
15-
vim.fn.system("mkdir -p tmp/installs")
16-
end)
14+
vim.fn.system("rm -rf tmp/installs")
15+
vim.fn.system("mkdir -p tmp/installs")
16+
end)
1717

18-
it("can compile elixir ls", function()
19-
local source_path = "tmp/clones/elixir-ls"
20-
local install_path = Path:new("tmp/installs/mhanberg/elixir-ls/HEAD", versions):absolute()
21-
local job = Compile.compile(source_path, install_path, { sync = true })
18+
it("can compile elixir ls", function()
19+
local source_path = "tmp/clones/elixir-ls"
20+
local install_path = Path:new("tmp/installs/mhanberg/elixir-ls/HEAD", versions):absolute()
21+
local job = Compile.compile(source_path, install_path, { sync = true })
2222

23-
eq(job.code, 0)
23+
eq(job.code, 0)
2424

25-
assert.True(Path:new("tmp/installs/mhanberg/elixir-ls/HEAD", versions, "language_server.sh"):exists())
26-
end)
25+
assert.True(Path:new("tmp/installs/mhanberg/elixir-ls/HEAD", versions, "language_server.sh"):exists())
26+
end)
2727
end)

tests/download_spec.lua

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,50 @@ local Path = require("plenary.path")
22
local eq = assert.are.same
33
local Download = require("elixir.elixirls.download")
44
vim.notify = function(thing)
5-
io.stdout:write(thing .. "\n")
5+
io.stdout:write(thing .. "\n")
66
end
77

88
describe("download", function()
9-
before_each(function()
10-
vim.fn.system([[rm -rf tmp/downloads]])
9+
before_each(function()
10+
vim.fn.system([[rm -rf tmp/downloads]])
1111

12-
assert(not Path:new("tmp/downloads"):exists(), "tmp/downloads was not deleted")
13-
end)
12+
assert(not Path:new("tmp/downloads"):exists(), "tmp/downloads was not deleted")
13+
end)
1414

15-
it("can git clone HEAD of the source code", function()
16-
local download_dir = "tmp/downloads"
15+
it("can git clone HEAD of the source code", function()
16+
local download_dir = "tmp/downloads"
1717

18-
local result = Download.clone(download_dir, { repo = "elixir-lsp/elixir-ls", ref = "HEAD" })
18+
local result = Download.clone(download_dir, { repo = "elixir-lsp/elixir-ls", ref = "HEAD" })
1919

20-
eq("elixir-lsp/elixir-ls/HEAD", result)
21-
assert.True(Path:new(download_dir, "elixir-lsp/elixir-ls/HEAD", "mix.exs"):exists())
22-
end)
20+
eq("elixir-lsp/elixir-ls/HEAD", result)
21+
assert.True(Path:new(download_dir, "elixir-lsp/elixir-ls/HEAD", "mix.exs"):exists())
22+
end)
2323

24-
it("can clone from a different repository", function()
25-
local download_dir = "tmp/downloads"
24+
it("can clone from a different repository", function()
25+
local download_dir = "tmp/downloads"
2626

27-
local result = Download.clone(download_dir, { repo = "mhanberg/elixir-ls", ref = "HEAD" })
27+
local result = Download.clone(download_dir, { repo = "mhanberg/elixir-ls", ref = "HEAD" })
2828

29-
eq("mhanberg/elixir-ls/HEAD", result)
30-
assert.True(Path:new(download_dir, "mhanberg/elixir-ls/HEAD", "mix.exs"):exists())
31-
end)
29+
eq("mhanberg/elixir-ls/HEAD", result)
30+
assert.True(Path:new(download_dir, "mhanberg/elixir-ls/HEAD", "mix.exs"):exists())
31+
end)
3232

33-
it("can checkout a different branch", function()
34-
local download_dir = "tmp/downloads"
33+
it("can checkout a different branch", function()
34+
local download_dir = "tmp/downloads"
3535

36-
local result = Download.clone(download_dir, { repo = "mhanberg/elixir-ls", ref = "mh/all-workspace-symbols" })
36+
local result =
37+
Download.clone(download_dir, { repo = "mhanberg/elixir-ls", ref = "mh/all-workspace-symbols" })
3738

38-
eq("mhanberg/elixir-ls/mh_all-workspace-symbols", result)
39-
assert.True(Path:new(download_dir, "mhanberg/elixir-ls/mh_all-workspace-symbols", "mix.exs"):exists())
40-
end)
39+
eq("mhanberg/elixir-ls/mh_all-workspace-symbols", result)
40+
assert.True(Path:new(download_dir, "mhanberg/elixir-ls/mh_all-workspace-symbols", "mix.exs"):exists())
41+
end)
4142

42-
it("can checkout a different tag", function()
43-
local download_dir = "tmp/downloads"
43+
it("can checkout a different tag", function()
44+
local download_dir = "tmp/downloads"
4445

45-
local result = Download.clone(download_dir, { repo = "elixir-lsp/elixir-ls", ref = "tags/v0.14.6" })
46+
local result = Download.clone(download_dir, { repo = "elixir-lsp/elixir-ls", ref = "tags/v0.14.6" })
4647

47-
eq("elixir-lsp/elixir-ls/tags_v0.14.6", result)
48-
assert.True(Path:new(download_dir, "elixir-lsp/elixir-ls/tags_v0.14.6", "mix.exs"):exists())
49-
end)
48+
eq("elixir-lsp/elixir-ls/tags_v0.14.6", result)
49+
assert.True(Path:new(download_dir, "elixir-lsp/elixir-ls/tags_v0.14.6", "mix.exs"):exists())
50+
end)
5051
end)

tests/elixirls_spec.lua

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@ local shell = vim.fn.system
22
local elixirls = require("elixir.elixirls")
33

44
describe("elixir", function()
5-
describe("command", function()
6-
after_each(function()
7-
shell("rm -rf tmp/fake_install")
8-
end)
5+
describe("command", function()
6+
after_each(function()
7+
shell("rm -rf tmp/fake_install")
8+
end)
99

10-
it("returns false when it's not installed", function()
11-
local install_path = "tmp/fake_install"
12-
local result = elixirls.command({
13-
path = install_path,
14-
repo = "foo/biz",
15-
ref = "bar/baz",
16-
versions = "foobarbaz",
17-
})
10+
it("returns false when it's not installed", function()
11+
local install_path = "tmp/fake_install"
12+
local result = elixirls.command {
13+
path = install_path,
14+
repo = "foo/biz",
15+
ref = "bar/baz",
16+
versions = "foobarbaz",
17+
}
1818

19-
assert.are.same("tmp/fake_install/foo/biz/bar_baz/foobarbaz/language_server.sh", tostring(result))
20-
assert.False(result:exists())
21-
end)
19+
assert.are.same("tmp/fake_install/foo/biz/bar_baz/foobarbaz/language_server.sh", tostring(result))
20+
assert.False(result:exists())
21+
end)
2222

23-
it("returns true when it is installed", function()
24-
local install_path = "tmp/fake_install"
25-
shell("mkdir -p tmp/fake_install/foo/biz/bar_baz/foobarbaz")
26-
shell("touch tmp/fake_install/foo/biz/bar_baz/foobarbaz/language_server.sh")
23+
it("returns true when it is installed", function()
24+
local install_path = "tmp/fake_install"
25+
shell("mkdir -p tmp/fake_install/foo/biz/bar_baz/foobarbaz")
26+
shell("touch tmp/fake_install/foo/biz/bar_baz/foobarbaz/language_server.sh")
2727

28-
local result = elixirls.command({
29-
path = install_path,
30-
repo = "foo/biz",
31-
ref = "bar/baz",
32-
versions = "foobarbaz",
33-
})
28+
local result = elixirls.command {
29+
path = install_path,
30+
repo = "foo/biz",
31+
ref = "bar/baz",
32+
versions = "foobarbaz",
33+
}
3434

35-
assert.True(result:exists())
36-
end)
37-
end)
35+
assert.True(result:exists())
36+
end)
37+
end)
3838
end)

tests/utils_spec.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ local root_dir = vim.fn.getcwd()
22
local utils = require("elixir.utils")
33

44
describe("utils", function()
5-
65
after_each(function()
76
vim.api.nvim_command("cd " .. root_dir)
87
end)
98

109
describe("root_dir", function()
11-
1210
it("finds elixir project root dir without a filename", function()
13-
1411
local project_dir = root_dir .. "/tests/fixtures/project_a"
1512

1613
vim.api.nvim_command("cd " .. project_dir)
@@ -38,7 +35,5 @@ describe("utils", function()
3835

3936
assert.are.equal(nil, result)
4037
end)
41-
4238
end)
4339
end)
44-

0 commit comments

Comments
 (0)