-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
use crate::domain::suggest::ModelSuggest; | ||
use core_model::coco_struct::ClassInfo; | ||
use core_model::Settings; | ||
use std::fs; | ||
|
||
pub struct Suggester; | ||
|
||
impl Suggester { | ||
pub fn run(_project: String) { | ||
// let model: ModelSuggest = ModelSuggest::new(model); | ||
pub fn run(project: String) { | ||
let file_name = format!("{}.json", project); | ||
let path = Settings::struct_dir().join(file_name); | ||
let contents = fs::read_to_string(path).expect("lost path"); | ||
let model: Vec<ClassInfo> = serde_json::from_str(contents.as_str()).expect("error format"); | ||
let suggest: ModelSuggest = ModelSuggest::new(model); | ||
suggest.analysis_all(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
pub struct ModelSuggest; | ||
use core_model::coco_struct::ClassInfo; | ||
|
||
#[allow(dead_code)] | ||
pub struct ModelSuggest { | ||
model: Vec<ClassInfo>, | ||
} | ||
|
||
impl ModelSuggest { | ||
pub fn new(model: Vec<ClassInfo>) -> ModelSuggest { | ||
ModelSuggest { model } | ||
} | ||
/// zh-CN: 过长参数 | ||
/// en-US: Long Parameter List | ||
/// suggest: | ||
/// zh-CN: 引入参数对象 | ||
/// en-US: Introduce Parameter Object | ||
pub fn find_long_parameter_list_method(&self) {} | ||
pub fn find_long_parameter_list_method(&self) { | ||
// let max_parameters = 5; | ||
for info in &self.model { | ||
for _method in &info.methods {} | ||
} | ||
} | ||
|
||
pub fn analysis_all(&self) { | ||
self.find_long_parameter_list_method(); | ||
} | ||
} |