{"id":16389451,"url":"https://github.com/qqwy/elixir-blocked","last_synced_at":"2025-03-21T02:31:58.045Z","repository":{"id":57479958,"uuid":"272744332","full_name":"Qqwy/elixir-blocked","owner":"Qqwy","description":"An Elixir-library that helps you to keep track of when hotfixes can be removed by showing compile-time warnings when issues (in your project repository or any other source-code GitHub repository) are closed.","archived":false,"fork":false,"pushed_at":"2020-06-25T10:56:29.000Z","size":141,"stargazers_count":29,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T04:33:04.383Z","etag":null,"topics":["code-quality","elixir-lang","github","hotfix-checker","metaprogramming"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/blocked","language":"Elixir","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/Qqwy.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}},"created_at":"2020-06-16T15:26:28.000Z","updated_at":"2023-04-05T11:39:50.000Z","dependencies_parsed_at":"2022-09-18T05:45:44.897Z","dependency_job_id":null,"html_url":"https://github.com/Qqwy/elixir-blocked","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/Qqwy%2Felixir-blocked","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qqwy%2Felixir-blocked/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qqwy%2Felixir-blocked/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qqwy%2Felixir-blocked/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qqwy","download_url":"https://codeload.github.com/Qqwy/elixir-blocked/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811386,"owners_count":16884305,"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":["code-quality","elixir-lang","github","hotfix-checker","metaprogramming"],"created_at":"2024-10-11T04:33:05.229Z","updated_at":"2024-10-28T09:10:01.840Z","avatar_url":"https://github.com/Qqwy.png","language":"Elixir","readme":"![](https://github.com/Qqwy/elixir-blocked/blob/master/media/blocked_logo_text_flat.svg)\n\n`Blocked` is an Elixir-library that helps you to keep track of when hotfixes can be removed by showing compile-time warnings when issues (in your project repository or any other source-code GitHub repository) are closed.\n\n[![hex.pm version](https://img.shields.io/hexpm/v/blocked.svg)](https://hex.pm/packages/blocked)\n[![Build Status](https://travis-ci.org/Qqwy/elixir-blocked.svg?branch=master)](https://travis-ci.org/Qqwy/elixir-blocked)\n[![Documentation](https://img.shields.io/badge/hexdocs-latest-blue.svg)](https://hexdocs.pm/blocked/index.html)\n[![Inline docs](http://inch-ci.org/github/qqwy/elixir-blocked.svg)](http://inch-ci.org/github/qqwy/elixir-blocked)\n\n---\n\nBlocked was made to improve the quality of your project's code over time: It automates away the human task of checking whether certain hot-fixes, 'temporary patches' or 'duct-tape code' are still required. This makes it less scary to add a temporary workaround to your codebase, because you'll know the minute it is no longer necessary!\n\n\nBasic features:\n\n- Runs at compile-time as a macro.\n- Prints a compile-time warning any time an issue is closed that a piece of your code was waiting for.\n- Works for your own project issues as well as for issues of any other GitHub-hosted repository.\n- Allows specifying both 'hotfix' and optionally a 'desired' code block, to make it clear to future readers of your code what can be changed once the related issue is closed.\n- Configurable to work on private repositories as well.\n- By default performs only checking in Continuous Integration, to keep local compilation fast.\n\n# Installation\n\nThe package can be installed\nby adding `blocked` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:blocked, \"~\u003e 0.9.0\"}\n  ]\nend\n```\n\nDocumentation can be found at [https://hexdocs.pm/blocked](https://hexdocs.pm/blocked).\n\n# Usage\n\n1. Put `require Blocked` in your module to be able to use the exposed macro.\n2. Write `Blocked.by(issue_reference, reason, do: ..., else: ...)` wherever you have to apply a temporary fix.\n\n\n#### Example:\n\n```elixir\ndefmodule Example do\n  require Blocked\n\n  def main do\n    IO.puts(\"Hello, world!\")\n    Blocked.by(\"#42\", \"This code can be removed when the issue is closed\") do\n      hacky_workaround()\n    end\n    \n    # The reason is optional\n    Blocked.by(\"#69\") do\n      a_quick_fix()\n    end\n    \n    # It is possible to indicate\n    # the desired 'ideal' code as well, by passing an `else` block:\n    Blocked.by(\"#1337\") do\n      ugly_fallback()\n    else\n      beautiful_progress()\n    end\n    \n    # If the blockage is more general, you can also leave out the `do` block.\n    Blocked.by(\"#65535\", \"This whole module can be rewritten once we're on the new Elixir version!\")\n    \n    # Blocked supports many ways of referring to an issue\n    Blocked.by(\"#13\")\n    Blocked.by(\"elixir#13\")\n    Blocked.by(\"elixir/13\")\n    Blocked.by(\"elixir-lang/elixir#13\")\n    Blocked.by(\"elixir-lang/elixir/13\")\n    Blocked.by(\"https://github.com/elixir-lang/elixir/issues/13\")\n  end\nend\n```\n\nAs example, a warning that might be generated once an issue is closeed looks like this:\n\n![](https://github.com/Qqwy/elixir-blocked/blob/master/media/example_warning.png)\n\n## When will `Blocked.by` run?\n\nBy default, the checks will only be performed inside Continuous Integration environments.\n(That is, any place where `System.get_env(\"CI\")` is set).\nThe reason for this default is that the checks perform HTTP requests to the GitHub-API,\nwhich will slow down compilation somewhat.\n\nThis can be overridden by altering the `warn`-field in the `Blocked.Config` for a particular environment.\n\n## What if I have a private GitHub-repository?\n\nBy default, `Blocked` will run with an unauthenticated GitHub-client.\nYou can configure the client by specifying an API token\n(of an account that has access to the repository in question)\nin the `Blocked.Config`.\n\n## Supported Issue Reference patterns\n\n1. `123` or `#123`: issue number. Assumes that the isue is part of the current repository.\n2. `reponame/123` or `reponame#123`: repository + issue number. Assumes that the repository is part of the same owner/organization as the current repository.\n3. `owner/reponame/123` or `owner/reponame#123`: owner/organization name + repository + issue number.\n4. `https://github.com/owner/reponame/issues/123`: Full-blown URL to the page of the issue.\n\n## Automatic Repository Detection\n\nWe use the `git remote get-url` command to check for the remote URL of the current repository and attempt to extract the owner/organization and repository name from that.\nWe check against the `upstream` remote (useful in a forked project), and the `origin` remote.\n\nIf your setup is different, you can configure the repository and owner name by specifying custom settings in the `Blocked.Config`.\n\n# Changelog\n\n- 0.9.1 - Fixes bug where HTTP was not always available at compile-time and improves stacktrace information.\n- 0.9.0 - Initial publicly-released version\n\n# Roadmap \u0026 nice-to-haves\n\nPR's are very much accepted!\n\n- Maybe at some point support GitLab, Bitbucket or other repository-hosts as well?\n\n# Attribution\n\nThis library is inspired and borrows heavily from the [Rust library of the same name](https://github.com/zacps/blocked).\n\n# See Also\n\n- [fixme-elixir](https://github.com/henrik/fixme-elixir) which triggers afer a certain point in time, rather than when an issue is closed.\n\n# Is it any good?\n\n[yes](https://news.ycombinator.com/item?id=3067434)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqqwy%2Felixir-blocked","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqqwy%2Felixir-blocked","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqqwy%2Felixir-blocked/lists"}