Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Cosmetic changes #128

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/csvparser.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::logging::ResultExt;

Check warning on line 1 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

unused import: `crate::logging::ResultExt`
use nom::{
branch::alt,

Check warning on line 3 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

unused imports: `IResult`, `branch::alt`, `complete::alphanumeric1`, `is_digit`, and `sequence::delimited`
bytes::complete::tag,
bytes::complete::take,
character::{complete::alphanumeric1, is_digit},
Expand Down Expand Up @@ -72,7 +72,7 @@
}

fn extract_dividends_transactions(df: &DataFrame) -> Result<DataFrame, &'static str> {
let mut df_transactions = df

Check warning on line 75 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

variable does not need to be mutable
.select(&["Date", "Gross amount", "Withholding tax", "Currency"])
.map_err(|_| "Error: Unable to select dividend data")?;

Expand All @@ -80,7 +80,7 @@
}

fn extract_sold_transactions(df: &DataFrame) -> Result<DataFrame, &'static str> {
let mut df_transactions = df

Check warning on line 83 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

variable does not need to be mutable
.select(&[
"Date acquired",
"Date sold",
Expand All @@ -96,7 +96,7 @@
fn extract_investment_gains_and_costs_transactions(
df: &DataFrame,
) -> Result<DataFrame, &'static str> {
let mut df_transactions = df

Check warning on line 99 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

variable does not need to be mutable
.select(&["Date", "Type", "Total Amount"])
.map_err(|_| "Error: Unable to select description")?;

Expand Down Expand Up @@ -292,13 +292,13 @@
let mut dividend_transactions: Vec<(String, crate::Currency, crate::Currency)> = vec![];
let mut sold_transactions: Vec<(String, String, crate::Currency, crate::Currency)> = vec![];

let mut dates: Vec<String> = vec![];

Check warning on line 295 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

value assigned to `dates` is never read
let mut acquired_dates: Vec<String> = vec![];
let mut sold_dates: Vec<String> = vec![];
let mut costs: Vec<crate::Currency> = vec![];
let mut gross: Vec<crate::Currency> = vec![];
let mut incomes: Vec<crate::Currency> = vec![];

Check warning on line 300 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

value assigned to `incomes` is never read
let mut taxes: Vec<crate::Currency> = vec![];

Check warning on line 301 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

value assigned to `taxes` is never read
//let mut rdr = csv::Reader::from_path(csvtoparse).map_err(|_| "Error: opening CSV")?;
let mut rdr = csv::ReaderBuilder::new()
.flexible(true)
Expand Down Expand Up @@ -372,7 +372,6 @@
.map_err(|e| format!("Error reading CSV: {e}"))?;

log::info!("Content of first to be DataFrame: {sales}");
println!("Content of first to be DataFrame: {sales}");

let filtred_df = extract_sold_transactions(&sales)?;
log::info!("Filtered Sold Data of interest: {filtred_df}");
Expand Down Expand Up @@ -422,7 +421,7 @@
}

mod tests {
use super::*;

Check warning on line 424 in src/csvparser.rs

View workflow job for this annotation

GitHub Actions / coverage

unused import: `super::*`

#[test]
fn test_extract_cash() -> Result<(), String> {
Expand Down
Loading