shard-ameba/index.json

1 line
950 KiB
JSON
Raw Normal View History

{"repository_name":"ameba","body":"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n- [About](#about)\n- [Usage](#usage)\n * [Run in parallel](#run-in-parallel)\n- [Installation](#installation)\n * [As a project dependency:](#as-a-project-dependency)\n * [OS X](#os-x)\n * [Docker](#docker)\n * [From sources](#from-sources)\n- [Configuration](#configuration)\n * [Sources](#sources)\n * [Rules](#rules)\n * [Explain issues](#explain-issues)\n * [Inline disabling](#inline-disabling)\n- [Editors & integrations](#editors--integrations)\n- [Credits & inspirations](#credits--inspirations)\n- [Contributors](#contributors)\n\n## About\n\nAmeba is a static code analysis tool for the Crystal language.\nIt enforces a consistent [Crystal code style](https://crystal-lang.org/reference/conventions/coding_style.html),\nalso catches code smells and wrong code constructions.\n\nSee also [Roadmap](https://github.com/crystal-ameba/ameba/wiki).\n\n## Usage\n\nRun `ameba` binary within your project directory to catch code issues:\n\n```sh\n$ ameba\nInspecting 107 files\n\n...............F.....................F....................................................................\n\nsrc/ameba/formatter/flycheck_formatter.cr:4:33\n[W] Lint/UnusedArgument: Unused argument `location`\n> source.issues.each do |e, location|\n ^\n\nsrc/ameba/formatter/base_formatter.cr:12:7\n[W] Lint/UselessAssign: Useless assignment to variable `s`\n> return s += issues.size\n ^\n\nFinished in 542.64 milliseconds\n129 inspected, 2 failures\n```\n\n### Run in parallel\n\nStarting from 0.31.0 Crystal [supports parallelism](https://crystal-lang.org/2019/09/06/parallelism-in-crystal.html).\nIt allows to run linting in parallel too.\nIn order to take advantage of this feature you need to build ameba with preview_mt support:\n\n```sh\n$ crystal build src/cli.cr -Dpreview_mt -o bin/ameba\n$ make install\n```\n\nSome quick benchmark results measured while running Ameba on Crystal repo:\n\n```sh\n$ CRYSTAL_WORKERS=1 ameba #=> 29.11 seconds\n$ CRYSTAL_WORKERS=2 ameba #=> 19.49 seconds\n$ CRYSTAL_WORKERS=4 ameba #=> 13.48 seconds\n$ CRYSTAL_WORKERS=8 ameba #=> 10.14 seconds\n```\n\n## Installation\n\n### As a project dependency:\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndevelopment_dependencies:\n ameba:\n github: crystal-ameba/ameba\n version: ~> 0.13.0\n```\n\nBuild `bin/ameba` binary within your project directory while running `shards install`.\n\nYou may also want to use it on [Travis](travis-ci.org):\n\n```yaml\n# .travis.yml\nlanguage: crystal\ninstall:\n - shards install\nscript:\n - crystal spec\n - crystal bin/ameba.cr\n```\n\nUsing this config Ameba will inspect files just after the specs run. Travis will also fail\nthe build if some problems detected.\n\n### OS X\n\n```sh\n$ brew tap veelenga/tap\n$ brew install ameba\n```\n\n### Docker\n\nBuild the image:\n\n```sh\n$ docker build -t crystal-ameba/ameba .\n```\n\nTo use the resulting image on a local source folder, mount the current (or target) directory into `/src`:\n\n```sh\n$ docker run -v $(pwd):/src crystal-ameba/ameba\n```\n\nAlso available on DockerHub: https://hub.docker.com/r/veelenga/ameba\n\n### From sources\n\n```sh\n$ git clone https://github.com/crystal-ameba/ameba && cd ameba\n$ make install\n```\n\n## Configuration\n\nDefault configuration file is `.ameba.yml`.\nIt allows to configure rule properties, disable specific rules and exclude sources from the rules.\n\nGenerate new file by running `ameba --gen-config`.\n\n### Sources\n\n**List of sources to run Ameba on can be configured globally via:**\n\n- `Globs` section - an array of wildcards (or paths) to include to the\n inspection. Defaults to `%w(**/*.cr !lib)`, meaning it includes all project\n files with `*.cr` extension except those which exist in `lib` folder.\n- `Excluded` section - an array of wildcards (or paths) to exclude from the\n source list defined by `Globs`. Defaults to an empty array.\n\nIn this example we define default globs and exc