├── .dockerignore ├── Dockerfile ├── README.md ├── apex-ruleset.xml ├── apexunit.xml ├── braces.xml ├── complexity.xml ├── empty.xml ├── engine.json ├── lib └── pmd │ ├── LICENSE │ ├── bin │ ├── bgastviewer.bat │ ├── cpd.bat │ ├── cpdgui.bat │ ├── designer.bat │ ├── pmd.bat │ └── run.sh │ └── lib │ ├── animal-sniffer-annotations-1.14.jar │ ├── ant-1.10.1.jar │ ├── ant-launcher-1.10.1.jar │ ├── antlr-runtime-3.5.2.jar │ ├── aopalliance-1.0.jar │ ├── asm-6.0.jar │ ├── cglib-3.2.0.jar │ ├── commons-io-2.4.jar │ ├── commons-lang3-3.7.jar │ ├── error_prone_annotations-2.0.18.jar │ ├── gson-2.5.jar │ ├── guava-19.0-rc3.jar │ ├── j2objc-annotations-1.1.jar │ ├── javacc-5.0.jar │ ├── javax.inject-1.jar │ ├── jaxen-1.1.6.jar │ ├── jcommander-1.48.jar │ ├── jol-core-0.4.jar │ ├── jsr305-3.0.1.jar │ ├── logback-classic-1.1.7.jar │ ├── logback-core-1.1.7.jar │ ├── org.eclipse.xtend.lib-2.10.0.jar │ ├── org.eclipse.xtend.lib.macro-2.10.0.jar │ ├── org.eclipse.xtext.xbase.lib-2.10.0.jar │ ├── pmd-apex-6.0.0.jar │ ├── pmd-apex-jorje-6.0.0-lib.jar │ ├── pmd-core-6.0.0.jar │ ├── pmd-visualforce-6.0.0.jar │ ├── saxon-9.1.0.8-dom.jar │ ├── saxon-9.1.0.8.jar │ ├── slf4j-api-1.7.12.jar │ └── snakeyaml-1.17.jar ├── metrics.xml ├── performance.xml ├── pmd.groovy ├── resources ├── .codeclimate.yml ├── ApexMetricsBanner.png ├── ApexMetricsLogo.png ├── ApexMetricsLogo.psd └── wiki │ ├── AddRuleDefinition.png │ ├── AddRuleToRuleset.png │ ├── AddRuleToTestclass.png │ ├── BuildPMD.png │ ├── BuildSuccess.png │ ├── CloneGitRepo.png │ ├── CloneGitRepo2.png │ ├── Commit.png │ ├── CompareChanges.png │ ├── CreatePullRequest.png │ ├── CreateRuleClass.png │ ├── DeleteProject.png │ ├── Fork.png │ ├── ImportExistingMavenProjects.png │ ├── ImportMavenProjects.png │ ├── ImportMavenProjects2.png │ ├── ImportProject.png │ ├── NewPullRequest.png │ ├── RunPMD.png │ ├── RunUnitTests.png │ ├── SyncWorkspace.png │ ├── TestCasesXml.png │ ├── UnitTestResults.png │ ├── WriteRule.png │ └── WriteRule2.png ├── rulesets.properties ├── security.xml └── style.xml /.dockerignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/.dockerignore -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8-jre 2 | 3 | MAINTAINER up2go-rsoesemann 4 | 5 | RUN cd /tmp && \ 6 | wget http://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.6.zip && \ 7 | unzip apache-groovy-binary-2.4.6.zip && \ 8 | mv groovy-2.4.6 /groovy && \ 9 | rm apache-groovy-binary-2.4.6.zip 10 | 11 | ENV GROOVY_HOME /groovy 12 | ENV PATH $GROOVY_HOME/bin/:$PATH 13 | 14 | RUN groupadd app -g 9000 && useradd -g 9000 -u 9000 -r -s /bin/false app 15 | 16 | VOLUME /code 17 | WORKDIR /code 18 | COPY . /usr/src/app 19 | 20 | USER app 21 | 22 | CMD ["/usr/src/app/pmd.groovy", "--codeFolder=/code","--configFile=/config.json"] 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## DISCONTINUED - This Salesforce-only PMD engine will not be updated anymore. Help make https://github.com/codeclimate/codeclimate-pmd available for all languages. Not Java-only. 2 | 3 | ## ApexMetrics - Code Climate engine for Salesforce.com Apex 4 | 5 | 6 | 7 | ApexMetrics is a [Code Climate engine](https://codeclimate.com/engines) for the programming language [Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/) of the [Salesforce.com cloud platform](http://www.salesforce.com/platform/products/force). 8 | 9 | If you [connect your Github repositories to Code Climate](https://docs.codeclimate.com/docs/importing-repositories) and enable the Engine [static code analysis](http://stackoverflow.com/questions/49716/what-is-static-code-analysis) is performed on every commit or pull request. The resulting continuous metrics will tell you where code improved or degraded over time and which [hot spots need refactoring](http://blog.xebia.com/static-code-analysis-is-just-tip-of-the-iceberg/). 10 | 11 | The engine and [all of](https://github.com/forcedotcom/idecore/tree/b5bf3a1cb6e8d94aaac10f375c771ec8eab821ba/com.salesforce.ide.apex.core/lib) [its "ingredients"](https://github.com/Up2Go/pmd) are open-source so everybody in the community can contribute. The engine was built by a software engineers at [Up2Go](https://github.com/Up2Go) who struggled with enforcing Clean Code into their daily work given [the lack of metrics tools in the Salesforce.com ecosystem](http://salesforce.stackexchange.com/questions/1697/apex-static-code-analysis). Not to forget the [awesome support](https://github.com/adangel) [by](https://github.com/forcedotcom/idecore/issues/167) [many](https://github.com/mrb) [others](https://github.com/sivakumar-kailasam). 12 | 13 | 14 | **[What we check](#rules) | [How to configure](#configuration) | [How to contribute](#contribute)** 15 | 16 | 17 | ### What issues are recognized? 18 | 19 | **[50+ rules for Apex and Visualforce..](https://pmd.github.io/latest/pmd_rules_apex.html)** 20 | 21 | ### Enable and configure the Engine 22 | 23 | Code Climate will not run this engine on your code unless you have this minimal '.codeclimate.yml' (Note the leading dot) in the root directory of your repository. 24 | 25 | ```yaml 26 | engines: 27 | apexmetrics: 28 | enabled: true 29 | ratings: 30 | paths: 31 | - "**.cls" 32 | - "**.trigger" 33 | - "**.page" 34 | - "**.component" 35 | ``` 36 | 37 | For more details about Code Climate configuration go to [docs.codeclimate.com](https://docs.codeclimate.com/docs/configuring-your-code-climate-analysis). 38 | 39 | ##### Exclude files and paths (optional) 40 | To exclude single files or folders from the analysis add a `exclude_paths` section to the file like in this minimal example: 41 | 42 | ```yaml 43 | engines: 44 | apexmetrics: 45 | enabled: true 46 | ratings: 47 | paths: 48 | - "**.cls" 49 | - "**.trigger" 50 | exclude_paths: 51 | - "/src/triggers" 52 | - "**.xml" 53 | ``` 54 | 55 | We recommend you to adapt a copy of this [.codeclimate.yml](https://github.com/Up2Go/codeclimate-apex/blob/master/resources/.codeclimate.yml) which already excludes most of the irrelevant Salesforce.com files and folders. 56 | 57 | For more details about how to exclude files and folders go to [docs.codeclimate.com](https://docs.codeclimate.com/docs/excluding-files-and-folders). 58 | 59 | 60 | ##### PMD Rule customization (optional) 61 | 62 | Not all checks make sense under all circumstances so configurability is crucial when it comes to Code metrix. By adjusting your `.codeclimate.yml` you can eighter disable certain checks [for a single issue](https://docs.codeclimate.com/docs/marking-false-positives) or [for your whole repo](https://docs.codeclimate.com/docs/disabling-individual-checks). 63 | 64 | But that's not enough. One key benefit of Code Climate is grading. Grading not only takes the amount of issues into a account but also how severe issues are to fix. To customize if and when code is marked as issue you need to go "one level deeper". The static code analysis performed by this engine uses [an Apex port](https://github.com/pmd/pmd/tree/master/pmd-apex) of the [famous Java tool PMD](https://pmd.github.io/). PMD is very flexible and can be [configured using a so called ruleset xml file](http://pmd.sourceforge.net/pmd-4.3.0/howtomakearuleset.html). 65 | 66 | By default or engine uses this [apex-ruleset.xml](https://github.com/Up2Go/codeclimate-apex/blob/master/apex-ruleset.xml). It enables all rules and runs them with values we came up with as good defaults. Just add a copy of that file to the root directory of your repository and adapt it to your needs. 67 | 68 | ```xml 69 | 70 | 3 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | ``` 82 | 83 | Some rules have parameters which define if and when code is marked as issue. To learn how such parameters influence a check go to the readup section of an issue which describs 84 | 85 | 86 | 87 | All properties starting with `cc_` are Code Climate specific and define how the results are displayed or how grades are calculated. 88 | 89 | * **cc_remediation_points_multiplier**: This is multiplication factor for the Code Climate Remediation Point default of 50.000. To understand the semantics and importance of Remediation point please check the [docs.codeclimate.com](https://github.com/codeclimate/spec/blob/master/SPEC.md#remediation-points). 90 | * **cc_categories**: The Code Climate specific [categorization](https://github.com/codeclimate/spec/blob/master/SPEC.md#categories). Might differ from PMD. 91 | * **cc_block_highlighting**: Defaults to 'false'. Only the first line of a problematic block is highlighted in the UI. If set to 'true' the whole block is highlighted which currently looks ugly. 92 | 93 | 94 | ### How to contribute 95 | 96 | There is a lot of room for improvement or extension. Depending on what you want to do you eighter need to fork, extend and pull request this repository or the PMD repository. Please check the [Wiki](https://github.com/Up2Go/codeclimate-apexmetrics/wiki#how-to-contribute) to learn how to contribute. 97 | -------------------------------------------------------------------------------- /apex-ruleset.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Default ruleset used by the Code Climate Engine for Salesforce.com Apex 4 | 5 | 6 | 7 | 3 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 3 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 3 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 3 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 3 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 3 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 3 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 3 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 3 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 3 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 3 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 3 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 3 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 3 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 3 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 3 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 3 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 3 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 3 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 3 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 3 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 3 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 3 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 3 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 3 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 3 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 3 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 3 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 3 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 3 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 3 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 3 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 3 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 3 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 3 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 3 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 3 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 3 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 3 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 3 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 3 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 3 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 3 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | -------------------------------------------------------------------------------- /apexunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | These rules deal with different problems that can occur with Apex unit tests. 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /braces.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | The Braces ruleset contains rules regarding the use and placement of braces. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /complexity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | The Complexity ruleset contains rules that find problems related to code size or complexity. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | The Empty Code ruleset contains rules that find empty statements of any kind (empty method, 9 | empty block statement, empty try or catch block,...). 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /engine.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codeclimate-apexmetrics", 3 | "description": "Static code analysis tool for Salesforce.com Apex based on PMD", 4 | "maintainer": { 5 | "name": "Up2go-rsoesemann", 6 | "email": "robert.soesemann@up2go.com" 7 | }, 8 | "languages": [ 9 | "Apex" 10 | ], 11 | "version": "1.4" 12 | } 13 | -------------------------------------------------------------------------------- /lib/pmd/LICENSE: -------------------------------------------------------------------------------- 1 | PMD's BSD-style license: 2 | 3 | Copyright (c) 2003-2009, InfoEther, LLC 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * The end-user documentation included with the redistribution, if 16 | any, must include the following acknowledgement: 17 | "This product includes software developed in part by support from 18 | the Defense Advanced Research Project Agency (DARPA)" 19 | * Neither the name of InfoEther, LLC nor the names of its 20 | contributors may be used to endorse or promote products derived from 21 | this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 24 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 26 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 27 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | --------------------------------------------------------------------- 36 | 37 | Apache License 38 | Version 2.0, January 2004 39 | http://www.apache.org/licenses/ 40 | 41 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 42 | 43 | 1. Definitions. 44 | 45 | "License" shall mean the terms and conditions for use, reproduction, 46 | and distribution as defined by Sections 1 through 9 of this document. 47 | 48 | "Licensor" shall mean the copyright owner or entity authorized by 49 | the copyright owner that is granting the License. 50 | 51 | "Legal Entity" shall mean the union of the acting entity and all 52 | other entities that control, are controlled by, or are under common 53 | control with that entity. For the purposes of this definition, 54 | "control" means (i) the power, direct or indirect, to cause the 55 | direction or management of such entity, whether by contract or 56 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 57 | outstanding shares, or (iii) beneficial ownership of such entity. 58 | 59 | "You" (or "Your") shall mean an individual or Legal Entity 60 | exercising permissions granted by this License. 61 | 62 | "Source" form shall mean the preferred form for making modifications, 63 | including but not limited to software source code, documentation 64 | source, and configuration files. 65 | 66 | "Object" form shall mean any form resulting from mechanical 67 | transformation or translation of a Source form, including but 68 | not limited to compiled object code, generated documentation, 69 | and conversions to other media types. 70 | 71 | "Work" shall mean the work of authorship, whether in Source or 72 | Object form, made available under the License, as indicated by a 73 | copyright notice that is included in or attached to the work 74 | (an example is provided in the Appendix below). 75 | 76 | "Derivative Works" shall mean any work, whether in Source or Object 77 | form, that is based on (or derived from) the Work and for which the 78 | editorial revisions, annotations, elaborations, or other modifications 79 | represent, as a whole, an original work of authorship. For the purposes 80 | of this License, Derivative Works shall not include works that remain 81 | separable from, or merely link (or bind by name) to the interfaces of, 82 | the Work and Derivative Works thereof. 83 | 84 | "Contribution" shall mean any work of authorship, including 85 | the original version of the Work and any modifications or additions 86 | to that Work or Derivative Works thereof, that is intentionally 87 | submitted to Licensor for inclusion in the Work by the copyright owner 88 | or by an individual or Legal Entity authorized to submit on behalf of 89 | the copyright owner. For the purposes of this definition, "submitted" 90 | means any form of electronic, verbal, or written communication sent 91 | to the Licensor or its representatives, including but not limited to 92 | communication on electronic mailing lists, source code control systems, 93 | and issue tracking systems that are managed by, or on behalf of, the 94 | Licensor for the purpose of discussing and improving the Work, but 95 | excluding communication that is conspicuously marked or otherwise 96 | designated in writing by the copyright owner as "Not a Contribution." 97 | 98 | "Contributor" shall mean Licensor and any individual or Legal Entity 99 | on behalf of whom a Contribution has been received by Licensor and 100 | subsequently incorporated within the Work. 101 | 102 | 2. Grant of Copyright License. Subject to the terms and conditions of 103 | this License, each Contributor hereby grants to You a perpetual, 104 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 105 | copyright license to reproduce, prepare Derivative Works of, 106 | publicly display, publicly perform, sublicense, and distribute the 107 | Work and such Derivative Works in Source or Object form. 108 | 109 | 3. Grant of Patent License. Subject to the terms and conditions of 110 | this License, each Contributor hereby grants to You a perpetual, 111 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 112 | (except as stated in this section) patent license to make, have made, 113 | use, offer to sell, sell, import, and otherwise transfer the Work, 114 | where such license applies only to those patent claims licensable 115 | by such Contributor that are necessarily infringed by their 116 | Contribution(s) alone or by combination of their Contribution(s) 117 | with the Work to which such Contribution(s) was submitted. If You 118 | institute patent litigation against any entity (including a 119 | cross-claim or counterclaim in a lawsuit) alleging that the Work 120 | or a Contribution incorporated within the Work constitutes direct 121 | or contributory patent infringement, then any patent licenses 122 | granted to You under this License for that Work shall terminate 123 | as of the date such litigation is filed. 124 | 125 | 4. Redistribution. You may reproduce and distribute copies of the 126 | Work or Derivative Works thereof in any medium, with or without 127 | modifications, and in Source or Object form, provided that You 128 | meet the following conditions: 129 | 130 | (a) You must give any other recipients of the Work or 131 | Derivative Works a copy of this License; and 132 | 133 | (b) You must cause any modified files to carry prominent notices 134 | stating that You changed the files; and 135 | 136 | (c) You must retain, in the Source form of any Derivative Works 137 | that You distribute, all copyright, patent, trademark, and 138 | attribution notices from the Source form of the Work, 139 | excluding those notices that do not pertain to any part of 140 | the Derivative Works; and 141 | 142 | (d) If the Work includes a "NOTICE" text file as part of its 143 | distribution, then any Derivative Works that You distribute must 144 | include a readable copy of the attribution notices contained 145 | within such NOTICE file, excluding those notices that do not 146 | pertain to any part of the Derivative Works, in at least one 147 | of the following places: within a NOTICE text file distributed 148 | as part of the Derivative Works; within the Source form or 149 | documentation, if provided along with the Derivative Works; or, 150 | within a display generated by the Derivative Works, if and 151 | wherever such third-party notices normally appear. The contents 152 | of the NOTICE file are for informational purposes only and 153 | do not modify the License. You may add Your own attribution 154 | notices within Derivative Works that You distribute, alongside 155 | or as an addendum to the NOTICE text from the Work, provided 156 | that such additional attribution notices cannot be construed 157 | as modifying the License. 158 | 159 | You may add Your own copyright statement to Your modifications and 160 | may provide additional or different license terms and conditions 161 | for use, reproduction, or distribution of Your modifications, or 162 | for any such Derivative Works as a whole, provided Your use, 163 | reproduction, and distribution of the Work otherwise complies with 164 | the conditions stated in this License. 165 | 166 | 5. Submission of Contributions. Unless You explicitly state otherwise, 167 | any Contribution intentionally submitted for inclusion in the Work 168 | by You to the Licensor shall be under the terms and conditions of 169 | this License, without any additional terms or conditions. 170 | Notwithstanding the above, nothing herein shall supersede or modify 171 | the terms of any separate license agreement you may have executed 172 | with Licensor regarding such Contributions. 173 | 174 | 6. Trademarks. This License does not grant permission to use the trade 175 | names, trademarks, service marks, or product names of the Licensor, 176 | except as required for reasonable and customary use in describing the 177 | origin of the Work and reproducing the content of the NOTICE file. 178 | 179 | 7. Disclaimer of Warranty. Unless required by applicable law or 180 | agreed to in writing, Licensor provides the Work (and each 181 | Contributor provides its Contributions) on an "AS IS" BASIS, 182 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 183 | implied, including, without limitation, any warranties or conditions 184 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 185 | PARTICULAR PURPOSE. You are solely responsible for determining the 186 | appropriateness of using or redistributing the Work and assume any 187 | risks associated with Your exercise of permissions under this License. 188 | 189 | 8. Limitation of Liability. In no event and under no legal theory, 190 | whether in tort (including negligence), contract, or otherwise, 191 | unless required by applicable law (such as deliberate and grossly 192 | negligent acts) or agreed to in writing, shall any Contributor be 193 | liable to You for damages, including any direct, indirect, special, 194 | incidental, or consequential damages of any character arising as a 195 | result of this License or out of the use or inability to use the 196 | Work (including but not limited to damages for loss of goodwill, 197 | work stoppage, computer failure or malfunction, or any and all 198 | other commercial damages or losses), even if such Contributor 199 | has been advised of the possibility of such damages. 200 | 201 | 9. Accepting Warranty or Additional Liability. While redistributing 202 | the Work or Derivative Works thereof, You may choose to offer, 203 | and charge a fee for, acceptance of support, warranty, indemnity, 204 | or other liability obligations and/or rights consistent with this 205 | License. However, in accepting such obligations, You may act only 206 | on Your own behalf and on Your sole responsibility, not on behalf 207 | of any other Contributor, and only if You agree to indemnify, 208 | defend, and hold each Contributor harmless for any liability 209 | incurred by, or claims asserted against, such Contributor by reason 210 | of your accepting any such warranty or additional liability. 211 | 212 | END OF TERMS AND CONDITIONS 213 | 214 | APPENDIX: How to apply the Apache License to your work. 215 | 216 | To apply the Apache License to your work, attach the following 217 | boilerplate notice, with the fields enclosed by brackets "[]" 218 | replaced with your own identifying information. (Don't include 219 | the brackets!) The text should be enclosed in the appropriate 220 | comment syntax for the file format. We also recommend that a 221 | file or class name and description of purpose be included on the 222 | same "printed page" as the copyright notice for easier 223 | identification within third-party archives. 224 | 225 | Copyright [yyyy] [name of copyright owner] 226 | 227 | Licensed under the Apache License, Version 2.0 (the "License"); 228 | you may not use this file except in compliance with the License. 229 | You may obtain a copy of the License at 230 | 231 | http://www.apache.org/licenses/LICENSE-2.0 232 | 233 | Unless required by applicable law or agreed to in writing, software 234 | distributed under the License is distributed on an "AS IS" BASIS, 235 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 236 | See the License for the specific language governing permissions and 237 | limitations under the License. 238 | -------------------------------------------------------------------------------- /lib/pmd/bin/bgastviewer.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set TOPDIR=%~dp0.. 3 | set OPTS= 4 | set MAIN_CLASS=net.sourceforge.pmd.util.viewer.Viewer 5 | 6 | java -classpath "%TOPDIR%\lib\*" %OPTS% %MAIN_CLASS% %* 7 | -------------------------------------------------------------------------------- /lib/pmd/bin/cpd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set TOPDIR=%~dp0.. 3 | set OPTS= 4 | set MAIN_CLASS=net.sourceforge.pmd.cpd.CPD 5 | 6 | java -classpath "%TOPDIR%\lib\*" %OPTS% %MAIN_CLASS% %* 7 | -------------------------------------------------------------------------------- /lib/pmd/bin/cpdgui.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set TOPDIR=%~dp0.. 3 | set OPTS= 4 | set MAIN_CLASS=net.sourceforge.pmd.cpd.GUI 5 | 6 | java -classpath "%TOPDIR%\lib\*" %OPTS% %MAIN_CLASS% %* 7 | -------------------------------------------------------------------------------- /lib/pmd/bin/designer.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set TOPDIR=%~dp0.. 3 | set OPTS= 4 | set MAIN_CLASS=net.sourceforge.pmd.util.fxdesigner.Designer 5 | 6 | java -classpath "%TOPDIR%\lib\*" %OPTS% %MAIN_CLASS% %* 7 | -------------------------------------------------------------------------------- /lib/pmd/bin/pmd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set TOPDIR=%~dp0.. 3 | set OPTS= 4 | set MAIN_CLASS=net.sourceforge.pmd.PMD 5 | 6 | java -classpath "%TOPDIR%\lib\*" %OPTS% %MAIN_CLASS% %* 7 | -------------------------------------------------------------------------------- /lib/pmd/bin/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | usage() { 4 | echo "Usage:" 5 | echo " $(basename $0) [-h|-v] ..." 6 | echo "" 7 | echo "application-name: valid options are: $(valid_app_options)" 8 | echo "-h print this help" 9 | echo "-v display PMD's version" 10 | } 11 | 12 | valid_app_options () { 13 | echo "pmd, cpd, cpdgui, designer, bgastviewer, designerold" 14 | } 15 | 16 | is_cygwin() { 17 | case "$(uname)" in 18 | CYGWIN*|MINGW*) 19 | readonly cygwin=true 20 | ;; 21 | esac 22 | # OS specific support. $var _must_ be set to either true or false. 23 | if [ -z ${cygwin} ] ; then 24 | readonly cygwin=false 25 | fi 26 | } 27 | 28 | cygwin_paths() { 29 | # For Cygwin, switch paths to Windows format before running java 30 | if ${cygwin} ; then 31 | [ -n "${JAVA_HOME}" ] && JAVA_HOME=$(cygpath --windows "${JAVA_HOME}") 32 | [ -n "${DIRECTORY}" ] && DIRECTORY=$(cygpath --windows "${DIRECTORY}") 33 | classpath=$(cygpath --path --windows "${classpath}") 34 | fi 35 | } 36 | 37 | convert_cygwin_vars() { 38 | # If cygwin, convert to Unix form before manipulating 39 | if ${cygwin} ; then 40 | [ -n "${JAVA_HOME}" ] && JAVA_HOME=$(cygpath --unix "${JAVA_HOME}") 41 | [ -n "${CLASSPATH}" ] && CLASSPATH=$(cygpath --path --unix "${CLASSPATH}") 42 | fi 43 | } 44 | 45 | java_heapsize_settings() { 46 | local heapsize=${HEAPSIZE} 47 | case "${heapsize}" in 48 | [1-9]*[mgMG]) 49 | readonly HEAPSIZE="-Xmx${heapsize}" 50 | ;; 51 | '') 52 | ;; 53 | *) 54 | echo "HEAPSIZE '${HEAPSIZE}' unknown (try: 1024m)" 55 | exit 1 56 | esac 57 | } 58 | 59 | 60 | set_lib_dir() { 61 | if [ -z ${LIB_DIR} ]; then 62 | local script_dir=$(dirname "${0}") 63 | local cwd="${PWD}" 64 | 65 | cd "${script_dir}/../lib" 66 | readonly LIB_DIR=$(pwd -P) 67 | cd "${cwd}" 68 | fi 69 | } 70 | 71 | check_lib_dir() { 72 | if [ ! -e "${LIB_DIR}" ]; then 73 | echo "The jar directory [${LIB_DIR}] does not exist" 74 | fi 75 | } 76 | 77 | readonly APPNAME="${1}" 78 | if [ -z "${APPNAME}" ]; then 79 | usage 80 | exit 1 81 | fi 82 | shift 83 | 84 | case "${APPNAME}" in 85 | "pmd") 86 | readonly CLASSNAME="net.sourceforge.pmd.PMD" 87 | ;; 88 | "cpd") 89 | readonly CLASSNAME="net.sourceforge.pmd.cpd.CPD" 90 | ;; 91 | "designer") 92 | readonly CLASSNAME="net.sourceforge.pmd.util.fxdesigner.Designer" 93 | ;; 94 | "designerold") 95 | readonly CLASSNAME="net.sourceforge.pmd.util.designer.Designer" 96 | ;; 97 | "bgastviewer") 98 | readonly CLASSNAME="net.sourceforge.pmd.util.viewer.Viewer" 99 | ;; 100 | "cpdgui") 101 | readonly CLASSNAME="net.sourceforge.pmd.cpd.GUI" 102 | ;; 103 | *) 104 | echo "${APPNAME} is NOT a valid application name, valid options are:$(valid_app_options)" 105 | ;; 106 | esac 107 | 108 | is_cygwin 109 | 110 | set_lib_dir 111 | check_lib_dir 112 | 113 | convert_cygwin_vars 114 | 115 | classpath=$CLASSPATH 116 | 117 | cd "${CWD}" 118 | 119 | for jarfile in "${LIB_DIR}"/*.jar; do 120 | if [ -n "$classpath" ]; then 121 | classpath=$classpath:$jarfile 122 | else 123 | classpath=$jarfile 124 | fi 125 | done 126 | 127 | cygwin_paths 128 | 129 | java_heapsize_settings 130 | 131 | java ${HEAPSIZE} -cp "${classpath}" "${CLASSNAME}" "$@" 132 | -------------------------------------------------------------------------------- /lib/pmd/lib/animal-sniffer-annotations-1.14.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/animal-sniffer-annotations-1.14.jar -------------------------------------------------------------------------------- /lib/pmd/lib/ant-1.10.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/ant-1.10.1.jar -------------------------------------------------------------------------------- /lib/pmd/lib/ant-launcher-1.10.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/ant-launcher-1.10.1.jar -------------------------------------------------------------------------------- /lib/pmd/lib/antlr-runtime-3.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/antlr-runtime-3.5.2.jar -------------------------------------------------------------------------------- /lib/pmd/lib/aopalliance-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/aopalliance-1.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/asm-6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/asm-6.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/cglib-3.2.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/cglib-3.2.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/commons-io-2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/commons-io-2.4.jar -------------------------------------------------------------------------------- /lib/pmd/lib/commons-lang3-3.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/commons-lang3-3.7.jar -------------------------------------------------------------------------------- /lib/pmd/lib/error_prone_annotations-2.0.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/error_prone_annotations-2.0.18.jar -------------------------------------------------------------------------------- /lib/pmd/lib/gson-2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/gson-2.5.jar -------------------------------------------------------------------------------- /lib/pmd/lib/guava-19.0-rc3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/guava-19.0-rc3.jar -------------------------------------------------------------------------------- /lib/pmd/lib/j2objc-annotations-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/j2objc-annotations-1.1.jar -------------------------------------------------------------------------------- /lib/pmd/lib/javacc-5.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/javacc-5.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/javax.inject-1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/javax.inject-1.jar -------------------------------------------------------------------------------- /lib/pmd/lib/jaxen-1.1.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/jaxen-1.1.6.jar -------------------------------------------------------------------------------- /lib/pmd/lib/jcommander-1.48.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/jcommander-1.48.jar -------------------------------------------------------------------------------- /lib/pmd/lib/jol-core-0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/jol-core-0.4.jar -------------------------------------------------------------------------------- /lib/pmd/lib/jsr305-3.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/jsr305-3.0.1.jar -------------------------------------------------------------------------------- /lib/pmd/lib/logback-classic-1.1.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/logback-classic-1.1.7.jar -------------------------------------------------------------------------------- /lib/pmd/lib/logback-core-1.1.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/logback-core-1.1.7.jar -------------------------------------------------------------------------------- /lib/pmd/lib/org.eclipse.xtend.lib-2.10.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/org.eclipse.xtend.lib-2.10.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/org.eclipse.xtend.lib.macro-2.10.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/org.eclipse.xtend.lib.macro-2.10.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/org.eclipse.xtext.xbase.lib-2.10.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/org.eclipse.xtext.xbase.lib-2.10.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/pmd-apex-6.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/pmd-apex-6.0.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/pmd-apex-jorje-6.0.0-lib.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/pmd-apex-jorje-6.0.0-lib.jar -------------------------------------------------------------------------------- /lib/pmd/lib/pmd-core-6.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/pmd-core-6.0.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/pmd-visualforce-6.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/pmd-visualforce-6.0.0.jar -------------------------------------------------------------------------------- /lib/pmd/lib/saxon-9.1.0.8-dom.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/saxon-9.1.0.8-dom.jar -------------------------------------------------------------------------------- /lib/pmd/lib/saxon-9.1.0.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/saxon-9.1.0.8.jar -------------------------------------------------------------------------------- /lib/pmd/lib/slf4j-api-1.7.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/slf4j-api-1.7.12.jar -------------------------------------------------------------------------------- /lib/pmd/lib/snakeyaml-1.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/lib/pmd/lib/snakeyaml-1.17.jar -------------------------------------------------------------------------------- /metrics.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | These are rules which use the Metrics Framework to calculate metrics. 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /performance.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | The Performance ruleset contains a collection of good practices which should be followed. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pmd.groovy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | import groovy.json.JsonSlurper 3 | import groovy.util.FileNameFinder 4 | 5 | 6 | def appContext = setupContext(args) 7 | def includePaths = new JsonSlurper().parse(new File(appContext.configFile), "UTF-8").include_paths?.join(" ").replace("./", "") 8 | def codeFolder = new File(appContext.codeFolder) 9 | 10 | def filesToAnalyse = new FileNameFinder().getFileNames(appContext.codeFolder, includePaths) 11 | 12 | def i = filesToAnalyse.iterator() 13 | while(i.hasNext()) { 14 | string = i.next() 15 | if( !string.endsWith(".cls") && !string.endsWith(".trigger") ) { 16 | i.remove() 17 | } 18 | } 19 | 20 | if (filesToAnalyse.isEmpty()) { 21 | System.exit(0) 22 | } 23 | 24 | 25 | def fileList = File.createTempFile("apexmetrics-filelist-", null, null) 26 | fileList.deleteOnExit() 27 | fileList.write filesToAnalyse.join(",\n") 28 | fileList << "\n" 29 | 30 | def ruleset 31 | def defaultRulesetLocation = "/usr/src/app/apex-ruleset.xml" 32 | def customRulesetLocation = "/code/apex-ruleset.xml" 33 | if ( new File(customRulesetLocation).exists() ) { 34 | ruleset = customRulesetLocation 35 | } 36 | else { 37 | ruleset = defaultRulesetLocation 38 | } 39 | 40 | def pmdCommand = "/usr/src/app/lib/pmd/bin/run.sh pmd -filelist ${fileList} -f codeclimate -R ${ruleset} -l apex -v 35 -failOnViolation false" 41 | 42 | ProcessBuilder builder = new ProcessBuilder( pmdCommand.split(' ') ) 43 | 44 | Process process = builder.start() 45 | 46 | InputStream stdout = process.getInputStream () 47 | BufferedReader reader = new BufferedReader (new InputStreamReader(stdout)) 48 | 49 | while ((line = reader.readLine ()) != null) { 50 | System.out.println ( line ) 51 | } 52 | 53 | process.waitForProcessOutput() 54 | 55 | if ( process.exitValue() != 0 ) { 56 | System.exit(-1) 57 | } 58 | 59 | System.exit(0) 60 | 61 | 62 | def setupContext(cmdArgs) { 63 | def cli = new CliBuilder(usage:"${this.class.name}") 64 | cli._(longOpt: "configFile", required: true, args: 1, "Path to config.json file") 65 | cli._(longOpt: "codeFolder", required: true, args: 1, "Path to code folder") 66 | cli.parse(cmdArgs) 67 | } 68 | -------------------------------------------------------------------------------- /resources/.codeclimate.yml: -------------------------------------------------------------------------------- 1 | engines: 2 | apexmetrics: 3 | enabled: true 4 | ratings: 5 | paths: 6 | - "**.cls" 7 | - "**.trigger" 8 | - "**.component" 9 | - "**.page" 10 | exclude_paths: 11 | - "src/documents/" 12 | - "**.schema" 13 | - "**.xml" 14 | - "**.actionLinkGroupTemplate" 15 | - "**.snapshot" 16 | - "**.appMenu" 17 | - "**.approvalProcess" 18 | - "**.assignmentRules" 19 | - "**.authprovider" 20 | - "**.autoResponseRules" 21 | - "**.callCenter" 22 | - "**.crt" 23 | - "**.channelLayout" 24 | - "**.community" 25 | - "**.connectedApp" 26 | - "**.corsWhitelistOrigin" 27 | - "**.app" 28 | - "**.customApplicationComponent" 29 | - "**.feedFilter" 30 | - "**.labels" 31 | - "**.md" 32 | - "**.object" 33 | - "**.objectTranslation" 34 | - "**.weblink" 35 | - "**.customPermission" 36 | - "**.site" 37 | - "**.tab" 38 | - "**.dashboard" 39 | - "**.datacategorygroup" 40 | - "**.delegateGroup" 41 | - "**.email" 42 | - "**.escalationRules" 43 | - "**.dataSource" 44 | - "**.flexipage" 45 | - "**.flow" 46 | - "**.flowDefinition" 47 | - "**.group" 48 | - "**.homePageComponent" 49 | - "**.homePageLayout" 50 | - "**.installedPackage" 51 | - "**.layout" 52 | - "**.letter" 53 | - "**.matchingRule" 54 | - "**.namedCredential" 55 | - "**.pathAssistant" 56 | - "**.permissionset" 57 | - "**.cachePartition" 58 | - "**.portal" 59 | - "**.postTemplate" 60 | - "**.profile" 61 | - "**.queue" 62 | - "**.quickAction" 63 | - "**.remoteSite" 64 | - "**.report" 65 | - "**.reportType" 66 | - "**.role" 67 | - "**.samlssoconfig" 68 | - "**.scf" 69 | - "**.settings" 70 | - "**.sharingRules" 71 | - "**.sharingSet" 72 | - "**.site" 73 | - "**.resource" 74 | - "**.synonymDictionary" 75 | - "**.transactionSecurityPolicy" 76 | - "**.workflow" 77 | - "**.xorghub" 78 | - "**.globalPicklist" 79 | - "**.translation" 80 | 81 | -------------------------------------------------------------------------------- /resources/ApexMetricsBanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/ApexMetricsBanner.png -------------------------------------------------------------------------------- /resources/ApexMetricsLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/ApexMetricsLogo.png -------------------------------------------------------------------------------- /resources/ApexMetricsLogo.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/ApexMetricsLogo.psd -------------------------------------------------------------------------------- /resources/wiki/AddRuleDefinition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/AddRuleDefinition.png -------------------------------------------------------------------------------- /resources/wiki/AddRuleToRuleset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/AddRuleToRuleset.png -------------------------------------------------------------------------------- /resources/wiki/AddRuleToTestclass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/AddRuleToTestclass.png -------------------------------------------------------------------------------- /resources/wiki/BuildPMD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/BuildPMD.png -------------------------------------------------------------------------------- /resources/wiki/BuildSuccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/BuildSuccess.png -------------------------------------------------------------------------------- /resources/wiki/CloneGitRepo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/CloneGitRepo.png -------------------------------------------------------------------------------- /resources/wiki/CloneGitRepo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/CloneGitRepo2.png -------------------------------------------------------------------------------- /resources/wiki/Commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/Commit.png -------------------------------------------------------------------------------- /resources/wiki/CompareChanges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/CompareChanges.png -------------------------------------------------------------------------------- /resources/wiki/CreatePullRequest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/CreatePullRequest.png -------------------------------------------------------------------------------- /resources/wiki/CreateRuleClass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/CreateRuleClass.png -------------------------------------------------------------------------------- /resources/wiki/DeleteProject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/DeleteProject.png -------------------------------------------------------------------------------- /resources/wiki/Fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/Fork.png -------------------------------------------------------------------------------- /resources/wiki/ImportExistingMavenProjects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/ImportExistingMavenProjects.png -------------------------------------------------------------------------------- /resources/wiki/ImportMavenProjects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/ImportMavenProjects.png -------------------------------------------------------------------------------- /resources/wiki/ImportMavenProjects2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/ImportMavenProjects2.png -------------------------------------------------------------------------------- /resources/wiki/ImportProject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/ImportProject.png -------------------------------------------------------------------------------- /resources/wiki/NewPullRequest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/NewPullRequest.png -------------------------------------------------------------------------------- /resources/wiki/RunPMD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/RunPMD.png -------------------------------------------------------------------------------- /resources/wiki/RunUnitTests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/RunUnitTests.png -------------------------------------------------------------------------------- /resources/wiki/SyncWorkspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/SyncWorkspace.png -------------------------------------------------------------------------------- /resources/wiki/TestCasesXml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/TestCasesXml.png -------------------------------------------------------------------------------- /resources/wiki/UnitTestResults.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/UnitTestResults.png -------------------------------------------------------------------------------- /resources/wiki/WriteRule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/WriteRule.png -------------------------------------------------------------------------------- /resources/wiki/WriteRule2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsoesemann/codeclimate-apexmetrics/c98bfe878a6a756e38d3b5f2012d8d006e2c1abe/resources/wiki/WriteRule2.png -------------------------------------------------------------------------------- /rulesets.properties: -------------------------------------------------------------------------------- 1 | # 2 | # BSD-style license; for more info see http://pmd.sourceforge.net/license.html 3 | # 4 | 5 | rulesets.filenames=\ 6 | category/apex/bestpractices.xml,\ 7 | category/apex/codestyle.xml,\ 8 | category/apex/design.xml,\ 9 | category/apex/errorprone.xml,\ 10 | category/apex/performance.xml,\ 11 | category/apex/security.xml 12 | 13 | # 14 | # categories with no rules yet 15 | # 16 | #category/apex/documentation.xml 17 | #category/apex/multithreading.xml 18 | -------------------------------------------------------------------------------- /security.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | These rules deal with different security problems that can occur within Apex. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | The Style Ruleset contains rules regarding preferred usage of names and identifiers. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | --------------------------------------------------------------------------------