|
| 1 | +from xrlint.plugin import Plugin |
| 2 | +from xrlint.util.importutil import import_submodules |
| 3 | + |
| 4 | + |
| 5 | +def export_plugin() -> Plugin: |
| 6 | + from .plugin import plugin |
| 7 | + |
| 8 | + import_submodules("xrlint.plugins.acdd.rules") |
| 9 | + |
| 10 | + common_configs = [ |
| 11 | + { |
| 12 | + "plugins": { |
| 13 | + "acdd": plugin, |
| 14 | + } |
| 15 | + } |
| 16 | + ] |
| 17 | + |
| 18 | + rules_1_0 = { |
| 19 | + "acdd/1.0-attrs-highly-recommended": "error", |
| 20 | + "acdd/1.0-attrs-recommended": "warn", |
| 21 | + "acdd/1.0-attrs-suggested": "warn", |
| 22 | + } |
| 23 | + |
| 24 | + rules_1_1 = { |
| 25 | + "acdd/1.1-attrs-highly-recommended": "error", |
| 26 | + "acdd/1.1-attrs-recommended": "warn", |
| 27 | + "acdd/1.1-attrs-suggested": "warn", |
| 28 | + } |
| 29 | + |
| 30 | + rules_1_3 = { |
| 31 | + "acdd/1.3-conventions": "error", |
| 32 | + "acdd/1.3-attrs-highly-recommended": "error", |
| 33 | + "acdd/1.3-attrs-recommended": "warn", |
| 34 | + "acdd/1.3-attrs-suggested": "warn", |
| 35 | + "acdd/1.3-no-blanks-in-id": "warn", |
| 36 | + "acdd/1.3-metadata-link": "warn", |
| 37 | + "acdd/1.3-dates-iso-format": "warn", |
| 38 | + } |
| 39 | + |
| 40 | + plugin.define_config( |
| 41 | + "recommended", [*common_configs, {"name": "recommended", "rules": rules_1_3}] |
| 42 | + ) |
| 43 | + |
| 44 | + plugin.define_config( |
| 45 | + "acdd_1.3", [*common_configs, {"name": "ACDD 1.3", "rules": rules_1_3}] |
| 46 | + ) |
| 47 | + |
| 48 | + plugin.define_config( |
| 49 | + "acdd_1.3_strict_reccomended", |
| 50 | + [ |
| 51 | + *common_configs, |
| 52 | + { |
| 53 | + "name": "ACDD 1.3 (strict recommended)", |
| 54 | + "rules": { |
| 55 | + **rules_1_3, |
| 56 | + "1.3-attrs-recommended": "error", |
| 57 | + }, |
| 58 | + }, |
| 59 | + ], |
| 60 | + ) |
| 61 | + |
| 62 | + plugin.define_config( |
| 63 | + "acdd_1.3_strict", |
| 64 | + [ |
| 65 | + *common_configs, |
| 66 | + {"name": "ACDD 1.3 (strict)", "rules": dict.fromkeys(rules_1_3, "error")}, |
| 67 | + ], |
| 68 | + ) |
| 69 | + |
| 70 | + plugin.define_config( |
| 71 | + "acdd_1.3_warn", |
| 72 | + [ |
| 73 | + *common_configs, |
| 74 | + { |
| 75 | + "name": "ACDD 1.3 (as warnings)", |
| 76 | + "rules": dict.fromkeys(rules_1_3, "warn"), |
| 77 | + }, |
| 78 | + ], |
| 79 | + ) |
| 80 | + |
| 81 | + plugin.define_config( |
| 82 | + "acdd_1.1", [*common_configs, {"name": "ACDD 1.1", "rules": rules_1_1}] |
| 83 | + ) |
| 84 | + |
| 85 | + plugin.define_config( |
| 86 | + "acdd_1.0", [*common_configs, {"name": "ACDD 1.0", "rules": rules_1_0}] |
| 87 | + ) |
| 88 | + |
| 89 | + return plugin |
0 commit comments