{"id":13684289,"url":"https://github.com/manicmaniac/danger-periphery","last_synced_at":"2025-04-11T02:11:56.786Z","repository":{"id":44667873,"uuid":"418788297","full_name":"manicmaniac/danger-periphery","owner":"manicmaniac","description":"A Danger plugin to detect unused codes using Periphery.","archived":false,"fork":false,"pushed_at":"2024-05-21T10:55:37.000Z","size":422,"stargazers_count":24,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-22T00:48:23.783Z","etag":null,"topics":["danger","periphery","ruby"],"latest_commit_sha":null,"homepage":"https://www.rubydoc.info/gems/danger-periphery/","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/manicmaniac.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":"2021-10-19T05:49:43.000Z","updated_at":"2024-05-30T01:17:47.730Z","dependencies_parsed_at":"2024-02-15T23:31:46.220Z","dependency_job_id":"fc4b0d76-9a33-4dc8-816a-2d84581dd06d","html_url":"https://github.com/manicmaniac/danger-periphery","commit_stats":{"total_commits":256,"total_committers":2,"mean_commits":128.0,"dds":0.21484375,"last_synced_commit":"5eafa69c5e6efa40b09f139c6a3e73903882d127"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manicmaniac%2Fdanger-periphery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manicmaniac%2Fdanger-periphery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manicmaniac%2Fdanger-periphery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manicmaniac%2Fdanger-periphery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manicmaniac","download_url":"https://codeload.github.com/manicmaniac/danger-periphery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328160,"owners_count":21085261,"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":["danger","periphery","ruby"],"created_at":"2024-08-02T14:00:31.909Z","updated_at":"2025-04-11T02:11:56.771Z","avatar_url":"https://github.com/manicmaniac.png","language":"Ruby","funding_links":[],"categories":["Plugins"],"sub_categories":["Ruby (danger)"],"readme":"# danger-periphery\n\n[![Test](https://github.com/manicmaniac/danger-periphery/actions/workflows/test.yml/badge.svg)](https://github.com/manicmaniac/danger-periphery/actions/workflows/test.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/1006dd155fc527b2b687/maintainability)](https://codeclimate.com/github/manicmaniac/danger-periphery/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/1006dd155fc527b2b687/test_coverage)](https://codeclimate.com/github/manicmaniac/danger-periphery/test_coverage)\n[![Gem Version](https://badge.fury.io/rb/danger-periphery.svg)](https://badge.fury.io/rb/danger-periphery)\n\nA Danger plugin to detect unused codes.\n\n\u003cimg width=\"899\" alt=\"image\" src=\"https://user-images.githubusercontent.com/1672393/181256005-40842f99-d504-4be8-a0e5-5df144f939d7.png\"\u003e\n\n## Installation\n\nYou need to install [Periphery](https://github.com/peripheryapp/periphery) beforehand.\n\nWrite the following code in your Gemfile.\n\n```ruby\ngem \"danger-periphery\"\n```\n\n## Usage\n\nIf you already have `.periphery.yml`, the easiest way to use is just add this to your Dangerfile.\n\n```ruby\nperiphery.scan\n```\n\nYou can specify the path to executable in this way.\n\n```ruby\nperiphery.binary_path = \"bin/periphery\"\n```\n\nYou can pass command line options to `periphery.scan` like the following.\nSee `periphery scan -h` for available options.\n\nNote that `build_args` option is a special option that does not exist in Periphery but the arguments are passed down to `periphery` after an argument terminator (`--`).\n\n```ruby\n# For Periphery \u003e= 3.0.0\nperiphery.scan(\n  project: \"Foo.xcodeproj\",\n  schemes: [\"foo\", \"bar\"],\n  clean_build: true,\n  exclude_targets: [\"bar\"],\n  build_args: \"-sdk iphonesimulator\"\n)\n\n# For Periphery \u003c 3.0.0\nperiphery.scan(\n  project: \"Foo.xcodeproj\",\n  schemes: [\"foo\", \"bar\"],\n  targets: \"foo\",\n  clean_build: true,\n  build_args: \"-sdk iphonesimulator\"\n)\n```\n\nBy default, `danger-periphery` scans all files in the specified targets and reports problems only in added, modified and renamed files.\nYou can make `danger-periphery` report problems in all files by setting `scan_all_files` to true.\n\n```ruby\nperiphery.scan_all_files = true\nperiphery.scan\n```\n\nYou can force `danger-periphery` treat all warnings as errors by changing `warning_as_error` flag.\n\n```ruby\nperiphery.warning_as_error = true\nperiphery.scan\n```\n\n## Advanced Usage\n\n### Skip building for faster analysis\n\nLet's say that your project already have workflow to run test like the following GitHub Actions workflow.\n\n```yaml\n# .github/workflows/test.yml\n\nsteps:\n  - name: Run Danger\n    run: bundle exec danger\n  - name: Run test\n    run: xcodebuild test -project Foo.xcodeproj -scheme foo -sdk iphonesimulator -arch arm64\n```\n\nIn this case, Periphery can reuse the index store generated by the previous build.\n\nTo enable this feature, you need to give `index_store_path` to the generated index store, and set `skip_build` to true.\n\n```ruby\n# Dangerfile\n\n# For Periphery \u003e= 3.0.0\nperiphery.scan(\n  project: \"Foo.xcodeproj\",\n  schemes: [\"foo\", \"bar\"],\n  skip_build: true,\n  exclude_targets: [\"bar\"],\n  index_store_path: 'DerivedData/Index.noindex/DataStore'\n)\n\n# For Periphery \u003c 3.0.0\nperiphery.scan(\n  project: \"Foo.xcodeproj\",\n  schemes: \"foo\",\n  targets: \"foo\",\n  skip_build: true,\n  index_store_path: 'DerivedData/Index.noindex/DataStore' # 'DerivedData/Index/DataStore' in Xcode 13 or earlier.\n)\n```\n\nThen do not forget to pass `-derivedDataPath` option to `xcodebuild`, and reorder steps.\n\n```yaml\n# .github/workflows/test.yml\n\nsteps:\n  - name: Run test\n    run: xcodebuild test -project Foo.xcodeproj -scheme foo -sdk iphonesimulator -arch arm64 -derivedDataPath DerivedData\n  - name: Run Danger\n    run: bundle exec danger\n```\n\n### Postprocess warnings by passing block to `#scan`\n\nYou can modify warnings as you like by passing a block to `scan`.\n`scan` takes a block that receives `ScanResult` instance as arguments.\nEach `ScanResult` instance corresponds with each entry of Danger warnings.\nIf that block returns falsy value, danger-periphery suppresses the corresponding warning.\n\nFor example, if you want your team members to be careful with warnings, the following code may work.\n\n```ruby\nperiphery.scan do |violation|\n  violation.message = \"Pay attention please! #{violation.message}\"\nend\n```\n\nFor another example, if you want to suppress warnings complaining about unused parameter of many of `didChangeValue(_ sender: Any)` methods, you can suppress this kind of warnings in the following way.\n\n```ruby\nperiphery.scan do |violation|\n  !violation.message.match(/Parameter 'sender' is unused/)\nend\n```\n\n### Enable verbose output\n\nYou can enable verbose output by setting the `verbose` option to `true`. When enabled, `danger-periphery` will print all output from Periphery in real-time, instead of only errors.\n\nBy default, verbose output is disabled.\n\n```ruby\nperiphery.verbose = true\nperiphery.scan\n```\n\nEven when `verbose` is enabled, `danger-periphery` automatically overrides certain Periphery options, such as `--disable-update-check`, `--format`, and `--quiet`, to ensure proper integration.\n\n### Install Periphery in Dangerfile\n\nAlthough I recommend you to install Periphery binary on your own, `danger-periphery` provides a method to install Periphery in Dangerfile.\n\n```ruby\nperiphery.install\nperiphery.scan\n```\n\nNote that `periphery.install` also changes `periphery.binary_path` so that you don't need to specify the installed file path.\n\nIf you want to install the specific version of Periphery to the specific path with overwriting an existing file, add options like this.\n\n```ruby\nperiphery.install version: '2.10.0', path: 'bin/periphery', force: true\n```\n\n## Development\n\n1. Clone this repo\n2. Run `bundle install` to setup dependencies.\n3. Run `bundle exec rake periphery:install` to install Periphery.\n4. Run `bundle exec rake spec` to run the tests.\n5. Use `bundle exec guard` to automatically have tests run as you make changes.\n6. Make your changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanicmaniac%2Fdanger-periphery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanicmaniac%2Fdanger-periphery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanicmaniac%2Fdanger-periphery/lists"}