Run a checker class
320910
def run_linter(self, linter) -> None:
        """"""
        self.current = linter.name

        if (linter.name not in self.parser["all"].as_list("linters")
                or linter.base_pyversion > sys.version_info):  # noqa: W503
            return

        if any(x not in self.installed for x in linter.requires_install):
            raise ModuleNotInstalled(linter.requires_install)

        linter.add_output_hook(self.out_func)
        linter.set_config(self.fn, self.parser[linter.name])
        linter.run(self.files)
        self.status_code = self.status_code or linter.status_code
254
def run_checks(collector):
    """"""
    artifact = collector.configuration["dashmat"].artifact
    chosen = artifact
    if chosen in (None, "", NotSpecified):
        chosen = None

    dashmat = collector.configuration["dashmat"]
    modules = collector.configuration["__active_modules__"]
    config_root = collector.configuration["config_root"]
    module_options = collector.configuration["modules"]

    datastore = JsonDataStore(os.path.join(config_root, "data.json"))
    if dashmat.redis_host:
        datastore = RedisDataStore(redis.Redis(dashmat.redis_host))

    scheduler = Scheduler(datastore)

    for name, module in modules.items():
        if chosen is None or name == chosen:
            server = module.make_server(module_options[name].server_options)
            scheduler.register(module, server, name)

    scheduler.twitch(force=True)
490996
public function run($checks)
    {
        if (is_array($checks) && count($checks) > 0) {
            foreach ($checks as $check_type => $check_info) {
                switch ($check_type) {
                    case 'auth':
                        $check_result = (new Auth())->run($this->dic['session_id']);
                        break;

                    case 'role':
                        $check_result = (new Role())->run($check_info, $this->dic['user']['roles']);
                        break;

                    default:
                        $classname = 'Lemurro\\Api\\App\\Checker\\' . $check_info['class'];
                        $class = new $classname($this->dic);
                        $check_result = call_user_func([$class, 'run'], $check_info);
                        break;
                }

                if (isset($check_result['errors'])) {
                    return $check_result;
                }
            }
        }

        return [];
    }
1172254
def run (self):
        """"""
        try:
            self.run_checked()
        except KeyboardInterrupt:
            thread.interrupt_main()
        except Exception:
            self.internal_error()
