iridia-ulb / references

Repository of shared bibtex files (references)
https://iridia-ulb.github.io/references/
10 stars 1 forks source link

Check crossref types: inproceedings <=> proceedings, incollection <=> book #15

Open MLopez-Ibanez opened 1 year ago

MLopez-Ibanez commented 1 year ago

How to add a check to test/test.sh to check that a crossref has the correct type?

That is:

@InProceedings{test1,
title ="X",
crossref="test2"
}
@Book{test2,
title ="X",
}

should fail. Same for @InCollection => @Book.

MLopez-Ibanez commented 1 year ago

An initial script using R:

library(rbibutils)
bibs <- readBib("biblio.bib", direct=TRUE, macros=c("abbrev.bib", "authors.bib", "crossref.bib"))
bibs <- sapply(bibs, function(x) {
  x <- unclass(x)[[1L]]
  list(key = attr(x, "key"), bibtype = attr(x, "bibtype"), crossref=x$crossref)
}, simplify=FALSE)

check_type <- function(x, cr_type, targetl, target) {
  if (tolower(cr_type) == targetl) return(NULL)
  paste0("Entry '", x$key, "' has type '", x$bibtype, "' but its crossref '", x$crossref, "' has type '", cr_type, "' instead of @", target, "!")
}
errors <- c()
for (x in bibs) {
  if (is.null(x$crossref)) next
  type <- x$bibtype
  cr_bib <- bibs[[x$crossref]]
  if (is.null(cr_bib))
    stop("Crossef '", x$crossref, "' of '", x$key, "' cannot be found!")
  cr_type <- bibs[[x$crossref]]$bibtype
  typel <- tolower(type)
  cr_typel <- tolower(type)
  if (typel == "inproceedings") {
    errors <- c(errors, check_type(x, cr_type, "proceedings", "Proceedings"))
  } else if (typel == "incollection" || typel == "inbook") {
    errors <- c(errors, check_type(x, cr_type, "book", "Book"))
  } 
}
cat(paste0(collapse="\n", errors))

but there are too many too fix before we can implement it:


