Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 18163:c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 24 Oct 2014 16:18:10 +0200 |
parents | 31ad929e1afd |
children | a4ab0b87fb34 |
comparison
equal
deleted
inserted
replaced
18162:ab62800259ff | 18163:c88ab4f1f04a |
---|---|
3144 for p in projects_opt_limit_to_suites(): | 3144 for p in projects_opt_limit_to_suites(): |
3145 if p.native: | 3145 if p.native: |
3146 continue | 3146 continue |
3147 sourceDirs = p.source_dirs() | 3147 sourceDirs = p.source_dirs() |
3148 | 3148 |
3149 csConfig = join(p.dir, '.checkstyle_checks.xml') | 3149 config = join(project(p.checkstyleProj).dir, '.checkstyle_checks.xml') |
3150 if not exists(csConfig): | 3150 if not exists(config): |
3151 abort('ERROR: Checkstyle configuration for project {} is missing: {}'.format(p.name, csConfig)) | 3151 logv('[No Checkstyle configuration foudn for {0} - skipping]'.format(p)) |
3152 continue | |
3152 | 3153 |
3153 # skip checking this Java project if its Java compliance level is "higher" than the configured JDK | 3154 # skip checking this Java project if its Java compliance level is "higher" than the configured JDK |
3154 jdk = java(p.javaCompliance) | 3155 jdk = java(p.javaCompliance) |
3155 assert jdk | 3156 assert jdk |
3156 | 3157 |
3172 if not mustCheck: | 3173 if not mustCheck: |
3173 if _opts.verbose: | 3174 if _opts.verbose: |
3174 log('[all Java sources in {0} already checked - skipping]'.format(sourceDir)) | 3175 log('[all Java sources in {0} already checked - skipping]'.format(sourceDir)) |
3175 continue | 3176 continue |
3176 | 3177 |
3177 dotCheckstyleXML = xml.dom.minidom.parse(csConfig) | |
3178 localCheckConfig = dotCheckstyleXML.getElementsByTagName('local-check-config')[0] | |
3179 configLocation = localCheckConfig.getAttribute('location') | |
3180 configType = localCheckConfig.getAttribute('type') | |
3181 if configType == 'project': | |
3182 # Eclipse plugin "Project Relative Configuration" format: | |
3183 # | |
3184 # '/<project_name>/<suffix>' | |
3185 # | |
3186 if configLocation.startswith('/'): | |
3187 name, _, suffix = configLocation.lstrip('/').partition('/') | |
3188 config = join(project(name).dir, suffix) | |
3189 else: | |
3190 config = join(p.dir, configLocation) | |
3191 else: | |
3192 logv('[unknown Checkstyle configuration type "' + configType + '" in {0} - skipping]'.format(sourceDir)) | |
3193 continue | |
3194 | |
3195 exclude = join(p.dir, '.checkstyle.exclude') | 3178 exclude = join(p.dir, '.checkstyle.exclude') |
3196 | |
3197 if exists(exclude): | 3179 if exists(exclude): |
3198 with open(exclude) as f: | 3180 with open(exclude) as f: |
3199 # Convert patterns to OS separators | 3181 # Convert patterns to OS separators |
3200 patterns = [name.rstrip().replace('/', os.sep) for name in f.readlines()] | 3182 patterns = [name.rstrip().replace('/', os.sep) for name in f.readlines()] |
3201 def match(name): | 3183 def match(name): |