1266163
boolean run(String... argArray) {
        Queue<String> args = new ArrayDeque<>(Arrays.asList(argArray));
        LoadMode loadMode = LoadMode.RELEASE;
        ScanMode scanMode = ScanMode.ARGS;
        String dir = null;
        String jar = null;
        String jdkHome = null;
        String release = "9";
        List<String> loadClasses = new ArrayList<>();
        String csvFile = null;

        try {
            while (!args.isEmpty()) {
                String a = args.element();
                if (a.startsWith("-")) {
                    args.remove();
                    switch (a) {
                        case "--class-path":
                            classPath.clear();
                            Arrays.stream(args.remove().split(File.pathSeparator))
                                  .map(File::new)
                                  .forEachOrdered(classPath::add);
                            break;
                        case "--for-removal":
                            forRemoval = true;
                            break;
                        case "--full-version":
                            out.println(System.getProperty("java.vm.version"));
                            return false;
                        case "--help":
                        case "-h":
                            out.println(Messages.get("main.usage"));
                            out.println();
                            out.println(Messages.get("main.help"));
                            return false;
                        case "-l":
                        case "--list":
                            require(scanMode == ScanMode.ARGS);
                            scanMode = ScanMode.LIST;
                            break;
                        case "--release":
                            loadMode = LoadMode.RELEASE;
                            release = args.remove();
                            if (!validReleases.contains(release)) {
                                throw new UsageException();
                            }
                            break;
                        case "-v":
                        case "--verbose":
                            verbose = true;
                            break;
                        case "--version":
                            out.println(System.getProperty("java.version"));
                            return false;
                        case "--Xcompiler-arg":
                            options.add(args.remove());
                            break;
                        case "--Xcsv-comment":
                            comments.add(args.remove());
                            break;
                        case "--Xhelp":
                            out.println(Messages.get("main.xhelp"));
                            return false;
                        case "--Xload-class":
                            loadMode = LoadMode.CLASSES;
                            loadClasses.add(args.remove());
                            break;
                        case "--Xload-csv":
                            loadMode = LoadMode.LOAD_CSV;
                            csvFile = args.remove();
                            break;
                        case "--Xload-dir":
                            loadMode = LoadMode.DIR;
                            dir = args.remove();
                            break;
                        case "--Xload-jar":
                            loadMode = LoadMode.JAR;
                            jar = args.remove();
                            break;
                        case "--Xload-jdk9":
                            loadMode = LoadMode.JDK9;
                            jdkHome = args.remove();
                            break;
                        case "--Xload-old-jdk":
                            loadMode = LoadMode.OLD_JDK;
                            jdkHome = args.remove();
                            break;
                        case "--Xload-self":
                            loadMode = LoadMode.SELF;
                            break;
                        case "--Xprint-csv":
                            require(scanMode == ScanMode.ARGS);
                            scanMode = ScanMode.PRINT_CSV;
                            break;
                        default:
                            throw new UsageException();
                    }
                } else {
                    break;
                }
            }

            if ((scanMode == ScanMode.ARGS) == args.isEmpty()) {
                throw new UsageException();
            }

            if (    forRemoval && loadMode == LoadMode.RELEASE &&
                    releasesWithoutForRemoval.contains(release)) {
                throw new UsageException();
            }

            boolean success = false;

            switch (loadMode) {
                case CLASSES:
                    success = doClassNames(loadClasses);
                    break;
                case DIR:
                    success = processDirectory(dir, loadClasses);
                    break;
                case JAR:
                    success = processJarFile(jar, loadClasses);
                    break;
                case JDK9:
                    require(!args.isEmpty());
                    success = processJdk9(jdkHome, loadClasses);
                    break;
                case LOAD_CSV:
                    deprList = DeprDB.loadFromFile(csvFile);
                    success = true;
                    break;
                case OLD_JDK:
                    success = processOldJdk(jdkHome, loadClasses);
                    break;
                case RELEASE:
                    success = processRelease(release, loadClasses);
                    break;
                case SELF:
                    success = processSelf(loadClasses);
                    break;
                default:
                    throw new UsageException();
            }

            if (!success) {
                return false;
            }
        } catch (NoSuchElementException | UsageException ex) {
            err.println(Messages.get("main.usage"));
            return false;
        } catch (IOException ioe) {
            if (verbose) {
                ioe.printStackTrace(err);
            } else {
                err.println(ioe);
            }
            return false;
        }

        // now the scanning phase

        boolean scanStatus = true;

        switch (scanMode) {
            case LIST:
                for (DeprData dd : deprList) {
                    if (!forRemoval || dd.isForRemoval()) {
                        out.println(Pretty.print(dd));
                    }
                }
                break;
            case PRINT_CSV:
                out.println("#jdepr1");
                comments.forEach(s -> out.println("# " + s));
                for (DeprData dd : deprList) {
                    CSV.write(out, dd.kind, dd.typeName, dd.nameSig, dd.since, dd.forRemoval);
                }
                break;
            case ARGS:
                DeprDB db = DeprDB.loadFromList(deprList);
                List<String> cp = classPath.stream()
                                           .map(File::toString)
                                           .collect(toList());
                Scan scan = new Scan(out, err, cp, db, verbose);

                for (String a : args) {
                    boolean s;
                    if (a.endsWith(".jar")) {
                        s = scan.scanJar(a);
                    } else if (a.endsWith(".class")) {
                        s = scan.processClassFile(a);
                    } else if (Files.isDirectory(Paths.get(a))) {
                        s = scan.scanDir(a);
                    } else {
                        s = scan.processClassName(a.replace('.', '/'));
                    }
                    scanStatus = scanStatus && s;
                }
                break;
        }

        return scanStatus;
    }
347860
def run(self):
        """"""
        # Catch all possible exceptions raised by the running thread
        # and let parent process know about it.
        try:
            self._run()
        except Exception:  # pylint: disable=broad-except
            self.action.put(
                ServiceCheckDiedError(self.name, traceback.format_exc())
            )
930621
public static void main(String[] args) throws Exception {
    MapReduceIntegrationChecker checker = new MapReduceIntegrationChecker();
    System.exit(checker.run(args));
  }
