├── .gitattributes
├── .github
├── CODEOWNERS
└── workflows
│ ├── codeql-analysis.yml
│ └── dotnet-format.yml
├── .gitignore
├── .gitmodules
├── .nuget
└── NuGet.exe
├── .pipelines
└── OneBranch.Official.yml
├── BuildAndTest.cmd
├── BuildVsixFromSigningDirectory.cmd
├── CONTRIBUTING.md
├── Content.md
├── GeneratedKey.snk
├── LICENSE
├── README.md
├── RunTests.cmd
├── SECURITY.md
├── Vsix.cmd
├── assets
├── Contributing-ErrorList.png
├── Contributing-Exp.png
├── Contributing-ExtensionsWorkload.png
├── Contributing-PackageError.png
└── Contributing-SetAsStartupProject.png
├── azure-pipelines.yml
├── docs
└── ResolvingLocalSourceFilePathFlow.md
├── dotnet-install.ps1
├── scripts
├── BuildAndTest.ps1
├── BuildPackagesFromSigningDirectory.ps1
├── New-AtomXml.ps1
├── Projects.psm1
├── RegistrySettings.ps1
├── Run-Tests.ps1
├── ScriptUtilities.psm1
├── Unzip.ps1
└── Vsix.ps1
├── src
├── .editorconfig
├── .ruleset
├── CommonAssemblyInfo.cs
├── Key.snk
├── ReleaseHistory.md
├── Sarif.Sarifer.2022
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ └── Package.ico
│ ├── Sarif.Sarifer.2022.csproj
│ ├── VSPackage.Designer.cs
│ ├── VSPackage.resx
│ └── source.extension.vsixmanifest
├── Sarif.Sarifer.Core
│ ├── BackgroundAnalysisService.cs
│ ├── BackgroundAnalysisTextViewCreationListener.cs
│ ├── BackgroundAnalyzerBase.cs
│ ├── Commands
│ │ ├── AnalyzeFileCommand.cs
│ │ ├── AnalyzeMenuCommandBase.cs
│ │ ├── AnalyzeProjectCommand.cs
│ │ ├── AnalyzeSolutionCommand.cs
│ │ ├── AnalyzeSolutionFolderNodeExtender.cs
│ │ ├── GenerateTestDataCommand.cs
│ │ └── SariferPackageCommand.cs
│ ├── FileAndForgetEventName.cs
│ ├── FirstViewAddedEventArgs.cs
│ ├── Guids.cs
│ ├── IBackgroundAnalysisService.cs
│ ├── IBackgroundAnalysisSink.cs
│ ├── IBackgroundAnalyzer.cs
│ ├── ITextBufferViewTracker.cs
│ ├── LastViewRemovedEventArgs.cs
│ ├── License.txt
│ ├── Options
│ │ ├── ISariferOption.cs
│ │ ├── SariferOption.cs
│ │ ├── SariferOptionsControl.xaml
│ │ ├── SariferOptionsControl.xaml.cs
│ │ ├── SariferOptionsControlResources.xaml
│ │ └── SariferOptionsPage.cs
│ ├── OutputWindowTracerListener.cs
│ ├── Sarif.Sarifer.Core.projitems
│ ├── Sarif.Sarifer.Core.shproj
│ ├── SarifViewerBackgroundAnalysisSink.cs
│ ├── SariferPackage.cs
│ ├── SariferPackageCommandIds.cs
│ ├── SariferPackageCommands.vsct
│ ├── SpamBackgroundAnalyzer.cs
│ ├── TestData
│ │ └── ProofOfConcept.sarif
│ ├── TextBufferViewTracker.cs
│ ├── TextBufferViewTrackingInformation.cs
│ ├── TextEditIdleAssistant.cs
│ ├── TextEditIdledEventArgs.cs
│ ├── ViewUpdatedEventArgs.cs
│ └── VsUtilities.cs
├── Sarif.Sarifer.UnitTests
│ ├── AnalyzeSolutionFolderCommandHandlerTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Sarif.Sarifer.UnitTests.csproj
│ ├── SpamBackgroundAnalyzerTests.cs
│ └── VsUtilitiesTests.cs
├── Sarif.Sarifer
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ └── Package.ico
│ ├── Sarif.Sarifer.csproj
│ ├── VSPackage.Designer.cs
│ ├── VSPackage.resx
│ └── source.extension.vsixmanifest
├── Sarif.Viewer.VisualStudio.2022
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Sarif.Viewer.VisualStudio.2022.csproj
│ ├── Triskele.ico
│ ├── VSPackage.resx
│ └── source.extension.vsixmanifest
├── Sarif.Viewer.VisualStudio.Core
│ ├── App.config
│ ├── CodeAnalysisResultManager.cs
│ ├── CodeFinding
│ │ ├── CodeFinder.cs
│ │ ├── FileSpan.cs
│ │ ├── Internals
│ │ │ ├── CStyle
│ │ │ │ ├── CSharpFinder.cs
│ │ │ │ ├── CStyleFinder.cs
│ │ │ │ ├── CppFinder.cs
│ │ │ │ └── ScopeIdentifier.cs
│ │ │ ├── CodeFinderBase.cs
│ │ │ ├── DefaultMatcher.cs
│ │ │ ├── FileSpanCollection.cs
│ │ │ ├── ListExtensions.cs
│ │ │ └── StringExtensions.cs
│ │ ├── Language.cs
│ │ ├── MatchQuery.cs
│ │ └── MatchResult.cs
│ ├── CodeFlowToTreeConverter.cs
│ ├── CodeLocationObject.cs
│ ├── CodeLocationObjectTypeDescriptor.cs
│ ├── Constants.cs
│ ├── ContentTypes.cs
│ ├── Controls
│ │ ├── BindableTextBlock.cs
│ │ ├── FeedbackControl.xaml
│ │ ├── FeedbackControl.xaml.cs
│ │ ├── FeedbackDialog.cs
│ │ ├── FeedbackStringResources.xaml
│ │ ├── InfoBar.cs
│ │ ├── InternetHyperlink.xaml
│ │ ├── InternetHyperlink.xaml.cs
│ │ └── VsDropDown.xaml
│ ├── Converters
│ │ ├── AnalysisStepNodeToTextConverter.cs
│ │ ├── BindingDebugConverter.cs
│ │ ├── BooleanToCollapsedVisibilityConverter.cs
│ │ ├── BooleanToVisibilityConverter.cs
│ │ ├── CollectionToBooleanConverter.cs
│ │ ├── CollectionToCountConverter.cs
│ │ ├── CollectionToJoinedStringConverter.cs
│ │ ├── CollectionToVisibilityConverter.cs
│ │ ├── FileExistsToBooleanConverter.cs
│ │ ├── Int32ToVisibilityConverter.cs
│ │ ├── MultipleStringsToVisibilityConverter.cs
│ │ ├── ObjectToVisibilityConverter.cs
│ │ └── StringToVisibilityConverter.cs
│ ├── Data
│ │ └── ruleLookup.json
│ ├── DelegateCommand.cs
│ ├── DelegateCommandBase.cs
│ ├── ErrorList
│ │ ├── BaselineStateTableDataSource.cs
│ │ ├── ColumnFilterer.cs
│ │ ├── ErrorListCommand.cs
│ │ ├── ErrorListService.cs
│ │ ├── FilteredColumnValue.cs
│ │ ├── IColumnFilterer.cs
│ │ ├── ISarifErrorListEventSelectionService.cs
│ │ ├── SarifErrorListEventProcessor.cs
│ │ ├── SarifErrorListEventProcessorProvider.cs
│ │ ├── SarifErrorListSelectionChangedEventArgs.cs
│ │ ├── SarifResultTableEntry.cs
│ │ ├── SarifTableDataSource.cs
│ │ ├── SarifTableDataSourceBase.cs
│ │ ├── SinkHolder.cs
│ │ ├── StubDisposable.cs
│ │ └── SuppressionStateTableDataSource.cs
│ ├── ExceptionalConditions.cs
│ ├── ExceptionalConditionsCalculator.cs
│ ├── FileAndForgetEventName.cs
│ ├── FileMonitor
│ │ ├── ISarifFileMonitor.cs
│ │ ├── SarifFolderMonitor.cs
│ │ └── SarifLogsMonitor.cs
│ ├── Fixes
│ │ ├── ApplyFixEventArgs.cs
│ │ ├── DisposableDifferenceViewerControl.xaml
│ │ ├── DisposableDifferenceViewerControl.xaml.cs
│ │ ├── DisposableDifferenceViewerControlStringResources.xaml
│ │ ├── EditActionPreviewProvider.cs
│ │ ├── FixSuggestedAction.cs
│ │ ├── FixSuggestedActionsSource.cs
│ │ ├── FixSuggestedActionsSourceProvider.cs
│ │ ├── IPreviewProvider.cs
│ │ ├── LineSpan.cs
│ │ ├── ProjectionBufferFactoryServiceExtensions.cs
│ │ ├── ReplacementEdit.cs
│ │ ├── SizeToFitHelper.cs
│ │ └── SuppressSuggestedAction.cs
│ ├── GlobalSuppressions.cs
│ ├── Guids.cs
│ ├── HashHelper.cs
│ ├── ICodeAnalysisResultManager.cs
│ ├── IToolWindow.cs
│ ├── KeyValuePairPropertyDescriptor.cs
│ ├── License.txt
│ ├── LogProcessedEventArgs.cs
│ ├── Models
│ │ ├── AnalysisStep.cs
│ │ ├── AnalysisStepCollection.cs
│ │ ├── AnalysisStepNode.cs
│ │ ├── ArtifactChangeModel.cs
│ │ ├── ArtifactDetailsModel.cs
│ │ ├── FeedbackModel.cs
│ │ ├── FeedbackType.cs
│ │ ├── FixModel.cs
│ │ ├── ISarifErrorListItem.cs
│ │ ├── InvocationModel.cs
│ │ ├── LocationCollection.cs
│ │ ├── LocationModel.cs
│ │ ├── ReplacementModel.cs
│ │ ├── RuleModel.cs
│ │ ├── SarifErrorListItem.cs
│ │ ├── SarifErrorListItemProperties.cs
│ │ ├── ScrollViewerWrapper.cs
│ │ ├── StackCollection.cs
│ │ ├── StackFrameModel.cs
│ │ ├── SuppressionModel.cs
│ │ ├── ToolModel.cs
│ │ └── VSSuppressionState.cs
│ ├── NotifyPropertyChangedObject.cs
│ ├── OpenLogFileCommands.cs
│ ├── Options
│ │ ├── ColorOption.cs
│ │ ├── ISarifViewerColorOptions.cs
│ │ ├── ISarifViewerGeneralOptions.cs
│ │ ├── LocationTextDecoration.cs
│ │ ├── LocationTextDecorationCollection.cs
│ │ ├── SarifViewerColorOptions.cs
│ │ ├── SarifViewerColorOptionsControl.xaml
│ │ ├── SarifViewerColorOptionsControl.xaml.cs
│ │ ├── SarifViewerColorOptionsPage.cs
│ │ ├── SarifViewerGeneralOptions.cs
│ │ ├── SarifViewerGeneralOptionsControl.xaml
│ │ ├── SarifViewerGeneralOptionsControl.xaml.cs
│ │ ├── SarifViewerGeneralOptionsPage.cs
│ │ ├── SarifViewerOptionsControlResources.xaml
│ │ └── SelectedColorChangedEventArgs.cs
│ ├── OutputWindowTracerListener.cs
│ ├── ProjectHelper.cs
│ ├── ProjectKind.cs
│ ├── ProjectNameCache.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── ResultTextMarker.cs
│ ├── RunDataCache.cs
│ ├── RunSummary.cs
│ ├── Sarif.Viewer.VisualStudio.Core.projitems
│ ├── Sarif.Viewer.VisualStudio.Core.shproj
│ ├── Sarif
│ │ ├── ArtifactChange.Extensions.cs
│ │ ├── CodeFlow.Extensions.cs
│ │ ├── FailureLevel.Extensions.cs
│ │ ├── Fix.Extensions.cs
│ │ ├── Invocation.Extensions.cs
│ │ ├── Location.Extensions.cs
│ │ ├── Region.Extensions.cs
│ │ ├── Replacement.Extensions.cs
│ │ ├── Result.Extensions.cs
│ │ ├── Rule.Extensions.cs
│ │ ├── Run.Extensions.cs
│ │ ├── SarifErrorListItem.Extensions.cs
│ │ ├── SarifLog.Extensions.cs
│ │ ├── Stack.Extensions.cs
│ │ ├── StackFrame.Extensions.cs
│ │ ├── Suppression.Extensions.cs
│ │ ├── ThreadFlowLocation.Extensions.cs
│ │ └── Tool.Extensions.cs
│ ├── SarifCommandPackage.vsct
│ ├── SarifExplorerWindow.cs
│ ├── SarifFileAndContentDefinitions.cs
│ ├── SarifTextViewCreationListener.cs
│ ├── SarifToolWindowCommand.cs
│ ├── SarifViewerPackage.cs
│ ├── SdkUiUtilities.cs
│ ├── Services
│ │ ├── CloseSarifLogService.cs
│ │ ├── DataService.cs
│ │ ├── ICloseSarifLogService.cs
│ │ ├── IDataService.cs
│ │ ├── ILoadSarifLogService.cs
│ │ ├── LoadSarifLogService.cs
│ │ ├── SCloseSarifLogService.cs
│ │ ├── SDataService.cs
│ │ └── SLoadSarifLogService.cs
│ ├── SpanHelper.cs
│ ├── Tags
│ │ ├── ISarifLocationTag.cs
│ │ ├── ISarifLocationTagCaretNotify.cs
│ │ ├── ISarifLocationTagger.cs
│ │ ├── ISarifLocationTaggerService.cs
│ │ ├── ITextViewCaretListenerService.cs
│ │ ├── KeyEventAdornment.cs
│ │ ├── KeyEventAdornmentManager.cs
│ │ ├── KeyEventTextViewCreationListener.cs
│ │ ├── SarifLocationErrorTag.cs
│ │ ├── SarifLocationErrorTagger.cs
│ │ ├── SarifLocationTagBase.cs
│ │ ├── SarifLocationTagHelpers.cs
│ │ ├── SarifLocationTaggerProvider.cs
│ │ ├── SarifLocationTaggerService.cs
│ │ ├── SarifLocationTextMarkerTag.cs
│ │ ├── SarifLocationTextMarkerTagger.cs
│ │ ├── TagInCaretChangedEventArgs.cs
│ │ ├── TextViewCaretListener.cs
│ │ └── TextViewCaretListenerService.cs
│ ├── Telemetry
│ │ ├── Events.cs
│ │ ├── FeedbackTelemetryEvent.cs
│ │ ├── ITelemetryProvider.cs
│ │ ├── KeyEventTelemetry.cs
│ │ ├── KeyEventTelemetryClient.cs
│ │ ├── Telemetry.Extensions.cs
│ │ └── TelemetryProvider.cs
│ ├── Themes
│ │ ├── AnalysisStepsStyles.xaml
│ │ ├── DefaultStyles.xaml
│ │ ├── FixesStyles.xaml
│ │ ├── InformationStyles.xaml
│ │ ├── LocationsStyles.xaml
│ │ ├── SarifViewerControlStyles.xaml
│ │ └── StacksStyles.xaml
│ ├── Uri.extensions.cs
│ ├── VersionControlParser
│ │ ├── AdoVersionControlParser.cs
│ │ ├── GithubVersionControlParser.cs
│ │ ├── IVersionControlParser.cs
│ │ ├── VersionControlParser.cs
│ │ └── VersionControlParserFactory.cs
│ ├── ViewModels
│ │ └── ViewModelLocator.cs
│ ├── Views
│ │ ├── AnalysisStepView.cs
│ │ ├── AnalysisSteps.xaml
│ │ ├── AnalysisStepsStringResources.xaml
│ │ ├── Information.xaml
│ │ ├── InformationStringResources.xaml
│ │ ├── Locations.xaml
│ │ ├── LocationsStringResources.xaml
│ │ ├── RelatedLocationsTreeView.cs
│ │ ├── ResolveEmbeddedFileDialog.xaml
│ │ ├── ResolveEmbeddedFileDialog.xaml.cs
│ │ ├── SarifToolWindowControl.xaml
│ │ ├── SarifToolWindowControl.xaml.cs
│ │ ├── SarifViewerControl.xaml
│ │ ├── SarifViewerControl.xaml.cs
│ │ ├── SarifViewerControlStringResources.xaml
│ │ ├── Stacks.xaml
│ │ ├── StacksStringResources.xaml
│ │ └── TreeView.xaml
│ ├── WeakEventHandlerManager.cs
│ ├── icon.png
│ ├── index.html
│ ├── overview.md
│ └── readme.md
├── Sarif.Viewer.VisualStudio.Interop
│ ├── ISarifViewerInterop.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Sarif.Viewer.VisualStudio.Interop.csproj
│ ├── Sarif.Viewer.VisualStudio.Interop.nuspec
│ ├── SarifViewerInterop.cs
│ └── icon.png
├── Sarif.Viewer.VisualStudio.ResultSources.ACL.2022
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.ACL.2022.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.ACL.Core
│ ├── Sarif.Viewer.VisualStudio.ResultSources.ACL.Core.projitems
│ ├── Sarif.Viewer.VisualStudio.ResultSources.ACL.Core.shproj
│ └── SecretStoreRepository.cs
├── Sarif.Viewer.VisualStudio.ResultSources.ACL
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.ACL.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.Domain.2022
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.Domain.2022.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.Domain.Core
│ ├── Abstractions
│ │ └── ISecretStoreRepository.cs
│ ├── Entities
│ │ └── Secret.cs
│ ├── Errors
│ │ └── Error.cs
│ ├── HttpClientAdapter.cs
│ ├── IHttpClientAdapter.cs
│ ├── Models
│ │ ├── Constants.cs
│ │ ├── ErrorListMenuCommand.cs
│ │ ├── ErrorListMenuFlyout.cs
│ │ ├── ErrorListMenuItem.cs
│ │ ├── ErrorListMenuItems.cs
│ │ ├── MenuCommandBeforeQueryStatusEventArgs.cs
│ │ ├── MenuCommandInvokedEventArgs.cs
│ │ ├── NoContent.cs
│ │ ├── RequestAddMenuItemsEventArgs.cs
│ │ ├── ResultSourceServiceAction.cs
│ │ ├── ResultSourceServiceEventType.cs
│ │ ├── ResultsUpdatedEventArgs.cs
│ │ ├── Secret.cs
│ │ └── ServiceEventArgs.cs
│ ├── Sarif.Viewer.VisualStudio.ResultSources.Domain.Core.projitems
│ ├── Sarif.Viewer.VisualStudio.ResultSources.Domain.Core.shproj
│ └── Services
│ │ ├── ErrorType.cs
│ │ └── IResultSourceService.cs
├── Sarif.Viewer.VisualStudio.ResultSources.Domain
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.Domain.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.Factory.2022
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.Factory.2022.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.Factory.Core
│ ├── IResultSourceFactory.cs
│ ├── ResultSourceFactory.cs
│ ├── ResultSourceHost.cs
│ ├── SampleResultSourceService.cs
│ ├── Sarif.Viewer.VisualStudio.ResultSources.Factory.Core.projitems
│ └── Sarif.Viewer.VisualStudio.ResultSources.Factory.Core.shproj
├── Sarif.Viewer.VisualStudio.ResultSources.Factory.UnitTests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ResultSourceFactoryTests.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.Factory.UnitTests.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.Factory
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.Factory.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.2022
│ ├── GitHubInfoBarHelper.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.2022.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.Core
│ ├── Errors
│ │ └── GitHubServiceError.cs
│ ├── Models
│ │ ├── UserVerificationResponse.cs
│ │ └── VerificationCode.cs
│ ├── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.Core.projitems
│ ├── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.Core.shproj
│ └── Services
│ │ ├── GitHubSourceService.cs
│ │ ├── GitRepoEventArgs.cs
│ │ └── IGitHubSourceService.cs
├── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.Resources
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ └── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.Resources.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.UnitTests
│ ├── GitHubSourceServiceTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.UnitTests.csproj
├── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity
│ ├── GitHubInfoBarHelper.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.csproj
├── Sarif.Viewer.VisualStudio.Shell.2022
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.Shell.2022.csproj
├── Sarif.Viewer.VisualStudio.Shell.Core
│ ├── BrowserService.cs
│ ├── FileSystem2.cs
│ ├── FileWatcher.cs
│ ├── GitExe.cs
│ ├── IFileSystem2.cs
│ ├── IFileWatcher.cs
│ ├── IGitExe.cs
│ ├── IInfoBarService.cs
│ ├── IStatusBarService.cs
│ ├── InfoBarService.cs
│ ├── Sarif.Viewer.VisualStudio.Shell.Core.projitems
│ ├── Sarif.Viewer.VisualStudio.Shell.Core.shproj
│ ├── StatusBarService.cs
│ └── VsUtilities.cs
├── Sarif.Viewer.VisualStudio.Shell
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sarif.Viewer.VisualStudio.Shell.csproj
├── Sarif.Viewer.VisualStudio.UnitTests
│ ├── AnalysisStepTraversalTests.cs
│ ├── CodeAnalysisResultManagerTests.cs
│ ├── CodeFinding
│ │ ├── README.md
│ │ ├── TestFiles
│ │ │ ├── C1.c
│ │ │ ├── CSharp2.cs
│ │ │ ├── Cpp1.cpp
│ │ │ └── Csharp1.cs
│ │ └── UnitTests
│ │ │ ├── CSharpTestMultiLine.cs
│ │ │ ├── CTests.cs
│ │ │ ├── CTests2.cs
│ │ │ ├── CodeFinderUnitTestBase.cs
│ │ │ ├── CppTests.cs
│ │ │ ├── CppTests2.cs
│ │ │ ├── CsharpTests.cs
│ │ │ ├── FileSpanCollectionTests.cs
│ │ │ └── IgnoredRegionsTests.cs
│ ├── ConverterResourceTests.cs
│ ├── Converters
│ │ ├── AnalysisStepNodeToTextConverterTests.cs
│ │ └── CollectionToVisibilityConverterTests.cs
│ ├── ErrorList
│ │ ├── ErrorListServiceTests.cs
│ │ ├── MultipleRunsPerSarifTests.cs
│ │ ├── SarifErrorListItemTests.cs
│ │ ├── SarifFileWithContentsTests.cs
│ │ ├── SarifResultEntryTests.cs
│ │ └── SarifTableDataSourceTests.cs
│ ├── ExceptionalConditionsCalculatorTests.cs
│ ├── FileWatcher
│ │ └── SarifFolderWatcherTests.cs
│ ├── GitExeTests.cs
│ ├── Models
│ │ ├── AnalysisStepCollectionTests.cs
│ │ ├── AnalysisStepNodeTests.cs
│ │ ├── AnalysisStepTests.cs
│ │ ├── ArtifactChangeModelTests.cs
│ │ ├── ReplacementModelTests.cs
│ │ ├── RuleModelTests.cs
│ │ ├── SarifErrorListItemTests.cs
│ │ └── ScrollViewerWrapperTests.cs
│ ├── OutputWindowTracerListenerTests.cs
│ ├── ProjectNameCacheTests.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── VersionConstants.cs
│ ├── ResourceExtractor.cs
│ ├── ResultTextMarkerTests.cs
│ ├── RunSummaryTests.cs
│ ├── Sarif.Viewer.VisualStudio.UnitTests.csproj
│ ├── Sarif
│ │ ├── ArtifactChangeExtensionsTests.cs
│ │ ├── FixExtensionsTests.cs
│ │ ├── LocationExtensionsTest.cs
│ │ ├── ReplacementExtensionsTests.cs
│ │ ├── RunExtensionsTests.cs
│ │ └── StackFrameExtensionsTests.cs
│ ├── SarifTextViewCreationListenerTests.cs
│ ├── SarifViewerPackageUnitTests.cs
│ ├── SdkUiUtilitiesTests.cs
│ ├── SpanHelperTests.cs
│ ├── StringBuilderFileStreamMock.cs
│ ├── SuppressionTests.cs
│ ├── Telemetry
│ │ └── KeyEventTelemetryTests.cs
│ ├── TestData
│ │ ├── BinaryTestFiles
│ │ │ ├── Binaries
│ │ │ │ ├── macho-binary
│ │ │ │ └── testapp.pdb
│ │ │ └── NonBinaries
│ │ │ │ ├── csharpfile.cs
│ │ │ │ └── test.html
│ │ └── FixModel
│ │ │ ├── index.html
│ │ │ └── index_fixed.html
│ ├── TestTraits.cs
│ ├── TestUtilities.cs
│ ├── ThreadFlowToTreeConverterTests.cs
│ ├── UriExtensionsTests.cs
│ └── VersionControlParserTests.cs
├── Sarif.Viewer.VisualStudio.sln
├── Sarif.Viewer.VisualStudio
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Sarif.Viewer.VisualStudio.csproj
│ ├── Triskele.ico
│ ├── VSPackage.resx
│ └── source.extension.vsixmanifest
├── build.props
├── build2022.props
├── strongname.props
├── stylecop.json
└── version.json
├── triskelion.png
└── vs-manifest.json
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Code owners file.
2 | # This file controls who is tagged for review for any given pull request.
3 |
4 | # For anything not explicitly taken by someone else:
5 | * @EasyRhinoMSFT @michaelcfanning @50wliu @chrishuynhc
6 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | name: "CodeQL"
2 |
3 | on:
4 | push:
5 | branches: '**'
6 | pull_request:
7 | # The branches below must be a subset of the branches above
8 | branches: [ main ]
9 | schedule:
10 | - cron: '0 0 * * 0'
11 |
12 | jobs:
13 | analyze:
14 | name: Analyze
15 | runs-on: windows-latest
16 | permissions:
17 | actions: read
18 | contents: read
19 | security-events: write
20 |
21 | strategy:
22 | fail-fast: false
23 | matrix:
24 | language: [ 'csharp' ]
25 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
26 | # Learn more about CodeQL language support at https://git.io/codeql-language-support
27 |
28 | steps:
29 | - name: Checkout repository
30 | uses: actions/checkout@v2
31 | with:
32 | fetch-depth: 0
33 |
34 | - name: Add msbuild to PATH
35 | uses: microsoft/setup-msbuild@v1.0.2
36 |
37 | - name: Initialize CodeQL
38 | uses: github/codeql-action/init@v2
39 | with:
40 | languages: csharp
41 |
42 | - run: |
43 | .\BuildAndTest.cmd -NoFormat -NoTest
44 |
45 | - name: Perform CodeQL Analysis
46 | uses: github/codeql-action/analyze@v2
47 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet-format.yml:
--------------------------------------------------------------------------------
1 | name: dotnet format
2 |
3 | on:
4 | pull_request:
5 | branches: [ main ]
6 |
7 | jobs:
8 | check-format:
9 | runs-on: windows-latest
10 |
11 | steps:
12 | - name: Check out code
13 | uses: actions/checkout@v2
14 |
15 | - name: Install format tool
16 | run: dotnet tool install -g dotnet-format
17 |
18 | - name: Run dotnet format
19 | run: dotnet-format --folder --check
20 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/Sarif.Viewer.VisualStudio.UnitTests/sarif-visualstudio-extension"]
2 | path = src/Sarif.Viewer.VisualStudio.UnitTests/sarif-visualstudio-extension
3 | url = https://github.com/microsoft/sarif-visualstudio-extension.git
4 | branch = Testing-branch
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/BuildAndTest.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -ExecutionPolicy RemoteSigned -File %~dp0\scripts\BuildAndTest.ps1 %*
3 |
--------------------------------------------------------------------------------
/GeneratedKey.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/GeneratedKey.snk
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/Vsix.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -ExecutionPolicy RemoteSigned -File %~dp0\scripts\Vsix.ps1 %*
3 |
--------------------------------------------------------------------------------
/assets/Contributing-ErrorList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/assets/Contributing-ErrorList.png
--------------------------------------------------------------------------------
/assets/Contributing-Exp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/assets/Contributing-Exp.png
--------------------------------------------------------------------------------
/assets/Contributing-ExtensionsWorkload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/assets/Contributing-ExtensionsWorkload.png
--------------------------------------------------------------------------------
/assets/Contributing-PackageError.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/assets/Contributing-PackageError.png
--------------------------------------------------------------------------------
/assets/Contributing-SetAsStartupProject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/assets/Contributing-SetAsStartupProject.png
--------------------------------------------------------------------------------
/scripts/Projects.psm1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Provides a list of SARIF Viewer projects and frameworks.
4 | .DESCRIPTION
5 | The Projects module exports variables whose properties specify the
6 | various kinds of projects in the SARIF Viewer, and the frameworks
7 | for which they are built.
8 | #>
9 |
10 | # .NET Framework versions for which we build.
11 | $Frameworks = @("net472")
12 |
13 | $Projects = @{}
14 | $Projects.Vsix = @(
15 | "Sarif.Viewer.VisualStudio.2022",
16 | "Sarif.Viewer.VisualStudio")
17 | $Projects.NuGet = @("Sarif.Viewer.VisualStudio.Interop")
18 | $Projects.Library = @(
19 | "Sarif.Viewer.VisualStudio.ResultSources.ACL.2022",
20 | "Sarif.Viewer.VisualStudio.ResultSources.ACL",
21 | "Sarif.Viewer.VisualStudio.ResultSources.Domain.2022",
22 | "Sarif.Viewer.VisualStudio.ResultSources.Domain",
23 | "Sarif.Viewer.VisualStudio.Shell.2022",
24 | "Sarif.Viewer.VisualStudio.Shell",
25 | "Sarif.Viewer.VisualStudio.ResultSources.Factory.2022",
26 | "Sarif.Viewer.VisualStudio.ResultSources.Factory",
27 | "Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.2022",
28 | "Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity",
29 | "Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.Resources")
30 | $Projects.Product = $Projects.Vsix + $Projects.NuGet
31 | $Projects.Test = @(
32 | "Sarif.Viewer.VisualStudio.UnitTests",
33 | "Sarif.Viewer.VisualStudio.ResultSources.Factory.UnitTests",
34 | "Sarif.Viewer.VisualStudio.ResultSources.GitHubAdvancedSecurity.UnitTests")
35 | $Projects.All = $Projects.Product + $Projects.Test + $Projects.Library
36 |
37 | Export-ModuleMember -Variable Frameworks, Projects
--------------------------------------------------------------------------------
/scripts/RegistrySettings.ps1:
--------------------------------------------------------------------------------
1 | #Requires -RunAsAdministrator
2 |
3 | $ErrorActionPreference = "stop"
4 | $InformationPreference = "continue"
5 |
6 | try {
7 | $vsExePath = (Get-ChildItem -Path ${env:ProgramFiles(x86)} -Filter "devenv.exe" -Recurse)[0].FullName
8 | $rootPath = ".\SOFTWARE\Classes"
9 | Push-Location
10 | Set-Location HKLM:
11 | Write-Information "Setting up the registery keys to run .sarif files with Visual Studio by default ...."
12 | New-Item -Path (Join-Path $rootPath "\.sarif") -Value "SARIFFILE" -Force | Out-Null
13 | $sarifFilePath = Join-Path $rootPath "SARIFFILE\shell\Open"
14 | New-Item -Path $sarifFilePath -Value "&Open with Visual Studio SARIF Viewer" -Force | Out-Null
15 | New-Item -Path "$sarifFilePath\Command" -Value $vsExePath -Force | Out-Null
16 | Write-Information "Registery Key Setting are done"
17 | } catch {
18 | Write-Information $_
19 | } finally {
20 | Pop-Location
21 | }
--------------------------------------------------------------------------------
/scripts/Run-Tests.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Runs tests in all test projects.
4 |
5 | .DESCRIPTION
6 | This script runs the tests in each test project. This is done in a separate script,
7 | rather than inline in BuildAndTest.ps1, because AppVeyor cannot run BuildAndTest.
8 | AppVeyor runs the tests by invoking a separate script, and this is it.
9 |
10 | .PARAMETER Configuration
11 | The build configuration: Release or Debug. Default=Release
12 | #>
13 |
14 | [CmdletBinding()]
15 | param(
16 | [string]
17 | [ValidateSet("Debug", "Release")]
18 | $Configuration="Release"
19 | )
20 |
21 | Set-StrictMode -Version Latest
22 | $ErrorActionPreference = "Stop"
23 | $InformationPreference = "Continue"
24 |
25 | Import-Module $PSScriptRoot\ScriptUtilities.psm1 -Force
26 | Import-Module $PSScriptRoot\Projects.psm1 -Force
27 |
28 | $ScriptName = $([io.Path]::GetFileNameWithoutExtension($PSCommandPath))
29 |
30 | $TestRunnerRootPath = "$NuGetPackageRoot\xunit.runner.console\2.4.1\tools\"
31 |
32 | foreach ($project in $Projects.Test) {
33 | Write-Information "Running tests in ${project}..."
34 | Push-Location $BinRoot\${Platform}_$Configuration\$project
35 | $dll = "$project" + ".dll"
36 | & ${TestRunnerRootPath}net472\xunit.console.exe $dll -parallel none
37 | if ($LASTEXITCODE -ne 0) {
38 | Pop-Location
39 | Exit-WithFailureMessage $ScriptName "${project}: tests failed."
40 | }
41 | Pop-Location
42 | }
43 |
--------------------------------------------------------------------------------
/scripts/Unzip.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Unzips archives to a specified path.
4 | .DESCRIPTION
5 | Unzips archives to a specified path.
6 | .PARAMETER Archive
7 | The path to the archive
8 | .PARAMETER ExtractTo
9 | The directory to which the archive should be expanded
10 | #>
11 |
12 | [CmdletBinding()]
13 | param(
14 | [string]
15 | $Archive,
16 |
17 | [string]
18 | $ExtractTo
19 | )
20 |
21 | [System.Console]::WriteLine($Archive)
22 | [System.Console]::WriteLine($ExtractTo)
23 |
24 | Remove-Item -LiteralPath $ExtractTo -Force -Recurse
25 |
26 | Add-Type -AssemblyName System.IO.Compression.FileSystem
27 |
28 | [System.IO.Compression.ZipFile]::ExtractToDirectory($archive, $extractTo)
29 |
--------------------------------------------------------------------------------
/src/.ruleset:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/CommonAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Runtime.InteropServices;
5 |
6 | // Setting ComVisible to false makes the types in this assembly not visible
7 | // to COM components. If you need to access a type in this assembly from
8 | // COM, set the ComVisible attribute to true on that type.
9 | [assembly: ComVisible(false)]
10 |
--------------------------------------------------------------------------------
/src/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/src/Key.snk
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.2022/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Reflection;
5 | using System.Resources;
6 | using System.Runtime.CompilerServices;
7 |
8 | [assembly: AssemblyTitle("Sarifer test data producer extension for Visual Studio")]
9 | [assembly: AssemblyDescription("Generates test data in SARIF format and provides it to the SARIF viewer extension, upon which it depends.")]
10 |
11 | [assembly: NeutralResourcesLanguage("en")]
12 |
13 | // This reference necessary for the MOQ test engine.
14 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
15 | [assembly: InternalsVisibleTo("Sarif.Sarifer.UnitTests")]
16 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.2022/Resources/Package.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/src/Sarif.Sarifer.2022/Resources/Package.ico
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Commands/AnalyzeFileCommand.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Collections.Generic;
5 | using System.ComponentModel.Design;
6 | using System.Linq;
7 |
8 | using EnvDTE;
9 |
10 | using Microsoft.VisualStudio.Shell;
11 |
12 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer.Commands
13 | {
14 | internal class AnalyzeFileCommand : AnalyzeMenuCommandBase
15 | {
16 | public AnalyzeFileCommand(IMenuCommandService menuCommandService)
17 | : base(menuCommandService, SariferPackageCommandIds.AnalyzeFile)
18 | {
19 | }
20 |
21 | protected override void AnalyzeTargets()
22 | {
23 | ThreadHelper.ThrowIfNotOnUIThread();
24 |
25 | var targetFiles = new List();
26 |
27 | if (this.dte.SelectedItems != null && this.dte.SelectedItems.Count > 0)
28 | {
29 | foreach (SelectedItem selectedItem in this.dte.SelectedItems)
30 | {
31 | targetFiles.AddRange(SariferPackageCommand.GetFiles(selectedItem));
32 | }
33 |
34 | if (targetFiles.Any())
35 | {
36 | // Disable the menu click when we are analysing.
37 | SariferPackageCommand.DisableAnalyzeCommands(this.menuCommandService);
38 | string logId = targetFiles.First() + (targetFiles.Count > 1 ? $"~{targetFiles.Count}" : string.Empty);
39 | this.backgroundAnalysisService.AnalyzeAsync(logId, targetFiles, this.cancellationTokenSource.Token)
40 | .FileAndForget(FileAndForgetEventName.BackgroundAnalysisFailure);
41 | }
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Commands/AnalyzeProjectCommand.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Collections.Generic;
5 | using System.ComponentModel.Design;
6 | using System.Linq;
7 |
8 | using EnvDTE;
9 |
10 | using Microsoft.VisualStudio.Shell;
11 |
12 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer.Commands
13 | {
14 | internal class AnalyzeProjectCommand : AnalyzeMenuCommandBase
15 | {
16 | public AnalyzeProjectCommand(IMenuCommandService menuCommandService)
17 | : base(menuCommandService, SariferPackageCommandIds.AnalyzeProject)
18 | {
19 | }
20 |
21 | protected override void AnalyzeTargets()
22 | {
23 | ThreadHelper.ThrowIfNotOnUIThread();
24 |
25 | IEnumerable selectedProjects = (this.dte.ActiveSolutionProjects as object[]).OfType();
26 | if (selectedProjects != null)
27 | {
28 | foreach (Project project in selectedProjects)
29 | {
30 | // Disable the menu click when we are analysing.
31 | SariferPackageCommand.DisableAnalyzeCommands(this.menuCommandService);
32 |
33 | List targetFiles = SariferPackageCommand.GetFiles(project);
34 |
35 | this.backgroundAnalysisService.AnalyzeAsync(project.FullName, targetFiles, this.cancellationTokenSource.Token)
36 | .FileAndForget(FileAndForgetEventName.BackgroundAnalysisFailure);
37 | }
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Commands/AnalyzeSolutionCommand.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Collections.Generic;
5 | using System.ComponentModel.Design;
6 |
7 | using EnvDTE;
8 |
9 | using Microsoft.VisualStudio.Shell;
10 |
11 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer.Commands
12 | {
13 | internal class AnalyzeSolutionCommand : AnalyzeMenuCommandBase
14 | {
15 | public AnalyzeSolutionCommand(IMenuCommandService menuCommandService)
16 | : base(menuCommandService, SariferPackageCommandIds.AnalyzeSolution)
17 | {
18 | }
19 |
20 | protected override void AnalyzeTargets()
21 | {
22 | ThreadHelper.ThrowIfNotOnUIThread();
23 |
24 | Solution solution = this.dte.Solution;
25 | if (solution == null)
26 | {
27 | return;
28 | }
29 |
30 | Projects projects = solution.Projects;
31 | if (projects == null)
32 | {
33 | return;
34 | }
35 |
36 | var targetFiles = new List();
37 | foreach (Project project in projects)
38 | {
39 | targetFiles.AddRange(SariferPackageCommand.GetFiles(project));
40 | }
41 |
42 | // Disable the menu click when we are analysing.
43 | SariferPackageCommand.DisableAnalyzeCommands(this.menuCommandService);
44 | this.backgroundAnalysisService.AnalyzeAsync(solution.FullName, targetFiles, this.cancellationTokenSource.Token)
45 | .FileAndForget(FileAndForgetEventName.BackgroundAnalysisFailure);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/FileAndForgetEventName.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
5 | {
6 | internal static class FileAndForgetEventName
7 | {
8 | internal const string BackgroundAnalysisFailure = Prefix + "BackgroundAnalysis/Failure";
9 | internal const string CloseSarifLogsFailure = Prefix + "CloseSarifLogs/Failure";
10 | internal const string SendDataToViewerFailure = Prefix + "SendDataToViewer/Failure";
11 |
12 | private const string Prefix = "Microsoft/Sarifer/";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Guids.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
7 | {
8 | ///
9 | /// Defines GUIDs used by this package. The values must match the values used in the VSCT file.
10 | ///
11 | internal static class Guids
12 | {
13 | public static readonly Guid SariferCommandSet = new Guid("{CD8EE607-A630-4652-B2BA-748F534235C1}");
14 | public static readonly Guid SariferFolderViewCommandSet = new Guid("71F099FC-EC9E-47D4-9723-9F3865CD0858");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/LastViewRemovedEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | using Microsoft.VisualStudio.Text;
7 | using Microsoft.VisualStudio.Text.Editor;
8 |
9 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
10 | {
11 | ///
12 | /// Provides data for the event handler invoked when the last on an
13 | /// is closed.
14 | ///
15 | public class LastViewRemovedEventArgs : EventArgs
16 | {
17 | ///
18 | /// Initializes a new instance of the class.
19 | ///
20 | ///
21 | /// The path to the file whose contents are being viewed.
22 | ///
23 | public LastViewRemovedEventArgs(string path)
24 | {
25 | this.Path = path;
26 | }
27 |
28 | ///
29 | /// Gets the path to the file whose contents are being viewed, or null if
30 | /// is not associated with a file.
31 | ///
32 | public string Path { get; }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/License.txt:
--------------------------------------------------------------------------------
1 | SARIFER ver. 2.0
2 | Copyright (c) Microsoft Corporation
3 | All rights reserved.
4 | MIT License
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Options/ISariferOption.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
5 | {
6 | internal interface ISariferOption
7 | {
8 | bool IsBackgroundAnalysisEnabled { get; }
9 |
10 | bool ShouldAnalyzeSarifFile { get; }
11 |
12 | bool IncludesPassResults { get; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Options/SariferOptionsControl.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Windows.Controls;
5 |
6 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
7 | {
8 | ///
9 | /// Interaction logic for SariferOptionsControl.xaml.
10 | ///
11 | public partial class SariferOptionsControl : UserControl
12 | {
13 | ///
14 | /// A handle to the options page instance that this control is bound to.
15 | ///
16 | private readonly SariferOptionsPage sariferOptionsPage;
17 |
18 | public SariferOptionsControl(SariferOptionsPage page)
19 | {
20 | InitializeComponent();
21 | sariferOptionsPage = page;
22 | this.DataContext = sariferOptionsPage;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Options/SariferOptionsControlResources.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 | Sarifer Options
6 |
7 | Enable background analysis automatically.
8 | If enabled, the background analysis would trigger if a file is opened or edited.
9 |
10 | Enable analysis for .sarif files.
11 | If enabled, .sarif files will be analyzed by default.
12 |
13 | Generates pass kind analysis results.
14 | If enabled, pass results will also be captured in analysis results.
15 |
16 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/Sarif.Sarifer.Core.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 710b6e5c-8322-4260-b131-41c18d23358f
5 | 14.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/SariferPackageCommandIds.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
5 | {
6 | ///
7 | /// Define the IDs of the commands implemented by this package. The values must match the
8 | /// values defined in the Buttons section of the VSCT file.
9 | ///
10 | internal static class SariferPackageCommandIds
11 | {
12 | public const int GenerateTestData = 0x2010;
13 | public const int AnalyzeSolution = 0x2020;
14 | public const int AnalyzeProject = 0x2030;
15 | public const int AnalyzeFile = 0x2040;
16 | public const int AnalyzeSolutionFolder = 0x2050;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/TextEditIdleAssistant.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Threading;
6 |
7 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
8 | {
9 | internal class TextEditIdleAssistant : IDisposable
10 | {
11 | // the same delay as the squiggle provider
12 | private const int DefaultUpdateDelayInMS = 3000;
13 |
14 | private readonly Timer waitingTimer;
15 |
16 | private TextEditIdledEventArgs args;
17 |
18 | public TextEditIdleAssistant()
19 | {
20 | this.waitingTimer = new Timer(p => Idled(this, this.args));
21 | }
22 |
23 | ///
24 | /// Timer event fires when specified delay time passes
25 | ///
26 | public event EventHandler Idled = (sender, e) => { };
27 |
28 | ///
29 | /// Triggered wheneven text content changed.
30 | /// If another change triggered within delay time, it resets timer.
31 | ///
32 | /// Event data.
33 | public void TextChanged(TextEditIdledEventArgs args)
34 | {
35 | this.args = args;
36 |
37 | // reset timer if its triggered within default delay time
38 | this.waitingTimer.Change(DefaultUpdateDelayInMS, Timeout.Infinite);
39 | }
40 |
41 | public void Dispose()
42 | {
43 | this.waitingTimer.Dispose();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.Core/TextEditIdledEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | using Microsoft.VisualStudio.Text.Editor;
11 |
12 | namespace Microsoft.CodeAnalysis.Sarif.Sarifer
13 | {
14 | public class TextEditIdledEventArgs : EventArgs
15 | {
16 | ///
17 | /// Initializes a new instance of the class.
18 | ///
19 | ///
20 | /// Instance of class.
21 | ///
22 | public TextEditIdledEventArgs(ITextView textView)
23 | {
24 | this.TextView = textView;
25 | }
26 |
27 | ///
28 | /// Gets the path to the file whose contents are being viewed, or null if
29 | /// is not associated with a file.
30 | ///
31 | public ITextView TextView { get; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer.UnitTests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Reflection;
5 |
6 | [assembly: AssemblyTitle("Unit Tests for Microsoft SARIF Viewer for Visual Studio")]
7 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Reflection;
5 | using System.Resources;
6 | using System.Runtime.CompilerServices;
7 |
8 | [assembly: AssemblyTitle("Sarifer test data producer extension for Visual Studio")]
9 | [assembly: AssemblyDescription("Generates test data in SARIF format and provides it to the SARIF viewer extension, upon which it depends.")]
10 |
11 | [assembly: NeutralResourcesLanguage("en")]
12 |
13 | // This reference necessary for the MOQ test engine.
14 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
15 | [assembly: InternalsVisibleTo("Sarif.Sarifer.UnitTests")]
16 |
--------------------------------------------------------------------------------
/src/Sarif.Sarifer/Resources/Package.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/src/Sarif.Sarifer/Resources/Package.ico
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.2022/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Reflection;
5 | using System.Resources;
6 | using System.Runtime.CompilerServices;
7 |
8 | [assembly: AssemblyTitle("Microsoft SARIF Viewer for Visual Studio 2022")]
9 | [assembly: AssemblyDescription("Visual Studio Extension for viewing SARIF log files")]
10 |
11 | [assembly: NeutralResourcesLanguage("en")]
12 |
13 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
14 | [assembly: InternalsVisibleTo("Sarif.Viewer.VisualStudio.UnitTests")]
15 | [assembly: InternalsVisibleTo("Sarif.Viewer.VisualStudio.Tests.Apex")]
16 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.2022/Triskele.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/sarif-visualstudio-extension/d7ceaf567b9b61d43257368b8355ac24e51be6f1/src/Sarif.Viewer.VisualStudio.2022/Triskele.ico
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/CodeFinding/Internals/DefaultMatcher.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | namespace Microsoft.Sarif.Viewer.CodeFinding.Internal
5 | {
6 | ///
7 | /// This is really just a wrapper for the base, abstract class.
8 | ///
9 | internal class DefaultFinder : CodeFinderBase
10 | {
11 | public DefaultFinder(string fileContents)
12 | : base(fileContents)
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ContentTypes.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.ComponentModel.Composition;
5 |
6 | using Microsoft.VisualStudio.Utilities;
7 |
8 | namespace Microsoft.Sarif.Viewer
9 | {
10 | public static class ContentTypes
11 | {
12 | ///
13 | /// The content type name for SARIF log files.
14 | ///
15 | public const string Sarif = "SARIF";
16 |
17 | ///
18 | /// The content type name that accepts any file.
19 | ///
20 | public const string Any = "any";
21 |
22 | ///
23 | /// The content type name for text files.
24 | ///
25 | public const string Text = "text";
26 |
27 | ///
28 | /// Gets the base content type definition for SARIF log files..
29 | ///
30 | [Export]
31 | [BaseDefinition("json")]
32 | [Name(Sarif)]
33 | internal static ContentTypeDefinition SarifBaseContentType { get; } = null;
34 |
35 | ///
36 | /// Gets the ".sarif" file extension mapping to "SARIF" content type.
37 | ///
38 | [Export]
39 | [FileExtension(".sarif")]
40 | [ContentType(Sarif)]
41 | internal static FileExtensionToContentTypeDefinition SarifFileExtensionContentType { get; } = null;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Controls/BindableTextBlock.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Collections.ObjectModel;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Documents;
8 |
9 | namespace Microsoft.Sarif.Viewer.Controls
10 | {
11 | public class BindableTextBlock : TextBlock
12 | {
13 | public static readonly DependencyProperty InlineListProperty =
14 | DependencyProperty.Register("InlineList", typeof(ObservableCollection), typeof(BindableTextBlock), new UIPropertyMetadata(null, OnPropertyChanged));
15 |
16 | public ObservableCollection InlineList
17 | {
18 | get { return (ObservableCollection)this.GetValue(InlineListProperty); }
19 | set { this.SetValue(InlineListProperty, value); }
20 | }
21 |
22 | private static void OnPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
23 | {
24 | if (e != null && e.NewValue != null)
25 | {
26 | var textBlock = sender as BindableTextBlock;
27 | var list = e.NewValue as ObservableCollection;
28 | textBlock.Inlines.Clear();
29 | textBlock.Inlines.AddRange(list);
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Controls/FeedbackControl.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Windows.Controls;
5 |
6 | using Microsoft.Sarif.Viewer.Models;
7 |
8 | namespace Microsoft.Sarif.Viewer.Controls
9 | {
10 | ///
11 | /// Interaction logic for FeedbackControl.xaml.
12 | ///
13 | public partial class FeedbackControl : UserControl
14 | {
15 | public FeedbackControl(FeedbackModel model)
16 | {
17 | this.InitializeComponent();
18 |
19 | this.DataContext = model;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Controls/FeedbackDialog.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Collections.Generic;
5 | using System.Windows;
6 |
7 | using Microsoft.Sarif.Viewer.Models;
8 | using Microsoft.VisualStudio.PlatformUI;
9 |
10 | namespace Microsoft.Sarif.Viewer.Controls
11 | {
12 | internal class FeedbackDialog : DialogWindow
13 | {
14 | public FeedbackDialog(string title, FeedbackModel feedbackModel)
15 | {
16 | this.Title = title;
17 | this.SizeToContent = SizeToContent.WidthAndHeight;
18 | this.ResizeMode = ResizeMode.NoResize;
19 |
20 | this.Content = new FeedbackControl(feedbackModel);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Controls/FeedbackStringResources.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 | Comments:
6 | Include code snippet from file
7 | Optional
8 | Report
9 | Cancel
10 |
11 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/BindingDebugConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Diagnostics;
6 | using System.Globalization;
7 | using System.Windows.Data;
8 |
9 | namespace Microsoft.Sarif.Viewer.Converters
10 | {
11 | public class DatabindingDebugConverter : IValueConverter
12 | {
13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14 | {
15 | Debugger.Break();
16 | return value;
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20 | {
21 | Debugger.Break();
22 | return value;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/BooleanToCollapsedVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Windows;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | public class BooleanToCollapsedVisibilityConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | if (value is bool boolValue)
15 | {
16 | return boolValue ? Visibility.Collapsed : Visibility.Visible;
17 | }
18 | else
19 | {
20 | return Visibility.Visible;
21 | }
22 | }
23 |
24 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
25 | {
26 | return null;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Windows;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | public class BooleanToVisibilityConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | if (value is bool boolValue)
15 | {
16 | return boolValue ? Visibility.Visible : Visibility.Collapsed;
17 | }
18 | else
19 | {
20 | return Visibility.Collapsed;
21 | }
22 | }
23 |
24 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
25 | {
26 | return null;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/CollectionToBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Collections;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | public class CollectionToBooleanConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | return !(value is ICollection collection) || collection.Count == 0 ? false : (object)true;
15 | }
16 |
17 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
18 | {
19 | return null;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/CollectionToCountConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Collections;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | public class CollectionToCountConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | var collection = value as ICollection;
15 |
16 | if (collection != null)
17 | {
18 | return collection.Count;
19 | }
20 | else
21 | {
22 | return 0;
23 | }
24 | }
25 |
26 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
27 | {
28 | return null;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/CollectionToJoinedStringConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | internal class CollectionToJoinedStringConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | return value is List list ?
15 | string.Join(parameter.ToString(), list) :
16 | null;
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
20 | {
21 | return null;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/FileExistsToBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Windows.Data;
6 |
7 | namespace Microsoft.Sarif.Viewer.Converters
8 | {
9 | public class FileExistsToBooleanConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
12 | {
13 | bool retVal = false;
14 | string file = value as string;
15 |
16 | if (!string.IsNullOrWhiteSpace(file))
17 | {
18 | if (System.IO.File.Exists(file))
19 | {
20 | retVal = true;
21 | }
22 | }
23 |
24 | return retVal;
25 | }
26 |
27 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
28 | {
29 | return null;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/Int32ToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Windows;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | public class Int32ToVisibilityConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | if (value is int intValue)
15 | {
16 | return intValue > 0 ? Visibility.Visible : Visibility.Collapsed;
17 | }
18 | else
19 | {
20 | return Visibility.Collapsed;
21 | }
22 | }
23 |
24 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
25 | {
26 | return null;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/MultipleStringsToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Globalization;
6 | using System.Windows;
7 | using System.Windows.Data;
8 |
9 | namespace Microsoft.Sarif.Viewer.Converters
10 | {
11 | public class MultipleStringsToVisibilityConverter : IMultiValueConverter
12 | {
13 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
14 | {
15 | for (int i = 0; i < values.Length; i++)
16 | {
17 | if (!string.IsNullOrWhiteSpace(values[i] as string))
18 | {
19 | return Visibility.Collapsed;
20 | }
21 | }
22 |
23 | return Visibility.Visible;
24 | }
25 |
26 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
27 | {
28 | return null;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/ObjectToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Windows;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | public class ObjectToVisibilityConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | return value == null ? Visibility.Collapsed : Visibility.Visible;
15 | }
16 |
17 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
18 | {
19 | return null;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Converters/StringToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Windows;
6 | using System.Windows.Data;
7 |
8 | namespace Microsoft.Sarif.Viewer.Converters
9 | {
10 | public class StringToVisibilityConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | return string.IsNullOrWhiteSpace(value as string) ? Visibility.Collapsed : Visibility.Visible;
15 | }
16 |
17 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
18 | {
19 | return null;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ErrorList/BaselineStateTableDataSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | using Microsoft.VisualStudio.Shell;
7 | using Microsoft.VisualStudio.Shell.TableManager;
8 |
9 | namespace Microsoft.Sarif.Viewer.ErrorList
10 | {
11 | // A "stub" data source whose sole purpose is to cause the Category column
12 | // to be displayed. It never actually adds entries to the Error List.
13 | //
14 | // For an explanation of why these this source is necessary, see the comment
15 | // near the top of SarifResultTableEntry.cs
16 | internal class BaselineStateTableDataSource : SarifTableDataSourceBase
17 | {
18 | private static BaselineStateTableDataSource _instance;
19 |
20 | private BaselineStateTableDataSource()
21 | {
22 | ThreadHelper.ThrowIfNotOnUIThread();
23 |
24 | this.Initialize(SarifResultTableEntry.AbsentResultColumns);
25 | }
26 |
27 | public static BaselineStateTableDataSource Instance =>
28 | _instance ?? (_instance = new BaselineStateTableDataSource());
29 |
30 | public override string Identifier => $"{Guids.GuidVSPackageString}-{nameof(BaselineStateTableDataSource)}";
31 |
32 | public override string DisplayName => Resources.ErrorListAbsentResultsDataSourceDisplayName;
33 |
34 | public override IDisposable Subscribe(ITableDataSink sink) => new StubDisposable();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ErrorList/FilteredColumnValue.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | namespace Microsoft.Sarif.Viewer.ErrorList
7 | {
8 | // Associates an error list column with a value that has been filtered from it.
9 | internal struct FilteredColumnValue
10 | {
11 | public string ColumnName { get; }
12 |
13 | public string FilteredValue { get; }
14 |
15 | public FilteredColumnValue(string columnName, string filteredValue)
16 | {
17 | this.ColumnName = columnName ?? throw new ArgumentNullException(nameof(columnName));
18 | this.FilteredValue = filteredValue ?? throw new ArgumentNullException(nameof(filteredValue));
19 | }
20 |
21 | public override bool Equals(object obj) =>
22 | obj is FilteredColumnValue other &&
23 | other.ColumnName.Equals(this.ColumnName, StringComparison.Ordinal) &&
24 | other.FilteredValue.Equals(this.FilteredValue, StringComparison.Ordinal);
25 |
26 | public override int GetHashCode()
27 | {
28 | int result = 17;
29 | unchecked
30 | {
31 | result = (result * 31) + this.ColumnName.GetHashCode();
32 | result = (result * 31) + this.FilteredValue.GetHashCode();
33 | }
34 |
35 | return result;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ErrorList/IColumnFilterer.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.Collections.Generic;
5 |
6 | namespace Microsoft.Sarif.Viewer.ErrorList
7 | {
8 | internal interface IColumnFilterer
9 | {
10 | void FilterOut(string columnName, string filteredValue);
11 |
12 | IEnumerable GetFilteredValues(string columnName);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ErrorList/SarifErrorListEventProcessorProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.ComponentModel.Composition;
5 |
6 | using Microsoft.VisualStudio.Shell.TableControl;
7 | using Microsoft.VisualStudio.Shell.TableManager;
8 | using Microsoft.VisualStudio.Utilities;
9 |
10 | namespace Microsoft.Sarif.Viewer.ErrorList
11 | {
12 | [Export(typeof(ITableControlEventProcessorProvider))]
13 | [ManagerType(StandardTables.ErrorsTable)]
14 | [DataSourceType(StandardTableDataSources.ErrorTableDataSource)]
15 | [DataSource(Guids.GuidVSPackageString)]
16 | [Name("SARIF Location Text Marker Tag")]
17 | [Order(Before = "Default")]
18 | internal class SarifErrorListEventProcessorProvider : ITableControlEventProcessorProvider
19 | {
20 | #pragma warning disable CS0649 // Filled in by MEF
21 | #pragma warning disable IDE0044 // Assigned by MEF
22 | [Import]
23 | private ISarifErrorListEventSelectionService sarifErrorListEventSelectionService;
24 | #pragma warning restore IDE0044
25 | #pragma warning restore CS0649
26 |
27 | public ITableControlEventProcessor GetAssociatedEventProcessor(IWpfTableControl tableControl)
28 | {
29 | (this.sarifErrorListEventSelectionService as SarifErrorListEventProcessor)?.SetTableControl(tableControl);
30 |
31 | return this.sarifErrorListEventSelectionService as ITableControlEventProcessor;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ErrorList/SarifErrorListSelectionChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | namespace Microsoft.Sarif.Viewer.ErrorList
7 | {
8 | ///
9 | /// Used as event arguments for the navigate and selection changed events from .
10 | ///
11 | internal class SarifErrorListSelectionChangedEventArgs : EventArgs
12 | {
13 | ///
14 | /// Initializes a new instance of the class.
15 | ///
16 | /// The previous item.
17 | /// The new item.
18 | /// Both parameters may be null.
19 | public SarifErrorListSelectionChangedEventArgs(SarifErrorListItem oldItem, SarifErrorListItem newItem)
20 | {
21 | this.OldItem = oldItem;
22 | this.NewItem = newItem;
23 | }
24 |
25 | ///
26 | /// Gets the previous item.
27 | ///
28 | ///
29 | /// May be null.
30 | ///
31 | public SarifErrorListItem OldItem { get; }
32 |
33 | ///
34 | /// Gets the new item.
35 | ///
36 | ///
37 | /// May be null.
38 | ///
39 | public SarifErrorListItem NewItem { get; }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ErrorList/StubDisposable.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | namespace Microsoft.Sarif.Viewer.ErrorList
7 | {
8 | // This class exists solely to provide an object for the "stub" table data sources to return
9 | // when the TableDataManager calls Subscribe on them.
10 | internal class StubDisposable : IDisposable
11 | {
12 | public void Dispose() { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ErrorList/SuppressionStateTableDataSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | using Microsoft.VisualStudio.Shell;
7 | using Microsoft.VisualStudio.Shell.TableManager;
8 |
9 | namespace Microsoft.Sarif.Viewer.ErrorList
10 | {
11 | // A "stub" data source whose sole purpose is to cause the Supression State column
12 | // to be displayed. It never actually adds entries to the Error List.
13 | //
14 | // For an explanation of why these this is necessary, see the comment near the top
15 | // of SarifResultTableEntry.cs
16 | internal class SuppressionStateTableDataSource : SarifTableDataSourceBase
17 | {
18 | private static SuppressionStateTableDataSource _instance;
19 |
20 | private SuppressionStateTableDataSource()
21 | {
22 | ThreadHelper.ThrowIfNotOnUIThread();
23 |
24 | this.Initialize(SarifResultTableEntry.SuppressedResultColumns);
25 | }
26 |
27 | public static SuppressionStateTableDataSource Instance =>
28 | _instance ?? (_instance = new SuppressionStateTableDataSource());
29 |
30 | public override string Identifier => $"{Guids.GuidVSPackageString}-{nameof(SuppressionStateTableDataSource)}";
31 |
32 | public override string DisplayName => Resources.ErrorListSuppressedResultsDataSourceDisplayName;
33 |
34 | public override IDisposable Subscribe(ITableDataSink sink) => new StubDisposable();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/ExceptionalConditions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 |
6 | namespace Microsoft.Sarif.Viewer
7 | {
8 | ///
9 | /// Constants specifying various exceptional conditions that can occur in a SARIF log file.
10 | ///
11 | [Flags]
12 | internal enum ExceptionalConditions
13 | {
14 | ///
15 | /// No exceptional conditions were detected in the log file.
16 | ///
17 | None = 0,
18 |
19 | ///
20 | /// The log file contained no results.
21 | ///
22 | NoResults = 0x00000001,
23 |
24 | ///
25 | /// The log file was not valid JSON.
26 | ///
27 | InvalidJson = 0x00000002,
28 |
29 | ///
30 | /// The log file contained at least one error-level tool configuration notification.
31 | ///
32 | ConfigurationError = 0x00000004,
33 |
34 | ///
35 | /// The log file contained at least one error-level tool execution notification.
36 | ///
37 | ExecutionError = 0x00000008,
38 |
39 | ///
40 | /// The log file contains results have been filtered by ErrorList.
41 | ///
42 | ResultsFiltered = 0x00000010,
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/FileAndForgetEventName.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | namespace Microsoft.Sarif.Viewer
5 | {
6 | internal static class FileAndForgetEventName
7 | {
8 | private const string Prefix = "Microsoft/VisualStudioSarifViewer/";
9 |
10 | internal const string InfoBarCloseFailure = Prefix + "InfoBarClose/Failure";
11 | internal const string InfoBarOpenFailure = Prefix + "InfoBarOpen/Failure";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/FileMonitor/ISarifFileMonitor.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | namespace Microsoft.Sarif.Viewer.FileMonitor
5 | {
6 | public interface ISarifFileMonitor
7 | {
8 | void StartWatch(string solutionFolder = null);
9 |
10 | void StopWatch();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Fixes/ApplyFixEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | namespace Microsoft.Sarif.Viewer.Fixes
5 | {
6 | internal enum FixScope
7 | {
8 | ///
9 | /// Scope of fixes to be applied is in current document.
10 | ///
11 | Document,
12 |
13 | ///
14 | /// Scope of fixes to be applied is in current project.
15 | ///
16 | Project,
17 |
18 | ///
19 | /// Scope of fixes to be applied is in current solution.
20 | ///
21 | Solution,
22 | }
23 |
24 | internal class ApplyFixEventArgs
25 | {
26 | internal ApplyFixEventArgs(FixScope scope, SarifErrorListItem errorItem)
27 | {
28 | this.Scope = scope;
29 | this.ErrorItem = errorItem;
30 | }
31 |
32 | public FixScope Scope { get; }
33 |
34 | public SarifErrorListItem ErrorItem { get; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Fixes/DisposableDifferenceViewerControl.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Fixes/DisposableDifferenceViewerControlStringResources.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 | Fix all occurrences in:
6 | Document
7 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Fixes/FixSuggestedActionsSourceProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System.ComponentModel.Composition;
5 |
6 | using Microsoft.VisualStudio.Language.Intellisense;
7 | using Microsoft.VisualStudio.Text;
8 | using Microsoft.VisualStudio.Text.Editor;
9 | using Microsoft.VisualStudio.Utilities;
10 |
11 | namespace Microsoft.Sarif.Viewer.Fixes
12 | {
13 | ///
14 | /// Provides a for a specified
15 | /// and .
16 | ///
17 | [Export(typeof(ISuggestedActionsSourceProvider))]
18 | [Name(FixActionCategoryName)]
19 | [ContentType(ContentTypes.Any)]
20 | internal class FixSuggestedActionsSourceProvider : ISuggestedActionsSourceProvider
21 | {
22 | private const string FixActionCategoryName = "SARIF fix suggestion";
23 |
24 | #pragma warning disable CS0649 // Filled in by MEF
25 | #pragma warning disable IDE0044 // Assigned by MEF
26 | [Import]
27 | private IPersistentSpanFactory persistentSpanFactory;
28 |
29 | [Import]
30 | private IPreviewProvider previewProvider;
31 | #pragma warning restore IDE0044
32 | #pragma warning restore CS0649
33 |
34 | ///
35 | public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer)
36 | {
37 | if (textBuffer == null && textView == null)
38 | {
39 | return null;
40 | }
41 |
42 | return new FixSuggestedActionsSource(textView, textBuffer, this.persistentSpanFactory, this.previewProvider);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Sarif.Viewer.VisualStudio.Core/Fixes/IPreviewProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 |
4 | using System;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 |
8 | using Microsoft.VisualStudio.Text;
9 |
10 | namespace Microsoft.Sarif.Viewer.Fixes
11 | {
12 | internal interface IPreviewProvider
13 | {
14 | Task