Skip to content

Conversation

girlpunk
Copy link

@girlpunk girlpunk commented May 7, 2025

At present, when a class uses an inline constructor (see examples below), the base class or interface would not be detected correctly, and incorrectly return object. This is due to an out of date library. This PR updates the library, and fixes a resultant error (there are now two overloads of GetAccessibleMembersInThisAndBaseTypes())

public class MyClass(String inputString) : OtherClass {}

public class CustomPipeline : Pipeline
{
    public CustomPipeline()
    {
        Dependencies.Add(nameof(Code));
        DependencyOf.Add(nameof(Statiq.Web.Pipelines.Content));

        using var cache = new CacheDocuments(new ExecuteConfig(Config.FromContext(AnalyseCSharp)));

        ProcessModules = new ModuleList(
            new ConcatDocuments(nameof(Code)),
            cache.WithoutSourceMapping()
        );
    }

    private static AnalyzeCSharp AnalyseCSharp(IExecutionContext ctx)
    {
        return new AnalyzeCSharp()
            .WhereNamespaces(ctx.Settings.GetBool(DocsKeys.IncludeGlobalNamespace))
            .WithCssClasses("code", "cs")
            .WithSolutions(Config.FromContext<IEnumerable<string>>(static ctx => ctx.GetList<string>(DocsKeys.SolutionFiles)))
            .WithAssemblySymbols()
            .WithImplicitInheritDoc(ctx.GetBool(DocsKeys.ImplicitInheritDoc))
            .WhereSymbol(
                static symbol =>
                {
                    if (symbol.Kind == SymbolKind.NamedType)
                    {
                        var typeSymbol = (INamedTypeSymbol) symbol;
                        return typeSymbol.BaseType?.GetQualifiedName() == "ExampleProject.OtherClass ";
                    }

                    return false;
                }
            );
    }
}

In the above, the CustomPipeline should only document classes the extend the OtherClass base type. At present, MyClass is not documented despite extending the correct base type. This PR fixes this issue.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Sam M seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@daveaglick
Copy link
Member

Thanks! I've got a fair amount of cleanup and catchup to do (including a big version bump courtesy of @devlead), but I'm still around and will get to everything eventually! I actually use this project in my regular job daily so it's far from dead. Just a heads up that I've seen this :)

@girlpunk
Copy link
Author

girlpunk commented May 8, 2025

That's great to hear, Statiq has some great features and is significantly easier to use that other tools like docfx. If there's anything I can do to help with the cleanup or catch up I'm more than happy to help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants