{"id":15042891,"url":"https://github.com/seart-group/jcloc","last_synced_at":"2025-04-24T06:49:33.128Z","repository":{"id":248718813,"uuid":"827873297","full_name":"seart-group/jcloc","owner":"seart-group","description":"Java wrapper for CLOC (Count Lines of Code)","archived":false,"fork":false,"pushed_at":"2025-04-14T22:47:00.000Z","size":372,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-24T06:49:28.194Z","etag":null,"topics":["analysis","api","cloc","jackson","java","java-8","java-library","language-detection","library","maven","mit-license","standalone-library","static-analysis","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Java","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/seart-group.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-12T15:05:50.000Z","updated_at":"2025-04-14T22:46:57.000Z","dependencies_parsed_at":"2024-08-27T01:23:31.640Z","dependency_job_id":"5a058106-f458-4a52-9c79-e15d2ee71125","html_url":"https://github.com/seart-group/jcloc","commit_stats":null,"previous_names":["seart-group/jcloc"],"tags_count":2,"template":false,"template_full_name":"seart-group/template-maven-dependency","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seart-group%2Fjcloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seart-group%2Fjcloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seart-group%2Fjcloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seart-group%2Fjcloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seart-group","download_url":"https://codeload.github.com/seart-group/jcloc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250580713,"owners_count":21453531,"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":["analysis","api","cloc","jackson","java","java-8","java-library","language-detection","library","maven","mit-license","standalone-library","static-analysis","wrapper"],"created_at":"2024-09-24T20:48:12.484Z","updated_at":"2025-04-24T06:49:33.107Z","avatar_url":"https://github.com/seart-group.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jcloc \u0026middot; [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/seart-group/jcloc/ci.yml)](https://github.com/seart-group/jcloc/actions/workflows/ci.yml) [![Maven Central](https://img.shields.io/maven-central/v/ch.usi.si.seart/jcloc)](https://central.sonatype.com/artifact/ch.usi.si.seart/jcloc) [![javadoc](https://javadoc.io/badge2/ch.usi.si.seart/jcloc/javadoc.svg)](https://javadoc.io/doc/ch.usi.si.seart/jcloc) [![MIT license](https://img.shields.io/github/license/seart-group/jcloc)](https://github.com/seart-group/jcloc/blob/master/LICENSE)\n\nJava wrapper for the [cloc](https://github.com/AlDanial/cloc) CLI tool. You can use the library by including the\nfollowing dependency in your Maven project:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ech.usi.si.seart\u003c/groupId\u003e\n  \u003cartifactId\u003ejcloc\u003c/artifactId\u003e\n  \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Requirements\n\nThis library requires a minimum of Java 8. You don't need to have `cloc` installed on your system, as the JAR comes\nbundled with the necessary script.\n\n\u003e [!NOTE]  \n\u003e Since this script is written in Perl, you must make sure that its interpreter is installed and located on your `PATH`.\n\u003e Should work out of the box on most systems (as the majority of Unix-like systems have it installed by default),\n\u003e but worth pointing out in case you plan on using this on a minimalistic Linux image or Windows.\n\n## Example\n\n```java\nimport ch.usi.si.seart.cloc.CLOC;\nimport ch.usi.si.seart.cloc.CLOCException;\n\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\n\npublic class Main {\n\n    public static void main(String[] args) throws CLOCException {\n        Path path = Paths.get(\"path\", \"to\", \"target\");\n        String result = CLOC.command()\n                .timeout(30)\n                .target(path)\n                .linesByLanguage()\n                .toPrettyString();\n        System.out.println(result);\n    }\n}\n```\n\nFor more usage examples, take a look at the [tests](/src/test/java/ch/usi/si/seart/cloc).\n\n## Options\n\nThe API currently maps only a subset of the `cloc` command-line options:\n\n```jshelllanguage\nimport ch.usi.si.seart.cloc.CLOC;\n\nCLOC.command()             // `cloc` equivalent:\n    .cores(4)              // --cores\n    .docstringAsCode(true) // --docstring-as-code\n    .followLinks(true)     // --follow-links\n    .maxFileSize(10)       // --max-file-size\n    .noRecurse(true)       // --no-recurse\n    .readBinaryFiles(true) // --read-binary-files\n    .skipUniqueness(true); // --skip-uniqueness\n```\n\nSupport for other flags and parameters will be added as development progresses.\n\n## Output\n\nOnce the command has been built, you can execute it using one of the following methods:\n\n```jshelllanguage\nimport ch.usi.si.seart.cloc.CLOC;\n\nCLOC cloc = CLOC.command().target(path);\n\ncloc.linesByLanguage();        // Count lines of code by language (default `cloc` behaviour)\ncloc.linesByFile();            // Count lines of code by file (equivalent to `cloc --by-file`)\ncloc.linesByFileAndLanguage(); // Count lines of code by file and language (equivalent to `cloc --by-file-by-lang`)\ncloc.countFiles();             // Count files by language (equivalent to `cloc --only-count-files`)\n```\n\nResults returned by all `cloc` command variants are parsed courtesy of [Jackson](https://github.com/FasterXML/jackson).\nSince all methods return an `ObjectNode`, you can convert results to a `String`, or map them to a custom POJO.\n\nYou can also customise the command output mapper used by the library like so:\n\n```java\nimport ch.usi.si.seart.cloc.CLOC;\nimport com.fasterxml.jackson.databind.json.JsonMapper;\n\npublic class Main {\n\n    public static void main(String[] args) {\n        JsonMapper mapper = JsonMapper.builder()\n                .enable(/* FEATURES */)\n                .build();\n        CLOC.setOutputMapper(mapper);\n        // Use the library as usual\n    }\n}\n```\n\n## FAQ\n\n### How can I request a feature or ask a question?\n\nIf you have ideas for a feature that you would like to see implemented or if you have any questions, we encourage you to\ncreate a new [discussion](https://github.com/seart-group/jcloc/discussions). By initiating a discussion, you can engage with the community and our\nteam, and we will respond promptly to address your queries or consider your feature requests.\n\n### How can I report a bug?\n\nTo report any issues or bugs you encounter, create a [new issue](https://github.com/seart-group/jcloc/issues). Providing detailed information about\nthe problem you're facing will help us understand and address it more effectively. Rest assured, we're committed to\npromptly reviewing and responding to the issues you raise, working collaboratively to resolve any bugs and improve the\noverall user experience.\n\n### How do I contribute to the project?\n\nRefer to [CONTRIBUTING.md](/CONTRIBUTING.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseart-group%2Fjcloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseart-group%2Fjcloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseart-group%2Fjcloc/lists"}