cha-core 0.6.2

Core analysis engine for Cha — pluggable code smell detection
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::path::PathBuf;

/// Raw source file content.
#[derive(Debug, Clone)]
pub struct SourceFile {
    pub path: PathBuf,
    pub content: String,
}

impl SourceFile {
    pub fn new(path: PathBuf, content: String) -> Self {
        Self { path, content }
    }

    pub fn line_count(&self) -> usize {
        self.content.lines().count()
    }
}