{"id":19359898,"url":"https://github.com/codacy/codacy-cli-v2","last_synced_at":"2026-01-17T06:29:21.081Z","repository":{"id":241113240,"uuid":"803303752","full_name":"codacy/codacy-cli-v2","owner":"codacy","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-14T15:48:24.000Z","size":11715,"stargazers_count":20,"open_issues_count":5,"forks_count":10,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-14T15:52:08.204Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"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/codacy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-20T13:17:25.000Z","updated_at":"2026-01-14T12:54:49.000Z","dependencies_parsed_at":"2024-05-22T13:56:28.753Z","dependency_job_id":"34f91c83-0fef-47b4-ab7a-888d796d3faa","html_url":"https://github.com/codacy/codacy-cli-v2","commit_stats":null,"previous_names":["codacy/codacy-cli-v2"],"tags_count":198,"template":false,"template_full_name":null,"purl":"pkg:github/codacy/codacy-cli-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-cli-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-cli-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-cli-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-cli-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codacy","download_url":"https://codeload.github.com/codacy/codacy-cli-v2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-cli-v2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28502308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-10T07:16:28.283Z","updated_at":"2026-01-17T06:29:21.073Z","avatar_url":"https://github.com/codacy.png","language":"Go","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# Codacy CLI v2\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/8cae070168cf488db82478ba6505a005)](https://app.codacy.com/gh/codacy/codacy-cli-v2/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade) [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/8cae070168cf488db82478ba6505a005)](https://app.codacy.com/gh/codacy/codacy-cli-v2/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_coverage)\n\n\nCodacy CLI (version 2) is a command-line tool for running code analysis and integrating with Codacy. If your repository exists in Codacy, you can sync your configuration to ensure consistency with your organization's standards. \n\nYou can also use Codacy CLI for local code analysis without a Codacy account, leveraging the linter configuration files found in your project's root or Codacy's suggested defaults.\n\nThe CLI supports uploading analysis results (in [SARIF](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html) format) to Codacy as well.\n\nIt is invoked using the `codacy-cli` command and provides several commands for project setup, analysis, and integration.\n\n---\n\n## Supported Platforms\n\n- **macOS**\n- **Linux**\n- **Windows (via WSL only)**\n\n\u003e **Note:** Native Windows is not yet supported. For Windows, use [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/) and follow the Linux instructions inside your WSL terminal.\n\n---\n\n## Installation\n\n### macOS (Homebrew)\n\n```bash\nbrew install codacy/codacy-cli-v2/codacy-cli-v2\n```\n\n### Linux / Windows (WSL)\n\nRun the following in your terminal (Linux or WSL):\n\n```bash\nbash \u003c(curl -Ls https://raw.githubusercontent.com/codacy/codacy-cli-v2/main/codacy-cli.sh)\n```\n\nOr create an alias for convenience:\n\n```bash\nalias codacy-cli=\"bash \u003c(curl -Ls https://raw.githubusercontent.com/codacy/codacy-cli-v2/main/codacy-cli.sh)\"\n```\n\n---\n\n## CLI Commands\n\n### `init` — Bootstrap Project Configuration\n\nBootstraps the CLI configuration in your project's folder. This command creates a `.codacy` directory containing a `codacy.yaml` file, which specifies the runtimes and tools that will be used and installed.\n\n- If you provide Codacy repository information (API token, provider, organization, repository), the configuration will be fetched from Codacy, ensuring consistency with your organization's standards.\n- If no Codacy information is provided, all available tools will be included. For each tool, if a local configuration file exists in your project, it will be used; otherwise, Codacy's suggested defaults will be used.\n\n- **Local mode (local configuration files):**\n  ```bash\n  codacy-cli init\n  ```\n- **Remote mode (fetch configuration from Codacy):**\n  ```bash\n  codacy-cli init --api-token \u003ctoken\u003e --provider \u003cgh|gl|bb\u003e --organization \u003corg\u003e --repository \u003crepo\u003e\n  ```\n\n**Flags:**\n- `--api-token` (string): Codacy API token (optional; enables fetching remote config)\n- `--provider` (string): Provider (`gh`, `gl`, `bb`), required with `--api-token`\n- `--organization` (string): Organization name, required with `--api-token`\n- `--repository` (string): Repository name, required with `--api-token`\n\n### `config reset` — Reset Configuration\n\nResets the Codacy configuration files and tool-specific configurations. This command overwrites existing configuration with either local default configurations or repository-specific configurations from Codacy.\n\n```bash\n# Reset to local default configurations\ncodacy-cli config reset\n\n# Reset to repository-specific configurations from Codacy\ncodacy-cli config reset --api-token \u003ctoken\u003e --provider \u003cgh|gl|bb\u003e --organization \u003corg\u003e --repository \u003crepo\u003e\n```\n\n**Behavior:**\n- **Local mode**: Creates default configurations for all available tools\n- **Remote mode**: Fetches and applies repository-specific configurations from Codacy\n- Prevents accidental mode switching (remote to local requires explicit flags)\n- Overwrites existing `.codacy/codacy.yaml` and tool configurations\n- Creates or updates `.codacy/.gitignore` file\n\n**Flags:** Same as `init` command (api-token, provider, organization, repository)\n\n### `config discover` — Discover Project Languages\n\nScans a project directory to detect programming languages and automatically configures appropriate static analysis tools. This command updates both `languages-config.yaml` and `codacy.yaml` with relevant tools for detected languages.\n\n```bash\n# Discover languages in current directory\ncodacy-cli config discover .\n\n# Discover languages in specific project path\ncodacy-cli config discover /path/to/project\n```\n\n**Features:**\n- Automatically detects file extensions and maps them to programming languages\n- Updates `.codacy/tools-configs/languages-config.yaml` with discovered languages\n- Enables relevant tools in `codacy.yaml` based on detected languages\n- Creates tool-specific configuration files for discovered tools\n- Works in both local and cloud modes\n\n### `install` — Install Runtimes and Tools\n\nInstalls all runtimes and tools specified in `.codacy/codacy.yaml`:\n- Downloads and extracts runtimes (Node, Python, Dart, Java, etc.)\n- Installs tools (ESLint, Trivy, Pylint, PMD, etc.) using the correct package manager or direct download\n- Handles platform-specific details\n- Skips already installed components (e.g., Node, Python, Dart, Java, etc.)\n- Shows a progress bar and reports any failures\n\n```bash\ncodacy-cli install\n```\n- Optionally specify a custom registry:\n  ```bash\n  codacy-cli install --registry \u003curl\u003e\n  ```\n\n### `analyze` — Run Code Analysis\n\nRuns all configured tools, or a specific tool, on your codebase.\n\n```bash\n# Run all tools\ncodacy-cli analyze\n\n# Run a specific tool (e.g., ESLint)\ncodacy-cli analyze --tool eslint\n\n# Output results in SARIF format\ncodacy-cli analyze --tool eslint --format sarif\n\n# Store results as SARIF in a file\ncodacy-cli analyze -t eslint --format sarif -o eslint.sarif\n\n# Analyze a specific file with all configured tools\ncodacy-cli analyze path/to/file.js\n\n# Analyze a specific file with a specific tool (e.g., ESLint)\ncodacy-cli analyze --tool eslint path/to/file.js\n```\n\n**Flags:**\n- `--output, -o`: Output file for the results; if not provided, results will be printed to the console\n- `--tool, -t`: Tool to run analysis with (e.g., eslint)\n- `--format`: Output format (e.g., `sarif`)\n- `--fix`: Automatically fix issues when possible\n\n### `upload` — Upload SARIF Results to Codacy\n\nUploads a SARIF file containing analysis results to Codacy.\n\n```bash\n# With project token\ncodacy-cli upload -s path/to/your.sarif -c \u003ccommit-uuid\u003e -t \u003cproject-token\u003e\n\n# With API token\ncodacy-cli upload -s path/to/your.sarif -c \u003ccommit-uuid\u003e -a \u003capi-token\u003e -p \u003cprovider\u003e -o \u003cowner\u003e -r \u003crepository\u003e\n```\n\n**Flags:**\n- `--sarif-path, -s`: Path to the SARIF report (required)\n- `--commit-uuid, -c`: Commit UUID\n- `--project-token, -t`: Project token for Codacy API\n- `--api-token, -a`: User-level token for Codacy API\n- `--provider, -p`: Provider name (e.g., gh, gl, bb)\n- `--owner, -o`: Repository owner\n- `--repository, -r`: Repository name\n\n### `update` — Update the CLI\n\nFetches and installs the latest version of the CLI.\n\n```bash\ncodacy-cli update\n```\n\n### `version` — Show Version Information\n\nDisplays detailed version/build information for the CLI.\n\n```bash\ncodacy-cli version\n```\n\n---\n\n## Configuration\n\n- **`.codacy/codacy.yaml`**: Main configuration file specifying runtimes and tool versions.\n- **`.codacy/tools-configs/`**: Tool-specific configuration files (auto-generated or fetched from Codacy).\n\n---\n\n## Example Usage\n\n```bash\n# 1. Initialize project (local or remote)\ncodacy-cli init\n# or\ncodacy-cli init --api-token \u003ctoken\u003e --provider gh --organization my-org --repository my-repo\n\n# 2. (Optional) Discover languages and configure tools automatically\ncodacy-cli config discover .\n\n# 3. Install all required runtimes and tools\ncodacy-cli install\n\n# 4. Run analysis (all tools or specific tool)\ncodacy-cli analyze\ncodacy-cli analyze --tool eslint\n\n# 5. Upload results to Codacy\ncodacy-cli upload -s eslint.sarif -c \u003ccommit-uuid\u003e -t \u003cproject-token\u003e\n```\n\n---\n\n## Troubleshooting\n\n### WSL (Windows Subsystem for Linux)\n- **Always use a WSL terminal** (e.g., Ubuntu on Windows) for all commands.\n- Ensure you have the latest version of WSL and a supported Linux distribution installed.\n- If you see errors related to missing Linux tools (e.g., `curl`, `tar`), install them using your WSL package manager (e.g., `sudo apt install curl tar`).\n\n### MacOS: Errors related to `docker-credential-osxkeychain` not found\n\nInstall the docker credential helper:\n\n```bash\nbrew install docker-credential-helper\n```\n\n---\n\n## Example Repository\n\nSee [eslint-test-examples](https://github.com/troubleshoot-codacy/eslint-test-examples) for a repository using this CLI in GitHub Actions.\n\n---\n\n## Breaking Changes \u0026 Version Pinning\n\nSome behaviors have changed with recent updates. To rely on a specific CLI version, set the following environment variable:\n\n```bash\nexport CODACY_CLI_V2_VERSION=\"1.0.0-main.133.3607792\"\n```\n\nCheck the [releases](https://github.com/codacy/codacy-cli-v2/releases) page for all available versions.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-cli-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodacy%2Fcodacy-cli-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-cli-v2/lists"}