{"id":17103152,"url":"https://github.com/helpermethod/idiomatic-groovy","last_synced_at":"2026-01-04T17:47:29.882Z","repository":{"id":146262404,"uuid":"69648727","full_name":"helpermethod/idiomatic-groovy","owner":"helpermethod","description":null,"archived":false,"fork":false,"pushed_at":"2016-11-23T16:37:00.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T03:32:30.897Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helpermethod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-09-30T08:27:38.000Z","updated_at":"2016-09-30T08:27:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"7991c25b-cb0e-4c0b-b617-cbdf2929d694","html_url":"https://github.com/helpermethod/idiomatic-groovy","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/helpermethod%2Fidiomatic-groovy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fidiomatic-groovy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fidiomatic-groovy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fidiomatic-groovy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helpermethod","download_url":"https://codeload.github.com/helpermethod/idiomatic-groovy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245161944,"owners_count":20570690,"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":[],"created_at":"2024-10-14T15:32:09.651Z","updated_at":"2026-01-04T17:47:29.855Z","avatar_url":"https://github.com/helpermethod.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Idiomatic Groovy\n\n## General\n\n* Omit semicolons\n\n```groovy\n// bad\ndef number = 1;\n\n// good\ndef number = 1\n```\n\n* Omit parentheses for single method calls\n\n```groovy\n// bad\nprintln('Hello World!')\n\n// good\nprintln 'Hello World!'\n```\n\n* Use parentheses for chained method calls\n\n## Strings\n\n* Use string interpolation for concatenation\n\n```groovy\ndef lang = 'Groovy'\n\n// bad\nprintln lang + ' rocks!'\n\n// good\nprintln \"$lang rocks!\"\n```\n\n* Use triple-quotes for multiline strings\n\n```groovy\n```\n\n## Collections\n\n* Use the `-` operator for removing all instances of an element\n\n```groovy\n// bad\n['a', null, 'b', null, 'c'].removeAll { it == null }\n\n// better\n['a', null, 'b', null, 'c'].findAll { it != null }\n\n// good\n['a', null, 'b', null, 'c'] - null\n```\n\n* Use the `+` operator for concatenation\n\n```groovy\n// bad\ndef l = ['a', 'b', 'c']\nl.addAll ['d', 'e', 'f']\n\n// good\nl + ['d', 'e', 'f']\n```\n\n## Functional Programming\n\n* Use `findAll` for filtering collections\n\n```groovy\n// bad\ndef result = []\n\nfor (c in [1, 2, 3, 4]) {\n    if (c % 2 == 0) {\n        result \u003c\u003c c\n    }\n}\n\n// good\n[1, 2, 3, 4].findAll {\n   it % 2 == 0\n}\n```\n\n* Use `collect` to apply a function to every element of a collection\n\n```groovy\n// bad\ndef result = []\n\nfor (c in ['a', 'b', 'c']) {\n    result \u003c\u003c c.toUpperCase()\n}\n\n// better\n['a', 'b', 'c'].collect { it.toUpperCase() }\n\n// good\n['a', 'b', 'c']*.toUpperCase()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpermethod%2Fidiomatic-groovy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpermethod%2Fidiomatic-groovy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpermethod%2Fidiomatic-groovy/lists"}