async scan()

in src/linter.js [529:562]


  async scan(deps = {}) {
    try {
      await this.extractMetadata(deps);
      const files = await this.io.getFiles();

      // Known libraries do not need to be scanned
      const filesWithoutJSLibraries = Object.keys(files).filter((file) => {
        return !Object.prototype.hasOwnProperty.call(
          this.addonMetadata.jsLibs,
          file
        );
      });

      await this.scanFiles(filesWithoutJSLibraries);
      this.closeIO();

      this.print(deps._console);
      // This is skipped in code coverage because the
      // test runs against un-instrumented code.
      /* istanbul ignore if */
      if (this.config.runAsBinary === true) {
        let exitCode = this.output.errors.length > 0 ? 1 : 0;
        if (exitCode === 0 && this.config.warningsAsErrors === true) {
          exitCode = this.output.warnings.length > 0 ? 1 : 0;
        }
        process.exit(exitCode);
      }
    } catch (err) {
      if (this.handleError(err, deps._console)) {
        return;
      }
      throw err;
    }
  }