Skip to content

Commit

Permalink
Revert "Add validation to ensure no empty ecos are added"
Browse files Browse the repository at this point in the history
This reverts commit 7fc98ca.
  • Loading branch information
platonicsocrates authored and jubos committed Nov 29, 2023
1 parent cf94d0d commit b8a1a77
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ enum ValidationError {
DuplicateRepoUrl(String),

TitleError(String),

EmptyEcosystem(String),
}

impl Display for ValidationError {
Expand All @@ -54,9 +52,6 @@ impl Display for ValidationError {
ValidationError::TitleError(file) => {
write!(f, "Title with leading/trailing space found in file: {}. Please remove the space(s) from your title.", file)
}
ValidationError::EmptyEcosystem(file) => {
write!(f, "Ecosystem in file {} has neither organizations nor sub-ecosystems. Please remove this. You can add it back later when/if you find its orgs / repos.", file)
}
}
}
}
Expand Down Expand Up @@ -134,14 +129,8 @@ fn validate_ecosystems(ecosystem_map: &EcosystemMap) -> Vec<ValidationError> {

for ecosystem in ecosystem_map.values() {
let mut seen_repos = HashSet::new();
let mut has_sub_ecosystems = false;
let mut has_orgs = false;
let mut has_repos = false;

if let Some(ref sub_ecosystems) = ecosystem.sub_ecosystems {
if !sub_ecosystems.is_empty() {
has_sub_ecosystems = true;
}
for sub in sub_ecosystems {
if !ecosystem_map.contains_key(sub) {
errors.push(ValidationError::MissingSubecosystem {
Expand All @@ -152,16 +141,7 @@ fn validate_ecosystems(ecosystem_map: &EcosystemMap) -> Vec<ValidationError> {
}
}

if let Some(ref orgs) = ecosystem.github_organizations {
if !orgs.is_empty() {
has_orgs = true;
}
}

if let Some(ref repos) = ecosystem.repo {
if !repos.is_empty() {
has_repos = true;
}
for repo in repos {
let lowercase_url = repo.url.to_lowercase();
if seen_repos.contains(&lowercase_url) {
Expand All @@ -182,13 +162,9 @@ fn validate_ecosystems(ecosystem_map: &EcosystemMap) -> Vec<ValidationError> {
}
}
}

if !(has_sub_ecosystems || has_orgs || has_repos) {
errors.push(ValidationError::EmptyEcosystem(ecosystem.title.clone()));
}
}

if errors.is_empty() {
if errors.len() == 0 {
println!(
"Validated {} ecosystems and {} repos ({} missing)",
ecosystem_map.len(),
Expand Down

0 comments on commit b8a1a77

Please sign in to comment.