Exemple #1
0
        public override void suppressProblem(Problem p, SuppressionScope scope)
        {
            if (p == null)
            {
                return;
            }

            String simpleFileName = p.FileName;

            String suppressionLine = null;

            switch (scope)
            {
            case SuppressionScope.suppressAllMessagesThisFileGlobally:
            case SuppressionScope.suppressAllMessagesThisFileSolutionWide:
            case SuppressionScope.suppressAllMessagesThisFileProjectWide:
                suppressionLine = "*:" + simpleFileName;
                break;

            case SuppressionScope.suppressThisTypeOfMessageFileWide:
                suppressionLine = p.MessageId + ":" + simpleFileName;
                break;

            case SuppressionScope.suppressThisTypeOfMessagesGlobally:
            case SuppressionScope.suppressThisTypeOfMessageProjectWide:
            case SuppressionScope.suppressThisTypeOfMessagesSolutionWide:
                suppressionLine = p.MessageId;
                break;

            case SuppressionScope.suppressThisMessage:
            case SuppressionScope.suppressThisMessageSolutionWide:
            case SuppressionScope.suppressThisMessageGlobally:
                suppressionLine = p.MessageId + ":" + simpleFileName + ":" + p.Line;
                break;

            default:
                throw new InvalidOperationException("Unsupported value: " + scope.ToString());
            }

            String suppressionsFilePath = suppressionsFilePathByScope(scope, p.BaseProjectPath, p.ProjectName);

            Debug.Assert(suppressionsFilePath != null);

            SuppressionsInfo suppressionsInfo = new SuppressionsInfo();

            suppressionsInfo.LoadFromFile(suppressionsFilePath);

            suppressionsInfo.AddSuppressionLine(suppressionLine);

            suppressionsInfo.SaveToFile(suppressionsFilePath);
        }
        public override void suppressProblem(Problem p, SuppressionScope scope)
        {
            if (p == null)
                return;

            String simpleFileName = p.FileName;

            String suppressionLine = null;
            switch (scope)
            {
                case SuppressionScope.suppressAllMessagesThisFileGlobally:
                case SuppressionScope.suppressAllMessagesThisFileSolutionWide:
                case SuppressionScope.suppressAllMessagesThisFileProjectWide:
                    suppressionLine = "*:" + simpleFileName;
                    break;
                case SuppressionScope.suppressThisTypeOfMessageFileWide:
                    suppressionLine = p.MessageId + ":" + simpleFileName;
                    break;
                case SuppressionScope.suppressThisTypeOfMessagesGlobally:
                case SuppressionScope.suppressThisTypeOfMessageProjectWide:
                case SuppressionScope.suppressThisTypeOfMessagesSolutionWide:
                    suppressionLine = p.MessageId;
                    break;
                case SuppressionScope.suppressThisMessage:
                case SuppressionScope.suppressThisMessageSolutionWide:
                case SuppressionScope.suppressThisMessageGlobally:
                    suppressionLine = p.MessageId + ":" + simpleFileName + ":" + p.Line;
                    break;
                default:
                    throw new InvalidOperationException("Unsupported value: " + scope.ToString());
            }

            String suppressionsFilePath = suppressionsFilePathByScope(scope, p.BaseProjectPath, p.ProjectName);
            Debug.Assert(suppressionsFilePath != null);

            SuppressionsInfo suppressionsInfo = new SuppressionsInfo();
            suppressionsInfo.LoadFromFile(suppressionsFilePath);

            suppressionsInfo.AddSuppressionLine(suppressionLine);

            suppressionsInfo.SaveToFile(suppressionsFilePath);
        }
Exemple #3
0
        protected string suppressionsFilePathByScope(SuppressionScope scope, string projectBasePath = null, string projectName = null)
        {
            switch (scope)
            {
            case SuppressionScope.suppressThisMessageGlobally:
            case SuppressionScope.suppressThisTypeOfMessagesGlobally:
            case SuppressionScope.suppressAllMessagesThisFileGlobally:
                return(globalSuppressionsFilePath());

            case SuppressionScope.suppressThisMessageSolutionWide:
            case SuppressionScope.suppressThisTypeOfMessagesSolutionWide:
            case SuppressionScope.suppressAllMessagesThisFileSolutionWide:
                return(solutionSuppressionsFilePath());

            case SuppressionScope.suppressThisMessage:
            case SuppressionScope.suppressThisTypeOfMessageFileWide:
            case SuppressionScope.suppressThisTypeOfMessageProjectWide:
            case SuppressionScope.suppressAllMessagesThisFileProjectWide:
                return(projectSuppressionsFilePath(projectBasePath, projectName));

            default:
                throw new InvalidOperationException("Unsupported enum value: " + scope.ToString());
            }
        }
Exemple #4
0
 public abstract void suppressProblem(Problem p, SuppressionScope scope);
 protected string suppressionsFilePathByScope(SuppressionScope scope, string projectBasePath = null, string projectName = null)
 {
     switch (scope)
     {
         case SuppressionScope.suppressThisMessageGlobally:
         case SuppressionScope.suppressThisTypeOfMessagesGlobally:
         case SuppressionScope.suppressAllMessagesThisFileGlobally:
             return globalSuppressionsFilePath();
         case SuppressionScope.suppressThisMessageSolutionWide:
         case SuppressionScope.suppressThisTypeOfMessagesSolutionWide:
         case SuppressionScope.suppressAllMessagesThisFileSolutionWide:
             return solutionSuppressionsFilePath();
         case SuppressionScope.suppressThisMessage:
         case SuppressionScope.suppressThisTypeOfMessageFileWide:
         case SuppressionScope.suppressThisTypeOfMessageProjectWide:
         case SuppressionScope.suppressAllMessagesThisFileProjectWide:
             return projectSuppressionsFilePath(projectBasePath, projectName);
         default:
             throw new InvalidOperationException("Unsupported enum value: " + scope.ToString());
     }
 }
 public abstract void suppressProblem(Problem p, SuppressionScope scope);