Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,21 @@ func validateFieldsV0(publiccode PublicCode, parser *Parser, network bool, baseU
}
}

if publiccodev0.Maintenance.Contacts != nil {
for i, contact := range *publiccodev0.Maintenance.Contacts {
if contact.Phone == nil || *contact.Phone == "" {
continue
}

if sharedValidate.Var(*contact.Phone, "e164") != nil {
vr = append(vr, newValidationWarning(
fmt.Sprintf("maintenance.contacts[%d].phone", i),
"Phone numbers SHOULD use the E.164 format, e.g. '+3923113215112'",
))
}
}
}

if publiccodev0.Legal.AuthorsFile != nil {
vr = append(vr, newValidationWarning(
"legal.authorsFile",
Expand Down
6 changes: 3 additions & 3 deletions testdata/v0/invalid/landingURL_invalid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@comune.reggioemilia.it"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
6 changes: 3 additions & 3 deletions testdata/v0/invalid/landingURL_wrong_type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@comune.reggioemilia.it"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
6 changes: 3 additions & 3 deletions testdata/v0/invalid/no-network/landingURL_invalid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@comune.reggioemilia.it"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
6 changes: 3 additions & 3 deletions testdata/v0/valid/no-network/valid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@example.org"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@example.org"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@example.org"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
6 changes: 3 additions & 3 deletions testdata/v0/valid/valid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@example.org"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@example.org"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@example.org"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
publiccodeYmlVersion: "0"

name: Medusa
url: "https://github.com/italia/developers.italia.it.git"

platforms:
- web

categories:
- cloud-management

developmentStatus: development

softwareType: "standalone/other"

description:
en-GB:
localisedName: Medusa
shortDescription: >
A rather short description which
is probably useless
longDescription: >
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 158 characters.
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 316 characters.
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 474 characters.
Very long description of this software, also split
on multiple rows. You should note what the software
is and why one should need it. This is 632 characters.
features:
- Just one feature

legal:
license: AGPL-3.0-or-later

maintenance:
type: "community"

contacts:
- name: Francesco Rossi
phone: "+39 231 13215112"

localisation:
localisationReady: true
availableLanguages:
- en
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@comune.reggioemilia.it"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
6 changes: 3 additions & 3 deletions testdata/v0/valid_with_warnings/valid_with_it_conforme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@comune.reggioemilia.it"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@comune.reggioemilia.it"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ maintenance:
- name: Francesco Rossi
email: "francesco.rossi@comune.reggioemilia.it"
affiliation: Comune di Reggio Emilia
phone: +39 231 13215112
phone: +3923113215112
- name: Dario Bianchi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322
- name: Giancarlo Verdi
email: "dario.bianchi@fornitore.it"
affiliation: Fornitore Privato S.P.A.
phone: +39 16 24231322
phone: +391624231322

localisation:
localisationReady: true
Expand Down
6 changes: 6 additions & 0 deletions v0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ func TestValidWithWarningsTestcasesV0(t *testing.T) {
"unicode_grapheme_clusters.yml": ValidationResults{
ValidationWarning{"", "description.en.genericName", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 23, 5},
},
"maintenance_contacts_phone_not_e164.yml": ValidationResults{
ValidationWarning{"", "maintenance.contacts[0].phone", "Phone numbers SHOULD use the E.164 format, e.g. '+3923113215112'", 46, 7},
},
"valid.minimal.v0.2.yml": ValidationResults{
ValidationWarning{"", "publiccodeYmlVersion", "v0.2 is not the latest version, use '0'. Parsing this file as v0.8.", 1, 1},
},
Expand Down Expand Up @@ -716,6 +719,9 @@ func TestDecodeValueErrorsRemote(t *testing.T) {
ValidationWarning{"", "intendedAudience.countries[1]", "Lowercase country codes are DEPRECATED. Use uppercase instead ('DE')", 32, 7},
ValidationWarning{"", "intendedAudience.unsupportedCountries", "This key is DEPRECATED and will be removed in the future. Use 'intendedAudience.countries' to list the targeted countries instead", 33, 3},
ValidationWarning{"", "intendedAudience.unsupportedCountries[0]", "Lowercase country codes are DEPRECATED. Use uppercase instead ('US')", 34, 7},
ValidationWarning{"", "maintenance.contacts[0].phone", "Phone numbers SHOULD use the E.164 format, e.g. '+3923113215112'", 83, 7},
ValidationWarning{"", "maintenance.contacts[1].phone", "Phone numbers SHOULD use the E.164 format, e.g. '+3923113215112'", 87, 7},
ValidationWarning{"", "maintenance.contacts[2].phone", "Phone numbers SHOULD use the E.164 format, e.g. '+3923113215112'", 91, 7},
ValidationWarning{"", "dependsOn.open", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 102, 3},
ValidationWarning{"", "usedBy", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 18, 1},
ValidationWarning{"", "description.en.videos", "This key is DEPRECATED and will be removed in the future. Link videos from the documentation or the website instead", 62, 5},
Expand Down
Loading