|
2 | 2 | from coalib.settings.Setting import path
|
3 | 3 |
|
4 | 4 |
|
5 |
| -known_checkstyles = { |
| 5 | +# Checkstyle included these two rulesets since version 6.2 |
| 6 | +_checkstyle_provided_styles = { |
6 | 7 | "google": "https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml",
|
7 | 8 | "sun": 'https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/sun_checks.xml',
|
| 9 | +} |
| 10 | + |
| 11 | +_online_styles = { |
8 | 12 | "android-check-easy": "https://raw.githubusercontent.com/noveogroup/android-check/master/android-check-plugin/src/main/resources/checkstyle/checkstyle-easy.xml",
|
9 | 13 | "android-check-hard": "https://raw.githubusercontent.com/noveogroup/android-check/master/android-check-plugin/src/main/resources/checkstyle/checkstyle-hard.xml",
|
10 | 14 | "geosoft": "http://geosoft.no/development/geosoft_checks.xml"}
|
11 | 15 |
|
| 16 | +# To be deprecated |
| 17 | +known_checkstyles = dict(_checkstyle_provided_styles, **_online_styles) |
| 18 | + |
12 | 19 |
|
13 | 20 | def check_invalid_configuration(checkstyle_configs, use_spaces, indent_size):
|
14 | 21 | if (checkstyle_configs is 'google' and
|
@@ -75,9 +82,13 @@ def create_arguments(
|
75 | 82 | check_invalid_configuration(
|
76 | 83 | checkstyle_configs, use_spaces, indent_size)
|
77 | 84 |
|
78 |
| - if checkstyle_configs in known_checkstyles: |
| 85 | + if checkstyle_configs in _checkstyle_provided_styles: |
| 86 | + # Locate the file as an absolute resource in the jar |
| 87 | + url = _checkstyle_provided_styles[checkstyle_configs] |
| 88 | + checkstyle_configs = url[url.rfind('/'):] |
| 89 | + elif checkstyle_configs in _online_styles: |
79 | 90 | checkstyle_configs = self.download_cached_file(
|
80 |
| - known_checkstyles[checkstyle_configs], |
| 91 | + _online_styles[checkstyle_configs], |
81 | 92 | checkstyle_configs + ".xml")
|
82 | 93 |
|
83 | 94 | return ('-jar', self.checkstyle_jar_file, '-c',
|
|
0 commit comments