diff --git a/CHANGELOG.md b/CHANGELOG.md index 61ec5fe2..6250d33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Added `CFrame.lookAlong` to the Roblox standard library +### Changed +- Updated the warning message for the `mixed_table` lint to include why mixed tables should be avoided + ## [0.26.1](https://github.com/Kampfkarren/selene/releases/tag/0.26.1) - 2023-11-11 ### Fixed - Fixed `UDim2.new()` firing the [`roblox_suspicious_udim2_new` lint](https://kampfkarren.github.io/selene/lints/roblox_suspicious_udim2_new.html). diff --git a/selene-lib/src/lints/mixed_table.rs b/selene-lib/src/lints/mixed_table.rs index 4a588abf..249357a3 100644 --- a/selene-lib/src/lints/mixed_table.rs +++ b/selene-lib/src/lints/mixed_table.rs @@ -30,7 +30,7 @@ impl Lint for MixedTableLint { for mixed_table in visitor.mixed_tables { diagnostics.push(Diagnostic::new_complete( "mixed_table", - "mixed tables are not allowed".to_owned(), + "mixed tables should be avoided, as they can cause confusing and hard to debug issues such as during iteration or encoding".to_owned(), Label::new(mixed_table.range), vec!["help: change this table to either an array or dictionary".to_owned()], Vec::new(), diff --git a/selene-lib/src/lints/roblox_incorrect_roact_usage.rs b/selene-lib/src/lints/roblox_incorrect_roact_usage.rs index 94c02362..3917df9f 100644 --- a/selene-lib/src/lints/roblox_incorrect_roact_usage.rs +++ b/selene-lib/src/lints/roblox_incorrect_roact_usage.rs @@ -18,7 +18,7 @@ use if_chain::if_chain; pub struct IncorrectRoactUsageLint; // Assumes string includes quotes at start and end -fn is_lua_valid_table_key_identifier(string: &String) -> bool { +fn is_lua_valid_table_key_identifier(string: &str) -> bool { // Valid identifier cannot start with numbers let first_char = string.chars().nth(1).unwrap(); if !first_char.is_alphabetic() && first_char != '_' { diff --git a/selene-lib/tests/lints/mixed_table/mixed_table.stderr b/selene-lib/tests/lints/mixed_table/mixed_table.stderr index b557beaa..24ad2049 100644 --- a/selene-lib/tests/lints/mixed_table/mixed_table.stderr +++ b/selene-lib/tests/lints/mixed_table/mixed_table.stderr @@ -1,4 +1,4 @@ -error[mixed_table]: mixed tables are not allowed +error[mixed_table]: mixed tables should be avoided, as they can cause confusing and hard to debug issues such as during iteration or encoding ┌─ mixed_table.lua:2:5 │ 2 │ ╭ "", @@ -7,7 +7,7 @@ error[mixed_table]: mixed tables are not allowed │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are not allowed +error[mixed_table]: mixed tables should be avoided, as they can cause confusing and hard to debug issues such as during iteration or encoding ┌─ mixed_table.lua:7:5 │ 7 │ ╭ {}, @@ -16,7 +16,7 @@ error[mixed_table]: mixed tables are not allowed │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are not allowed +error[mixed_table]: mixed tables should be avoided, as they can cause confusing and hard to debug issues such as during iteration or encoding ┌─ mixed_table.lua:12:5 │ 12 │ ╭ a, @@ -25,7 +25,7 @@ error[mixed_table]: mixed tables are not allowed │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are not allowed +error[mixed_table]: mixed tables should be avoided, as they can cause confusing and hard to debug issues such as during iteration or encoding ┌─ mixed_table.lua:19:5 │ 19 │ ╭ 1, @@ -34,7 +34,7 @@ error[mixed_table]: mixed tables are not allowed │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are not allowed +error[mixed_table]: mixed tables should be avoided, as they can cause confusing and hard to debug issues such as during iteration or encoding ┌─ mixed_table.lua:25:5 │ 25 │ ╭ [c] = d, @@ -43,7 +43,7 @@ error[mixed_table]: mixed tables are not allowed │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are not allowed +error[mixed_table]: mixed tables should be avoided, as they can cause confusing and hard to debug issues such as during iteration or encoding ┌─ mixed_table.lua:30:5 │ 30 │ ╭ a = b,