상속: Gendarme.Framework.BasicIgnoreList
예제 #1
0
        byte Execute(string [] args)
        {
            try {
                byte result = Parse(args);
                Header();
                if (version)
                {
                    return(0);
                }

                if ((result != 0) || help)
                {
                    Help();
                    return(help ? (byte)0 : result);
                }

                // load configuration, including rules
                Settings config = new Settings(this, config_file, rule_set);
                // and continue if there's at least one rule to execute
                if (!config.Load() || (Rules.Count < 1))
                {
                    int validationErrorsCounter = 0;
                    foreach (string error in config.ValidationErrors)
                    {
                        Console.WriteLine(error);
                        validationErrorsCounter++;
                    }
                    if (validationErrorsCounter == 0)
                    {
                        Console.WriteLine("Configuration parameters does not match any known rule.");
                    }
                    return(3);
                }

                foreach (string name in assembly_names)
                {
                    result = AddFiles(name);
                    if (result != 0)
                    {
                        return(result);
                    }
                }

                IgnoreList = new IgnoreFileList(this, ignore_file);

                // now that all rules and assemblies are know, time to initialize
                Initialize();
                // before analyzing the assemblies with the rules
                Run();
                // and winding down properly
                TearDown();

                return(Report());
            } catch (IOException e) {
                if (0 == VerbosityLevel)
                {
                    Console.Error.WriteLine("ERROR: {0}", e.Message);
                    return(2);
                }
                else
                {
                    WriteUnhandledExceptionMessage(e);
                    return(4);
                }
            } catch (Exception e) {
                WriteUnhandledExceptionMessage(e);
                return(4);
            }
        }
예제 #2
0
		byte Execute (string [] args)
		{
			try {
				byte result = Parse (args);
				Header ();
				if (version)
					return 0;

				if ((result != 0) || help) {
					Help ();
					return help ? (byte) 0 : result;
				}

				// load configuration, including rules
				Settings config = new Settings (this, config_file, rule_set);
				// and continue if there's at least one rule to execute
				if (!config.Load () || (Rules.Count < 1)) {
					int validationErrorsCounter = 0;
					foreach (string error in config.ValidationErrors) {
						Console.WriteLine (error);
						validationErrorsCounter++;
					}
					if (validationErrorsCounter == 0)
						Console.WriteLine ("Configuration parameters does not match any known rule.");
					return 3;
				}

				foreach (string name in assembly_names) {
					result = AddFiles (name);
					if (result != 0)
						return result;
				}

				IgnoreList = new IgnoreFileList (this, ignore_file);

				// now that all rules and assemblies are know, time to initialize
				Initialize ();
				// before analyzing the assemblies with the rules
				Run ();
				// and winding down properly
				TearDown ();

				return Report ();

			} catch (IOException e) {
				if (0 == VerbosityLevel) {
					Console.Error.WriteLine ("ERROR: {0}", e.Message);
					return 2;
				} else {
					WriteUnhandledExceptionMessage (e);
					return 4;
				}

			} catch (Exception e) {
				WriteUnhandledExceptionMessage (e);
				return 4;
			}
		}