Run checks on self.files, printing json object
        containing information relavent to the CS50 IDE plugin at the end.
354363
def run_json(self):
        
        checks = {}
        for file in self.files:
            try:
                results = self._check(file)
            except Error as e:
                checks[file] = {
                    "error": e.msg
                }
            else:
                checks[file] = {
                    "score": results.score,
                    "comments": results.comment_ratio >= results.COMMENT_MIN,
                    "diff": "<pre>{}</pre>".format("\n".join(self.html_diff(results.original, results.styled))),
                }

        json.dump(checks, sys.stdout, indent=4)
        print()
1170578
function isJsonFile (file) {
  return file.data &&                             // The file has data
    (typeof file.data === 'string') &&            // and it's a string
    (
      mimeTypePattern.test(file.mimeType) ||      // and it has a JSON MIME type
      extensionPattern.test(file.url)             // or at least a .json file extension
    );
}
480759
def export_json_object(dict_obj, filename=None):
    
    try:
        if filename:
            try:
                with open(filename, 'w') as handle:
                    handle.write(json.dumps(dict_obj, indent=4, sort_keys=True))
                    logger.info(
                        '%s: Wrote %s to local filesystem location' %
                        (inspect.stack()[0][3], filename))
                handle.close()
            except TypeError as e:
                logger.warning(
                    '%s: object in dict not serializable: %s' %
                    (inspect.stack()[0][3], str(e)))
        else:
            json_str = json.dumps(dict_obj, indent=4, sort_keys=True)
            print(highlight(json_str, lexers.JsonLexer(), formatters.TerminalFormatter()))
            logger.info('%s: successful export to stdout' % inspect.stack()[0][3])
            return True
    except IOError as e:
        logger.critical(
            '%s: export_file_object: error writing to %s to filesystem. Error: %s' %
            (inspect.stack()[0][3], filename, str(e)))
        return False
    else:
        logger.info('export_file_object: successful export to %s' % filename)
        return True
850959
def _debug_linter_status(linter, filename, show_lint_files):
    """"""
    if show_lint_files:
        print("{linter}: {filename}".format(linter=linter, filename=filename))
273287
function(checks, callback) {
      fs.lstat(options.source, function(err, stats) {
        /* istanbul ignore else  */
        if (stats.isFile()) {
          copyFile(options, callback);
        } else if (stats.isDirectory()) {
          copyDir(options, callback);
        } else if (stats.isSymbolicLink()) {
          copySymlink(options, callback);
        } else {
          callback(new Error('Unsupported file type !'));
        }
      });
    }
873764
def lint
      return if target_files.empty?

      bin = textlint_path
      result_json = run_textlint(bin, target_files)
      errors = parse(result_json)
      send_comment(errors)
    end
1215686
def is_json_file(filename, show_warnings = False):
    
    try:
        config_dict = load_config(filename, file_type = "json")
        is_json = True
    except:
        is_json = False
    return(is_json)
1192598
function() {
      'use strict';
      var filesToCopy = {
         'widget.json': 'widget.json',
         'gitignore': '.gitignore',
         'spec/spec_runner.html': 'spec/spec_runner.html',
         'spec/spec_runner.js': 'spec/spec_runner.js',
         'spec/widget.spec.js': 'spec/' + this.placeholder.name + '.spec.js'
      };
      var integrationTechnology = this.placeholder.laxarIntegrationTechnology;
      var widget = !this.options.activity;

      if( widget && integrationTechnology !== 'react' ) {
         filesToCopy[ 'default.theme/widget.html' ] = 'default.theme/' + this.placeholder.name + '.html';
      }
      if( widget ) {
         filesToCopy[ 'default.theme/css/widget.css' ] = 'default.theme/css/' + this.placeholder.name + '.css';
      }

      if( integrationTechnology === 'plain' ) {
         if( !widget ) {
            filesToCopy[ 'controller.plain.activity.js' ] = this.placeholder.name + '.js';
         }
         else {
            filesToCopy[ 'controller.plain.widget.js' ] = this.placeholder.name + '.js';
         }
      }
      else if( integrationTechnology === 'angular' ) {
         filesToCopy[ 'controller.angular.js' ] = this.placeholder.name + '.js';
      }
      else if( integrationTechnology === 'react' ) {
         filesToCopy[ 'controller.react.jsx' ] = this.placeholder.name + '.jsx';
      }

      if( this.placeholder.infrastructure ) {
         filesToCopy[ 'README.md' ] = 'README.md';
         if( widget && integrationTechnology !== 'react') {
            filesToCopy[ 'bower.widget.json' ] = 'bower.json';
         }
         else if ( widget && integrationTechnology === 'react' ) {
            filesToCopy[ 'bower.react.widget.json' ] = 'bower.json';
         }
         else {
            filesToCopy[ 'bower.activity.json' ] = 'bower.json';
         }
      }
      for( var file in filesToCopy ) {
         if( filesToCopy.hasOwnProperty( file ) ) {
            this.fs.copyTpl(
               this.templatePath( file ),
               this.destinationPath(
                  path.join( this.widgetDirname, this.placeholder.name, filesToCopy[ file ] )
               ),
               this.placeholder
            );
         }
      }
   }
