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