Skip to content

Commit f4aaf57

Browse files
authored
feat: add deprecation warning for legal.repoOwner (#268)
1 parent 1197ee8 commit f4aaf57

19 files changed

+146
-37
lines changed

fields.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ func validateFieldsV0(publiccode PublicCode, parser Parser, network bool) error
118118
}
119119
}
120120

121+
if publiccodev0.Legal.RepoOwner != nil {
122+
vr = append(vr, ValidationWarning{"legal.repoOwner", "This key is DEPRECATED and will be removed in the future. Use 'organisation.name' instead", 0, 0})
123+
}
124+
121125
if publiccodev0.InputTypes != nil {
122126
vr = append(vr, ValidationWarning{"inputTypes", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 0, 0})
123127
}

parser_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestValidTestcasesV0_NoNetwork(t *testing.T) {
105105
func TestValidWithWarningTestcasesV0_NoNetwork(t *testing.T) {
106106
expected := map[string]error{
107107
"authorsFile.yml": ValidationResults{
108-
ValidationWarning{"legal.authorsFile", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 72, 3},
108+
ValidationWarning{"legal.authorsFile", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 71, 3},
109109
},
110110
}
111111

@@ -626,11 +626,11 @@ func TestInvalidTestcasesV0(t *testing.T) {
626626
ValidationError{"IT.riuso.codiceIPA", "codiceIPA must be a valid Italian Public Administration Code (iPA) (see https://www.indicepa.gov.it/public-services/opendata-read-service.php?dstype=FS&filename=amministrazioni.txt)", 55, 5},
627627
},
628628
"it_IT_duplicated.yml": ValidationResults{
629-
ValidationWarning{"it", "Lowercase country codes are DEPRECATED and will be removed in the future. Use 'IT' instead", 120, 1},
630-
ValidationError{"it", "'IT' key already present. Remove this key", 120, 1},
629+
ValidationWarning{"it", "Lowercase country codes are DEPRECATED and will be removed in the future. Use 'IT' instead", 119, 1},
630+
ValidationError{"it", "'IT' key already present. Remove this key", 119, 1},
631631
},
632632
"it_wrong_case.yml": ValidationResults{
633-
ValidationError{"It", "field It not found in type publiccode.PublicCodeV0", 108, 1},
633+
ValidationError{"It", "field It not found in type publiccode.PublicCodeV0", 107, 1},
634634
},
635635

636636
// misc
@@ -699,16 +699,19 @@ func TestValidWithWarningsTestcasesV0(t *testing.T) {
699699
ValidationWarning{"outputTypes", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 50, 1},
700700
},
701701
"valid_with_it_conforme.yml": ValidationResults{
702-
ValidationWarning{"IT.conforme", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 120, 3},
702+
ValidationWarning{"IT.conforme", "This key is DEPRECATED and will be removed in the future. It's safe to drop it", 119, 3},
703703
},
704704
"valid_with_country_specific_section_downcase.yml": ValidationResults{
705-
ValidationWarning{"it", "Lowercase country codes are DEPRECATED and will be removed in the future. Use 'IT' instead", 108, 1},
705+
ValidationWarning{"it", "Lowercase country codes are DEPRECATED and will be removed in the future. Use 'IT' instead", 107, 1},
706706
},
707707
"valid_with_lowercase_countries.yml": ValidationResults{
708708
ValidationWarning{"intendedAudience.countries[0]", "Lowercase country codes are DEPRECATED. Use uppercase instead ('IT')", 30, 3},
709709
ValidationWarning{"intendedAudience.countries[1]", "Lowercase country codes are DEPRECATED. Use uppercase instead ('DE')", 30, 3},
710710
ValidationWarning{"intendedAudience.unsupportedCountries[0]", "Lowercase country codes are DEPRECATED. Use uppercase instead ('US')", 30, 3},
711711
},
712+
"valid_with_legal_repoOwner.yml": ValidationResults{
713+
ValidationWarning{"legal.repoOwner", "This key is DEPRECATED and will be removed in the future. Use 'organisation.name' instead", 70, 3},
714+
},
712715
}
713716

714717
dir := "testdata/v0/valid_with_warnings/"

testdata/v0/invalid/it_IT_duplicated.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ description:
6767
legal:
6868
license: AGPL-3.0-or-later
6969
mainCopyrightOwner: City of Chicago
70-
repoOwner: City of Chicago
7170

7271
maintenance:
7372
type: "community"

testdata/v0/invalid/it_wrong_case.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ description:
6767
legal:
6868
license: AGPL-3.0-or-later
6969
mainCopyrightOwner: City of Chicago
70-
repoOwner: City of Chicago
7170

7271
maintenance:
7372
type: "community"

testdata/v0/invalid/landingURL_invalid.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ description:
6969
legal:
7070
license: AGPL-3.0-or-later # SPDX expression of license
7171
mainCopyrightOwner: City of Chicago
72-
repoOwner: City of Chicago
7372

7473
maintenance:
7574
type: "contract"

testdata/v0/invalid/landingURL_wrong_type.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ description:
6565
legal:
6666
license: AGPL-3.0-or-later # SPDX expression of license
6767
mainCopyrightOwner: City of Chicago
68-
repoOwner: City of Chicago
6968

7069
maintenance:
7170
type: "contract"

testdata/v0/invalid/legal_license_missing.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ description:
1919
en:
2020
localisedName: Medusa
2121
shortDescription: >
22-
A rather short description which
23-
is probably useless
22+
A rather short description which
23+
is probably useless
2424
longDescription: >
25-
Very long description of this software, also split
26-
on multiple rows. You should note what the software
27-
is and why one should need it. This is 158 characters.
28-
Very long description of this software, also split
29-
on multiple rows. You should note what the software
30-
is and why one should need it. This is 316 characters.
31-
Very long description of this software, also split
32-
on multiple rows. You should note what the software
33-
is and why one should need it. This is 474 characters.
34-
Very long description of this software, also split
35-
on multiple rows. You should note what the software
36-
is and why one should need it. This is 632 characters.
25+
Very long description of this software, also split
26+
on multiple rows. You should note what the software
27+
is and why one should need it. This is 158 characters.
28+
Very long description of this software, also split
29+
on multiple rows. You should note what the software
30+
is and why one should need it. This is 316 characters.
31+
Very long description of this software, also split
32+
on multiple rows. You should note what the software
33+
is and why one should need it. This is 474 characters.
34+
Very long description of this software, also split
35+
on multiple rows. You should note what the software
36+
is and why one should need it. This is 632 characters.
3737
features:
38-
- Just one feature
38+
- Just one feature
3939

4040
legal:
41-
repoOwner: foobar
41+
mainCopyrightOwner: foobar
4242
# Should NOT validate: license is missing
4343

4444
maintenance:

testdata/v0/invalid/no-network/landingURL_invalid.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ description:
6969
legal:
7070
license: AGPL-3.0-or-later # SPDX expression of license
7171
mainCopyrightOwner: City of Chicago
72-
repoOwner: City of Chicago
7372

7473
maintenance:
7574
type: "contract"

testdata/v0/valid/countryExtensionVersion_1.0.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ description:
6767
legal:
6868
license: AGPL-3.0-or-later
6969
mainCopyrightOwner: City of Chicago
70-
repoOwner: City of Chicago
7170

7271
maintenance:
7372
type: "community"

testdata/v0/valid/dependsOn.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ description:
6868
legal:
6969
license: AGPL-3.0-or-later # SPDX expression of license
7070
mainCopyrightOwner: City of Chicago
71-
repoOwner: City of Chicago
7271

7372
maintenance:
7473
type: "community"

0 commit comments

Comments
 (0)