835034
function output() {
        var sortByKey = options.sortByKey;
        if (sortByKey) {
          var keys = Object.keys(json),
            i, k, len = keys.length,
            tmp = {};
          keys.sort();
          for (i = 0; i < len; i++) {
            k = keys[i];
            tmp[k] = json[k];
          }
          json = tmp;
          tmp = null;
        }
        grunt.file.write(outputFile, JSON.stringify(json, null, 4));
        done();
      }
855129
function JSONReporter(dir, config) {
    this._config = config;

    var fileName = config.file || DEFAULT_FILE_NAME;
    this._filePath = path.join(dir, fileName);
}
352145
async function displayStatusInfo(rootFolder, metadata) {
    const local = path.join(rootFolder, constants.META_DIR, constants.META_LOCAL);
    const remote = path.join(rootFolder, constants.META_DIR, constants.META_REMOTE);

    // Get valid extensions for code files
    const extensions = eaft.getCodeExtensions();

    const files = [];
    const keys = [];
    const data = [];
    data.local = JSON.parse(fs.readFileSync(local, 'utf8'));
    data.remote = JSON.parse(fs.readFileSync(remote, 'utf8'));

    // Construct array with filename, extension and environment as key
    for (const env in data) {
        for (const codeFile of data[env].files) {
            const extension = eaft.getExtensionFromFiletype(codeFile.type, extensions);
            const key = `${codeFile.name}${extension}.${env}`;
            keys.push(key);
            codeFile.environment = env;
            files[key] = codeFile;
        }
    }

    // Sort keys
    keys.sort();

    // Track what we need to print
    const addedFiles = [];
    const modifiedFiles = [];
    const deletedFiles = [];

    // Iterate over all keys
    for (let i = 0; i < keys.length; i++) {
        const file = files[keys[i]];
        const extension = eaft.getExtensionFromFiletype(file.type, extensions);
        const nextFile = files[keys[i + 1]];

        if (nextFile && file.name === nextFile.name && file.type === nextFile.type) {
            // We can skip 1 ahead
            i++;
            if (file.source !== nextFile.source) {
                modifiedFiles.push(file.name + extension);
            }
        } else if (file.environment === 'local') {
            addedFiles.push(file.name + extension);
        } else if (file.environment === 'remote') {
            deletedFiles.push(file.name + extension);
        }
    }

    // Display something if everything is ok
    if (addedFiles.length === 0 && modifiedFiles.length === 0 && deletedFiles.length === 0) {
        process.stdout.write(`Your local and remote project for '${metadata.name}' are in sync`);
        checkbox.display(`green`);
    } else {
        process.stdout.write(`There are some differences between your local and remote projectfiles for '${metadata.name}'`);
        console.log(``);

        // Display added files
        if (addedFiles.length > 0) {
            console.log(``);
        }
        for (const added of addedFiles) {
            console.log(`   + ${added}`.green);
        }

        // Display modified files
        if (modifiedFiles.length > 0) {
            console.log(``);
        }
        for (const modified of modifiedFiles) {
            console.log(`   ~ ${modified}`.yellow);
        }

        // Display removed files
        if (deletedFiles.length > 0) {
            console.log(``);
        }
        for (const deleted of deletedFiles) {
            console.log(`   - ${deleted}`.red);
        }
        console.log(``);
    }
}
191179
def get_output(self):
        """"""
        logger.info("Getting outputs.")
        # Get the set of prefixes (each will correspond to three json files.)
        json_files = glob.glob(path.join(self.output_dir, '*.json'))
        json_prefixes = set()
        for json_file in json_files:
            # Remove .uaz.<subfile type>.json
            prefix = '.'.join(path.basename(json_file).split('.')[:-3])
            json_prefixes.add(path.join(self.output_dir, prefix))

        # Join each set of json files and store the json dict.
        for prefix in json_prefixes:
            base_prefix = path.basename(prefix)
            if base_prefix.isdecimal():
                base_prefix = int(base_prefix)
            elif base_prefix in self.id_maps.keys():
                base_prefix = self.id_maps[base_prefix]
            try:
                content = self._join_json_files(prefix, clear=True)
            except Exception as e:
                logger.exception(e)
                logger.error("Could not load result for prefix %s." % prefix)
                content = None
            self.add_result(base_prefix, content)
            logger.debug('Joined files for prefix %s.' % base_prefix)
        return self.results
