1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-04-19 19:56:50 +00:00

Add more checks shown before in list subcommand

This commit is contained in:
Paul-Christian Volkmer 2023-11-08 12:35:58 +01:00
parent f02ea9b065
commit 7ab5523f3c
3 changed files with 33 additions and 1 deletions

View File

@ -76,7 +76,7 @@ fn check_line(line: usize, content: String) -> Vec<CheckNotice> {
if content.contains(" </Bezeichnung>") {
result.append(&mut vec![CheckNotice::ErrorWithCode {
code: "2023-0001".to_string(),
code: "2023-0003".to_string(),
description:
"Leerzeichen am Ende der Plausibilitätsregel-Bezeichnung (OSTARSUPP-13334)"
.to_string(),

View File

@ -28,6 +28,7 @@ use std::collections::HashSet;
use console::style;
use serde::{Deserialize, Serialize};
use crate::checks::CheckNotice::ErrorWithCode;
use crate::checks::{CheckNotice, Checkable};
use crate::model::onkostar_editor::OnkostarEditor;
use crate::model::requirements::{Requirement, Requires};
@ -386,6 +387,24 @@ impl FolderContent for DataForm {
impl Checkable for DataForm {
fn check(&self) -> Vec<CheckNotice> {
if self
.entries
.entry
.iter()
.filter(|entry| entry.procedure_date_status != "none")
.count()
== 0
{
return vec![ErrorWithCode {
code: "2023-0002".to_string(),
description: format!(
"Formular '{}' hat keine Angabe zum Prozedurdatum",
self.name
),
line: None,
example: None,
}];
}
vec![]
}
}

View File

@ -25,6 +25,7 @@
use std::cmp::Ordering;
use std::collections::HashSet;
use crate::checks::CheckNotice::ErrorWithCode;
use crate::checks::{CheckNotice, Checkable};
use console::style;
use serde::{Deserialize, Serialize};
@ -383,6 +384,18 @@ impl FolderContent for Unterformular {
impl Checkable for Unterformular {
fn check(&self) -> Vec<CheckNotice> {
if self.hat_unterformulare {
return vec![ErrorWithCode {
code: "2023-0001".to_string(),
description: format!(
"Unterformular '{}' mit Markierung 'hat Unterformulare'",
self.name
),
line: None,
example: None,
}];
}
vec![]
}
}