{"id":13779800,"url":"https://github.com/inaka/elvis","last_synced_at":"2025-04-12T01:56:31.849Z","repository":{"id":18075082,"uuid":"21137327","full_name":"inaka/elvis","owner":"inaka","description":"Erlang Style Reviewer","archived":false,"fork":false,"pushed_at":"2025-04-07T06:45:47.000Z","size":805,"stargazers_count":426,"open_issues_count":6,"forks_count":87,"subscribers_count":55,"default_branch":"master","last_synced_at":"2025-04-12T01:56:26.318Z","etag":null,"topics":["elvis","erlang","hacktoberfest","style-checker"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inaka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2014-06-23T18:24:33.000Z","updated_at":"2025-04-07T05:20:32.000Z","dependencies_parsed_at":"2024-06-07T21:29:50.120Z","dependency_job_id":"caf0dbb6-18fc-454b-aa14-02afc4b089c9","html_url":"https://github.com/inaka/elvis","commit_stats":{"total_commits":438,"total_committers":51,"mean_commits":8.588235294117647,"dds":"0.46803652968036524","last_synced_commit":"a482801f953523d6678a550a184079e2818e5c68"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Felvis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Felvis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Felvis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Felvis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inaka","download_url":"https://codeload.github.com/inaka/elvis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505864,"owners_count":21115354,"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":["elvis","erlang","hacktoberfest","style-checker"],"created_at":"2024-08-03T18:01:09.372Z","updated_at":"2025-04-12T01:56:31.827Z","avatar_url":"https://github.com/inaka.png","language":"Erlang","readme":"# `elvis` [![CI][build-badge]][elvis]\n\n[elvis]: https://github.com/inaka/elvis\n[build-badge]: https://github.com/inaka/elvis/workflows/build/badge.svg\n\n![Elvis Presley dancing](https://www.reactiongifs.com/wp-content/uploads/2013/01/elvis-dance.gif)\n\n`elvis`, the Erlang style reviewer, is the command-line interface for\n[`elvis_core`](https://github.com/inaka/elvis_core).\n\n## What is `elvis`?\n\n`elvis` is an Erlang generic style reviewer that focuses on code and configuration consistency,\nas well as readability, across your whole code base. By the very nature of the rules applied from\n`elvis_core` it can also be considered a learning tool, by trying to generalize good practices and\nallowing teams to adapt it to their own specific needs, while fostering discussions around code\nconventions.\n\n### Advantages of using it\n\nSome of the advantages of using `elvis` are:\n\n* enabling consistency in style across all your code base\n* encouraging the development team to sit down and talk about code conventions\n* allowing continuous monitoring of code quality\n* helping developers avoid repeated mistakes that can be automatically detected\n* providing homogenisation among different projects in a company, therefore facilitating project\nswitching for developers, as well as allowing easier code sharing between projects\n* learning, since some of the conventions it proposes are themselves the distilled result of\nworking in very large code bases\n\n## Installation\n\nTo use `elvis` as a standalone tool, you need to:\n\n```console\ngit clone https://github.com/inaka/elvis\ncd elvis\nrebar3 escriptize\nexport PATH=${PWD}/_build/default/bin:${PATH}\n```\n\n(to make the env. variable export more permanent add it to your shell's configuration file,\ni.e. `.bashrc`, `.zshrc`, ...)\n\nNow run it by calling `elvis` (or `elvis help`), and you should get to the `Usage: elvis`\ninstructions.\n\n### Shell completion\n\nElvis also comes with shell completions.\n\nOptionally, download and install:\n\n- Bash completion from \u003chttps://github.com/inaka/elvis/raw/master/priv/bash_completion/elvis\u003e\n- Zsh completion from \u003chttps://github.com/inaka/elvis/master/priv/zsh_completion/_elvis\u003e\n\ndepending on your preferred shell.\n\n## Usage\n\nThe most common use case is to `cd` into a folder containing an `elvis.config` file\nand executing `elvis rock`.\n\nIf you just execute `elvis` with no arguments or options you'll get to the usage instructions\noutlined in this README.\n\n## Options\n\nWhile you can get a more complete list of options by executing `elvis help`, we try to keep them\ndocumented below.\n\n### `--code-path \u003cdir\u003e` (`-p \u003cdir\u003e`)\n\nAdds `\u003cdir\u003e` to the analysis' code path.\n\n### `--commands`\n\nOutputs the list of commands under stood by `elvis`.\n\n#### `git-branch \u003cbranch | commit\u003e`\n\nExecutes `elvis` on source files that have changed since `\u003cbranch\u003e` or `\u003ccommit\u003e`.\n\n#### `git-hook`\n\nExecutes `elvis` (with the specific configuration file) on the pre-commit hook Git-staged files.\n\n#### `install git-hook`\n\nInstalls `elvis` in your current Git repository, as a pre-commit hook.\n\n#### `rock [file...]`\n\nExecutes `elvis` analysis on identified files. It will, by default, consider all the files\nin the configuration (i.e. either `elvis.config` or the path set by option `--config`).\n\n### `--config \u003cfile\u003e` (`-c \u003cfile\u003e`)\n\nAllows providing the path to the config. file (by default `elvis.config` is assumed).\n\n### `--help` (`-h`)\n\nShows help information.\n\n### `--keep-rocking` (`-k`)\n\nDoesn't stop analysis when erroring out on a file, if given a list of files to analyse.\n\n### `--output-format \u003cplain | colors | parsable\u003e`\n\nAllows controlling the output format of the analysis' results.\n\nThe default value is `colors`.\n\n`plain` will output results without colors.\n`parsable` will allow for consumption by systems (it's less readable for humans).\n\n### `--parallel \u003cn | auto\u003e` (`-P \u003cn | auto\u003e`)\n\nAllows analyzing files concurrently.\n\nUse `n` to set the desired number of parallel workers, or `auto` to have the application choose\nan appropriate value (based on the number of schedulers).\n\n### `--quiet` (`-q`)\n\nAllows suppressing all output. The exit code will still be non-`0` if there are failing rules.\n\n### `--verbose` (`-V`)\n\nAllows verbose output.\n\n### `--version` (`-v`)\n\nOutputs the application's version.\n\n## Configuration\n\n`elvis` is configured via `elvis_core`'s `elvis.config` as detailed under\n[`elvis_core / Configuration`](https://github.com/inaka/elvis_core?tab=readme-ov-file#configuration).\n\n### Rules\n\nA reference of all rules implemented in `elvis` can be found in `elvis_core`'s [RULES.md](https://github.com/inaka/elvis_core/blob/main/RULES.md).\n\n### User-defined rules\n\nIf you have implemented `elvis` rule that are in your local repository or in one of\nyour dependencies, you can add these rule to your `elvis.config` file and\ntell `elvis` where to find the `.beam` that contains the compiled rule using\nthe `--code-path` option.\n\nFor example, if the rule is in one of your dependencies, you can run `elvis rock -p deps/elvis_rules/ebin -c elvis.config`.\n\n## As a Git hook\n\n`elvis` can be used as a [`git` pre-commit hook](https://git-scm.com/book/en/Customizing-Git-Git-Hooks#Client-Side-Hooks)\nusing the `git-hook` command (installable via `install git-hook`) as:\n\n```sh\n#!/bin/sh\nelvis git-hook\n```\n\nThis will have `elvis` execute on staged files, as per its configuration.\n\nIf any rule fails, `elvis` exits with a non-zero code, which signals to `git` that the commit\nshouldn't be made.\n\n**Note**: your pre-commit hook script should be executable (i.e. by running\n`chmod +x .git/hooks/pre-commit`), otherwise `git` won't be able to execute it.\n\n## As a webhook\n\n`elvis` can be used as a GitHub [webhook](https://developer.github.com/v3/repos/hooks/) for\n`pull request` (PR) events, by calling the `elvis_webhook:event/1` function. This will add\na comment in each file and rule that is broken, analyzing only the files associated with the PR.\n\nSince GitHub's API needs a valid username and password to allow the creation of\nreviews on PRs, parameters `github_user` and `github_password` need to be\nadded to `elvis`'s configuration file (mind you that the credentials used\nmust be from an admin. of the repo or someone with permissions for requesting changes\nto PRs).\n\nThe `elvis_webhook:event/1` function takes a map containing the keys `headers` and `body`,\nwhose values should be the map of headers and the body from the GitHub's event\nrequest.\n\n```erlang\nHeaders = #{\u003c\u003c\"X-GitHub-Event\"\u003e\u003e, \u003c\u003c\"pull_request\"\u003e\u003e},\nBody = \u003c\u003c\"{}\"\u003e\u003e, %% JSON data from GitHub's event.\nRequest = #{headers =\u003e Headers, body =\u003e Body},\nelvis:webhook(Request).\n```\n\nThe extension to the configuration is as follows:\n\n```erlang\n[\n  {elvis, [\n    {config, [...]},\n    %% webhook configuration parameters\n    {github_user, \"user\"},\n    {github_password, \"password\"}\n  ]}\n].\n```\n\n## Documentation\n\nYou can generate local documentation with `rebar3 ex_doc` and then access it with `open doc/index.html`.\n\n## Contributing\n\n`elvis` is a FOSS application, and as such contributions are welcome. Be sure to read\nthe [contributing guide](CONTRIBUTING.md) for more detailed information.\n\n## License\n\n`elvis` is licensed under the [Apache License, Version 2.0](LICENSE).\n\n## Inspiration\n\n`elvis` got some of its inspiration from [HoundCI](https://houndci.com/).\n","funding_links":[],"categories":["Erlang","Linters","Programming Languages","Codebase Maintenance"],"sub_categories":["Erlang"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Felvis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finaka%2Felvis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Felvis/lists"}