You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include gdscript warning name in the warning message.
Occasionally you want to ignore a warning with a `warning-ignore`
comment, and you have to go into the settings to look up what the
actual name of the warning is. This patch appends the warning name to
the end of the warning so you know what string to use to ignore it,
similar to other linters like pylint.
For example
```
"The signal 'blah' is declared but never emitted.";
```
is now
```
"The signal 'blah' is declared but never emitted. (UNUSED_SIGNAL)";
```
return"Using assignment with operation but the variable '" + symbols[0] + "' was not previously assigned a value.";
2028
+
msg ="Using assignment with operation but the variable '" + symbols[0] + "' was not previously assigned a value.";
2027
2029
} break;
2028
2030
case UNASSIGNED_VARIABLE: {
2029
2031
CHECK_SYMBOLS(1);
2030
-
return"The variable '" + symbols[0] + "' was used but never assigned a value.";
2032
+
msg ="The variable '" + symbols[0] + "' was used but never assigned a value.";
2031
2033
} break;
2032
2034
case UNUSED_VARIABLE: {
2033
2035
CHECK_SYMBOLS(1);
2034
-
return"The local variable '" + symbols[0] + "' is declared but never used in the block. If this is intended, prefix it with an underscore: '_" + symbols[0] + "'";
2036
+
msg ="The local variable '" + symbols[0] + "' is declared but never used in the block. If this is intended, prefix it with an underscore: '_" + symbols[0] + "'";
2035
2037
} break;
2036
2038
case SHADOWED_VARIABLE: {
2037
2039
CHECK_SYMBOLS(2);
2038
-
return"The local variable '" + symbols[0] + "' is shadowing an already-defined variable at line " + symbols[1] + ".";
2040
+
msg ="The local variable '" + symbols[0] + "' is shadowing an already-defined variable at line " + symbols[1] + ".";
2039
2041
} break;
2040
2042
case UNUSED_CLASS_VARIABLE: {
2041
2043
CHECK_SYMBOLS(1);
2042
-
return"The class variable '" + symbols[0] + "' is declared but never used in the script.";
2044
+
msg ="The class variable '" + symbols[0] + "' is declared but never used in the script.";
2043
2045
} break;
2044
2046
case UNUSED_ARGUMENT: {
2045
2047
CHECK_SYMBOLS(2);
2046
-
return"The argument '" + symbols[1] + "' is never used in the function '" + symbols[0] + "'. If this is intended, prefix it with an underscore: '_" + symbols[1] + "'";
2048
+
msg ="The argument '" + symbols[1] + "' is never used in the function '" + symbols[0] + "'. If this is intended, prefix it with an underscore: '_" + symbols[1] + "'";
2047
2049
} break;
2048
2050
case UNREACHABLE_CODE: {
2049
2051
CHECK_SYMBOLS(1);
2050
-
return"Unreachable code (statement after return) in function '" + symbols[0] + "()'.";
2052
+
msg ="Unreachable code (statement after return) in function '" + symbols[0] + "()'.";
2051
2053
} break;
2052
2054
case STANDALONE_EXPRESSION: {
2053
-
return"Standalone expression (the line has no effect).";
2055
+
msg ="Standalone expression (the line has no effect).";
2054
2056
} break;
2055
2057
case VOID_ASSIGNMENT: {
2056
2058
CHECK_SYMBOLS(1);
2057
-
return"Assignment operation, but the function '" + symbols[0] + "()' returns void.";
2059
+
msg ="Assignment operation, but the function '" + symbols[0] + "()' returns void.";
2058
2060
} break;
2059
2061
case NARROWING_CONVERSION: {
2060
-
return"Narrowing conversion (float is converted to int and loses precision).";
2062
+
msg ="Narrowing conversion (float is converted to int and loses precision).";
2061
2063
} break;
2062
2064
case FUNCTION_MAY_YIELD: {
2063
2065
CHECK_SYMBOLS(1);
2064
-
return"Assigned variable is typed but the function '" + symbols[0] + "()' may yield and return a GDScriptFunctionState instead.";
2066
+
msg ="Assigned variable is typed but the function '" + symbols[0] + "()' may yield and return a GDScriptFunctionState instead.";
2065
2067
} break;
2066
2068
case VARIABLE_CONFLICTS_FUNCTION: {
2067
2069
CHECK_SYMBOLS(1);
2068
-
return"Variable declaration of '" + symbols[0] + "' conflicts with a function of the same name.";
2070
+
msg ="Variable declaration of '" + symbols[0] + "' conflicts with a function of the same name.";
2069
2071
} break;
2070
2072
case FUNCTION_CONFLICTS_VARIABLE: {
2071
2073
CHECK_SYMBOLS(1);
2072
-
return"Function declaration of '" + symbols[0] + "()' conflicts with a variable of the same name.";
2074
+
msg ="Function declaration of '" + symbols[0] + "()' conflicts with a variable of the same name.";
2073
2075
} break;
2074
2076
case FUNCTION_CONFLICTS_CONSTANT: {
2075
2077
CHECK_SYMBOLS(1);
2076
-
return"Function declaration of '" + symbols[0] + "()' conflicts with a constant of the same name.";
2078
+
msg ="Function declaration of '" + symbols[0] + "()' conflicts with a constant of the same name.";
2077
2079
} break;
2078
2080
case INCOMPATIBLE_TERNARY: {
2079
-
return"Values of the ternary conditional are not mutually compatible.";
2081
+
msg ="Values of the ternary conditional are not mutually compatible.";
2080
2082
} break;
2081
2083
case UNUSED_SIGNAL: {
2082
2084
CHECK_SYMBOLS(1);
2083
-
return"The signal '" + symbols[0] + "' is declared but never emitted.";
2085
+
msg ="The signal '" + symbols[0] + "' is declared but never emitted.";
2084
2086
} break;
2085
2087
case RETURN_VALUE_DISCARDED: {
2086
2088
CHECK_SYMBOLS(1);
2087
-
return"The function '" + symbols[0] + "()' returns a value, but this value is never used.";
2089
+
msg ="The function '" + symbols[0] + "()' returns a value, but this value is never used.";
2088
2090
} break;
2089
2091
case PROPERTY_USED_AS_FUNCTION: {
2090
2092
CHECK_SYMBOLS(2);
2091
-
return"The method '" + symbols[0] + "()' was not found in base '" + symbols[1] + "' but there's a property with the same name. Did you mean to access it?";
2093
+
msg ="The method '" + symbols[0] + "()' was not found in base '" + symbols[1] + "' but there's a property with the same name. Did you mean to access it?";
2092
2094
} break;
2093
2095
case CONSTANT_USED_AS_FUNCTION: {
2094
2096
CHECK_SYMBOLS(2);
2095
-
return"The method '" + symbols[0] + "()' was not found in base '" + symbols[1] + "' but there's a constant with the same name. Did you mean to access it?";
2097
+
msg ="The method '" + symbols[0] + "()' was not found in base '" + symbols[1] + "' but there's a constant with the same name. Did you mean to access it?";
2096
2098
} break;
2097
2099
case FUNCTION_USED_AS_PROPERTY: {
2098
2100
CHECK_SYMBOLS(2);
2099
-
return"The property '" + symbols[0] + "' was not found in base '" + symbols[1] + "' but there's a method with the same name. Did you mean to call it?";
2101
+
msg ="The property '" + symbols[0] + "' was not found in base '" + symbols[1] + "' but there's a method with the same name. Did you mean to call it?";
2100
2102
} break;
2101
2103
case INTEGER_DIVISION: {
2102
-
return"Integer division, decimal part will be discarded.";
2104
+
msg ="Integer division, decimal part will be discarded.";
2103
2105
} break;
2104
2106
case UNSAFE_PROPERTY_ACCESS: {
2105
2107
CHECK_SYMBOLS(2);
2106
-
return"The property '" + symbols[0] + "' is not present on the inferred type '" + symbols[1] + "' (but may be present on a subtype).";
2108
+
msg ="The property '" + symbols[0] + "' is not present on the inferred type '" + symbols[1] + "' (but may be present on a subtype).";
2107
2109
} break;
2108
2110
case UNSAFE_METHOD_ACCESS: {
2109
2111
CHECK_SYMBOLS(2);
2110
-
return"The method '" + symbols[0] + "' is not present on the inferred type '" + symbols[1] + "' (but may be present on a subtype).";
2112
+
msg ="The method '" + symbols[0] + "' is not present on the inferred type '" + symbols[1] + "' (but may be present on a subtype).";
2111
2113
} break;
2112
2114
case UNSAFE_CAST: {
2113
2115
CHECK_SYMBOLS(1);
2114
-
return"The value is cast to '" + symbols[0] + "' but has an unknown type.";
2116
+
msg ="The value is cast to '" + symbols[0] + "' but has an unknown type.";
2115
2117
} break;
2116
2118
case UNSAFE_CALL_ARGUMENT: {
2117
2119
CHECK_SYMBOLS(4);
2118
-
return"The argument '" + symbols[0] + "' of the function '" + symbols[1] + "' requires a the subtype '" + symbols[2] + "' but the supertype '" + symbols[3] + "' was provided";
2120
+
msg ="The argument '" + symbols[0] + "' of the function '" + symbols[1] + "' requires a the subtype '" + symbols[2] + "' but the supertype '" + symbols[3] + "' was provided";
2119
2121
} break;
2120
2122
case DEPRECATED_KEYWORD: {
2121
2123
CHECK_SYMBOLS(2);
2122
-
return"The '" + symbols[0] + "' keyword is deprecated and will be removed in a future release, please replace its uses by '" + symbols[1] + "'.";
2124
+
msg ="The '" + symbols[0] + "' keyword is deprecated and will be removed in a future release, please replace its uses by '" + symbols[1] + "'.";
2123
2125
} break;
2124
2126
case STANDALONE_TERNARY: {
2125
-
return"Standalone ternary conditional operator: the return value is being discarded.";
2126
-
}
2127
-
case WARNING_MAX: break; // Can't happen, but silences warning
2127
+
msg = "Standalone ternary conditional operator: the return value is being discarded.";
0 commit comments