Entry 'AnsMalSamSelTie2015:ijcai' has type 'InCollection' but its crossref 'IJCAI2015' has type 'Proceedings' instead of @Book!
Entry 'AugHan2005cec' has type 'InCollection' but its crossref 'CEC2005' has type 'Proceedings' instead of @Book!
Entry 'AugHan2005lrcmaes' has type 'InCollection' but its crossref 'CEC2005' has type 'Proceedings' instead of @Book!
Entry 'BecGotStu05' has type 'InProceedings' but its crossref 'EA2005' has type 'Book' instead of @Proceedings!
Entry 'BehAffWag2017' has type 'InProceedings' but its crossref 'GECCO2017c' has type 'Book' instead of @Proceedings!
Entry 'BelDreSavSch2016:ppsn' has type 'InProceedings' but its crossref 'PPSN2016' has type 'Book' instead of @Proceedings!
Entry 'BenCasLus2020interactive' has type 'InCollection' but its crossref 'AAAI2020' has type 'Proceedings' instead of @Book!
Entry 'BerDorLanSerGam1996:icec' has type 'InProceedings' but its crossref 'ICEC1996' has type 'Book' instead of @Proceedings!
Entry 'BesStuDor00:ppsn' has type 'InProceedings' but its crossref 'PPSN2000' has type 'Book' instead of @Proceedings!
Entry 'BezLopStu2015moead' has type 'InProceedings' but its crossref 'EMO2015_1' has type 'Book' instead of @Proceedings!
Entry 'BiaGamDor02:ppsn' has type 'InProceedings' but its crossref 'PPSN2002' has type 'Book' instead of @Proceedings!
Entry 'BieLinEggFraFawHoo2017' has type 'InProceedings' but its crossref 'AAAI2017' has type 'Book' instead of @Proceedings!
Entry 'BieMarLinHut2018lion' has type 'InProceedings' but its crossref 'LION2018' has type 'Book' instead of @Proceedings!
Entry 'BosKerNeu2019' has type 'InProceedings' but its crossref 'FOGA2019' has type 'Book' instead of @Proceedings!
Entry 'BreSch2011gecco' has type 'InProceedings' but its crossref 'GECCO2011c' has type 'Book' instead of @Proceedings!
Entry 'BriFri2010ppsn' has type 'InProceedings' but its crossref 'PPSN2010' has type 'Book' instead of @Proceedings!
Entry 'BrigFri2009foga' has type 'InProceedings' but its crossref 'FOGA2009' has type 'Book' instead of @Proceedings!
Entry 'BrinFriNeuWag2011' has type 'InCollection' but its crossref 'IJCAI2011' has type 'Proceedings' instead of @Book!
Entry 'BroZit2006allobjectives' has type 'InProceedings' but its crossref 'PPSN2006' has type 'Book' instead of @Proceedings!
Entry 'BruRit2018evo' has type 'InProceedings' but its crossref 'EVOCOP2018' has type 'Book' instead of @Proceedings!
Entry 'BurHydKen2007gecco' has type 'InProceedings' but its crossref 'GECCO2007' has type 'Book' instead of @Proceedings!
Entry 'CamDorStu2018ants' has type 'InProceedings' but its crossref 'ANTS2018' has type 'Book' instead of @Proceedings!
Entry 'CarProSha2013votes' has type 'InProceedings' but its crossref 'EC2013' has type 'Book' instead of @Proceedings!
Entry 'CheKanTay1991ijcai' has type 'InProceedings' but its crossref 'IJCAI1991' has type 'Book' instead of @Proceedings!
Entry 'Coello2000cec' has type 'InCollection' but its crossref 'CEC2000' has type 'Proceedings' instead of @Book!
Entry 'CorKno2003cec' has type 'InCollection' but its crossref 'CEC2003' has type 'Proceedings' instead of @Book!
Entry 'CorRey2011gecco' has type 'InProceedings' but its crossref 'GECCO2011' has type 'Book' instead of @Proceedings!
Entry 'DebTewDixDut2007finding' has type 'InCollection' but its crossref 'CEC2007' has type 'Proceedings' instead of @Book!
Entry 'DigChiSch2006' has type 'InProceedings' but its crossref 'ECAI2006' has type 'Book' instead of @Proceedings!
Entry 'DroJanWeg2002' has type 'InProceedings' but its crossref 'FOGA2002' has type 'Book' instead of @Proceedings!
Entry 'IshPanSha2020unbounded' has type 'InProceedings' but its crossref 'ECAI2020' has type 'Book' instead of @Proceedings!
Entry 'DubHooStu2015gecco' has type 'InProceedings' but its crossref 'GECCO2015' has type 'Book' instead of @Proceedings!
Entry 'DubStu2017cec' has type 'InCollection' but its crossref 'CEC2017' has type 'Proceedings' instead of @Book!
Entry 'EppLopStuDeS2011:cec' has type 'InCollection' but its crossref 'CEC2011' has type 'Proceedings' instead of @Book!
Entry 'EshSch1992' has type 'InProceedings' but its crossref 'FOGA1992' has type 'Book' instead of @Proceedings!
Entry 'FonPaqLop06:hypervolume' has type 'InCollection' but its crossref 'CEC2006' has type 'Proceedings' instead of @Book!
Entry 'FosHugObr2020' has type 'InProceedings' but its crossref 'GECCO2020' has type 'Book' instead of @Proceedings!
Entry 'FraStu2017:EA' has type 'InProceedings' but its crossref 'EA2017' has type 'Book' instead of @Proceedings!
Entry 'FreMer1996icec' has type 'InProceedings' but its crossref 'ICEC1996' has type 'Book' instead of @Proceedings!
Entry 'GamDor96:icec' has type 'InProceedings' but its crossref 'ICEC1996' has type 'Book' instead of @Proceedings!
Entry 'GanMezFre1997' has type 'InProceedings' but its crossref 'MOPGP1996' has type 'Book' instead of @Proceedings!
Entry 'Gor1997' has type 'InProceedings' but its crossref 'ICEC1997' has type 'Book' instead of @Proceedings!
Entry 'GotPucSol03:evoworkshops' has type 'InProceedings' but its crossref 'evoworkshops2003' has type 'Book' instead of @Proceedings!
Entry 'GreMatSlo2010cec' has type 'InCollection' but its crossref 'CEC2010' has type 'Proceedings' instead of @Book!
Entry 'GunBra2003:evoworkshops' has type 'InProceedings' but its crossref 'evoworkshops2003' has type 'Book' instead of @Proceedings!
Entry 'GunMid02:EvoWorkshops' has type 'InProceedings' but its crossref 'evoworkshops2002' has type 'Book' instead of @Proceedings!
Entry 'IkeKitShi2001cec' has type 'InCollection' but its crossref 'CEC2001' has type 'Proceedings' instead of @Book!
Entry 'JaiCoeUri2009onlinered' has type 'InProceedings' but its crossref 'EMO2009' has type 'Book' instead of @Proceedings!
Entry 'KadMalSelTie2010isac' has type 'InProceedings' but its crossref 'ECAI2010' has type 'Book' instead of @Proceedings!
Entry 'KelPol2008ae' has type 'InProceedings' but its crossref 'EA2017' has type 'Book' instead of @Proceedings!
Entry 'KnoCor1999cec' has type 'InCollection' but its crossref 'CEC1999' has type 'Proceedings' instead of @Book!
Entry 'KnoCor2002cec' has type 'InCollection' but its crossref 'CEC2002' has type 'Proceedings' instead of @Book!
Entry 'KnoCor2003emo' has type 'InProceedings' but its crossref 'EMO2003' has type 'Book' instead of @Proceedings!
Entry 'KnoCorFle2003' has type 'InCollection' but its crossref 'CEC2003' has type 'Proceedings' instead of @Book!
Entry 'KorSilOblKos07:cec' has type 'InCollection' but its crossref 'CEC2007' has type 'Proceedings' instead of @Book!
Entry 'KraGloGoe2007' has type 'InProceedings' but its crossref 'GECCO2007' has type 'Book' instead of @Proceedings!
Entry 'KukLam2005:gde3' has type 'InCollection' but its crossref 'CEC2005' has type 'Proceedings' instead of @Book!
Entry 'LacMolHer2013cec' has type 'InCollection' but its crossref 'CEC2013' has type 'Proceedings' instead of @Book!
Entry 'LegMic1999:cec' has type 'InCollection' but its crossref 'CEC1999' has type 'Proceedings' instead of @Book!
Entry 'LiaMonStu2011gecco' has type 'InProceedings' but its crossref 'GECCO2011c' has type 'Book' instead of @Proceedings!
Entry 'LiaStu2013cec' has type 'InCollection' but its crossref 'CEC2013' has type 'Proceedings' instead of @Book!
Entry 'LohNow2013faster' has type 'InProceedings' but its crossref 'ALT2013' has type 'Book' instead of @Proceedings!
Entry 'LopPraPaech05:cec' has type 'InCollection' but its crossref 'CEC2005' has type 'Proceedings' instead of @Book!
Entry 'MarSte2000' has type 'InProceedings' but its crossref 'evoworkshops2000' has type 'Book' instead of @Proceedings!
Entry 'MauLopStu2010:cec' has type 'InCollection' but its crossref 'CEC2010' has type 'Proceedings' instead of @Book!
Entry 'MicHen2004' has type 'InProceedings' but its crossref 'ICAPS2004' has type 'Book' instead of @Proceedings!
Entry 'Misevicius2003:gecco' has type 'InProceedings' but its crossref 'GECCO2003_1' has type 'Book' instead of @Proceedings!
Entry 'MitSelLev1992' has type 'InCollection' but its crossref 'AAAI1992' has type 'Proceedings' instead of @Book!
Entry 'MniSzeAud2008' has type 'InCollection' but its crossref 'ICML2008' has type 'Proceedings' instead of @Book!
Entry 'MonRif2013gecco' has type 'InCollection' but its crossref 'CEC2013' has type 'Proceedings' instead of @Book!
Entry 'MonRifNev2010' has type 'InProceedings' but its crossref 'GECCO2010' has type 'Book' instead of @Proceedings!
Entry 'Morris1993' has type 'InCollection' but its crossref 'AAAI1993' has type 'Proceedings' instead of @Book!
Entry 'MosJoh03:bioinf' has type 'InProceedings' but its crossref 'ICANNGA2003' has type 'Book' instead of @Proceedings!
Entry 'NagKob1997' has type 'InProceedings' but its crossref 'ICGA1997' has type 'Book' instead of @Proceedings!
Entry 'NanEib2007ijcai' has type 'InCollection' but its crossref 'IJCAI2007' has type 'Proceedings' instead of @Book!
Entry 'NisOyaAkiAguTan2014:space' has type 'InProceedings' but its crossref 'LION2014' has type 'Book' instead of @Proceedings!
Entry 'ObaSas2003visualization' has type 'InProceedings' but its crossref 'EMO2003' has type 'Book' instead of @Proceedings!
Entry 'OchHydCur2012evocop' has type 'InProceedings' but its crossref 'EVOCOP2012' has type 'Book' instead of @Proceedings!
Entry 'OchTomVerDar2008' has type 'InProceedings' but its crossref 'GECCO2008' has type 'Book' instead of @Proceedings!
Entry 'OddRasCesSmi2011' has type 'InCollection' but its crossref 'IJCAI2011' has type 'Proceedings' instead of @Book!
Entry 'OliHusRolDorStu2017cec' has type 'InCollection' but its crossref 'CEC2017' has type 'Proceedings' instead of @Book!
Entry 'PerBisStu2017rf' has type 'InProceedings' but its crossref 'GECCO2017c' has type 'Book' instead of @Proceedings!
Entry 'PetEve2002control' has type 'InProceedings' but its crossref 'GECCO2002' has type 'Book' instead of @Proceedings!
Entry 'PitBehAff2013' has type 'InProceedings' but its crossref 'EVOCOP2013' has type 'Book' instead of @Proceedings!
Entry 'Prasad03' has type 'InProceedings' but its crossref 'AWSM03' has type 'Book' instead of @Proceedings!
Entry 'RachSri2006' has type 'InCollection' but its crossref 'CEC2006' has type 'Proceedings' instead of @Book!
Entry 'RahEveFie2017infill' has type 'InProceedings' but its crossref 'GECCO2017' has type 'Book' instead of @Proceedings!
Entry 'RobFil05demo' has type 'InProceedings' but its crossref 'EMO2005' has type 'Book' instead of @Proceedings!
Entry 'Rudolph1992' has type 'InProceedings' but its crossref 'PPSN1992' has type 'Book' instead of @Proceedings!
Entry 'Rudolph1994:icec' has type 'InProceedings' but its crossref 'ICEC1994' has type 'Book' instead of @Proceedings!
Entry 'Sch1996exploiting' has type 'InProceedings' but its crossref 'NIPS1996' has type 'Book' instead of @Proceedings!
Entry 'SchNguEbe2015sal' has type 'InCollection' but its crossref 'ECMLPKDD2015-3' has type 'Proceedings' instead of @Book!
Entry 'SeiPohBosKerTra2020' has type 'InProceedings' but its crossref 'PPSN2020' has type 'Book' instead of @Proceedings!
Entry 'Ser1992' has type 'InProceedings' but its crossref 'MCDM1991' has type 'Book' instead of @Proceedings!
Entry 'ShaFonNor1999cec' has type 'InCollection' but its crossref 'CEC1999' has type 'Proceedings' instead of @Book!
Entry 'ShiEbe1998' has type 'InCollection' but its crossref 'EVOPROG98' has type 'Proceedings' instead of @Book!
Entry 'ShmAguHoo2002:ants' has type 'InProceedings' but its crossref 'ANTS2002' has type 'Book' instead of @Proceedings!
Entry 'SilRunSouPal2002:ants' has type 'InProceedings' but its crossref 'ANTS2002' has type 'Book' instead of @Proceedings!
Entry 'SmiEib2009cec' has type 'InCollection' but its crossref 'CEC2009' has type 'Proceedings' instead of @Book!
Entry 'SmiEib2010cec' has type 'InCollection' but its crossref 'CEC2010' has type 'Proceedings' instead of @Book!
Entry 'SmiEib2011ae' has type 'InProceedings' but its crossref 'EA2011' has type 'Book' instead of @Proceedings!
Entry 'SmiStoSer2016explo' has type 'InProceedings' but its crossref 'GECCO2016' has type 'Book' instead of @Proceedings!
Entry 'SmiVanLim2010' has type 'InProceedings' but its crossref 'LION2010' has type 'Book' instead of @Proceedings!
Entry 'SocSamMan03:evoworkshops' has type 'InProceedings' but its crossref 'evoworkshops2003' has type 'Book' instead of @Proceedings!
Entry 'SteAggBurGonRes2015gecco' has type 'InProceedings' but its crossref 'GECCO2015' has type 'Book' instead of @Proceedings!
Entry 'Syswerda89' has type 'InCollection' but its crossref 'ICGA1989' has type 'Proceedings' instead of @Book!
Entry 'TanOya2017gecco' has type 'InProceedings' but its crossref 'GECCO2017' has type 'Book' instead of @Proceedings!
Entry 'TusFil2007' has type 'InProceedings' but its crossref 'EMO2007' has type 'Book' instead of @Proceedings!
Entry 'TusFil2011vis4d' has type 'InProceedings' but its crossref 'GECCO2011' has type 'Book' instead of @Proceedings!
Entry 'ValDubStu13:cec' has type 'InCollection' but its crossref 'CEC2013' has type 'Proceedings' instead of @Book!
Entry 'VanKorBlo2018' has type 'InProceedings' but its crossref 'AAAI2018' has type 'Book' instead of @Proceedings!
Entry 'WacSuiYueOno2018aaai' has type 'InProceedings' but its crossref 'AAAI2018' has type 'Book' instead of @Proceedings!
Entry 'Wegener2005' has type 'InProceedings' but its crossref 'ICALP2005' has type 'Book' instead of @Proceedings!
Entry 'XuKhHo2016' has type 'InProceedings' but its crossref 'LION2016' has type 'Book' instead of @Proceedings!
Entry 'YavAydStu2016' has type 'InCollection' but its crossref 'CEC2016' has type 'Proceedings' instead of @Book!
Entry 'YueDuStu2017cec' has type 'InCollection' but its crossref 'CEC2017' has type 'Proceedings' instead of @Book!
``
MLopez-Ibanez commented 11 months ago

The repository is clean and the test run on pre-commit but it does not run when testing because it would require installing R and rbibutils.

MLopez-Ibanez commented 10 months ago

We could do this:

      - uses: r-lib/actions/setup-r@v2
      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: cran::rbibutils
      - run: Rscript ./scripts/bibcheck.R

but we want it to trigger only when crossref.bib or biblio.bib change.