From 8c04c77f99b417d7e88eb3227fb64c610041176c Mon Sep 17 00:00:00 2001 From: Griffin Castles Date: Mon, 5 Feb 2024 19:10:14 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=A6=84=20refactor(util):=20Fix=20ty?= =?UTF-8?q?pe=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix type annotation in `getLatestSeleneRelease` function --- selene-vscode/src/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selene-vscode/src/util.ts b/selene-vscode/src/util.ts index 34fe12fd..586ebe04 100644 --- a/selene-vscode/src/util.ts +++ b/selene-vscode/src/util.ts @@ -29,7 +29,7 @@ export async function getLatestSeleneRelease(): Promise { headers: { "User-Agent": "selene-vscode", }, - }).then((body) => { + }).then((body: any) => { return JSON.parse(body) as GithubRelease }) } From 400217aae807b38fc40acfce31a1b8694b014aa9 Mon Sep 17 00:00:00 2001 From: Griffin Castles Date: Mon, 5 Feb 2024 19:26:35 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=A6=84=20refactor(mixed=5Ftable):?= =?UTF-8?q?=20Update=20error=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update mixed table lint error message to be more descriptive --- selene-lib/src/lints/mixed_table.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selene-lib/src/lints/mixed_table.rs b/selene-lib/src/lints/mixed_table.rs index 4a588abf..19876df9 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 are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging".to_owned(), Label::new(mixed_table.range), vec!["help: change this table to either an array or dictionary".to_owned()], Vec::new(), From f587209d2750f65a977140ba5e4bf4a44954e4ea Mon Sep 17 00:00:00 2001 From: Griffin Castles Date: Mon, 5 Feb 2024 19:30:20 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E2=86=A9=20revert(util):=20Type=20annota?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert type annotation --- selene-vscode/src/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selene-vscode/src/util.ts b/selene-vscode/src/util.ts index 586ebe04..34fe12fd 100644 --- a/selene-vscode/src/util.ts +++ b/selene-vscode/src/util.ts @@ -29,7 +29,7 @@ export async function getLatestSeleneRelease(): Promise { headers: { "User-Agent": "selene-vscode", }, - }).then((body: any) => { + }).then((body) => { return JSON.parse(body) as GithubRelease }) } From 0f2c71d8b9ce9eed3802b30361f97961c98fbc14 Mon Sep 17 00:00:00 2001 From: Griffin Castles Date: Mon, 5 Feb 2024 19:32:42 +0800 Subject: [PATCH 04/10] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61ec5fe2..86fa7c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased](https://github.com/Kampfkarren/selene/compare/0.26.1...HEAD) ### Added - Added `CFrame.lookAlong` to the Roblox standard library +- When a mixed table is detected, selene will now tell you why mixed tables are bad and that they should be avoided ## [0.26.1](https://github.com/Kampfkarren/selene/releases/tag/0.26.1) - 2023-11-11 ### Fixed From 55e6eebd3c5dbace375be8207179117ca2a82992 Mon Sep 17 00:00:00 2001 From: Griffin Castles Date: Mon, 5 Feb 2024 19:39:42 +0800 Subject: [PATCH 05/10] Resolve failing test --- .../tests/lints/mixed_table/mixed_table.stderr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/selene-lib/tests/lints/mixed_table/mixed_table.stderr b/selene-lib/tests/lints/mixed_table/mixed_table.stderr index b557beaa..44a9e4e3 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 are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging ┌─ 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 are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging ┌─ 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 are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging ┌─ 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 are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging ┌─ 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 are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging ┌─ 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 are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging ┌─ mixed_table.lua:30:5 │ 30 │ ╭ a = b, From 9313cfc6556ecd8bc2790a44903e12e441f00405 Mon Sep 17 00:00:00 2001 From: Griffin Date: Tue, 6 Feb 2024 14:50:02 +0800 Subject: [PATCH 06/10] Update selene-lib/src/lints/mixed_table.rs Co-authored-by: boyned//Kampfkarren --- selene-lib/src/lints/mixed_table.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selene-lib/src/lints/mixed_table.rs b/selene-lib/src/lints/mixed_table.rs index 19876df9..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 heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging".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(), From 75a75dc62a56283d0c6e7fa6e027018684f63cd1 Mon Sep 17 00:00:00 2001 From: Griffin Castles Date: Sat, 17 Feb 2024 21:43:22 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=90=9E=20fix(mixed=5Ftable):=20Erro?= =?UTF-8?q?r=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Error messages now match (should be good to merge now) --- .../tests/lints/mixed_table/mixed_table.stderr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/selene-lib/tests/lints/mixed_table/mixed_table.stderr b/selene-lib/tests/lints/mixed_table/mixed_table.stderr index 44a9e4e3..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 heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging +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 heavily discouraged due to factors such as: │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging +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 heavily discouraged due to factors such as: │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging +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 heavily discouraged due to factors such as: │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging +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 heavily discouraged due to factors such as: │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging +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 heavily discouraged due to factors such as: │ = help: change this table to either an array or dictionary -error[mixed_table]: mixed tables are heavily discouraged due to factors such as: type safety, readability, compatibility, and debugging +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, From cdfb77945d55be35b3ad05dec964a67f066660cd Mon Sep 17 00:00:00 2001 From: Griffin Castles Date: Sat, 24 Feb 2024 10:59:41 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=90=9E=20fix(roblox=5Fincorrect=5Fr?= =?UTF-8?q?oact=5Fusage):=20Clippy=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed a Clippy error --- selene-lib/src/lints/roblox_incorrect_roact_usage.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 != '_' { From eb456574e18fd0f61eb035c1ad946451eb78cb6c Mon Sep 17 00:00:00 2001 From: Chris Chang <51393127+chriscerie@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:01:16 -0800 Subject: [PATCH 09/10] Move changelog entry to changed --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86fa7c17..5172433a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased](https://github.com/Kampfkarren/selene/compare/0.26.1...HEAD) ### Added - Added `CFrame.lookAlong` to the Roblox standard library -- When a mixed table is detected, selene will now tell you why mixed tables are bad and that they should be avoided + +### Changed +- Updated the warning message for the `must_use` 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 From 9b6480461db8297bee62a67771a1be067bb683d4 Mon Sep 17 00:00:00 2001 From: Christopher Chang <51393127+chriscerie@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:01:05 -0800 Subject: [PATCH 10/10] Fix changelog lint name --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5172433a..6250d33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Added `CFrame.lookAlong` to the Roblox standard library ### Changed -- Updated the warning message for the `must_use` lint to include why mixed tables should be avoided +- 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