Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Integrity NoBibtexFieldChecker #2059

Merged
merged 5 commits into from
Sep 25, 2016
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- [#2012](https://github.com/JabRef/jabref/issues/2012) Implemented integrity check for `month` field: Should be an integer or normalized (BibLaTeX), Should be normalized (BibTeX)
- [#1779](https://github.com/JabRef/jabref/issues/1779) Implemented integrity check for `bibtexkey` field: Empty BibTeX key
- Prohibit more than one connections to the same shared database.
- Implemented integrity check for `journaltitle` field: BibLaTeX field only (BibTeX)

### Fixed
- Fixed [#2054](https://github.com/JabRef/jabref/issues/2054): Ignoring a new version now works as expected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ private List<IntegrityMessage> checkBibtexEntry(BibEntry entry) {
result.addAll(new TitleChecker().check(entry));
result.addAll(new PagesChecker().check(entry));
result.addAll(new ASCIICharacterChecker().check(entry));
result.addAll(new NoBibtexFieldChecker().check(entry));
} else {
result.addAll(new BiblatexPagesChecker().check(entry));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.sf.jabref.logic.integrity;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

import net.sf.jabref.logic.integrity.IntegrityCheck.Checker;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.model.entry.FieldName;

public class NoBibtexFieldChecker implements Checker {

/**
* BibLaTeX package documentation (Section 2.1.1):
* The title of the periodical is given in the journaltitle field.
*/
@Override
public List<IntegrityMessage> check(BibEntry entry) {
Optional<String> value = entry.getField(FieldName.JOURNALTITLE);

//BibTeX
if (!value.isPresent()) {
return Collections.emptyList();
}
else {
return Collections.singletonList(
new IntegrityMessage(Localization.lang("BibLaTeX field only"), entry, FieldName.JOURNALTITLE));
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=Invalid_ISBN\:_'%0'.
should_be_an_integer_or_normalized=should_be_an_integer_or_normalized
should_be_normalized=should_be_normalized
empty_BibTeX_key=empty_BibTeX_key
BibLaTeX_field_only=BibLaTeX_field_only
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=ISBN_invalide_:_%0.
should_be_an_integer_or_normalized=devrait_être_un_entier_ou_une_abréviation_standard
should_be_normalized=devrait_être_une_abréviation_standard
empty_BibTeX_key=Clef_BibTeX_vide
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=ISBN_invalido\:'%0'
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=Geçersiz_ISBN\:_'%0'.
should_be_an_integer_or_normalized=bir_tamsayı_olmalı_ya_da_normalleştirilmelidir
should_be_normalized=normalleştirilmelidir
empty_BibTeX_key=boş_BibTeX_anahtarı
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2306,3 +2306,4 @@ Invalid_ISBN\:_'%0'.=
should_be_an_integer_or_normalized=
should_be_normalized=
empty_BibTeX_key=
BibLaTeX_field_only=
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ public void testMonthChecks() {
assertWrong(withMode(createContext("month", "Lorem"), BibDatabaseMode.BIBLATEX));
}

@Test
public void testJournaltitleChecks() {
assertCorrect(withMode(createContext("journaltitle", "A journal"), BibDatabaseMode.BIBLATEX));
assertWrong(withMode(createContext("journaltitle", "A journal"), BibDatabaseMode.BIBTEX));
}

@Test
public void testBibtexkeyChecks() {
assertCorrect(createContext("bibtexkey", "Knuth2014"));
Expand Down