From e73ccccbbf80d5f271f520a1baea4bfac27cabe5 Mon Sep 17 00:00:00 2001 From: Griffin Date: Sun, 25 Feb 2024 06:30:01 +0800 Subject: [PATCH 1/9] Update mixed_table warning message (#586) Closes: #572 It makes the error message for mixed tables more descriptive and explains why they're bad and should be _avoided_. --------- Co-authored-by: boyned//Kampfkarren Co-authored-by: Chris Chang <51393127+chriscerie@users.noreply.github.com> --- CHANGELOG.md | 3 +++ selene-lib/src/lints/mixed_table.rs | 2 +- selene-lib/src/lints/roblox_incorrect_roact_usage.rs | 2 +- .../tests/lints/mixed_table/mixed_table.stderr | 12 ++++++------ 4 files changed, 11 insertions(+), 8 deletions(-) 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, From abf408d732f2f0ba5e01be91b494877ca6977295 Mon Sep 17 00:00:00 2001 From: Chris Chang <51393127+chriscerie@users.noreply.github.com> Date: Mon, 29 Apr 2024 03:41:52 +0900 Subject: [PATCH 2/9] Support specific params to be deprecated and properly deprecate instance.new's second param (#594) Closes #436, closes #433. --- CHANGELOG.md | 2 + docs/src/usage/std.md | 2 +- selene-lib/default_std/roblox_base.yml | 5 ++ selene-lib/src/lints/deprecated.rs | 69 ++++++++++++++++--- selene-lib/src/standard_library/mod.rs | 4 ++ selene-lib/src/standard_library/v1_upgrade.rs | 1 + .../lints/deprecated/deprecated_params.lua | 8 +++ .../deprecated/deprecated_params.std.yml | 17 +++++ .../lints/deprecated/deprecated_params.stderr | 40 +++++++++++ .../tests/lints/deprecated/specific_allow.lua | 2 + .../lints/deprecated/specific_allow.std.yml | 7 ++ selene/src/roblox/generate_std.rs | 24 +++++-- 12 files changed, 167 insertions(+), 14 deletions(-) create mode 100644 selene-lib/tests/lints/deprecated/deprecated_params.lua create mode 100644 selene-lib/tests/lints/deprecated/deprecated_params.std.yml create mode 100644 selene-lib/tests/lints/deprecated/deprecated_params.stderr diff --git a/CHANGELOG.md b/CHANGELOG.md index 6250d33a..49302b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,11 @@ 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 +- Added `deprecated` config field to standard library function parameters ### Changed - Updated the warning message for the `mixed_table` lint to include why mixed tables should be avoided +- Properly deprecated `Instance.new`'s second argument in the Roblox standard library ## [0.26.1](https://github.com/Kampfkarren/selene/releases/tag/0.26.1) - 2023-11-11 ### Fixed diff --git a/docs/src/usage/std.md b/docs/src/usage/std.md index 93e06247..70f21a80 100644 --- a/docs/src/usage/std.md +++ b/docs/src/usage/std.md @@ -154,7 +154,7 @@ globals: A field is understood as a table if it has fields of its own. Notice that `math` is not defined anywhere, but its fields are. This will create an implicit `math` with the property writability of `read-only`. ### Deprecated -Any field can have a deprecation notice added to it, which will then be read by [the deprecated lint](../lints/deprecated.md). +Any field or arg can have a deprecation notice added to it, which will then be read by [the deprecated lint](../lints/deprecated.md). ```yaml --- diff --git a/selene-lib/default_std/roblox_base.yml b/selene-lib/default_std/roblox_base.yml index b8608e0d..6d99221b 100644 --- a/selene-lib/default_std/roblox_base.yml +++ b/selene-lib/default_std/roblox_base.yml @@ -320,6 +320,11 @@ globals: Instance.new: args: - type: string + - required: false + type: + display: Instance + deprecated: + message: set the instance's parent separately # This is only must_use because we don't allow the second parameter must_use: true NumberRange.new: diff --git a/selene-lib/src/lints/deprecated.rs b/selene-lib/src/lints/deprecated.rs index 46644444..262557d3 100644 --- a/selene-lib/src/lints/deprecated.rs +++ b/selene-lib/src/lints/deprecated.rs @@ -3,7 +3,7 @@ use std::convert::Infallible; use full_moon::{ast, visitors::Visitor}; use serde::Deserialize; -use crate::ast_util::{name_paths::*, scopes::ScopeManager}; +use crate::ast_util::{name_paths::*, range, scopes::ScopeManager}; use super::{super::standard_library::*, *}; @@ -48,6 +48,11 @@ struct DeprecatedVisitor<'a> { standard_library: &'a StandardLibrary, } +struct Argument { + display: String, + range: (usize, usize), +} + impl<'a> DeprecatedVisitor<'a> { fn new( config: &DeprecatedLintConfig, @@ -94,7 +99,7 @@ impl<'a> DeprecatedVisitor<'a> { node: &N, what: &str, name_path: &[String], - parameters: &[String], + arguments: &[Argument], ) { assert!(!name_path.is_empty()); @@ -115,7 +120,12 @@ impl<'a> DeprecatedVisitor<'a> { let mut notes = vec![deprecated.message.to_owned()]; - if let Some(replace_with) = deprecated.try_instead(parameters) { + if let Some(replace_with) = deprecated.try_instead( + &arguments + .iter() + .map(|arg| arg.display.clone()) + .collect::>(), + ) { notes.push(format!("try: {replace_with}")); } @@ -130,6 +140,28 @@ impl<'a> DeprecatedVisitor<'a> { Vec::new(), )); } + + if let Some(Field { + field_kind: FieldKind::Function(function), + .. + }) = self.standard_library.find_global(name_path) + { + for (arg, arg_std) in arguments + .iter() + .zip(&function.arguments) + .filter(|(arg, _)| arg.display != "nil") + { + if let Some(deprecated) = &arg_std.deprecated { + self.diagnostics.push(Diagnostic::new_complete( + "deprecated", + "this parameter is deprecated".to_string(), + Label::new(arg.range), + vec![deprecated.message.clone()], + Vec::new(), + )); + }; + } + } } } @@ -194,21 +226,32 @@ impl Visitor for DeprecatedVisitor<'_> { feature = "force_exhaustive_checks", deny(non_exhaustive_omitted_patterns) )] - let argument_displays = match function_args { + let arguments = match function_args { ast::FunctionArgs::Parentheses { arguments, .. } => arguments .iter() - .map(|argument| argument.to_string()) + .map(|argument| Argument { + display: argument.to_string().trim_end().to_string(), + range: range(argument), + }) .collect(), - ast::FunctionArgs::String(token) => vec![token.to_string()], + ast::FunctionArgs::String(token) => vec![ + (Argument { + display: token.to_string(), + range: range(token), + }), + ], ast::FunctionArgs::TableConstructor(table_constructor) => { - vec![table_constructor.to_string()] + vec![Argument { + display: table_constructor.to_string(), + range: range(table_constructor), + }] } _ => Vec::new(), }; - self.check_name_path(call, "function", &name_path, &argument_displays); + self.check_name_path(call, "function", &name_path, &arguments); } } @@ -234,6 +277,15 @@ mod tests { ); } + #[test] + fn test_deprecated_params() { + test_lint( + DeprecatedLint::new(DeprecatedLintConfig::default()).unwrap(), + "deprecated", + "deprecated_params", + ); + } + #[test] fn test_specific_allow() { test_lint( @@ -242,6 +294,7 @@ mod tests { "deprecated_allowed".to_owned(), "more.*".to_owned(), "wow.*.deprecated_allowed".to_owned(), + "deprecated_param".to_owned(), ], }) .unwrap(), diff --git a/selene-lib/src/standard_library/mod.rs b/selene-lib/src/standard_library/mod.rs index 77448e95..79ff08f5 100644 --- a/selene-lib/src/standard_library/mod.rs +++ b/selene-lib/src/standard_library/mod.rs @@ -603,6 +603,10 @@ pub struct Argument { #[serde(default)] #[serde(skip_serializing_if = "is_default")] pub observes: Observes, + + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecated: Option, } #[derive(Clone, Debug, Hash, PartialEq, Eq)] diff --git a/selene-lib/src/standard_library/v1_upgrade.rs b/selene-lib/src/standard_library/v1_upgrade.rs index 176fc563..3bbf0d87 100644 --- a/selene-lib/src/standard_library/v1_upgrade.rs +++ b/selene-lib/src/standard_library/v1_upgrade.rs @@ -41,6 +41,7 @@ impl From for Argument { required: v1_argument.required.into(), argument_type: v1_argument.argument_type.into(), observes: Observes::ReadWrite, + deprecated: None, } } } diff --git a/selene-lib/tests/lints/deprecated/deprecated_params.lua b/selene-lib/tests/lints/deprecated/deprecated_params.lua new file mode 100644 index 00000000..5e58e59e --- /dev/null +++ b/selene-lib/tests/lints/deprecated/deprecated_params.lua @@ -0,0 +1,8 @@ +local _ = Instance.new(a) +local _ = Instance.new(a, b) +local _ = Instance.new(a, nil ) +local _ = Instance.new(a, "nil") + +a(1) +a "" +a {} diff --git a/selene-lib/tests/lints/deprecated/deprecated_params.std.yml b/selene-lib/tests/lints/deprecated/deprecated_params.std.yml new file mode 100644 index 00000000..3dc6f959 --- /dev/null +++ b/selene-lib/tests/lints/deprecated/deprecated_params.std.yml @@ -0,0 +1,17 @@ +--- +globals: + Instance.new: + args: + - type: string + - required: false + type: + display: Instance + deprecated: + message: set the instance's parent separately + a: + args: + - required: false + type: + display: any + deprecated: + message: this is deprecated diff --git a/selene-lib/tests/lints/deprecated/deprecated_params.stderr b/selene-lib/tests/lints/deprecated/deprecated_params.stderr new file mode 100644 index 00000000..6e29413d --- /dev/null +++ b/selene-lib/tests/lints/deprecated/deprecated_params.stderr @@ -0,0 +1,40 @@ +error[deprecated]: this parameter is deprecated + ┌─ deprecated_params.lua:2:27 + │ +2 │ local _ = Instance.new(a, b) + │ ^ + │ + = set the instance's parent separately + +error[deprecated]: this parameter is deprecated + ┌─ deprecated_params.lua:4:27 + │ +4 │ local _ = Instance.new(a, "nil") + │ ^^^^^ + │ + = set the instance's parent separately + +error[deprecated]: this parameter is deprecated + ┌─ deprecated_params.lua:6:3 + │ +6 │ a(1) + │ ^ + │ + = this is deprecated + +error[deprecated]: this parameter is deprecated + ┌─ deprecated_params.lua:7:3 + │ +7 │ a "" + │ ^^ + │ + = this is deprecated + +error[deprecated]: this parameter is deprecated + ┌─ deprecated_params.lua:8:3 + │ +8 │ a {} + │ ^^ + │ + = this is deprecated + diff --git a/selene-lib/tests/lints/deprecated/specific_allow.lua b/selene-lib/tests/lints/deprecated/specific_allow.lua index 71671714..40a07f75 100644 --- a/selene-lib/tests/lints/deprecated/specific_allow.lua +++ b/selene-lib/tests/lints/deprecated/specific_allow.lua @@ -5,3 +5,5 @@ more.deprecated_allowed() wow.extra.deprecated_allowed() deprecated_allowed.more() + +deprecated_param(1) diff --git a/selene-lib/tests/lints/deprecated/specific_allow.std.yml b/selene-lib/tests/lints/deprecated/specific_allow.std.yml index f31f8cb6..ba66141a 100644 --- a/selene-lib/tests/lints/deprecated/specific_allow.std.yml +++ b/selene-lib/tests/lints/deprecated/specific_allow.std.yml @@ -16,3 +16,10 @@ globals: args: [] deprecated: message: "this is deprecated" + deprecated_param: + args: + - required: false + type: + display: any + deprecated: + message: this is deprecated diff --git a/selene/src/roblox/generate_std.rs b/selene/src/roblox/generate_std.rs index 89c402af..95481024 100644 --- a/selene/src/roblox/generate_std.rs +++ b/selene/src/roblox/generate_std.rs @@ -125,6 +125,7 @@ impl RobloxGenerator { argument_type: ArgumentType::Any, required: Required::NotRequired, observes: Observes::ReadWrite, + deprecated: None, }) .collect(), method: true, @@ -260,11 +261,23 @@ impl RobloxGenerator { self.std.globals.insert( "Instance.new".to_owned(), Field::from_field_kind(FieldKind::Function(FunctionBehavior { - arguments: vec![Argument { - argument_type: ArgumentType::Constant(instance_names), - required: Required::Required(None), - observes: Observes::ReadWrite, - }], + arguments: vec![ + Argument { + argument_type: ArgumentType::Constant(instance_names), + required: Required::Required(None), + observes: Observes::ReadWrite, + deprecated: None, + }, + Argument { + argument_type: ArgumentType::Display("Instance".to_string()), + required: Required::Required(None), + observes: Observes::ReadWrite, + deprecated: Some(Deprecated { + message: "set the instance's parent separately".to_owned(), + replace: vec![], + }), + }, + ], method: false, // Only true because we don't allow the second parameter @@ -294,6 +307,7 @@ impl RobloxGenerator { argument_type: ArgumentType::Constant(service_names), required: Required::Required(None), observes: Observes::ReadWrite, + deprecated: None, }], method: true, must_use: true, From 49cc8411f25afbbda5a1e973bf20fc2c25a1943c Mon Sep 17 00:00:00 2001 From: Kampfkarren Date: Sun, 28 Apr 2024 11:54:06 -0700 Subject: [PATCH 3/9] 0.27.0 [release] --- CHANGELOG.md | 2 ++ Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- selene/Cargo.toml | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49302b86..5074d837 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.1...HEAD) + +## [0.27.0](https://github.com/Kampfkarren/selene/compare/0.26.1...0.26.2) - 2024-04-28 ### Added - Added `CFrame.lookAlong` to the Roblox standard library - Added `deprecated` config field to standard library function parameters diff --git a/Cargo.lock b/Cargo.lock index d312b6ff..84ecc886 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -941,7 +941,7 @@ dependencies = [ [[package]] name = "selene" -version = "0.26.1" +version = "0.27.0" dependencies = [ "atty", "cfg-if", @@ -971,7 +971,7 @@ dependencies = [ [[package]] name = "selene-lib" -version = "0.26.1" +version = "0.27.0" dependencies = [ "codespan", "codespan-reporting", diff --git a/Cargo.toml b/Cargo.toml index 13c090a1..049fec09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["selene", "selene-lib"] resolver = "2" [workspace.package] -version = "0.26.1" +version = "0.27.0" authors = ["Kampfkarren "] edition = "2021" homepage = "https://kampfkarren.github.io/selene/" @@ -15,4 +15,4 @@ full_moon = "0.19.0" toml = "0.7.2" # Do not update this without confirming profiling uses the same version of tracy-client as selene -profiling = "1.0.7" \ No newline at end of file +profiling = "1.0.7" diff --git a/selene/Cargo.toml b/selene/Cargo.toml index 7ad931a3..05885800 100644 --- a/selene/Cargo.toml +++ b/selene/Cargo.toml @@ -24,7 +24,7 @@ globset = "0.4.10" lazy_static = "1.4" num_cpus = "1.15" profiling.workspace = true -selene-lib = { path = "../selene-lib", version = "=0.26.1", default-features = false } +selene-lib = { path = "../selene-lib", version = "=0.27.0", default-features = false } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.9.16" @@ -42,4 +42,4 @@ pretty_assertions = "1.3" [features] default = ["roblox"] tracy-profiling = ["profiling/profile-with-tracy", "tracy-client"] -roblox = ["selene-lib/roblox", "full_moon/roblox", "ureq"] \ No newline at end of file +roblox = ["selene-lib/roblox", "full_moon/roblox", "ureq"] From cd08fc4e283197a47dbb6f2fc8b31134da656083 Mon Sep 17 00:00:00 2001 From: Kampfkarren Date: Sun, 28 Apr 2024 13:06:15 -0700 Subject: [PATCH 4/9] Fix Instance.new second parameter being required --- selene/src/roblox/generate_std.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selene/src/roblox/generate_std.rs b/selene/src/roblox/generate_std.rs index 95481024..5a7384c2 100644 --- a/selene/src/roblox/generate_std.rs +++ b/selene/src/roblox/generate_std.rs @@ -270,7 +270,7 @@ impl RobloxGenerator { }, Argument { argument_type: ArgumentType::Display("Instance".to_string()), - required: Required::Required(None), + required: Required::NotRequired, observes: Observes::ReadWrite, deprecated: Some(Deprecated { message: "set the instance's parent separately".to_owned(), From cbd7746b499ec88e88fa54cd841a6cb4ead2aa8a Mon Sep 17 00:00:00 2001 From: Kampfkarren Date: Sun, 28 Apr 2024 13:07:25 -0700 Subject: [PATCH 5/9] 0.27.1 [release] --- CHANGELOG.md | 8 ++++++-- Cargo.lock | 4 ++-- Cargo.toml | 2 +- selene/Cargo.toml | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5074d837..ad388a10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ # Changelog This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/Kampfkarren/selene/compare/0.26.1...HEAD) +## [Unreleased](https://github.com/Kampfkarren/selene/compare/0.27.1...HEAD) -## [0.27.0](https://github.com/Kampfkarren/selene/compare/0.26.1...0.26.2) - 2024-04-28 +## [0.27.1](https://github.com/Kampfkarren/selene/releases/tag/0.27.1) - 2024-04-28 +### Fixed +- Fixed `Instance.new`'s second parameter being incorrectly marked as required. + +## [0.27.0](https://github.com/Kampfkarren/selene/releases/tag/0.27.0) - 2024-04-28 ### Added - Added `CFrame.lookAlong` to the Roblox standard library - Added `deprecated` config field to standard library function parameters diff --git a/Cargo.lock b/Cargo.lock index 84ecc886..3b8a6f39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -941,7 +941,7 @@ dependencies = [ [[package]] name = "selene" -version = "0.27.0" +version = "0.27.1" dependencies = [ "atty", "cfg-if", @@ -971,7 +971,7 @@ dependencies = [ [[package]] name = "selene-lib" -version = "0.27.0" +version = "0.27.1" dependencies = [ "codespan", "codespan-reporting", diff --git a/Cargo.toml b/Cargo.toml index 049fec09..caf6734f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["selene", "selene-lib"] resolver = "2" [workspace.package] -version = "0.27.0" +version = "0.27.1" authors = ["Kampfkarren "] edition = "2021" homepage = "https://kampfkarren.github.io/selene/" diff --git a/selene/Cargo.toml b/selene/Cargo.toml index 05885800..e5c08751 100644 --- a/selene/Cargo.toml +++ b/selene/Cargo.toml @@ -24,7 +24,7 @@ globset = "0.4.10" lazy_static = "1.4" num_cpus = "1.15" profiling.workspace = true -selene-lib = { path = "../selene-lib", version = "=0.27.0", default-features = false } +selene-lib = { path = "../selene-lib", version = "=0.27.1", default-features = false } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.9.16" From a7b4a53e4d0c9844eb1540c5718bd47588680102 Mon Sep 17 00:00:00 2001 From: Chris Chang <51393127+chriscerie@users.noreply.github.com> Date: Sat, 25 May 2024 12:31:14 -0700 Subject: [PATCH 6/9] Fix get_then_check clippy (#602) --- selene-lib/src/ast_util/scopes.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/selene-lib/src/ast_util/scopes.rs b/selene-lib/src/ast_util/scopes.rs index 3e3b6ff2..dadcd47e 100644 --- a/selene-lib/src/ast_util/scopes.rs +++ b/selene-lib/src/ast_util/scopes.rs @@ -830,11 +830,7 @@ impl Visitor for ScopeVisitor { fn visit_block(&mut self, block: &ast::Block) { if let Some((start, end)) = block.range() { - if self - .else_blocks - .get(&(start.bytes(), end.bytes())) - .is_some() - { + if self.else_blocks.contains(&(start.bytes(), end.bytes())) { self.close_scope(); // close the if or elseif's block self.open_scope(block); } @@ -843,11 +839,7 @@ impl Visitor for ScopeVisitor { fn visit_block_end(&mut self, block: &ast::Block) { if let Some((start, end)) = block.range() { - if self - .else_blocks - .get(&(start.bytes(), end.bytes())) - .is_some() - { + if self.else_blocks.contains(&(start.bytes(), end.bytes())) { self.close_scope(); } } From 96727f643c664d39223377f18d2538a3275f41c3 Mon Sep 17 00:00:00 2001 From: Stefan <79119093+Stenimated@users.noreply.github.com> Date: Mon, 24 Jun 2024 20:20:24 +0200 Subject: [PATCH 7/9] Add Path2DControlPoint.new to roblox_base.yml (#605) this lint works fine for the majority. besides this bellow, it'll require all 3 args if the second one is present Path2DControlPoint.new(UDim2.new(), UDim2.new()) -- RUNTIME ERROR any way to lint for that --- CHANGELOG.md | 2 ++ selene-lib/default_std/roblox_base.yml | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad388a10..0e6a62ce 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.27.1...HEAD) +### Added +- Added `Path2DControlPoint.new` to the Roblox standard library ## [0.27.1](https://github.com/Kampfkarren/selene/releases/tag/0.27.1) - 2024-04-28 ### Fixed diff --git a/selene-lib/default_std/roblox_base.yml b/selene-lib/default_std/roblox_base.yml index 6d99221b..6be6df1b 100644 --- a/selene-lib/default_std/roblox_base.yml +++ b/selene-lib/default_std/roblox_base.yml @@ -349,6 +349,18 @@ globals: OverlapParams.new: args: [] must_use: true + Path2DControlPoint.new: + args: + - required: false + type: + display: UDim2 + - required: false + type: + display: UDim2 + - required: false + type: + display: UDim2 + must_use: true PathWaypoint.new: args: - required: false From 23411d5b4674adf09ec6b8dc79e035a1538237b7 Mon Sep 17 00:00:00 2001 From: LinuxOnTheDesktop <47056543+LinuxOnTheDesktop@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:43:44 +0100 Subject: [PATCH 8/9] Amend installation.md so as to make its instruction about `--no-default-features` harder to misunderstand (#607) Closes #606. --- docs/src/cli/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/cli/installation.md b/docs/src/cli/installation.md index 696021c9..49f8cd38 100644 --- a/docs/src/cli/installation.md +++ b/docs/src/cli/installation.md @@ -16,4 +16,4 @@ cargo install --branch main --git https://github.com/Kampfkarren/selene selene ``` ### Disabling Roblox features -selene is built with Roblox specific lints by default. If you don't want these, type `--no-default-features` after whichever command you choose. +selene is built with Roblox specific lints by default. If you don't want these, then pass `--no-default-features` to the `cargo install` command. From 6e02c2ff8dd9579c1ec165ee11effbecd368f54a Mon Sep 17 00:00:00 2001 From: Jos Dehaes Date: Sat, 29 Jun 2024 01:52:37 +0200 Subject: [PATCH 9/9] add aarch64 build (#599) Hi, In asahi linux (aarch64), selene is not available in neovim because mason can not download an artifact for it (there is no aarch64 linux on github releases). To fix this, I added a cross compilation step to generate and upload an aarch64 linux binary. I tested this in my fork, and it correctly generates aarch64 binaries. Please let me know if you like something changed! Co-authored-by: boyned//Kampfkarren --- .github/workflows/build.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28ac794b..760b6692 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,6 +78,18 @@ jobs: with: name: selene-linux path: ./target/release/selene + - name: Build arm64 (Default features) + uses: actions-rs/cargo@v1 + with: + working-directory: selene + use-cross: true + command: build + args: --locked --release --target aarch64-unknown-linux-gnu + - name: Upload selene arm64 + uses: actions/upload-artifact@v1 + with: + name: selene-linux-aarch64 + path: ./target/aarch64-unknown-linux-gnu/release/selene build_linux_light: runs-on: ubuntu-latest steps: @@ -91,6 +103,18 @@ jobs: with: name: selene-light-linux path: ./target/release/selene + - name: Build arm64 (Lightweight) + uses: actions-rs/cargo@v1 + with: + working-directory: selene + use-cross: true + command: build + args: --locked --release --verbose --no-default-features --target aarch64-unknown-linux-gnu + - name: Upload selene-light arm64 + uses: actions/upload-artifact@v1 + with: + name: selene-light-linux-aarch64 + path: ./target/aarch64-unknown-linux-gnu/release/selene release: runs-on: ubuntu-latest needs: ['build_windows_light', 'build_windows', 'build_mac', 'build_mac_light', 'build_linux', 'build_linux_light']