Skip to content

Commit c9ade97

Browse files
committed
fix: use correct type annotation for optional parameters
1 parent 3d64a2c commit c9ade97

8 files changed

Lines changed: 16 additions & 16 deletions

File tree

lua/gitlab/actions/common.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ M.print_node = function(tree)
127127
end
128128

129129
---Check if type of node is note or note body
130-
---@param node NuiTree.Node?
130+
---@param node? NuiTree.Node
131131
---@return boolean
132132
M.is_node_note = function(node)
133133
if node and (node.type == "note_body" or node.type == "note") then
@@ -139,7 +139,7 @@ end
139139

140140
---Get root node
141141
---@param tree NuiTree
142-
---@param node NuiTree.Node?
142+
---@param node? NuiTree.Node
143143
---@return NuiTree.Node?
144144
M.get_root_node = function(tree, node)
145145
if not node then
@@ -155,7 +155,7 @@ end
155155

156156
---Get note node
157157
---@param tree NuiTree
158-
---@param node NuiTree.Node?
158+
---@param node? NuiTree.Node
159159
---@return NuiTree.Node?
160160
M.get_note_node = function(tree, node)
161161
if not node then

lua/gitlab/actions/discussions/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ end
109109

110110
---Opens the discussion tree, sets the keybindings. It also
111111
---creates the tree for notes (which are not linked to specific lines of code)
112-
---@param callback function?
112+
---@param callback? function
113113
---@param view_type "discussions"|"notes" Defines the view type to select (useful for overriding the default view type when jumping to discussion tree when it's closed).
114114
M.open = function(callback, view_type)
115115
local original_window = vim.api.nvim_get_current_win() -- The window from which ther user called M.open

lua/gitlab/actions/discussions/tree.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local M = {}
1111

1212
---Create nodes for NuiTree from discussions
1313
---@param items Discussion[]
14-
---@param unlinked boolean? False or nil means that discussions are linked to code lines
14+
---@param unlinked? boolean False or nil means that discussions are linked to code lines
1515
---@return NuiTree.Node[]
1616
M.add_discussions_to_table = function(items, unlinked)
1717
local t = {}
@@ -102,7 +102,7 @@ end
102102
---Create path node
103103
---@param relative_path string
104104
---@param full_path string
105-
---@param child_nodes NuiTree.Node[]?
105+
---@param child_nodes? NuiTree.Node[]
106106
---@return NuiTree.Node
107107
local function create_path_node(relative_path, full_path, child_nodes)
108108
return NuiTree.Node({
@@ -154,7 +154,7 @@ end
154154
---Create file name node
155155
---@param file_name string
156156
---@param full_file_path string
157-
---@param child_nodes NuiTree.Node[]?
157+
---@param child_nodes? NuiTree.Node[]
158158
---@return NuiTree.Node
159159
local function create_file_name_node(file_name, full_file_path, child_nodes)
160160
local icon, icon_hl = u.get_icon(file_name)
@@ -258,7 +258,7 @@ end
258258

259259
---Build note node body
260260
---@param note Note|DraftNote
261-
---@param resolve_info table?
261+
---@param resolve_info? table
262262
---@return string
263263
---@return NuiTree.Node[]
264264
local function build_note_body(note, resolve_info)
@@ -294,7 +294,7 @@ end
294294

295295
---Build note node
296296
---@param note Note|DraftNote
297-
---@param resolve_info table?
297+
---@param resolve_info? table
298298
---@return NuiTree.Node
299299
---@return string
300300
---@return NuiTree.Node[]

lua/gitlab/actions/merge.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ M.merge = function(opts)
4646
end
4747

4848
---@param merge_body MergeOpts
49-
---@param squash_message string?
49+
---@param squash_message? string
5050
M.confirm_merge = function(merge_body, squash_message)
5151
if squash_message ~= nil then
5252
merge_body.squash_message = squash_message

lua/gitlab/git_async.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ end
2727
---@param remote string The remote from which to pull.
2828
---@param branch string The branch to pull.
2929
---@param on_exit OnExitCallback The callback to execute when the command finishes.
30-
---@param args string[]? Extra arguments passed to the `git pull` command.
30+
---@param args? string[] Extra arguments passed to the `git pull` command.
3131
M.pull = function(remote, branch, on_exit, args)
3232
local current_branch = require("gitlab.git").get_current_branch()
3333
if not current_branch then

lua/gitlab/indicators/diagnostics.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ end
8888
---@param namespace number namespace for diagnostics
8989
---@param bufnr number the bufnr for placing the diagnostics
9090
---@param diagnostics table see :h vim.diagnostic.set
91-
---@param opts table? see :h vim.diagnostic.set
91+
---@param opts? table see :h vim.diagnostic.set
9292
local set_diagnostics = function(namespace, bufnr, diagnostics, opts)
9393
vim.diagnostic.set(namespace, bufnr, diagnostics, opts)
9494
require("gitlab.indicators.signs").set_signs(diagnostics, bufnr)

lua/gitlab/popup.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ local M = {}
55
---Get the popup view_opts
66
---@param title string The string to appear on top of the popup
77
---@param user_settings table|nil User-defined popup settings
8-
---@param width number? Override default width
9-
---@param height number? Override default height
10-
---@param zindex number? Override default zindex
8+
---@param width? number Override default width
9+
---@param height? number Override default height
10+
---@param zindex? number Override default zindex
1111
---@return table
1212
M.create_popup_state = function(title, user_settings, width, height, zindex)
1313
local settings = u.merge(require("gitlab.state").settings.popup, user_settings or {})

lua/gitlab/utils/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ M.get_web_url = function()
657657
M.notify("Could not get Gitlab URL", vim.log.levels.ERROR)
658658
end
659659

660-
---@param url string?
660+
---@param url? string
661661
M.open_in_browser = function(url)
662662
if vim.fn.has("mac") == 1 then
663663
vim.fn.jobstart({ "open", url })

0 commit comments

Comments
 (0)