Skip to content

Commit

Permalink
Create IVisualNodeProducer & RuleSplitDescription models for new rule…
Browse files Browse the repository at this point in the history
… descriptions (#5211)

Fixes #5209
  • Loading branch information
1 parent 34df0da commit 5ed7db7
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/Education/Layout/Logical/IVisualNodeProducer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SonarLint for Visual Studio
* Copyright (C) 2016-2024 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

using System.Diagnostics.CodeAnalysis;
using SonarLint.VisualStudio.Education.Layout.Visual;
using SonarLint.VisualStudio.Education.XamlGenerator;

namespace SonarLint.VisualStudio.Education.Layout.Logical
{
[ExcludeFromCodeCoverage]
internal class VisualizationParameters
{
public IRuleHelpXamlTranslator HtmlToXamlTranslator { get; }
public string RelevantContext { get; }
}

internal interface IVisualNodeProducer
{
IAbstractVisualizationTreeNode ProduceVisualNode(VisualizationParameters parameters);
}
}
103 changes: 103 additions & 0 deletions src/Education/Layout/Logical/RuleSplitDescription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* SonarLint for Visual Studio
* Copyright (C) 2016-2024 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using SonarLint.VisualStudio.Education.Layout.Visual;

namespace SonarLint.VisualStudio.Education.Layout.Logical
{
[ExcludeFromCodeCoverage]
internal class RuleSplitDescription : IVisualNodeProducer
{
private readonly string introductionHtml;
private readonly List<IRuleDescriptionTab> tabs;

public RuleSplitDescription(string introductionHtml, List<IRuleDescriptionTab> tabs)
{
this.introductionHtml = introductionHtml;
this.tabs = tabs;
}

public IAbstractVisualizationTreeNode ProduceVisualNode(VisualizationParameters parameters)
{
throw new System.NotImplementedException();
}
}

internal interface IRuleDescriptionTab : IVisualNodeProducer
{
string Title { get; }
}

[ExcludeFromCodeCoverage]
internal class NonContextualRuleDescriptionTab : IRuleDescriptionTab
{
private readonly string htmlContent;

public NonContextualRuleDescriptionTab(string title, string htmlContent)
{
Title = title;
this.htmlContent = htmlContent;
}

public string Title { get; }

public IAbstractVisualizationTreeNode ProduceVisualNode(VisualizationParameters parameters)
{
throw new System.NotImplementedException();
}
}

[ExcludeFromCodeCoverage]
internal class ContextualRuleDescriptionTab : IRuleDescriptionTab
{
private readonly List<ContextContentTab> contexts;
private readonly string defaultContext;

public ContextualRuleDescriptionTab(string title, string defaultContext, List<ContextContentTab> contexts)
{
Title = title;
this.contexts = contexts;
this.defaultContext = defaultContext;
}

public string Title { get; set; }

public IAbstractVisualizationTreeNode ProduceVisualNode(VisualizationParameters parameters)
{
throw new System.NotImplementedException();
}

internal class ContextContentTab
{
public ContextContentTab(string title, string contextKey, string htmlContent)
{
Title = title;
ContextKey = contextKey;
HtmlContent = htmlContent;
}

public string Title { get; }
public string ContextKey { get; }
public string HtmlContent { get; }
}
}
}

0 comments on commit 5ed7db7

Please sign in to comment.