Skip to content

Commit

Permalink
feat: make suggest in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 28, 2021
1 parent 946b798 commit bf32e29
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/app/suggest/suggester.rs
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();
}
}
2 changes: 2 additions & 0 deletions src/domain/suggest/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub use model_suggest::ModelSuggest;
pub mod model_suggest;

pub mod pipeline_suggest;

/// count git tag interval for insight of release
Expand Down
21 changes: 19 additions & 2 deletions src/domain/suggest/model_suggest.rs
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();
}
}

0 comments on commit bf32e29

Please sign in to comment.