fix: remove tarpaulin annotations

This commit is contained in:
Aravinth Manivannan 2025-10-02 14:00:16 +05:30
parent 5c29c2e71e
commit a05f8ec6f0
No known key found for this signature in database
GPG Key ID: F8F50389936984FF
6 changed files with 0 additions and 32 deletions

View File

@ -8,7 +8,6 @@ use std::env;
use sqlx::postgres::PgPoolOptions;
use sqlx::mysql::MySqlPoolOptions;
#[cfg(not(tarpaulin_include))]
#[actix_rt::main]
async fn main() {
//TODO featuregate sqlite and postgres

View File

@ -188,7 +188,6 @@ impl Data {
.build()
.unwrap()
}
#[cfg(not(tarpaulin_include))]
/// create new instance of app data
pub async fn new(s: &Settings, survey_secrets: SecretsStore) -> Arc<Self> {
let creds = Self::get_creds();

View File

@ -40,7 +40,6 @@ impl std::cmp::PartialEq for SmtpErrorWrapper {
}
#[derive(Debug, Display, PartialEq, Error)]
#[cfg(not(tarpaulin_include))]
pub enum ServiceError {
#[display(fmt = "internal server error")]
InternalServerError,
@ -114,14 +113,11 @@ pub enum ServiceError {
}
#[derive(Serialize, Deserialize)]
#[cfg(not(tarpaulin_include))]
pub struct ErrorToResponse {
pub error: String,
}
#[cfg(not(tarpaulin_include))]
impl ResponseError for ServiceError {
#[cfg(not(tarpaulin_include))]
fn error_response(&self) -> HttpResponse {
HttpResponseBuilder::new(self.status_code())
.append_header((header::CONTENT_TYPE, "application/json; charset=UTF-8"))
@ -133,7 +129,6 @@ impl ResponseError for ServiceError {
)
}
#[cfg(not(tarpaulin_include))]
fn status_code(&self) -> StatusCode {
match self {
ServiceError::ClosedForRegistration => StatusCode::FORBIDDEN,
@ -177,7 +172,6 @@ impl ResponseError for ServiceError {
}
impl From<CredsError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(e: CredsError) -> ServiceError {
match e {
CredsError::UsernameCaseMappedError => ServiceError::UsernameCaseMappedError,
@ -192,7 +186,6 @@ impl From<CredsError> for ServiceError {
}
impl From<DBError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(e: DBError) -> ServiceError {
println!("from conversin: {}", e);
match e {
@ -208,57 +201,46 @@ impl From<DBError> for ServiceError {
}
impl From<ValidationErrors> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(_: ValidationErrors) -> ServiceError {
ServiceError::NotAnEmail
}
}
impl From<ParseError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(_: ParseError) -> ServiceError {
ServiceError::NotAUrl
}
}
#[cfg(not(tarpaulin_include))]
impl From<CaptchaError> for ServiceError {
fn from(e: CaptchaError) -> ServiceError {
ServiceError::CaptchaError(e)
}
}
#[cfg(not(tarpaulin_include))]
impl From<SmtpError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(e: SmtpError) -> Self {
ServiceError::UnableToSendEmail(SmtpErrorWrapper(e))
}
}
#[cfg(not(tarpaulin_include))]
impl From<RecvError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(e: RecvError) -> Self {
log::error!("{:?}", e);
ServiceError::InternalServerError
}
}
#[cfg(not(tarpaulin_include))]
impl From<MailboxError> for ServiceError {
#[cfg(not(tarpaulin_include))]
fn from(e: MailboxError) -> Self {
log::error!("{:?}", e);
ServiceError::InternalServerError
}
}
#[cfg(not(tarpaulin_include))]
pub type ServiceResult<V> = std::result::Result<V, ServiceError>;
#[derive(Debug, Display, PartialEq, Error)]
#[cfg(not(tarpaulin_include))]
pub enum PageError {
#[display(fmt = "Something weng wrong: Internal server error")]
InternalServerError,
@ -267,17 +249,13 @@ pub enum PageError {
ServiceError(ServiceError),
}
#[cfg(not(tarpaulin_include))]
impl From<ServiceError> for PageError {
#[cfg(not(tarpaulin_include))]
fn from(e: ServiceError) -> Self {
PageError::ServiceError(e)
}
}
#[cfg(not(tarpaulin_include))]
impl From<DBError> for PageError {
#[cfg(not(tarpaulin_include))]
fn from(e: DBError) -> Self {
let se: ServiceError = e.into();
se.into()
@ -297,7 +275,6 @@ impl ResponseError for PageError {
}
}
#[cfg(not(tarpaulin_include))]
fn status_code(&self) -> StatusCode {
match self {
PageError::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR,
@ -306,7 +283,6 @@ impl ResponseError for PageError {
}
}
#[cfg(not(tarpaulin_include))]
pub type PageResult<V> = std::result::Result<V, PageError>;
#[cfg(test)]

View File

@ -92,7 +92,6 @@ pub const CACHE_AGE: u32 = 604800;
pub type ArcData = Arc<crate::data::Data>;
pub type AppData = actix_web::web::Data<ArcData>;
#[cfg(not(tarpaulin_include))]
#[actix_web::main]
async fn main() -> std::io::Result<()> {
use std::time::Duration;
@ -185,7 +184,6 @@ async fn main() -> std::io::Result<()> {
Ok(())
}
#[cfg(not(tarpaulin_include))]
pub fn get_json_err() -> JsonConfig {
JsonConfig::default().error_handler(|err, _| {
//debug!("JSON deserialization error: {:?}", &err);
@ -193,7 +191,6 @@ pub fn get_json_err() -> JsonConfig {
})
}
#[cfg(not(tarpaulin_include))]
pub fn get_identity_service(
settings: &Settings,
) -> IdentityService<CookieIdentityPolicy> {

View File

@ -25,7 +25,6 @@ pub fn get_middleware() -> Authentication<routes::Routes> {
Authentication::with_identity(routes::ROUTES)
}
#[cfg(not(tarpaulin_include))]
#[cfg(test)]
mod tests {
use actix_web::http::StatusCode;

View File

@ -56,7 +56,6 @@ pub struct Smtp {
}
impl Server {
#[cfg(not(tarpaulin_include))]
pub fn get_ip(&self) -> String {
format!("{}:{}", self.ip, self.port)
}
@ -205,7 +204,6 @@ const DEPRECATED_ENV_VARS: [(&str, &str); 23] = [
("smtp.port", "MCAPTCHA_SMTP_PORT"),
];
#[cfg(not(tarpaulin_include))]
impl Settings {
pub fn new() -> Result<Self, ConfigError> {
let mut s = Config::builder();