Ejemplo n.º 1
0
 public ScanAndReportTab(JqaExecutor jqaExecutor, HistoryManager historyManager,
                         RuleSelector ruleSelector)
 {
     _jqaExecutor    = jqaExecutor;
     _historyManager = historyManager;
     _ruleSelector   = ruleSelector;
 }
Ejemplo n.º 2
0
        private void InitializeFieldsIfNecessary()
        {
            if (_jqaManager != null)
            {
                return;
            }

            _jqaManager            = new JqaManager();
            _historyManager        = new HistoryManager();
            _ruleSelector          = new RuleSelector();
            _jqaExecutor           = new JqaExecutor(_historyManager, _ruleSelector);
            _scanAndReportTab      = new ScanAndReportTab(_jqaExecutor, _historyManager, _ruleSelector);
            _installTab            = new InstallTab(_jqaManager);
            _manageCustomRulesTab  = new ManageCustomRulesTab();
            _navigationButtonStyle = NavigationButtonStyleProvider.Provide();
        }
Ejemplo n.º 3
0
        public void Show()
        {
            CqaLabel.Heading1("Scan");

            if (!JqaManager.CheckIfJqaIsInstalled())
            {
                CqaLabel.Error("CQA is currently not installed.");
                return;
            }

            CqaLabel.Normal("CQA scans all scripts inside your Assets folder.");

            History.History history = _historyManager.LoadHistory();

            if (history != null)
            {
                CqaLabel.Normal("The last scan was at " + history.GetLastScan() + ".");
            }

            EditorGUI.BeginDisabledGroup(_jqaExecutor.IsAnyProcessRunning());
            if (CqaButton.NormalButton("Scan Assets"))
            {
                _jqaExecutor.ScanAssets();
            }

            if (Directory.Exists(JqaPaths.Instance.BuildJqaStorePath()) && CqaButton.NormalButton("Start Server"))
            {
                _jqaExecutor.StartServer();
            }

            EditorGUI.EndDisabledGroup();

            if (_jqaExecutor.IsScanProcessRunning())
            {
                CqaLabel.Bold("Status: Running ...");

                // FIXME: Stopping the process does currently not work.
                //
                // if (CqaButton.NormalButton("Stop Process"))
                // {
                //     _jqaExecutor.StopProcess();
                // }
            }

            GUILayout.Space(30);
            CqaLine.DrawHorizontalLine();

            CqaLabel.Heading1("Report");

            if (!JqaExecutor.DidFinishSuccessfullyOnce())
            {
                CqaLabel.Error("You must scan your project before you can create a report.");
                return;
            }

            CqaLabel.Normal("Select rules that you want to be checked in the report.");

            if (_jqaExecutor.IsReportProcessRunning())
            {
                CqaLabel.Bold("Status: Running ...");

                // FIXME: Stopping the process does currently not work.
                //
                // if (CqaButton.NormalButton("Stop Process"))
                // {
                //     _jqaExecutor.StopProcess();
                // }
            }

            _ruleSelector.OnGUI();

            ShowReportButtons();
        }