Пример #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);
        }
Пример #2
0
        private static void CreateDefaultGlobalSuppressions()
        {
            String globalsuppressionsFilePath = ICodeAnalyzer.suppressionsFilePathByStorage(ICodeAnalyzer.SuppressionStorage.Global);

            if (!System.IO.File.Exists(globalsuppressionsFilePath))
            {
                SuppressionsInfo suppressionsInfo = new SuppressionsInfo();
                suppressionsInfo.SkippedIncludesMask.Add(".*Microsoft Visual Studio.*");
                suppressionsInfo.SkippedIncludesMask.Add(".*Microsoft SDKs.*");
                suppressionsInfo.SkippedIncludesMask.Add(".*Windows Kits.*");
                suppressionsInfo.SkippedIncludesMask.Add(".*boost.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\ActiveQt.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\Qt$");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtCore.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtDeclarative.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtGui.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtMultimedia.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtNetwork.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtOpenGL.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtOpenVG.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtScript.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtScriptTools.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtSql.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtSvg.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtTest.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtWebKit.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtXml.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtXmlPatterns.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtConcurrent.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtMultimediaWidgets.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtOpenGLExtensions.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtQml.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtQuick.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtSensors.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtWebKitWidgets.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtWidgets.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtZlib.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtV8.*");
                suppressionsInfo.SkippedIncludesMask.Add(@".*\\mkspecs\\win32-.*");

                suppressionsInfo.SkippedFilesMask.Add("^moc_.*\\.cpp$");
                suppressionsInfo.SkippedFilesMask.Add("^qrc_.*\\.cpp$");
                suppressionsInfo.SkippedFilesMask.Add("^ui_.*\\.h$");

                suppressionsInfo.SaveToFile(globalsuppressionsFilePath);
            }
        }
		private static void CreateDefaultGlobalSuppressions()
		{
			String globalsuppressionsFilePath = ICodeAnalyzer.suppressionsFilePathByStorage(ICodeAnalyzer.SuppressionStorage.Global);
			if (!System.IO.File.Exists(globalsuppressionsFilePath))
			{
				SuppressionsInfo suppressionsInfo = new SuppressionsInfo();
				suppressionsInfo.SkippedIncludesMask.Add(".*Microsoft Visual Studio.*");
				suppressionsInfo.SkippedIncludesMask.Add(".*Microsoft SDKs.*");
				suppressionsInfo.SkippedIncludesMask.Add(".*Windows Kits.*");
				suppressionsInfo.SkippedIncludesMask.Add(".*boost.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\ActiveQt.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\Qt$");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtCore.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtDeclarative.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtGui.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtMultimedia.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtNetwork.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtOpenGL.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtOpenVG.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtScript.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtScriptTools.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtSql.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtSvg.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtTest.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtWebKit.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtXml.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtXmlPatterns.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtConcurrent.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtMultimediaWidgets.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtOpenGLExtensions.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtQml.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtQuick.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtSensors.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtWebKitWidgets.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtWidgets.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtZlib.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\include\\QtV8.*");
				suppressionsInfo.SkippedIncludesMask.Add(@".*\\mkspecs\\win32-.*");

				suppressionsInfo.SkippedFilesMask.Add("^moc_.*\\.cpp$");
				suppressionsInfo.SkippedFilesMask.Add("^qrc_.*\\.cpp$");
				suppressionsInfo.SkippedFilesMask.Add("^ui_.*\\.h$");

				suppressionsInfo.SaveToFile(globalsuppressionsFilePath);
			}
		}
Пример #4
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);
		}