Skip to content

Latest commit

 

History

History
135 lines (98 loc) · 3.12 KB

File metadata and controls

135 lines (98 loc) · 3.12 KB

CodeScene

Code quality platform for managing technical debt and improving code health.

GitHub Education Access

Claim your free access at GitHub Education Pack - look for CodeScene.

Dashboard

Features

  • Code Health: Aggregated metric analyzing 25+ code factors
  • Technical Debt: Visualization and prioritization
  • Automated Reviews: PR quality feedback
  • IDE Extensions: Real-time code health in editor
  • Delivery Performance: Track productivity bottlenecks

Setup

Connect Repository

  1. Go to https://codescene.io/projects
  2. Click "Add Project"
  3. Connect your Git provider (GitHub, GitLab, Bitbucket, Azure)
  4. Select repository
  5. Configure analysis settings

IDE Extensions

VS Code:

# Install from VS Code Marketplace
ext install codescene.codescene-vscode

IntelliJ:

  • Preferences → Plugins → Search "CodeScene"

Configuration

Copy from templates/codescene/:

  • codescene.yml - Analysis configuration
  • .codescene/ - Project-specific settings

codescene.yml Example

version: 2
analysis:
  exclude_paths:
    - "node_modules/**"
    - "vendor/**"
    - "*.min.js"

  code_health:
    enabled: true

  hotspots:
    enabled: true

GitHub Actions Integration

# .github/workflows/codescene-analysis.yml
name: CodeScene Analysis

on: [pull_request]

jobs:
  codescene:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: CodeScene Delta Analysis
        uses: codescene/codescene-ci-cd@v1
        with:
          api-token: ${{ secrets.CODESCENE_API_TOKEN }}
          project-id: ${{ vars.CODESCENE_PROJECT_ID }}

Code Health Metrics

CodeScene analyzes:

  • Brain Methods: Complex functions with too much logic
  • Deep Nesting: Excessive if/else/loop nesting
  • Large Methods: Functions that are too long
  • Code Duplication: Repeated code patterns
  • Coupling: Dependencies between components

Pre-Commit Hook

#!/bin/bash
# .git/hooks/pre-commit

# Run CodeScene check on staged files
codescene-cli analyze --staged

if [ $? -ne 0 ]; then
  echo "CodeScene: Code health issues detected"
  exit 1
fi

Best Practices

  1. Focus on hotspots: Address issues in frequently changed files first
  2. Track trends: Monitor code health over time
  3. Set thresholds: Configure minimum code health scores for PRs
  4. Review refactoring: Use prioritized refactoring suggestions
  5. Exclude generated code: Don't analyze auto-generated files

Environment Variables

CODESCENE_API_TOKEN=your_api_token
# Get from: https://codescene.io → User Settings → API Tokens

CODESCENE_PROJECT_ID=your_project_id
# Get from: Project URL or Settings

Resources