684892
def run(cls):
        """"""
        project = __import__(IMPORT, fromlist=[''])
        for expected, var in [('@Robpol86', '__author__'), (LICENSE, '__license__'), (VERSION, '__version__')]:
            if getattr(project, var) != expected:
                raise SystemExit('Mismatch: {0}'.format(var))
        # Check changelog.
        if not re.compile(r'^%s - \d{4}-\d{2}-\d{2}[\r\n]' % VERSION, re.MULTILINE).search(readme()):
            raise SystemExit('Version not found in readme/changelog file.')
        # Check tox.
        if INSTALL_REQUIRES:
            contents = readme('tox.ini')
            section = re.compile(r'[\r\n]+install_requires =[\r\n]+(.+?)[\r\n]+\w', re.DOTALL).findall(contents)
            if not section:
                raise SystemExit('Missing install_requires section in tox.ini.')
            in_tox = re.findall(r'    ([^=]+)==[\w\d.-]+', section[0])
            if INSTALL_REQUIRES != in_tox:
                raise SystemExit('Missing/unordered pinned dependencies in tox.ini.')
396044
function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {
        /*
        * if expectations aren't met, args checker will throw appropriate exceptions
        * notifying the user regarding the errors of the arguments.
        * */
    	args.expect(arguments, ['boolean|string', '*', 'function|object', 'number', 'array']);

        // do something here...
        console.log("\n\nfunction `run` arguments passed!");
    }
523829
public void check()
    {
        //
        // Find the nearest @ControlInterface, which is where the relevant control checker
        // annotation will be found.
        //

        AptControlInterface mostDerived = (AptControlInterface) getMostDerivedInterface();
        if ( mostDerived == null )
            return;

        InterfaceDeclaration intfDecl = mostDerived._intfDecl;

        if ( intfDecl == null )
            return;

        AnnotationMirror controlMirror = null;

        for (AnnotationMirror annot : intfDecl.getAnnotationMirrors())
        {
            if (annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
                    "org.apache.beehive.controls.api.bean.ControlInterface"))
            {
                controlMirror = annot;
                break;
            }
        }

        assert ( controlMirror != null ) : "Found a control interface that isn't annotated properly: " + intfDecl;

        AptAnnotationHelper controlAnnot = new AptAnnotationHelper(controlMirror);

        //
        // Read the name of the checker class from the @ControlInterface annotation,
        // dynamically load and run it.
        //

        DeclaredType checkerMirror = (DeclaredType)controlAnnot.getObjectValue("checker");
        if ( checkerMirror == null )
        {
            // try the deprecated 'checkerClass' attribute
            checkerMirror = (DeclaredType)controlAnnot.getObjectValue("checkerClass");
        }

        if ( checkerMirror != null && checkerMirror.getDeclaration() != null )
        {
            // TODO: optimize to not invoke default checker?
            String checkerName = checkerMirror.toString();

            try
            {
                ClassLoader loader = getExternalClassLoader();

                Class checkerClass = loader.loadClass( checkerName );
                if ( !ControlChecker.class.isAssignableFrom(checkerClass) )
                {
                    _ap.printError( intfDecl, "control.interface.illegal.checker", intfDecl.getSimpleName(), checkerName );
                }
                else
                {

                    Constructor ctor = checkerClass.getConstructor();

                    ControlChecker checker = (ControlChecker) ctor.newInstance();
                    CheckerAnnotationProcessorEnvironmentImpl ape =
                            new CheckerAnnotationProcessorEnvironmentImpl(_ap);
                    checker.check( _intfDecl, ape );
                }
            }
            catch ( Exception e ) {
                _ap.printError( intfDecl, "control.interface.checker.load.failed", intfDecl.getSimpleName(), checkerName );
            }
        }
    }
879715
def get_checker_executable(name):
    """"""
    if programs.is_program_installed(name):
        # Checker is properly installed
        return [name]
    else:
        path1 = programs.python_script_exists(package=None,
                                              module=name+'_script')
        path2 = programs.python_script_exists(package=None, module=name)
        if path1 is not None:  # checker_script.py is available
            # Checker script is available but has not been installed
            # (this may work with pyflakes)
            return [sys.executable, path1]
        elif path2 is not None:  # checker.py is available
            # Checker package is available but its script has not been
            # installed (this works with pycodestyle but not with pyflakes)
            return [sys.executable, path2]
843129
def _do_check(self, obj, check_module, check_str):
        ''''''
        opts = self._config['options']
        if check_str in opts:
            fargs = opts[check_str]
            if isinstance(fargs, list):
                out = check_wrapper(getattr(check_module, check_str))(obj, *fargs)
            else:
                out = check_wrapper(getattr(check_module, check_str))(obj, fargs)
        else:
            out = check_wrapper(getattr(check_module, check_str))(obj)

        try:
            if out.info:
                L.debug('%s: %d failing ids detected: %s',
                        out.title, len(out.info), out.info)
        except TypeError:  # pragma: no cover
            pass

        return out
