Skip to content

Commit

Permalink
fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborginhas committed Feb 9, 2024
1 parent 553f9bf commit 0426168
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/calibrate.R
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ calibrate <- function(infected_years_file,
config <- host_pool_setup(config)
}
config$competency_table_list <- competency_table_list_creator(config$competency_table)
config$pest_host_table_list <- pest_host_table_list_creator(config$pest_host_table)
config$pest_host_table_list <- pest_host_table_list_creator(config$pest_host_table)

data <- pops_model(
random_seed = config$random_seed,
Expand Down
20 changes: 10 additions & 10 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -331,43 +331,43 @@ multihost_checks <-
checks_passed <- FALSE
failed_check <- competency_value_error
}

if (!checks_passed && identical(names(competency_table)
[(length(names(competency_table)) - 1):
length(names(competency_table))],
length(names(competency_table))],
competency_table_colnames)) {
checks_passed <- FALSE
failed_check <- competency_table_wrong_columns

Check warning on line 340 in R/checks.R

View check run for this annotation

Codecov / codecov/patch

R/checks.R#L339-L340

Added lines #L339 - L340 were not covered by tests
}

if (!checks_passed && (length(infected_file_list) + 1) <= nrow(competency_table)) {
checks_passed <- FALSE
failed_check <- competency_table_row_length_error
} else {
competency_table_list <- competency_table_list_creator(competency_table)
}

if (!checks_passed && identical(names(pest_host_table), pest_host_table_colnames)) {
checks_passed <- FALSE
failed_check <- pest_host_table_wrong_columns

Check warning on line 352 in R/checks.R

View check run for this annotation

Codecov / codecov/patch

R/checks.R#L352

Added line #L352 was not covered by tests
}


if (!checks_passed && all(pest_host_table$susceptibility_mean <= 1) &&
all(pest_host_table$susceptibility_mean >= 0) && all(pest_host_table$susceptibility_sd <= 1) &&
all(pest_host_table$susceptibility_mean >= 0) &&
all(pest_host_table$susceptibility_sd <= 1) &&
all(pest_host_table$susceptibility_sd >= 0)) {
checks_passed <- FALSE
failed_check <- pest_host_susceptbility_value_error

Check warning on line 360 in R/checks.R

View check run for this annotation

Codecov / codecov/patch

R/checks.R#L360

Added line #L360 was not covered by tests
}

if (!checks_passed && all(pest_host_table$mortality_rate_mean <= 1) &&
all(pest_host_table$mortality_rate_mean >= 0) && all(pest_host_table$mortality_rate_sd <= 1) &&
all(pest_host_table$mortality_rate_mean >= 0) &&

Check warning on line 364 in R/checks.R

View workflow job for this annotation

GitHub Actions / lint

file=R/checks.R,line=364,col=55,[trailing_whitespace_linter] Trailing whitespace is superfluous.
all(pest_host_table$mortality_rate_sd <= 1) &&
all(pest_host_table$mortality_rate_sd >= 0)) {
checks_passed <- FALSE
failed_check <- pest_host_mortality_rate_value_error

Check warning on line 368 in R/checks.R

View check run for this annotation

Codecov / codecov/patch

R/checks.R#L368

Added line #L368 was not covered by tests
}



if (!checks_passed && length(infected_file_list) != nrow(pest_host_table)) {
checks_passed <- FALSE
failed_check <- pest_host_table_row_length_error

Check warning on line 373 in R/checks.R

View check run for this annotation

Codecov / codecov/patch

R/checks.R#L372-L373

Added lines #L372 - L373 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ RcppExport SEXP _PoPS_pops_model_cpp(SEXP random_seedSEXP, SEXP multiple_random_
if (rcpp_isError_gen) {
SEXP rcpp_msgSEXP_gen = Rf_asChar(rcpp_result_gen);
UNPROTECT(1);
Rf_error(CHAR(rcpp_msgSEXP_gen));
Rf_error("%s", CHAR(rcpp_msgSEXP_gen));
}
UNPROTECT(1);
return rcpp_result_gen;
Expand Down

1 comment on commit 0426168

@cyborginhas
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed most of the lintr issues returned.

Please sign in to comment.