forked from coala/coala-bears
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ApertiumLintBear is a bear which uses apertium-lint to lint 4 file types namely dictionaries, transfer, modes and tagger. Closes coala#1320
- Loading branch information
1 parent
aa547dd
commit 95b85f5
Showing
9 changed files
with
437 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
from queue import Queue | ||
|
||
from bears.apertium.ApertiumLintBear import ApertiumLintBear | ||
from coalib.testing.BearTestHelper import generate_skip_decorator | ||
from coalib.testing.LocalBearTestHelper import LocalBearTestHelper | ||
from coalib.settings.Section import Section | ||
from coalib.settings.Setting import Setting | ||
|
||
|
||
@generate_skip_decorator(ApertiumLintBear) | ||
class ApertiumLintBearTest(LocalBearTestHelper): | ||
|
||
def setUp(self): | ||
self.section = Section('test section') | ||
self.uut = ApertiumLintBear(self.section, Queue()) | ||
test_files = os.path.join(os.path.dirname(__file__), 'test_files') | ||
self.good_file = os.path.join(test_files, 'apertium-go-od.en.dix') | ||
self.bad_file = os.path.join(test_files, 'apertium-ba-ad.en.dix') | ||
self.config_file = os.path.join(test_files, 'apertium_config.json') | ||
|
||
def test_run(self): | ||
self.section.append(Setting('apertiumlint_config', '')) | ||
self.check_validity(self.uut, [], self.good_file) | ||
|
||
self.section.append(Setting('apertiumlint_config', self.config_file)) | ||
self.check_validity(self.uut, [], self.good_file) | ||
|
||
self.section.append(Setting('apertiumlint_config', '')) | ||
self.check_validity(self.uut, [], self.bad_file, valid=False) | ||
|
||
self.section.append(Setting('apertiumlint_config', self.config_file)) | ||
self.check_validity(self.uut, [], self.bad_file, valid=False) | ||
|
||
def test_paradigm_names(self): | ||
self.section.append(Setting('paradigm_names', 'False')) | ||
self.check_validity(self.uut, [], self.bad_file) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<dictionary> | ||
<alphabet>·ÀÁÂÄÇÈÉÊËÌÍÎÏÑÒÓÔÖÙÚÛÜÚāàáâäçèéêëìíîïīñòóôöõùúûüABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ş</alphabet> | ||
<pardefs> | ||
|
||
<pardef n="ö"> | ||
<e> <p><l>ö</l> <r>ö</r></p></e> | ||
<e r="LR"><p><l>oe</l> <r>ö</r></p></e> | ||
</pardef> | ||
|
||
</pardefs> | ||
</dictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<dictionary> | ||
<alphabet>·ÀÁÂÄÇÈÉÊËÌÍÎÏÑÒÓÔÖÙÚÛÜÚāàáâäçèéêëìíîïīñòóôöõùúûüABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ş</alphabet> | ||
<pardefs> | ||
|
||
<pardef n="zero__n"> | ||
<e> <p><l></l> <r><s n="n"/><s n="sg"/></r></p></e> | ||
<e> <p><l>es</l> <r><s n="n"/><s n="pl"/></r></p></e> | ||
<e r="LR"><p><l>s</l> <r><s n="n"/><s n="pl"/></r></p></e> | ||
</pardef> | ||
|
||
</pardefs> | ||
</dictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"monodix": { | ||
"paradigmNames":{ | ||
"message": "Warning : Improper paradigm name found :", | ||
"enable" : true | ||
} | ||
} | ||
} |