AIFeed

Show HN: Coderot – AI share and complexity over time for any GitHub repo

Original text(via HN AI)

Round 1 of 3

图表:Human. dotnet/runtime as of 2020, before Copilot existed. Source

A · GroupJoinIterator()


        {
    using (IEnumerator<TOuter> e = outer.GetEnumerator())
    {
        if (e.MoveNext())
        {
            Lookup<TKey, TInner> lookup =
                Lookup<TKey, TInner>.CreateForJoin(
                    inner, innerKeySelector, comparer);
            do
            {
                TOuter item = e.Current;
                yield return resultSelector(
                    item, lookup[outerKeySelector(item)]);
            }
            while (e.MoveNext());
        }
    }
}
      

B · GroupJoinIterator()


        {
    using IEnumerator<TOuter> e = outer.GetEnumerator();
    if (e.MoveNext())
    {
        Lookup<TKey, TInner> lookup =
            Lookup<TKey, TInner>.CreateForJoin(
                inner, innerKeySelector, comparer);
        do
        {
            TOuter item = e.Current;
            yield return new GroupJoinGrouping<TOuter, TInner>(
                item, lookup[outerKeySelector(item)]);
        }
        while (e.MoveNext());
    }
}
      

Spotted the newer using syntax? That dates the code, but it doesn't name the author: the agent mirrored the existing method next to it, line for line.

Round 2 of 3

A · IsWhiteSpaceByte()


        {
    // Check for ASCII whitespace characters: space (0x20),
    // tab (0x09), newline (0x0A), carriage return (0x0D),
    // form feed (0x0C), and vertical tab (0x0B)
    // For non-ASCII bytes, convert to char and check with
    // char.IsWhiteSpace
    return b <= 127 ? char.IsWhiteSpace((char)b) : false;
}
      

B · SkipWhiteSpace()


        {
    // Create local copy to avoid bounds checks.
    ReadOnlySpan<byte> localBuffer = _buffer;
    for (; _consumed < localBuffer.Length; _consumed++)
    {
        byte val = localBuffer[_consumed];

        // JSON RFC 8259 section 2 says only these 4
        // characters count, not all of the Unicode
        // defintions of whitespace.
        if (val != JsonConstants.Space &&
            val != JsonConstants.CarriageReturn &&
            val != JsonConstants.LineFeed &&
            val != JsonConstants.Tab)
        {
            break;
        }

        if (val == JsonConstants.LineFeed)
        {
            _lineNumber++;
            _bytePositionInLine = 0;
        }
        else
        {
            _bytePositionInLine++;
        }
    }
}
      

A's comment says non-ASCII bytes get checked with char.IsWhiteSpace, but the code returns false for them. A tell? People leave wrong comments too, and this one passed review.

Round 3 of 3

A · normalizeGitRepoPath()


        {
    const trimmed =
        path.replace(/\/+/g, '/').replace(/\/+$/g, '');
    if (!trimmed.toLowerCase().endsWith('.git')) {
        return undefined;
    }

    const withLeadingSlash =
        trimmed.startsWith('/') ? trimmed : `/${trimmed}`;
    const pathWithoutGit = withLeadingSlash.slice(1, -4);
    if (!pathWithoutGit || !pathWithoutGit.includes('/')) {
        return undefined;
    }

    return withLeadingSlash;
}
      

B · normalizeGitRepoPath()


        {
    const gitSuffix = '.git';
    const trimmed =
        path.replace(/\/+/g, '/').replace(/\/+$/g, '');

    const withLeadingSlash =
        trimmed.startsWith('/') ? trimmed : `/${trimmed}`;
    // Strip .git suffix (if present) only for the purposes
    // of validating path depth.
    const pathWithoutGit =
        withLeadingSlash.toLowerCase().endsWith(gitSuffix)
            ? withLeadingSlash.slice(1,
                withLeadingSlash.length - gitSuffix.length)
            : withLeadingSlash.slice(1);
    if (!pathWithoutGit || !pathWithoutGit.includes('/')) {
        return undefined;
    }

    return withLeadingSlash;
}
      

The named constant and the explaining comment felt like AI? Fair guess. But A isn't proven human either: its commit message says "(Commit message generated by Copilot)", and nothing records who wrote the code. coderot would count A as unknown.

Method bodies as committed, with long lines wrapped.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