{"id":26700380,"url":"https://github.com/encalmo/gitignore","last_synced_at":"2026-04-28T22:34:20.022Z","repository":{"id":284339735,"uuid":"954605758","full_name":"encalmo/gitignore","owner":"encalmo","description":"Scala implementation of the .gitignore compliant filter, ready to embed in different tools without having to run git command","archived":false,"fork":false,"pushed_at":"2025-03-25T11:31:50.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-25T12:22:33.336Z","etag":null,"topics":["git","gitignore","scala"],"latest_commit_sha":null,"homepage":"https://encalmo.github.io/gitignore/","language":"Scala","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/encalmo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-03-25T10:41:06.000Z","updated_at":"2025-03-25T11:31:54.000Z","dependencies_parsed_at":"2025-03-25T12:22:36.831Z","dependency_job_id":"c917d675-6b56-4a5e-a6ab-a083ef3e3dc1","html_url":"https://github.com/encalmo/gitignore","commit_stats":null,"previous_names":["encalmo/gitignore"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/encalmo/gitignore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encalmo%2Fgitignore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encalmo%2Fgitignore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encalmo%2Fgitignore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encalmo%2Fgitignore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/encalmo","download_url":"https://codeload.github.com/encalmo/gitignore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encalmo%2Fgitignore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32402670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["git","gitignore","scala"],"created_at":"2025-03-27T00:19:56.690Z","updated_at":"2026-04-28T22:34:20.008Z","avatar_url":"https://github.com/encalmo.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://github.com/encalmo/gitignore\"\u003e![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge\u0026logo=github\u0026logoColor=white)\u003c/a\u003e \u003ca href=\"https://central.sonatype.com/artifact/org.encalmo/gitignore_3\" target=\"_blank\"\u003e![Maven Central Version](https://img.shields.io/maven-central/v/org.encalmo/gitignore_3?style=for-the-badge)\u003c/a\u003e \u003ca href=\"https://encalmo.github.io/gitignore/scaladoc/org/encalmo/utils.html\" target=\"_blank\"\u003e\u003cimg alt=\"Scaladoc\" src=\"https://img.shields.io/badge/docs-scaladoc-red?style=for-the-badge\"\u003e\u003c/a\u003e\n\n# gitignore\n\nThe [.gitignore](https://git-scm.com/docs/gitignore) has became de-facto standard filter format for project's files and folders. \n\nThis nano-library provides Scala implementation of the `.gitignore` compliant filter, ready to embed in different tools without having to run `git` command.\n\n## Table of contents\n\n- [Dependencies](#dependencies)\n- [Usage](#usage)\n- [Examples](#examples)\n\n## Dependencies\n\n   - [Scala](https://www.scala-lang.org) \u003e= 3.3.5\n\n## Usage\n\nUse with SBT\n\n    libraryDependencies += \"org.encalmo\" %% \"gitignore\" % \"0.9.3\"\n\nor with SCALA-CLI\n\n    //\u003e using dep org.encalmo::gitignore:0.9.3\n\n## Examples\n\nOption **1** - parse existing `.gitignore` file content\n\n```scala\nval gitIgnore = GitIgnore.fromCurrentDirectory()\ngitIgnore.isAllowed(\".scala-build/\") shouldBe false\ngitIgnore.isAllowed(\"GitIgnore.scala\") shouldBe true\n```\n\n```scala\nval gitIgnore = GitIgnore.fromFile(new File(\".gitignore\"))\ngitIgnore.isAllowed(\".scala-build/\") shouldBe false\ngitIgnore.isAllowed(\"GitIgnore.scala\") shouldBe true\n```\n\n```scala\nimport com.github.arturopala.gitignore._\n\nval gitignore = GitIgnore\n    .parse(\"\"\" \n        |#*.json\n        |*.txt\n        |*.pdf\n        |!ok.*\n        |bar.json \n        |target  \n        |\"\"\".stripMargin)\n// gitignore: GitIgnore = GitIgnore(\n//   gitPatterns = List(\"*.txt\", \"*.pdf\", \"!ok.*\", \"bar.json\", \"target\")\n// )\n \ngitignore.isIgnored(\"foo.txt\")\n// res0: Boolean = true\ngitignore.isIgnored(\"bar.txt\")\n// res1: Boolean = true\ngitignore.isIgnored(\"ok.txt\")\n// res2: Boolean = false\ngitignore.isIgnored(\"foo.pdf\")\n// res3: Boolean = true\ngitignore.isIgnored(\"bar.pdf\")\n// res4: Boolean = true\ngitignore.isIgnored(\"ok.pdf\")\n// res5: Boolean = false\ngitignore.isIgnored(\"foo.json\")\n// res6: Boolean = false\ngitignore.isIgnored(\"bar.json\")\n// res7: Boolean = true\ngitignore.isIgnored(\"ok.json\")\n// res8: Boolean = false\ngitignore.isIgnored(\"target/\")\n// res9: Boolean = true\ngitignore.isIgnored(\"target.json\")\n// res10: Boolean = false\n\ngitignore.isAllowed(\"foo.txt\")\n// res11: Boolean = false\ngitignore.isAllowed(\"bar.txt\")\n// res12: Boolean = false\ngitignore.isAllowed(\"ok.txt\")\n// res13: Boolean = true\ngitignore.isAllowed(\"foo.pdf\")\n// res14: Boolean = false\ngitignore.isAllowed(\"bar.pdf\")\n// res15: Boolean = false\ngitignore.isAllowed(\"ok.pdf\")\n// res16: Boolean = true\ngitignore.isAllowed(\"foo.json\")\n// res17: Boolean = true\ngitignore.isAllowed(\"bar.json\")\n// res18: Boolean = false\ngitignore.isAllowed(\"ok.json\")\n// res19: Boolean = true\ngitignore.isAllowed(\"target/\")\n// res20: Boolean = false\ngitignore.isAllowed(\"target.json\")\n// res21: Boolean = true\n```\n\nOption **2** - pass list of rules to the constructor\n\n```scala\nimport com.github.arturopala.gitignore._\n\nval gitignore = GitIgnore(Seq(\n    \"*.txt\",\n    \"*.pdf\",\n    \"!ok.*\",\n    \"bar.json \",\n    \"target\"))\n// gitignore: GitIgnore = GitIgnore(\n//   gitPatterns = List(\"*.txt\", \"*.pdf\", \"!ok.*\", \"bar.json \", \"target\")\n// )\n \ngitignore.isIgnored(\"foo.txt\")\n// res23: Boolean = true\ngitignore.isIgnored(\"bar.txt\")\n// res24: Boolean = true\ngitignore.isIgnored(\"ok.txt\")\n// res25: Boolean = false\ngitignore.isIgnored(\"foo.pdf\")\n// res26: Boolean = true\ngitignore.isIgnored(\"bar.pdf\")\n// res27: Boolean = true\ngitignore.isIgnored(\"ok.pdf\")\n// res28: Boolean = false\ngitignore.isIgnored(\"foo.json\")\n// res29: Boolean = false\ngitignore.isIgnored(\"bar.json\")\n// res30: Boolean = false\ngitignore.isIgnored(\"ok.json\")\n// res31: Boolean = false\ngitignore.isIgnored(\"target/\")\n// res32: Boolean = true\ngitignore.isIgnored(\"target.json\")\n// res33: Boolean = false\n\ngitignore.isAllowed(\"foo.txt\")\n// res34: Boolean = false\ngitignore.isAllowed(\"bar.txt\")\n// res35: Boolean = false\ngitignore.isAllowed(\"ok.txt\")\n// res36: Boolean = true\ngitignore.isAllowed(\"foo.pdf\")\n// res37: Boolean = false\ngitignore.isAllowed(\"bar.pdf\")\n// res38: Boolean = false\ngitignore.isAllowed(\"ok.pdf\")\n// res39: Boolean = true\ngitignore.isAllowed(\"foo.json\")\n// res40: Boolean = true\ngitignore.isAllowed(\"bar.json\")\n// res41: Boolean = true\ngitignore.isAllowed(\"ok.json\")\n// res42: Boolean = true\ngitignore.isAllowed(\"target/\")\n// res43: Boolean = false\ngitignore.isAllowed(\"target.json\")\n// res44: Boolean = true\n```\n\n## Project content\n\n```\n├── .github\n│   └── workflows\n│       ├── pages.yaml\n│       ├── release.yaml\n│       └── test.yaml\n│\n├── .gitignore\n├── .scalafmt.conf\n├── AnyWordSpecCompat.test.scala\n├── Debug.scala\n├── GitIgnore.scala\n├── GitIgnore.test.scala\n├── Glob.scala\n├── Glob.test.scala\n├── GlobCheck.test.scala\n├── LICENSE\n├── project.scala\n├── README.md\n├── test.sh\n├── Zoom.scala\n└── Zoom.test.scala\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fencalmo%2Fgitignore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fencalmo%2Fgitignore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fencalmo%2Fgitignore/lists"}