From b0f9911759ef664d788e9f3b474733dcab8b6ab6 Mon Sep 17 00:00:00 2001 From: ".Barsik" Date: Wed, 11 Dec 2024 23:53:24 +0200 Subject: [PATCH] NOT READY: (willbe): `qqq` processing (#1511) * fix(willbe): imports related to `wca` changes * fix(willbe): long lines --- module/move/willbe/src/action/list.rs | 31 ++++++++++++++----- module/move/willbe/src/action/test.rs | 4 +-- module/move/willbe/src/command/list.rs | 4 +-- module/move/willbe/src/command/publish.rs | 4 +-- .../move/willbe/src/command/publish_diff.rs | 4 +-- module/move/willbe/src/command/test.rs | 6 ++-- .../willbe/src/command/workspace_renew.rs | 4 +-- module/move/willbe/src/entity/dependency.rs | 9 ++++-- module/move/willbe/src/entity/test.rs | 6 ++-- module/move/willbe/src/tool/template.rs | 2 +- .../willbe/tests/inc/action_tests/test.rs | 8 ----- 11 files changed, 47 insertions(+), 35 deletions(-) diff --git a/module/move/willbe/src/action/list.rs b/module/move/willbe/src/action/list.rs index 040c8ba12c..c747532f6d 100644 --- a/module/move/willbe/src/action/list.rs +++ b/module/move/willbe/src/action/list.rs @@ -462,17 +462,32 @@ mod private .package_find_by_manifest( manifest_file ) .ok_or_else( || format_err!( "Package not found in the workspace" ) ) .err_with_report( report )?; + let version = if args.info.contains( &PackageAdditionalInfo::Version ) + { + Some( package.version().to_string() ) + } + else + { + None + }; + let crate_dir = if args.info.contains( &PackageAdditionalInfo::Path ) + { + Some( package.crate_dir() ).transpose() + } + else + { + Ok( None ) + } + .err_with_report( report )?; let mut package_report = tool::ListNodeReport { name : package.name().to_string(), - // qqq : for Bohdan : too long lines - version : if args.info.contains( &PackageAdditionalInfo::Version ) { Some( package.version().to_string() ) } else { None }, - // qqq : for Bohdan : don't put multiline if into struct constructor - crate_dir : if args.info.contains( &PackageAdditionalInfo::Path ) - { Some( package.crate_dir() ).transpose() } - else - { Ok( None ) } - .err_with_report( report )?, + // aaa : for Bohdan : too long lines + // aaa : moved out + version, + // aaa : for Bohdan : don't put multiline if into struct constructor + // aaa : moved out + crate_dir, duplicate : false, normal_dependencies : vec![], dev_dependencies : vec![], diff --git a/module/move/willbe/src/action/test.rs b/module/move/willbe/src/action/test.rs index 8efcad2f5f..0d22053121 100644 --- a/module/move/willbe/src/action/test.rs +++ b/module/move/willbe/src/action/test.rs @@ -71,7 +71,7 @@ mod private // -> Result< TestsReport, ( TestsReport, Error ) > { - // qqq : incapsulate progress bar logic into some function of struct. don't keep it here + // aaa : incapsulate progress bar logic into some function of struct. don't keep it here // aaa : done let mut report = TestsReport::default(); @@ -164,7 +164,7 @@ Try to install it with `rustup install {}` command(-s)", ).err_with_report( &report )?; println!( "{plan}" ); - // aaa : split on two functions for create plan and for execute + // aaa : split on two functions for create plan and for execute // aaa : it's already separated, look line: 203 : let result = tests_run( &options ); let temp_path = if temp diff --git a/module/move/willbe/src/command/list.rs b/module/move/willbe/src/command/list.rs index 98e8b2d2be..7687b6db1d 100644 --- a/module/move/willbe/src/command/list.rs +++ b/module/move/willbe/src/command/list.rs @@ -97,10 +97,10 @@ mod private Ok( () ) } - impl TryFrom< wca::Props > for ListProperties + impl TryFrom< wca::executor::Props > for ListProperties { type Error = error::untyped::Error; - fn try_from( value : wca::Props ) -> Result< Self, Self::Error > + fn try_from( value : wca::executor::Props ) -> Result< Self, Self::Error > { let mut this = Self::former(); diff --git a/module/move/willbe/src/command/publish.rs b/module/move/willbe/src/command/publish.rs index 3af3fad60d..d02fa67bb5 100644 --- a/module/move/willbe/src/command/publish.rs +++ b/module/move/willbe/src/command/publish.rs @@ -101,10 +101,10 @@ mod private } } - impl TryFrom< wca::Props > for PublishProperties + impl TryFrom< wca::executor::Props > for PublishProperties { type Error = error::untyped::Error; - fn try_from( value : wca::Props ) -> Result< Self, Self::Error > + fn try_from( value : wca::executor::Props ) -> Result< Self, Self::Error > { let mut this = Self::former(); diff --git a/module/move/willbe/src/command/publish_diff.rs b/module/move/willbe/src/command/publish_diff.rs index 74cdbcbc48..6408de6de5 100644 --- a/module/move/willbe/src/command/publish_diff.rs +++ b/module/move/willbe/src/command/publish_diff.rs @@ -53,10 +53,10 @@ mod private Ok( () ) } - impl TryFrom< wca::Props > for PublishDiffProperties + impl TryFrom< wca::executor::Props > for PublishDiffProperties { type Error = error::untyped::Error; - fn try_from( value : wca::Props ) -> Result< Self, Self::Error > + fn try_from( value : wca::executor::Props ) -> Result< Self, Self::Error > { let mut this = Self::former(); diff --git a/module/move/willbe/src/command/test.rs b/module/move/willbe/src/command/test.rs index b56c84a79f..36fac78a27 100644 --- a/module/move/willbe/src/command/test.rs +++ b/module/move/willbe/src/command/test.rs @@ -147,10 +147,10 @@ Set at least one of them to true." ); } } - impl TryFrom< wca::Props > for TestsProperties + impl TryFrom< wca::executor::Props > for TestsProperties { type Error = error::untyped::Error; - fn try_from( value : wca::Props ) -> Result< Self, Self::Error > + fn try_from( value : wca::executor::Props ) -> Result< Self, Self::Error > { let mut this = Self::former(); @@ -192,4 +192,4 @@ crate::mod_interface! { /// run tests in specified crate exposed use test; -} \ No newline at end of file +} diff --git a/module/move/willbe/src/command/workspace_renew.rs b/module/move/willbe/src/command/workspace_renew.rs index 6e43d29eea..018046b146 100644 --- a/module/move/willbe/src/command/workspace_renew.rs +++ b/module/move/willbe/src/command/workspace_renew.rs @@ -33,11 +33,11 @@ mod private .context( "Fail to create workspace" ) } - impl TryFrom< wca::Props > for WorkspaceNewProperties + impl TryFrom< wca::executor::Props > for WorkspaceNewProperties { type Error = error::untyped::Error; - fn try_from( value : wca::Props ) -> std::result::Result< Self, Self::Error > + fn try_from( value : wca::executor::Props ) -> std::result::Result< Self, Self::Error > { let mut this = Self::former(); diff --git a/module/move/willbe/src/entity/dependency.rs b/module/move/willbe/src/entity/dependency.rs index 337ecb01a2..5d09c1cea0 100644 --- a/module/move/willbe/src/entity/dependency.rs +++ b/module/move/willbe/src/entity/dependency.rs @@ -260,8 +260,13 @@ mod private } DependenciesSort::Topological => { - // qqq : too long line - graph::toposort( graph::construct( &graph ) ).map_err( | err | format_err!( "{}", err ) )?.into_iter().filter( | x | x != &root ).collect() + // aaa : too long line + // aaa : splited + graph::toposort( graph::construct( &graph ) ) + .map_err( | err | format_err!( "{}", err ) )? + .into_iter() + .filter( | x | x != &root ) + .collect() }, }; diff --git a/module/move/willbe/src/entity/test.rs b/module/move/willbe/src/entity/test.rs index 938c5ca415..b8b7b67227 100644 --- a/module/move/willbe/src/entity/test.rs +++ b/module/move/willbe/src/entity/test.rs @@ -36,12 +36,12 @@ mod private /// Represents the optimization setting for the test variant. optimization : optimization::Optimization, /// Contains additional features or characteristics of the test variant. - features : collection::BTreeSet, + features : collection::BTreeSet< String >, } impl fmt::Display for TestVariant { - fn fmt( &self, f : &mut fmt::Formatter< '_ >) -> fmt::Result + fn fmt( &self, f : &mut fmt::Formatter< '_ > ) -> fmt::Result { let features = if self.features.is_empty() { " ".to_string() } else { self.features.iter().join( " " ) }; writeln!( f, "{} {} {}", self.optimization, self.channel, features )?; @@ -58,7 +58,7 @@ mod private impl fmt::Display for TestPlan { - fn fmt( &self, f : &mut fmt::Formatter< '_ >) -> std::fmt::Result + fn fmt( &self, f : &mut fmt::Formatter< '_ > ) -> std::fmt::Result { writeln!( f, "Plan: " )?; for plan in &self.packages_plan diff --git a/module/move/willbe/src/tool/template.rs b/module/move/willbe/src/tool/template.rs index 59040dca01..91c804c8ce 100644 --- a/module/move/willbe/src/tool/template.rs +++ b/module/move/willbe/src/tool/template.rs @@ -172,7 +172,7 @@ mod private impl TemplateParameters { /// Extracts template values from props for parameters required for this template. - pub fn values_from_props( &self, props : &wca::Props ) -> TemplateValues + pub fn values_from_props( &self, props : &wca::executor::Props ) -> TemplateValues { let values = self.descriptors .iter() diff --git a/module/move/willbe/tests/inc/action_tests/test.rs b/module/move/willbe/tests/inc/action_tests/test.rs index 16a4e8cd6a..67c926cb89 100644 --- a/module/move/willbe/tests/inc/action_tests/test.rs +++ b/module/move/willbe/tests/inc/action_tests/test.rs @@ -1,21 +1,13 @@ use super::*; -// use the_module::*; // qqq : for Bohdan : bad. don't import the_module::* use inc::helper:: { ProjectBuilder, WorkspaceBuilder, - // BINARY_NAME, }; use collection::BTreeSet; -// use std:: -// { -// fs::{ self, File }, -// io::Write, -// }; -// use path::{ Path, PathBuf }; use assert_fs::TempDir; use the_module::action::test::{ test, TestsCommandOptions };