From a96aa402fe50e310f2de8b942c4bbe07898d28be Mon Sep 17 00:00:00 2001 From: boyned//Kampfkarren Date: Sat, 11 Nov 2023 15:39:25 -0800 Subject: [PATCH] Fix UDim2.new() linting (#570) --- CHANGELOG.md | 2 ++ selene-lib/src/lints/roblox_suspicious_udim2_new.rs | 2 +- .../roblox_suspicious_udim2_new/roblox_suspicious_udim2_new.lua | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43e75d9c..8b840168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased](https://github.com/Kampfkarren/selene/compare/0.26.0...HEAD) +### Fixed +- Fixed `UDim2.new()` firing the [`roblox_suspicious_udim2_new` lint](https://kampfkarren.github.io/selene/lints/roblox_suspicious_udim2_new.html). ## [0.26.0](https://github.com/Kampfkarren/selene/releases/tag/0.26.0) - 2023-11-11 ### Added diff --git a/selene-lib/src/lints/roblox_suspicious_udim2_new.rs b/selene-lib/src/lints/roblox_suspicious_udim2_new.rs index a29d0550..3bf14a96 100644 --- a/selene-lib/src/lints/roblox_suspicious_udim2_new.rs +++ b/selene-lib/src/lints/roblox_suspicious_udim2_new.rs @@ -97,7 +97,7 @@ impl Visitor for UDim2CountVisitor { then { let args_provided = arguments.len(); - if args_provided >= 4 { + if args_provided == 0 || args_provided >= 4 { return; } diff --git a/selene-lib/tests/lints/roblox_suspicious_udim2_new/roblox_suspicious_udim2_new.lua b/selene-lib/tests/lints/roblox_suspicious_udim2_new/roblox_suspicious_udim2_new.lua index 4a8df682..7cecaee8 100644 --- a/selene-lib/tests/lints/roblox_suspicious_udim2_new/roblox_suspicious_udim2_new.lua +++ b/selene-lib/tests/lints/roblox_suspicious_udim2_new/roblox_suspicious_udim2_new.lua @@ -13,3 +13,4 @@ UDim2.new(1, 1, 1, 1) UDim2.new(a, b, c, d) UDim2.fromOffset(1, 1) UDim2.fromScale(1, 1) +UDim2.new()