Skip to content

Commit 0e1b1ed

Browse files
authored
Merge pull request #2107 from AlWoSp/thwe/missing-local-export-doc
Annotation rule for exported local functions
2 parents ea48312 + d2a08ab commit 0e1b1ed

File tree

19 files changed

+421
-74
lines changed

19 files changed

+421
-74
lines changed

.luarc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"disable": [
44
"close-non-object",
55
"incomplete-signature-doc",
6-
"missing-global-doc"
6+
"missing-global-doc",
7+
"missing-local-export-doc"
78
],
89
"groupFileStatus": {
910
"ambiguity": "Any",

doc/en-us/config.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Array<string>
286286
* ``"miss-space-between"``
287287
* ``"miss-symbol"``
288288
* ``"missing-global-doc"``
289+
* ``"missing-local-export-doc"``
289290
* ``"missing-parameter"``
290291
* ``"missing-return"``
291292
* ``"missing-return-value"``
@@ -453,6 +454,7 @@ object<string, string>
453454
* duplicate-doc-param
454455
* incomplete-signature-doc
455456
* missing-global-doc
457+
* missing-local-export-doc
456458
* undefined-doc-class
457459
* undefined-doc-name
458460
* undefined-doc-param
@@ -578,6 +580,7 @@ object<string, string>
578580
* duplicate-doc-param
579581
* incomplete-signature-doc
580582
* missing-global-doc
583+
* missing-local-export-doc
581584
* undefined-doc-class
582585
* undefined-doc-name
583586
* undefined-doc-param
@@ -814,6 +817,10 @@ object<string, string>
814817
*/
815818
"missing-global-doc": "None",
816819
/*
820+
Enable diagnostics for exported local function definitions which are not fully annotated.
821+
*/
822+
"missing-local-export-doc": "None",
823+
/*
817824
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
818825
*/
819826
"missing-parameter": "Any",
@@ -1074,6 +1081,10 @@ object<string, string>
10741081
*/
10751082
"missing-global-doc": "Warning",
10761083
/*
1084+
Enable diagnostics for exported local function definitions which are not annotated.
1085+
*/
1086+
"missing-local-export-doc": "Warning",
1087+
/*
10771088
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
10781089
*/
10791090
"missing-parameter": "Warning",

doc/pt-br/config.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Array<string>
286286
* ``"miss-space-between"``
287287
* ``"miss-symbol"``
288288
* ``"missing-global-doc"``
289+
* ``"missing-local-export-doc"``
289290
* ``"missing-parameter"``
290291
* ``"missing-return"``
291292
* ``"missing-return-value"``
@@ -453,6 +454,7 @@ object<string, string>
453454
* duplicate-doc-param
454455
* incomplete-signature-doc
455456
* missing-global-doc
457+
* missing-local-export-doc
456458
* undefined-doc-class
457459
* undefined-doc-name
458460
* undefined-doc-param
@@ -577,6 +579,8 @@ object<string, string>
577579
* duplicate-doc-field
578580
* duplicate-doc-param
579581
* incomplete-signature-doc
582+
* missing-global-doc
583+
* missing-local-export-doc
580584
* undefined-doc-class
581585
* undefined-doc-name
582586
* undefined-doc-param
@@ -813,6 +817,10 @@ object<string, string>
813817
*/
814818
"missing-global-doc": "None",
815819
/*
820+
Enable diagnostics for exported local function definitions which are not fully annotated.
821+
*/
822+
"missing-local-export-doc": "None",
823+
/*
816824
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
817825
*/
818826
"missing-parameter": "Any",
@@ -1073,6 +1081,10 @@ object<string, string>
10731081
*/
10741082
"missing-global-doc": "Warning",
10751083
/*
1084+
Enable diagnostics for exported local function definitions which are not annotated.
1085+
*/
1086+
"missing-local-export-doc": "Warning",
1087+
/*
10761088
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
10771089
*/
10781090
"missing-parameter": "Warning",

doc/zh-cn/config.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Array<string>
286286
* ``"miss-space-between"``
287287
* ``"miss-symbol"``
288288
* ``"missing-global-doc"``
289+
* ``"missing-local-export-doc"``
289290
* ``"missing-parameter"``
290291
* ``"missing-return"``
291292
* ``"missing-return-value"``
@@ -453,6 +454,7 @@ object<string, string>
453454
* duplicate-doc-param
454455
* incomplete-signature-doc
455456
* missing-global-doc
457+
* missing-local-export-doc
456458
* undefined-doc-class
457459
* undefined-doc-name
458460
* undefined-doc-param
@@ -578,6 +580,7 @@ object<string, string>
578580
* duplicate-doc-param
579581
* incomplete-signature-doc
580582
* missing-global-doc
583+
* missing-local-export-doc
581584
* undefined-doc-class
582585
* undefined-doc-name
583586
* undefined-doc-param
@@ -814,6 +817,10 @@ object<string, string>
814817
*/
815818
"missing-global-doc": "None",
816819
/*
820+
Enable diagnostics for exported local function definitions which are not fully annotated.
821+
*/
822+
"missing-local-export-doc": "None",
823+
/*
817824
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
818825
*/
819826
"missing-parameter": "Any",
@@ -1073,6 +1080,10 @@ object<string, string>
10731080
*/
10741081
"missing-global-doc": "Warning",
10751082
/*
1083+
Enable diagnostics for exported local function definitions which are not annotated.
1084+
*/
1085+
"missing-local-export-doc": "Warning",
1086+
/*
10761087
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
10771088
*/
10781089
"missing-parameter": "Warning",

doc/zh-tw/config.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Array<string>
286286
* ``"miss-space-between"``
287287
* ``"miss-symbol"``
288288
* ``"missing-global-doc"``
289+
* ``"missing-local-export-doc"``
289290
* ``"missing-parameter"``
290291
* ``"missing-return"``
291292
* ``"missing-return-value"``
@@ -453,6 +454,7 @@ object<string, string>
453454
* duplicate-doc-param
454455
* incomplete-signature-doc
455456
* missing-global-doc
457+
* missing-local-export-doc
456458
* undefined-doc-class
457459
* undefined-doc-name
458460
* undefined-doc-param
@@ -578,6 +580,7 @@ object<string, string>
578580
* duplicate-doc-param
579581
* incomplete-signature-doc
580582
* missing-global-doc
583+
* missing-local-export-doc
581584
* undefined-doc-class
582585
* undefined-doc-name
583586
* undefined-doc-param
@@ -814,6 +817,10 @@ object<string, string>
814817
*/
815818
"missing-global-doc": "None",
816819
/*
820+
Enable diagnostics for exported local function definitions which are not fully annotated.
821+
*/
822+
"missing-local-export-doc": "None",
823+
/*
817824
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
818825
*/
819826
"missing-parameter": "Any",
@@ -1073,6 +1080,10 @@ object<string, string>
10731080
*/
10741081
"missing-global-doc": "Warning",
10751082
/*
1083+
Enable diagnostics for exported local function definitions which are not annotated.
1084+
*/
1085+
"missing-local-export-doc": "Warning",
1086+
/*
10761087
Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.
10771088
*/
10781089
"missing-parameter": "Warning",

locale/en-us/script.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ DIAG_MISSING_GLOBAL_DOC_PARAM =
120120
'Missing @param annotation for parameter `{}` in global function `{}`.'
121121
DIAG_MISSING_GLOBAL_DOC_RETURN =
122122
'Missing @return annotation at index `{}` in global function `{}`.'
123+
DIAG_MISSING_LOCAL_EXPORT_DOC_COMMENT =
124+
'Missing comment for exported local function `{}`.'
125+
DIAG_MISSING_LOCAL_EXPORT_DOC_PARAM =
126+
'Missing @param annotation for parameter `{}` in exported local function `{}`.'
127+
DIAG_MISSING_LOCAL_EXPORT_DOC_RETURN =
128+
'Missing @return annotation at index `{}` in exported local function `{}`.'
123129
DIAG_INCOMPLETE_SIGNATURE_DOC_PARAM =
124130
'Incomplete signature. Missing @param annotation for parameter `{}` in function `{}`.'
125131
DIAG_INCOMPLETE_SIGNATURE_DOC_RETURN =

locale/en-us/setting.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ config.diagnostics['invisible'] =
381381
'Enable diagnostics for accesses to fields which are invisible.'
382382
config.diagnostics['missing-global-doc'] =
383383
'Missing annotations for globals! Global functions must have a comment and annotations for all parameters and return values.'
384+
config.diagnostics['missing-local-export-doc'] =
385+
'Missing annotations for exported locals! Exported local functions must have a comment and annotations for all parameters and return values.'
384386
config.diagnostics['missing-parameter'] =
385387
'Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.'
386388
config.diagnostics['missing-return'] =

locale/pt-br/script.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ DIAG_MISSING_GLOBAL_DOC_PARAM = -- TODO: need translate!
120120
'Missing @param annotation for parameter `{}` in global function `{}`.'
121121
DIAG_MISSING_GLOBAL_DOC_RETURN = -- TODO: need translate!
122122
'Missing @return annotation at index `{}` in global function `{}`.'
123+
DIAG_MISSING_LOCAL_EXPORT_DOC_COMMENT = -- TODO: need translate!
124+
'Missing comment for exported local function `{}`.'
125+
DIAG_MISSING_LOCAL_EXPORT_DOC_PARAM = -- TODO: need translate!
126+
'Missing @param annotation for parameter `{}` in exported local function `{}`.'
127+
DIAG_MISSING_LOCAL_EXPORT_DOC_RETURN = -- TODO: need translate!
128+
'Missing @return annotation at index `{}` in exported local function `{}`.'
123129
DIAG_INCOMPLETE_SIGNATURE_DOC_PARAM = -- TODO: need translate!
124130
'Incomplete signature. Missing @param annotation for parameter `{}` in function `{}`.'
125131
DIAG_INCOMPLETE_SIGNATURE_DOC_RETURN = -- TODO: need translate!

locale/pt-br/setting.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ config.diagnostics['invisible'] = -- TODO: need translate!
381381
'Enable diagnostics for accesses to fields which are invisible.'
382382
config.diagnostics['missing-global-doc'] = -- TODO: need translate!
383383
'Missing annotations for globals! Global functions must have a comment and annotations for all parameters and return values.'
384+
config.diagnostics['missing-local-export-doc'] = -- TODO: need translate!
385+
'Missing annotations for exported locals! Exported local functions must have a comment and annotations for all parameters and return values.'
384386
config.diagnostics['missing-parameter'] = -- TODO: need translate!
385387
'Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.'
386388
config.diagnostics['missing-return'] = -- TODO: need translate!

locale/zh-cn/script.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ DIAG_MISSING_GLOBAL_DOC_PARAM = -- TODO: need translate!
120120
'Missing @param annotation for parameter `{}` in global function `{}`.'
121121
DIAG_MISSING_GLOBAL_DOC_RETURN = -- TODO: need translate!
122122
'Missing @return annotation at index `{}` in global function `{}`.'
123+
DIAG_MISSING_LOCAL_EXPORT_DOC_COMMENT = -- TODO: need translate!
124+
'Missing comment for exported local function `{}`.'
125+
DIAG_MISSING_LOCAL_EXPORT_DOC_PARAM = -- TODO: need translate!
126+
'Missing @param annotation for parameter `{}` in exported local function `{}`.'
127+
DIAG_MISSING_LOCAL_EXPORT_DOC_RETURN = -- TODO: need translate!
128+
'Missing @return annotation at index `{}` in exported local function `{}`.'
123129
DIAG_INCOMPLETE_SIGNATURE_DOC_PARAM = -- TODO: need translate!
124130
'Incomplete signature. Missing @param annotation for parameter `{}` in function `{}`.'
125131
DIAG_INCOMPLETE_SIGNATURE_DOC_RETURN = -- TODO: need translate!

0 commit comments

Comments
 (0)