@codacy/tools-reek-6
v0.2.1
Published
Reek adapter — CLI-mode Ruby code smell detector
Downloads
192
Readme
@codacy/tools-reek-6
Table of Contents
Overview
Ruby code smell detector using the Reek gem. Uses the CLI execution strategy -- spawns reek --format json via spawnTool() and parses its JSON output.
| Property | Value |
| ------------- | -------------------------------------- |
| Tool ID | Reek |
| Codacy UUID | ec8f6265-18e8-478a-a295-7a4c09fa2171 |
| Strategy | CLI |
| Languages | Ruby |
| Binary | reek (installed via gem install) |
| File patterns | **/*.rb |
Updating patterns
# Re-fetch pattern metadata from the Codacy API
pnpm prefetch
# Commit the result
git add src/patterns.jsonThe prefetch script calls packages/tools/scripts/fetch-patterns.mjs with the tool UUID to download pattern metadata (IDs, categories, severity levels) from the Codacy API.
Pattern IDs are bare smell type names (no prefix): FeatureEnvy, TooManyStatements, UncommunicativeMethodName, etc.
Updating the Reek version
- Update
REEK_VERSIONinsrc/adapter.ts - Run
pnpm prefetchto check for new/removed smells - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
reek-7/)
Development
pnpm build # Build with tsup
pnpm test # Run tests (requires ruby + reek in PATH for integration tests)To install reek locally for testing:
gem install reek -v 6.5.0Notes for maintainers
- Reek requires Ruby >= 2.7 as a runtime. The adapter uses
ensureRuby()to download a portable Ruby if no system Ruby is found. - Gems are installed in an isolated directory at
~/.codacy/runtimes/reek-6/gems/viaGEM_HOME/GEM_PATHenvironment variables. - Output format is a flat JSON array of smell objects, each with
smell_type,source,lines[],message, andcontext. - The
linesfield is an array -- a single smell can span multiple lines. The adapter useslines[0]as the primary line number. - Exit codes: 0 = no smells, 2 = smells found (both success), 1 = runtime error.
- Pattern IDs in
patterns.jsonhave no prefix -- they are bare smell type names matchingsmell_typefrom Reek's JSON output. - Pattern filtering is post-hoc: Reek runs against all provided files, then output is filtered by the enabled patterns set.
- Config file detection supports
.reek.ymlandconfig.reek. When a local config is found anduseLocalConfigurationFileis true, it is passed via--config <path>.
