Changeset 16469


Ignore:
Timestamp:
12/29/18 21:13:46 (3 weeks ago)
Author:
gkronber
Message:

#2520: Adapted VS code fixes:

  • using HeuristicLab.Persistence -> using HEAL.Fossil
  • Made missing StorableCtor a Warning
  • Ignore StorableCtor for structs and interfaces
Location:
misc/tools/PersistenceCodeFix/PersistenceCodeFix
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • misc/tools/PersistenceCodeFix/PersistenceCodeFix/PersistenceCodeFix.Vsix/PersistenceCodeFix.Vsix.csproj

    r14933 r16469  
    33<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    44  <PropertyGroup>
    5     <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
     5    <MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
    66    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
     7    <FileUpgradeFlags>
     8    </FileUpgradeFlags>
     9    <UpgradeBackupLocation>
     10    </UpgradeBackupLocation>
     11    <OldToolsVersion>14.0</OldToolsVersion>
    712  </PropertyGroup>
    813  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  • misc/tools/PersistenceCodeFix/PersistenceCodeFix/PersistenceCodeFix/Analyzers/MissingStorableConstructor/MissingStorableConstructorAnalyzer.cs

    r14985 r16469  
    1414    private const string Category = nameof(DiagnosticCategory.Persistence);
    1515
    16     private static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);
     16    private static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description);
    1717
    1818    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }
     
    2525      var namedTypeSymbol = (INamedTypeSymbol)context.Symbol;
    2626      if (namedTypeSymbol.IsStatic) return;
    27       if (namedTypeSymbol.TypeKind == TypeKind.Delegate || namedTypeSymbol.TypeKind == TypeKind.Enum) return;
     27      if (namedTypeSymbol.TypeKind == TypeKind.Delegate || namedTypeSymbol.TypeKind == TypeKind.Enum || namedTypeSymbol.TypeKind == TypeKind.Struct || namedTypeSymbol.TypeKind == TypeKind.Interface) return;
    2828
    2929      var attr = context.Symbol.GetAttributes();
  • misc/tools/PersistenceCodeFix/PersistenceCodeFix/PersistenceCodeFix/Analyzers/MissingStorableType/MissingStorableTypeFix.cs

    r14989 r16469  
    100100      var newRoot = root.ReplaceNode(baseTypeDecl, newBaseTypeDecl);
    101101
    102       // add using of HeuristicLab.Persistence if the document does not already have it
     102      // add using of HEAL.Fossil if the document does not already have it
    103103      var oldUsings = root.Usings;
    104       if (oldUsings.All(x => x.Name.WithoutTrivia().ToString() != "HeuristicLab.Persistence")) {
    105         var persistenceUsing = SyntaxFactory.UsingDirective(SyntaxFactory.IdentifierName("HeuristicLab.Persistence"));
     104      if (oldUsings.All(x => x.Name.WithoutTrivia().ToString() != "HEAL.Fossil")) {
     105        var persistenceUsing = SyntaxFactory.UsingDirective(SyntaxFactory.IdentifierName("HEAL.Fossil"));
    106106        newRoot = newRoot.WithUsings(oldUsings.Add(persistenceUsing));
    107107      }
  • misc/tools/PersistenceCodeFix/PersistenceCodeFix/PersistenceCodeFix/Analyzers/ObsoleteStorableClass/ObsoleteStorableClassFix.cs

    r14989 r16469  
    8282      var newRoot = root.ReplaceNode(attrDecl, newAttrDecl);
    8383
    84       // add using of HeuristicLab.Persistence if the document does not already have it
     84      // add using of HEAL.Fossil if the document does not already have it
    8585      var oldUsings = root.Usings;
    86       if (oldUsings.All(x => x.Name.WithoutTrivia().ToString() != "HeuristicLab.Persistence")) {
    87         var persistenceUsing = SyntaxFactory.UsingDirective(SyntaxFactory.IdentifierName("HeuristicLab.Persistence"));
     86      if (oldUsings.All(x => x.Name.WithoutTrivia().ToString() != "HEAL.Fossil")) {
     87        var persistenceUsing = SyntaxFactory.UsingDirective(SyntaxFactory.IdentifierName("HEAL.Fossil"));
    8888        newRoot = newRoot.WithUsings(oldUsings.Add(persistenceUsing));
    8989      }
Note: See TracChangeset for help on using the changeset viewer.