Skip to content

Commit 3f62b74

Browse files
committed
fix: mypy ci and formatting
1 parent 0535442 commit 3f62b74

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

lua/guard-collection/linter/mypy/base.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ return function(cmd, args)
6464
tonumber(mes.col) - opts.offset,
6565
('%s [%s]'):format(mes.message, code),
6666
opts.severities[mes.severity],
67-
opts.source
67+
opts.source,
68+
nil,
69+
nil
6870
)
6971

7072
diag.end_col = tonumber(mes.end_col) - opts.offset

test/formatter/alejandra_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ describe('alejandra', function()
77
-- the helper creates a new buffer with it, formats, and returns the formatted output
88
local formatted = require('test.formatter.helper').test_with('nix', {
99
-- The input code should somewhat reflect the filetype
10-
[[{inputs={nixpkgs.url="github:NixOS/nixpkgs/nixos-unstable";};}]]
10+
[[{inputs={nixpkgs.url="github:NixOS/nixpkgs/nixos-unstable";};}]],
1111
})
1212
-- Show that the input is indeed formatted as intended
1313
assert.are.same({
14-
[[{inputs = {nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";};}]]
14+
[[{inputs = {nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";};}]],
1515
}, formatted)
1616
end)
1717
end)

test/linter/mypy_spec.lua

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,18 @@ describe('mypy', function()
66
ft('python'):lint('mypy')
77

88
local diagnostics = helper.test_with('python', {
9-
[[from typing import Iterator]],
10-
[[def fib(n) -> Iterator[str]:]],
11-
[[ a, b = 0, 1]],
12-
[[ while a < n:]],
13-
[[ yield a]],
14-
[[ a, b = b, a+b]],
9+
[[def foo() -> str:]],
10+
[[ return 42]],
1511
})
1612

1713
assert.are.same({
1814
{
1915
bufnr = 3,
20-
col = 4,
21-
end_col = 10,
22-
end_lnum = 4,
23-
lnum = 4,
24-
message = 'Incompatible types in "yield" (actual type "int", expected type "str") [misc]',
16+
col = 11,
17+
end_col = 12,
18+
end_lnum = 1,
19+
lnum = 1,
20+
message = 'Incompatible return value type (got "int", expected "str") [return-value]',
2521
namespace = ns,
2622
severity = 1,
2723
source = 'mypy',

0 commit comments

Comments
 (0)