945408
def run(self, data):
        
        result_type = namedtuple('Result', 'code messages')

        if self.passes is True:
            result = result_type(Checker.Code.PASSED, '')
        elif self.passes is False:
            if self.allow_failure:
                result = result_type(Checker.Code.IGNORED, '')
            else:
                result = result_type(Checker.Code.FAILED, '')
        else:
            try:
                result = self.check(data, **self.arguments)
                messages = ''
                if isinstance(result, tuple):
                    result, messages = result

                if result not in Checker.Code:
                    result = Checker.Code.PASSED if bool(result) else Checker.Code.FAILED

                if result == Checker.Code.FAILED and self.allow_failure:
                    result = Checker.Code.IGNORED

                result = result_type(result, messages)
            except NotImplementedError:
                result = result_type(Checker.Code.NOT_IMPLEMENTED, '')
        self.result = result
287334
def run(self, files, working_area):
        

        # Ensure that dictionary is ordered by check declaration order (via self.check_names)
        # NOTE: Requires CPython 3.6. If we need to support older versions of Python, replace with OrderedDict.
        results = {name: None for name in self.check_names}
        checks_root = working_area.parent
        with futures.ProcessPoolExecutor() as executor:

            # Start all checks that have no dependencies
            not_done = set(executor.submit(run_check(name, self.checks_spec, checks_root))
                           for name, _ in self.child_map[None])
            not_passed = []

            while not_done:
                done, not_done = futures.wait(not_done, return_when=futures.FIRST_COMPLETED)
                for future in done:
                    # Get result from completed check
                    result, state = future.result()
                    results[result.name] = result
                    if result.passed:
                        # Dispatch dependent checks
                        for child_name, _ in self.child_map[result.name]:
                            not_done.add(executor.submit(
                                run_check(child_name, self.checks_spec, checks_root, state)))
                    else:
                        not_passed.append(result.name)

        for name in not_passed:
            self._skip_children(name, results)

        return results.values()
665263
public static function run(): void
    {
        foreach (self::CHECKERS as $checker) {
            WP_CLI::add_wp_hook(CheckerCollectionFactory::REGISTER_HOOK, [$checker, 'register']);
        }
    }
329113
private function run() {
		$issues = [];
		$totalFiles = 0;
		$totalLines = 0;
		$filePath = $this->scanner->getCurrentFilePath();
		if (!$this->options->getOption('t') || in_array('syntax', $this->options->getOption('t'), true)) {
			$checkSyntax = true;
			$versionGood = $this->tests->getPHPVersion();
			if (!$versionGood) {
				$this->reporter->add("ERROR!  Syntax checking was selected and a PHP binary lower than 7.0.0-dev was specified.", 0, 1);
			}
		} else {
			$checkSyntax = false;
		}

		while (($lines = $this->scanner->scanNextFile()) !== false) {
			$totalFiles++;

			//Check syntax and assign a line to grab if needed.
			$grabLineNumber = null;
			$grabLine = null;
			if ($checkSyntax) {
				$syntax = $this->tests->checkSyntax($filePath);
				if (!isset($syntax['is_valid'])) {
					$grabLineNumber = $syntax['line'];
				}
			}

			foreach ($lines as $index => $line) {
				$lineNumber = $index + 1;
				$line = trim($line, "\r\n");

				if ($lineNumber == $grabLineNumber) {
					$grabLine = $line;
				}

				$totalLines++;
				$issues = $this->tests->testLine($line);
				foreach ($issues as $section => $tests) {
					foreach ($tests as $test => $true) {
						$this->reporter->addToSection($section, $test, $filePath, $lineNumber, $line);
					}
				}
			}

			if ($checkSyntax && $grabLine !== null) {
				$this->reporter->addToSection('syntax', 'syntax', $filePath, $grabLineNumber, $grabLine.' //'.$syntax['error']);
			}
			$filePath = $this->scanner->getCurrentFilePath();
		}
		$this->reporter->add("Processed {$totalLines} lines contained in {$totalFiles} files.", 0, 1);
	}
789806
public function run()
    {
        $this->registerAssets();
        
        if ($this->hasModel()) {
            echo Html::activeCheckbox($this->model, $this->attribute, $this->options);
        } else {
            $checked = ArrayHelper::remove($this->options, 'checked', false);
            echo Html::checkbox($this->name, $checked, $this->options);
        }
    }