{"id":14991244,"url":"https://github.com/mikik0/omochi","last_synced_at":"2025-10-31T12:30:36.950Z","repository":{"id":224302616,"uuid":"729689230","full_name":"mikik0/omochi","owner":"mikik0","description":" Omochi leverages static analysis techniques to scrutinize Ruby codebases and identify methods that lack associated spec files. ","archived":false,"fork":false,"pushed_at":"2024-08-18T04:37:14.000Z","size":80,"stargazers_count":72,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T20:11:24.235Z","etag":null,"topics":["rspec","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/mikik0.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":"2023-12-10T02:57:02.000Z","updated_at":"2025-01-21T02:09:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"74b4c527-e262-4565-9ee5-d635bb78485a","html_url":"https://github.com/mikik0/omochi","commit_stats":{"total_commits":80,"total_committers":7,"mean_commits":"11.428571428571429","dds":0.1875,"last_synced_commit":"0b19763f9b3ba7749938689aa31cb24cc33e16c0"},"previous_names":["mikik0/omochi"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikik0%2Fomochi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikik0%2Fomochi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikik0%2Fomochi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikik0%2Fomochi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikik0","download_url":"https://codeload.github.com/mikik0/omochi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239195491,"owners_count":19598037,"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":["rspec","ruby","ruby-on-rails"],"created_at":"2024-09-24T14:21:57.622Z","updated_at":"2025-10-31T12:30:36.906Z","avatar_url":"https://github.com/mikik0.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Omochi\n\nOmochi is a CLI tool to support Ruby on Rails development with RSpec. It detects methods uncovered by tests and prints the test code generated by LLM.\n\nThere are two advantages of using Omochi. We can make sure every method is covered by tests with GitHub Actions support. We can also generate spec files for uncovered methods so that we can reduce time to write them manually.\n\n## Installation\n\n    $ gem install omochi\n\n## Usage\n\n```\n$ omochi --help\nCommands:\n  omochi help [COMMAND]     # Describe available commands or one specific command\n  omochi verify local_path  # verify spec created for all of new methods and functions\n```\n\n## Commands\n### verify\n\nWhen you execute Omochi locally, you can confirm that you have spec coverage for uncommitted diff.\n\n```\n# Local\n$ omochi verify local_path\n```\n\nYou can skip check with ignore comment.\n\n```ruby\n#omochi:ignore:\n```\n\n### --create option\n\nYou can generate spec files with LLM by giving `-c` or `--create` option. It outputs to STDOUT.\n\n```\n# Generate spec files\n$ omochi verify local_path -c\n# Or\n$ omochi verify local_path --create\n```\n\n### --github option\n\nWith `-h` option you can check uncovered methods against given Pull Request with GitHub Actions.\nIt uses `gh pr diff` command internally.\n\n```\n$ omochi verify local_path -h\n# Or\n$ omochi verify local_path --github\n```\n\n## Samples\n\n```\n$ omochi verify -c\n\"Verify File List: [\\\"lib/omochi/cli.rb\\\", \\\"lib/omochi/util.rb\\\"]\"\n\"specファイルあり\"\n\"There are spec files.\"\n===================================================================\nverifyのテストを以下に表示します。\nWe will show the test of verify below.\nrequire 'rspec'\n\ndescribe 'exit_on_failure?' do\n  it 'returns true' do\n    expect(exit_on_failure?).to eq(true)\n  end\nend\n======= RESULT: lib/omochi/cli.rb =======\n- exit_on_failure?\n\"specファイルなし\"\n======= RESULT: lib/omochi/util.rb =======\n- local_diff_path\n- github_diff_path\n- remote_diff_path\n- get_ast\n- dfs\n- find_spec_file\n- get_pure_function_name\n- dfs_describe\n- print_result\n- get_ignore_methods\n- create_spec_by_bedrock\n===================================================================\nlib/omochi/util.rbのテストを以下に表示します。\nWe will show the test of lib/omochi/util.rb below.\nrequire \"spec_helper\"\n\ndescribe \"local_diff_path\" do\n  it \"returns array of diff paths from git\" do\n    allow(Open3).to receive(:capture3).with(\"git diff --name-only\", any_args).and_return([\"path1\", \"path2\"], \"\", double(success?: true))\n    expect(local_diff_path).to eq([\"path1\", \"path2\"])\n  end\n\n  it \"returns empty array if git command fails\" do\n    allow(Open3).to receive(:capture3).with(\"git diff --name-only\", any_args).and_return(\"\", \"error\", double(success?: false))\n    expect(local_diff_path).to eq([])\n  end\nend\n\ndescribe \"github_diff_path\" do\n  it \"returns array of diff paths from gh\" do\n    allow(Open3).to receive(:capture3).with(\"gh pr diff --name-only\", any_args).and_return([\"path1\", \"path2\"], \"\", double(success?: true))\n    expect(github_diff_path).to eq([\"path1\", \"path2\"])\n  end\n\n  it \"returns empty array if gh command fails\" do\n    allow(Open3).to receive(:capture3).with(\"gh pr diff --name-only\", any_args).and_return(\"\", \"error\", double(success?: false))\n    expect(github_diff_path).to eq([])\n  end\nend\n\ndescribe \"remote_diff_path\" do\n  it \"returns array of diff paths from remote\" do\n    allow(Open3).to receive(:capture3).with(/git diff --name-only .*${{ github\\.sha }}/, any_args).and_return([\"path1\", \"path2\"], \"\", double(success?: true))\n    expect(remote_diff_path).to eq([\"path1\", \"path2\"])\n  end\n\n  it \"returns empty array if git command fails\" do\n    allow(Open3).to receive(:capture3).with(/git diff --name-only .*${{ github\\.sha }}/, any_args).and_return(\"\", \"error\", double(success?: false))\n    expect(remote_diff_path).to eq([])\n  end\nend\n\ndescribe \"get_ast\" do\n  it \"returns AST for given file\" do\n    allow(File).to receive(:read).with(\"file.rb\").and_return(\"code\")\n    allow(Parser::CurrentRuby).to receive(:parse_with_comments).with(\"code\").and_return([\"ast\"], [\"comments\"])\n    expect(get_ast(\"file.rb\")).to eq([{ast: \"ast\", filename: \"file.rb\"}])\n  end\nend\n\ndescribe \"dfs\" do\n  let(:node) { double(:node, type: :def, children: [double(:child, children: [\"name\"])]) }\n  let(:result) { {} }\n\n  it \"traverses node and captures def names\" do\n    dfs(node, \"file.rb\", result)\n    expect(result).to eq({\"name\" =\u003e \"def name\\nend\"})\n  end\nend\n\ndescribe \"find_spec_file\" do\n  before do\n    allow(File).to receive(:exist?).with(\"spec/app/file_spec.rb\").and_return(true)\n  end\n\n  it \"returns spec file path if exists\" do\n    expect(find_spec_file(\"app/file.rb\")).to eq(\"spec/app/file_spec.rb\")\n  end\n\n  it \"returns nil if spec file does not exist\" do\n    allow(File).to receive(:exist?).with(\"spec/app/file_spec.rb\").and_return(false)\n    expect(find_spec_file(\"app/file.rb\")).to be_nil\n  end\nend\n\n# similarly test other functions\n```\n\n## Contributing\n\nBug reports and Pull Requests are accepted on GitHub (https://github.com/mikik0/omochi).\nThis project should be a safe place for collaboration.\n\n### Design\n\nSee [DESIGN.md](https://github.com/mikik0/omochi/blob/master/DESIGN.md)\n\n### Development\n\n#### Requirement\n\n- ruby3.x\n- AWS Credentials (for `--create`)\n\n```\ngit clone https://github.com/mikik0/omochi.git\nbundle install\nbundle exec bin/omochi verify\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikik0%2Fomochi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikik0%2Fomochi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikik0%2Fomochi/lists"}