Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

878 B
Raw Blame
// Fixtures for class-level (LCOM4 / god-class) walker tests.
//
// Uses explicit `this->` so the member-access node type is exercised; bare
// member access is covered in tests/unit/health/test_implicit_member_cohesion.py.

class Cohesive {
    int total;
    int count;

public:
    void add(int n) {
        this->total += n;
        this->count += 1;
    }

    int average() {
        return this->count ? this->total / this->count : 0;
    }

    void reset() {
        this->total = 0;
        this->count = 0;
    }

    int describe() {
        return this->count;
    }
};

class Splintered {
    int a;
    int b;

public:
    void setA(int v) {
        this->a = v;
    }

    int getA() {
        return this->a;
    }

    void setB(int v) {
        this->b = v;
    }

    int getB() {
        return this->b;
    }

    int loner() {
        return 42;
    }
};