667111
def run(self):
        
        # thanks to deluge guys ;)
        po_dir = os.path.join(os.path.dirname(__file__), 'webant', 'translations')
        print('Compiling po files from "{}"...'.format(po_dir))
        for lang in os.listdir(po_dir):
            sys.stdout.write("\tCompiling {}... ".format(lang))
            sys.stdout.flush()
            curr_lang_path = os.path.join(po_dir, lang)
            for path, dirs, filenames in os.walk(curr_lang_path):
                for f in filenames:
                    if f.endswith('.po'):
                        src = os.path.join(path, f)
                        dst = os.path.join(path, f[:-3] + ".mo")
                        if not os.path.exists(dst) or self.force:
                            msgfmt.make(src, dst)
                            print("ok.")
                        else:
                            src_mtime = os.stat(src)[8]
                            dst_mtime = os.stat(dst)[8]
                            if src_mtime > dst_mtime:
                                msgfmt.make(src, dst)
                                print("ok.")
                            else:
                                print("already up to date.")
        print('Finished compiling translation files.')
315917
function (files, output, name) {
    this.files = files;
    this.outputfile = path.resolve(output || os.tmpdir()) + path.sep + (name || '.check');
    this.data = {};
}
867820
def check_outputs(self):
        
        self.outputs = self.expand_filenames(self.outputs)
        result = False
        if self.files_exist(self.outputs):
            if self.dependencies_are_newer(self.outputs, self.inputs):
                result = True
                print("Dependencies are newer than outputs.")
                print("Running task.")
            elif self.force:
                print("Dependencies are older than inputs, but 'force' option present.")
                print("Running task.")
                result = True
            else:
                print("Dependencies are older than inputs.")
        else:
            print("No ouput file(s).")
            print("Running task.")
            result = True
        return result
592092
def proselint(paths=None, version=None, clean=None, debug=None,
              output_json=None, time=None, demo=None, compact=None):
    """"""
    if time:
        click.echo(timing_test())
        return

    # In debug or clean mode, delete cache & *.pyc files before running.
    if debug or clean:
        clear_cache()

    # Use the demo file by default.
    if demo:
        paths = [demo_file]

    # Expand the list of directories and files.
    filepaths = extract_files(list(paths))

    # Lint the files
    num_errors = 0

    # Use stdin if no paths were specified
    if len(paths) == 0:
        filepaths.append('-')

    for fp in filepaths:
        try:
            if fp == '-':
                fp = '<stdin>'
                f = sys.stdin
            else:
                f = click.open_file(
                    fp, 'r', encoding="utf-8", errors="replace")
            errors = lint(f, debug=debug)
            num_errors += len(errors)
            print_errors(fp, errors, output_json, compact=compact)
        except Exception:
            traceback.print_exc()

    # Return an exit code
    close_cache_shelves()
    if num_errors > 0:
        sys.exit(1)
    else:
        sys.exit(0)
295479
def execute!
      files_to_check = parse_options.leftovers

      YamlLint.logger.level = Logger::DEBUG if opts.debug

      no_yamls_to_check_msg = "Error: need at least one YAML file to check.\n"\
                              'Try --help for help.'
      abort(no_yamls_to_check_msg) if files_to_check.empty?
      lint(files_to_check)
    end