{"id":21981782,"url":"https://github.com/gmullerb/project-style-checker","last_synced_at":"2026-05-04T14:34:11.962Z","repository":{"id":96572707,"uuid":"153472147","full_name":"gmullerb/project-style-checker","owner":"gmullerb","description":"Small set of Gradle's tasks for checking file style for all files and for checking code style of Gradle's code","archived":false,"fork":false,"pushed_at":"2019-08-15T17:06:15.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T17:05:58.655Z","etag":null,"topics":["base-style-config","base-style-config-wrapper","best-practices","build-code","checking-end-of-file","checking-tab-character","checkstyle","code-style","codenarc","coding-standards","coding-style","eof","file-style","gradle-code","groovy","tabulation"],"latest_commit_sha":null,"homepage":null,"language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gmullerb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-17T14:34:59.000Z","updated_at":"2019-08-15T17:06:17.000Z","dependencies_parsed_at":"2023-04-22T21:36:22.711Z","dependency_job_id":null,"html_url":"https://github.com/gmullerb/project-style-checker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Fproject-style-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Fproject-style-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Fproject-style-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmullerb%2Fproject-style-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmullerb","download_url":"https://codeload.github.com/gmullerb/project-style-checker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245041135,"owners_count":20551363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["base-style-config","base-style-config-wrapper","best-practices","build-code","checking-end-of-file","checking-tab-character","checkstyle","code-style","codenarc","coding-standards","coding-style","eof","file-style","gradle-code","groovy","tabulation"],"created_at":"2024-11-29T17:19:36.854Z","updated_at":"2026-05-04T14:34:06.904Z","avatar_url":"https://github.com/gmullerb.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project Style Checker\n\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](/LICENSE.txt) \n[![Download](https://api.bintray.com/packages/gmullerb/all.shared.gradle/project-style-checker/images/download.svg)](https://bintray.com/gmullerb/all.shared.gradle/project-style-checker/_latestVersion) \n[![coverage report](https://gitlab.com/gmullerb/project-style-checker/badges/master/coverage.svg)](https://gitlab.com/gmullerb/project-style-checker/commits/master)\n\n**A Gradle plugin that offers a small set of Gradle's tasks for checking file style for all files and for checking code style of Gradle's build code**.\n\nThis project is licensed under the terms of the [MIT license](/LICENSE.txt).\n__________________\n\n## Quick Start\n\n1 . Apply the plugin:\n\n`build.gradle`:\n\n```gradle\n plugins {\n   id 'all.shared.gradle.project-style-checker' version '1.0.5'\n }\n```\n\n2 . Add `assessCommon` and `assessGradle` tasks, usually as default tasks:\n\n`build.gradle`:\n\n```gradle\n  defaultTasks 'assessCommon', 'assessGradle', ..\n```\n\n3 . Jump to [Using/Configuration](#Using/Configuration), for customization or digging on How it works.\n__________________\n\n## Goals\n\n* Have a task for checking all files, not only code files, with some basic but common rules.\n* Have a task for checking Gradle's code.\n* Allow to log to console of checking report.\n* Automatically apply all the required plugins.\n\n## Features\n\n* Offers a small set of tasks:\n\n  * `assessCommon`: checks all the specified files with the [Common Checkstyle's set](https://github.com/gmullerb/base-style-config/tree/master/config/common/common-checks.xml) from [base-style-config project](https://github.com/gmullerb/base-style-config).\n  * `assessGradle`: checks all the Gradle files (`.gradle`) from the specified file tree with [Codenarc's set](https://github.com/gmullerb/base-style-config/tree/master/config/gradle/gradle-rules.groovy) from [base-style-config project](https://github.com/gmullerb/base-style-config).\n    * Task automatically filters the received file tree to get the `.gradle` files.\n\n* Adds Tasks that show a summary of the CodeNarc report to console:\n  * `logForAssessGradle`[1].\n  * `logForCodeNarcMain` [2].\n  * `logForCodeNarcTest` [2].\n\n* Applies the required plugins to the project:\n\n  * [Base Style Configuration Wrapper plugin](https://github.com/gmullerb/base-style-config-wrapper).\n    * which will set some default configuration the Coding Style Tools.\n  * [File Lister plugin ](https://github.com/gmullerb/file-lister).\n  * [Checkstyle plugin](https://docs.gradle.org/current/userguide/checkstyle_plugin.html).\n  * [CodeNarc plugin](https://docs.gradle.org/current/userguide/codenarc_plugin.html).\n\n* Allows to indicate the version of:\n  * [Base Style Configuration](https://github.com/gmullerb/base-style-config).\n  * [Checkstyle](http://checkstyle.sourceforge.net).\n  * [CodeNarc](http://codenarc.sourceforge.net).\n\n\u003e [1] Fails for exactly Gradle version 5.2, use any version (after or before) except 5.2.  \n\u003e [2] Added if the `codenarcMain` and/or `codenarcTest` tasks are present in the project.\n__________________\n\n## Using/Configuration\n\n### Prerequisites\n\n* None\n\n### Gradle configuration\n\n1 . Apply the plugin [1]:\n\n```gradle\n plugins {\n   id 'all.shared.gradle.project-style-checker' version '1.0.5'\n }\n```\n\n\u003e [1]: This is the only configuration step required to use this plugin.\n\n### Plugin configuration [Optional]\n\n2 . If required, use the plugin's extension, `projectStyleChecker`, which have two fields [1]:\n\n* `common`: has the `assessCommon` configuration.\n* `gradle`: has the `assessGradle` configuration.\n\nBoth have same fields:\n\n* `config`: which correspond with the `config` field of [`CodeNarc task`](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.CodeNarc.html) or [`Checkstyle task`](https://docs.gradle.org/current/dsl/org.gradle.api.plugins.quality.Checkstyle.html) , basically the Code style set of rules.\n  * By default, use rules defined by [Base Style Configuration Wrapper plugin](https://github.com/gmullerb/base-style-config-wrapper).\n* `fileTree`: which indicate the file tree to explore when checking.\n  * By default, all file tree is checked, using default exclusions of [File Lister plugin exclusions](https://github.com/gmullerb/file-lister#features).\n\nE.G.:\n\n```gradle\n projectStyleChecker {\n   common {\n     config = ..\n     fileTree = ..\n   }\n   gradle {\n     config = ..\n     fileTree = ..\n   }\n }\n```\n\n\u003e [1] **All these values are filled by default with values obtain from [Base Style Configuration Wrapper plugin](https://github.com/gmullerb/base-style-config-wrapper) and [File Lister plugin ](https://github.com/gmullerb/file-lister)**\n\n#### Code Quality Tools Configuration [Optional]\n\nThe following processes are inherited/done by the [Base Style Configuration Wrapper plugin](https://github.com/gmullerb/base-style-config-wrapper):\n\n3 . Use `BASE_STYLE_CONFIG_VERSION` to establish the version of [Base Style Configuration](https://github.com/gmullerb/base-style-config) to be used:\n\n* If not set, then last version will be used.\n\n[`gradle.properties`](gradle.properties):\n\n```properties\n BASE_STYLE_CONFIG_VERSION=2.0.1\n```\n\n4 . Use `CHECKSTYLE_VERSION` to establish the version of [Checkstyle](http://checkstyle.sourceforge.net) to be used:\n\n* Use to check all files.\n* If not set, Gradle's default version will be used.\n  * But, should be set in order to be compatible with the selected, `BASE_STYLE_CONFIG_VERSION`, i.e. with the selected set of rules defined by [Base Style Configuration](https://github.com/gmullerb/base-style-config).\n\n[`gradle.properties`](gradle.properties):\n\n```properties\n CHECKSTYLE_VERSION=8.18\n```\n\n5 . Use `CODENARC_VERSION` to establish the version of [CodeNarc](http://codenarc.sourceforge.net) to be used:\n\n* Use to check Gradle files.\n* If not set, Gradle's default version will be used.\n  * But, should be set in order to be compatible with the selected, `BASE_STYLE_CONFIG_VERSION`, i.e. with the selected set of rules defined by [Base Style Configuration](https://github.com/gmullerb/base-style-config).\n\n[`gradle.properties`](gradle.properties):\n\n```properties\n CODENARC_VERSION=1.3\n```\n\n### Assessing files\n\n* To assess all files use Gradle task: `assessCommon`.\n* To assess Gradle's code use Gradle task: `assessGradle`.\n* To assess CodeNarc's code use Gradle task: `codenarcMain`.\n* To assess CodeNarc's code use Gradle task: `codenarcTest`.\n__________________\n\n## Extending/Developing\n\n### Prerequisites\n\n* [Java](http://www.oracle.com/technetwork/java/javase/downloads).\n* [Git](https://git-scm.com/downloads) (only if you are going to clone the project).\n\n### Getting it\n\nClone or download the project[1], in the desired folder execute:\n\n```sh\ngit clone https://github.com/gmullerb/project-style-checker\n```\n\n\u003e [1] [Cloning a repository](https://help.github.com/articles/cloning-a-repository/)\n\n### Set up\n\n* **No need**, only download and run (It's Gradle! Yes!).\n\n#### Make it your own\n\n  1. Remove the Git Origin: `git remote remove origin`.\n  2. Add your Git origin: `git remote add origin https://gitlab.com/yourUser/yourRepo.git`.\n  3. Remove the License for 'All rights reserved' projects, or Modify the License for your needs.\n  4. Change the `all.shared.gradle.project-style-checker.properties` file name to your plugin Id, e.g. `some.pluginId.properties`.\n\n### Building it\n\n* To build it:\n  * `gradlew`: this will run default task, or\n  * `gradlew build`.\n\n* To assess files:\n  * `gradlew assessCommon`: will check common style of files.\n  * `gradlew assessGradle`: will check code style of Gradle's.\n  * `gradlew codenarcMain`: will check code style of Groovy's source files.\n  * `gradlew codenarcTest`: will check code style of Groovy's test files.\n  * `assemble` task depends on these four tasks.\n\n* To test code: `gradlew test`\n\n* To get all the tasks for the project: `gradlew tasks --all`\n\n### Folders structure\n\n```\n  /src\n    /main\n      /groovy\n    /test\n      /groovy\n```\n\n- `src/main/groovy`: Source code files.\n  - [`CreateAssessCommonAction`](src/main/groovy/all/shared/gradle/quality/code/assess/common/CreateAssessCommonAction.groovy) + [`PrepareAssessCommonAction`](src/main/groovy/all/shared/gradle/quality/code/assess/common/PrepareAssessCommonAction.groovy) define the `assessCommon` task.\n  - [`CreateAssessGradleAction`](src/main/groovy/all/shared/gradle/quality/code/assess/gradle/CreateAssessGradleAction.groovy) + [`PrepareAssessGradleAction`](src/main/groovy/all/shared/gradle/quality/code/assess/gradle/PrepareAssessGradleAction.groovy) define the `assessGradle` task.\n  - [`LogCodeNarcReportAction`](src/main/groovy/all/shared/gradle/quality/code/assess/gradle/LogCodeNarcReportAction.groovy) is the action for logging report of a CodeNarc task.\n  - [`ProjectStyleChecker`](src/main/groovy/all/shared/gradle/quality/code/ProjectStyleChecker.groovy) is where all the magic happens (where plugins are added, where tasks are added, etc.).\n    - If using this class directly, then prefer `fillAllExtensions`, over `fillExtensionConfigs`, `fillExtensionFileTree`, `establishCheckstyleVersion` \u0026 `establishCodenarcSettings`, see [`ProjectStyleCheckerPlugin`](src/main/groovy/all/shared/gradle/quality/code/ProjectStyleCheckerPlugin.groovy)\n- `src/test/groovy`: Test code files[1].\n\n\u003e [1] Tests are done with [JUnit](http://junit.org) and [Mockito](http://javadoc.io/page/org.mockito/mockito-core/latest/org/mockito/Mockito.html).\n\n### Convention over Configuration\n\nAll `all.shared.gradle` plugins define:\n\n* _PluginName_**Plugin**: which contains the class implements `Plugin` interface.\n* _PluginName_**Extension**: which represent the extension of the plugin.\n* If Tasks are define, then their names will be _TaskName_**Task**.\n* If Actions are define, then their names will be _ActionName_**Action**.\n\nAll `all.shared.gradle` plugins have two **`static`** members:\n\n* `String EXTENSION_NAME`: This will have the name of the extension that the plugin add.\n  * if the plugin does not add an extension the this field will not exist.\n\n* `String TASK_NAME`: This will have the name of the **unique** task that the plugin add.\n  * if the plugin does not add a task or add more than one task, then this field will not exist.\n\n* `boolean complement(final ..)`: will apply the plugin and return true if successful, false otherwise.\n  * this methods is **exactly equivalent to the instance `apply` method**, but without instantiate the class if not required.\n\nBoth may be useful when applying the plugin when creating custom plugins.\n\nAll `all.shared.gradle` plugins \"silently\" fail when the extension can not be added.\n\n## Documentation\n\n* [`CHANGELOG.md`](CHANGELOG.md): add information of notable changes for each version here, chronologically ordered [1].\n\n\u003e [1] [Keep a Changelog](http://keepachangelog.com)\n\n## License\n\n[MIT License](/LICENSE.txt)\n__________________\n\n## Remember\n\n* Use code style verification tools =\u003e Encourages Best Practices, Efficiency, Readability and Learnability.\n* Start testing early =\u003e Encourages Reliability and Maintainability.\n* Code Review everything =\u003e Encourages Functional suitability, Performance Efficiency and Teamwork.\n\n## Additional words\n\nDon't forget:\n\n* **Love what you do**.\n* **Learn everyday**.\n* **Learn yourself**.\n* **Share your knowledge**.\n* **Learn from the past, dream on the future, live and enjoy the present to the max!**.\n\nAt life:\n\n* Let's act, not complain.\n* Be flexible.\n\nAt work:\n\n* Let's give solutions, not questions.\n* Aim to simplicity not intellectualism.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmullerb%2Fproject-style-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmullerb%2Fproject-style-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmullerb%2Fproject-style-checker/lists"}