Skip to content

Commit

Permalink
refactor: fix naming issue for struct
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 2, 2021
1 parent 1f8dc97 commit 2e7c143
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core_model/src/coco_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Settings {
Settings::reporter(Some("framework"))
}

pub fn struct_analysis() -> PathBuf {
Settings::reporter(Some("struct_analysis"))
pub fn struct_dir() -> PathBuf {
Settings::reporter(Some("struct"))
}
}
2 changes: 1 addition & 1 deletion plugins/coco_struct/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ path = "../../core_model"
path = "../../plugin_interface"

[lib]
name = "coco_struct_analysis"
name = "coco_struct"
crate-type = ["cdylib"]
6 changes: 3 additions & 3 deletions plugins/coco_struct/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod coco_struct;
pub mod ctags_opt;
pub mod ctags_parser;
pub mod plantuml_render;
pub mod struct_analysis;
pub mod struct_plugin;

pub struct CocoStructAnalysis {}

Expand All @@ -34,7 +34,7 @@ impl PluginInterface for CocoStructAnalysis {
fn on_plugin_unload(&self) {}

fn execute(&self, config: CocoConfig) {
struct_analysis::execute(config);
struct_plugin::execute(config);
}
}

Expand Down Expand Up @@ -85,7 +85,7 @@ pub fn plugin() -> Box<dyn PluginInterface> {
#[cfg(test)]
mod tests {
use crate::coco_struct::ClassInfo;
use crate::struct_analysis::execute;
use crate::struct_plugin::execute;
use core_model::{CocoConfig, RepoConfig};
use std::fs::File;
use std::io::Read;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ fn count_thread(origin_files: &Vec<String>) -> usize {

fn write_to_json_file(url_str: &str, result: &String) {
let file_name = url_format::json_filename(url_str);
let output_file = Settings::struct_analysis().join(file_name);
let output_file = Settings::struct_dir().join(file_name);
fs::write(output_file, result).expect("cannot write file");
}

fn write_to_puml_file(url_str: &str, classes: &Vec<ClassInfo>) {
let file_name = url_format::puml_filename(url_str);
let output_file = Settings::struct_analysis().join(file_name);
let output_file = Settings::struct_dir().join(file_name);
let result = PlantUmlRender::render(classes);
fs::write(output_file, result).expect("cannot write file");
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/visual/output_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ fn export_reporter<P: AsRef<Path>>(path: &P, project: String) {
let _ = fs::copy(cloc, &data_dir.join("cloc.json"));

// struct analysis
let structs = Settings::struct_analysis().join(format!("{}.json", project));
let structs = Settings::struct_dir().join(format!("{}.json", project));
let _ = fs::copy(structs, &data_dir.join("struct-analysis.json"));
}

0 comments on commit 2e7c143

Please sign in to comment.