too_many_arguments
Finds a procedure with more parameters than max_arguments (default 7).
Category restriction, allow by default.
Off by default; the example is shown with the rule enabled.
#import "Basic";
draw :: (x: int, y: int, w: int, h: int, r: u8, g: u8, b: u8, a: u8) -> int {
return x + y + w + h + r + g + b + a;
}
main :: () {
print("%\n", draw(0, 0, 10, 10, 255, 0, 0, 255));
}warning[too_many_arguments]: `draw` takes 8 parameters, past the limit of 7
--> example.jai:3:1
|
3 | draw :: (x: int, y: int, w: int, h: int, r: u8, g: u8, b: u8, a: u8) -> int {
| ^^^^
|
= help: group parameters that belong together in a struct and pass that#import "Basic";
Rect :: struct {
x, y, w, h: int;
}
Color :: struct {
r, g, b, a: u8;
}
draw :: (rect: Rect, color: Color) -> int {
return rect.x + rect.y + rect.w + rect.h + color.r + color.g + color.b + color.a;
}
main :: () {
print("%\n", draw(.{ 0, 0, 10, 10 }, .{ 255, 0, 0, 255 }));
}Every parameter counts, defaulted, baked ($T) and variadic ones included.