REPORTING AND FIXING
971432
function reverse(array) {
  return array.map(function (v) {
    return {
      name: v.name,
      rank: -v.rank,
      node: v.node,
    }
  }).reverse()
}
273892
private final void fixReportDependencyAnalysis(final Element root) {
        for (final Element head : root.getElementsByTag("h2")) {
            head.tagName("h1");
        }

        for (final Element head : root.getElementsByTag("h3")) {
            head.tagName("h2");
        }
    }
913890
function report(items, heading) {
            grunt.log.subhead(heading);
            if (items.length > 0) {
                grunt.log.error(grunt.log.wordlist(items, {separator: '\n'}));
            } else {
                grunt.log.ok();
            }
        }
238493
def fix_parameters(self):
        """"""
        for W, b in zip(self.W_list, self.b_list):
            W.fix()
            b.fix()
333074
private final void fixReportCpd(final Element root) {
        final Collection<Element> elements; // Found elements

        elements = root.getElementsByTag("h2");
        if (!elements.isEmpty()) {
            elements.iterator().next().tagName("h1");
        }
    }
579207
private void fix() {
        Set<String> nodeGroups = appContext.getTaskTrackerManager().getNodeGroups();
        if (CollectionUtils.isEmpty(nodeGroups)) {
            return;
        }
        for (String nodeGroup : nodeGroups) {
            List<JobPo> deadJobPo = appContext.getExecutableJobQueue().getDeadJob(nodeGroup, SystemClock.now() - MAX_TIME_OUT);
            if (CollectionUtils.isNotEmpty(deadJobPo)) {
                for (JobPo jobPo : deadJobPo) {
                    appContext.getExecutableJobQueue().resume(jobPo);
                    LOGGER.info("Fix executable job : {} ", JSON.toJSONString(jobPo));
                }
            }
        }
    }
767375
function report(node) {
            const leftParenToken = sourceCode.getTokenBefore(node);
            const rightParenToken = sourceCode.getTokenAfter(node);

            if (!isParenthesisedTwice(node)) {
                if (tokensToIgnore.has(sourceCode.getFirstToken(node))) {
                    return;
                }

                if (isIIFE(node) && !isParenthesised(node.callee)) {
                    return;
                }
            }

            context.report({
                node,
                loc: leftParenToken.loc.start,
                messageId: "unexpected",
                fix(fixer) {
                    const parenthesizedSource = sourceCode.text.slice(leftParenToken.range[1], rightParenToken.range[0]);

                    return fixer.replaceTextRange([
                        leftParenToken.range[0],
                        rightParenToken.range[1]
                    ], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource + (requiresTrailingSpace(node) ? " " : ""));
                }
            });
        }
860049
def fix_input(warnings, line, line_number, filename)
      fixable_warnings = filter_fixable warnings
      if fixable_warnings.size == 1
        self.settings[:output_lines] << fixable_warnings.first.fix rescue line
      elsif fixable_warnings.size > 1
        new_text = fixable_warnings.first.fix rescue line
        process_line(new_text, line_number, filename)
      else
        self.settings[:output_lines] << line
      end
    end
1121042
private final void fixReportTeamList(final Element root) {
        for (final Element head : root.getElementsByTag("h2")) {
            head.tagName("h1");
        }

        for (final Element head : root.getElementsByTag("h3")) {
            head.tagName("h2");
        }
    }
998843
def cleanup(self):
    
    # Move any existing errors to global errors
    self.global_errors.extend(self.errors)
    self.errors = []

    # Make the previous module's output available to the next module
    self.input = self.output
    self.output = []
159132
public void fixate() {
		ransac = FactoryMultiViewRobust.trifocalRansac(configTriRansac,configError,configRansac);
		sba = FactoryMultiView.bundleSparseProjective(configSBA);
	}
646656
function reportAllExceptFirst(nodes, messageId, fix) {
            reportSlice(nodes, 1, nodes.length, messageId, fix);
        }
711137
protected void updateReporting(Reporting value, String xmlTag, Counter counter, Element element)
   {
      boolean shouldExist = value != null;
      Element root = updateElement(counter, element, xmlTag, shouldExist);
      if (shouldExist)
      {
         Counter innerCount = new Counter(counter.getDepth() + 1);
         findAndReplaceSimpleElement(innerCount, root, "excludeDefaults",
                  (value.isExcludeDefaults() == false) ? null : String.valueOf(value.isExcludeDefaults()), "false");
         findAndReplaceSimpleElement(innerCount, root, "outputDirectory", value.getOutputDirectory(), null);
         iterateReportPlugin(innerCount, root, value.getPlugins(), "plugins", "plugin");
      }
   }
962254
def fix(csvfile):
    ''''''
    header('Apply fixes from {}', csvfile.name)
    bads = []
    reader = csv.reader(csvfile)
    reader.next()  # Skip header
    for id, _, sources, dests in reader:
        advice = Advice.objects.get(id=id)
        sources = [s.strip() for s in sources.split(',') if s.strip()]
        dests = [d.strip() for d in dests.split(',') if d.strip()]
        if not len(sources) == len(dests):
            bads.append(id)
            continue
        for source, dest in zip(sources, dests):
            echo('{0}: Replace {1} with {2}', white(id), white(source), white(dest))
            advice.subject = advice.subject.replace(source, dest)
            advice.content = advice.content.replace(source, dest)
        advice.save()
        index(advice)
    for id in bads:
        echo('{0}: Replacements length not matching', white(id))
    success('Done')
1288493
function updateReport() {
				var nodeIndex = getNodeIndex({}, structureJson);
			
				var treeOptions = {
					"plugins" : [ "themes", "json_data", "ui", "cookies", "contextmenu" ],
          "core" : {
            "html_titles" : true
          },
					"cookies" : {
						"save_opened" : $report.attr("id")+"_opened"
					},
					"contextmenu" : {
						"select_node" : true,
						"items" : contextMenuHandler
					},
					"json_data" : {
						"progressive_render" : true,
						"progressive_unload" : true,
						"data" : dataHandler
          }
				};
				$report.jstree(treeOptions)
				.on("loaded.jstree", function(event, data) {
					$cukeTree.cukeTree().reportRendered($report);
				})
				.on("select_node.jstree", function(event, data) {
					var $node = $(data.args[0]);
					$cukeTree.cukeTree().reportNodeSelected({ $report : $report, selected : $node });
				});	
        
        function dataHandler(item, callback) {
          var data = null;
          if (item === -1) {
            data = [getTreeNode("group", structureJson)];
          } else {
            data = getTreeNodeChildren($(item).attr("id"));
          }
          callback(data);
        }
        
        function getTreeNodeChildren(id) {
          var data = [];
          var parent = nodeIndex[id];
          if (parent.children !== undefined) {
            for(var i=0; i<parent.children.length; i++) { data.push(getTreeNode("group", parent.children[i])); }
          }
          if (parent.features !== undefined) {
            for(var i=0; i<parent.features.length; i++) { data.push(getTreeNode("feature", parent.features[i])); }
          }
          if (parent.elements !== undefined) {
            for(var i=0; i<parent.elements.length; i++) { data.push(getTreeNode("scenario", parent.elements[i])); }
          }
          if (parent.steps !== undefined) {
            for(var i=0; i<parent.steps.length; i++) { data.push(getTreeNode("step", parent.steps[i])); }
          }
          return data;
        }
        
        function getTreeNode(type, reportEntry) {
          var cssClasses = "node-"+ reportEntry.result.status;
          cssClasses += " "+ type +" "+ type +"-"+ reportEntry.result.status;
          
          var title = reportEntry.name;
          switch(type) {
            case "group": 
              title += " ("+ getScenarioCount(type, reportEntry) +" scenario(s))"; 
              break;
            case "feature":
              var scenarioCount = reportEntry.elements !== undefined ? reportEntry.elements.length : 0;
              if (reportEntry.profile !== undefined) {
                title += " <span class='profile'>["+ reportEntry.profile +"]</span>";
              }
              title += " ("+ scenarioCount +" scenario(s))"
              break;
            case "scenario":
              for(var i=0; i < (reportEntry.tags !== undefined ? reportEntry.tags.length : 0); i++) {
                title += " <span class='scenario-tag'>"+ reportEntry.tags[i].name +"</span>";
              }
              break;
            case "step":
              title = '<span class="keyword">'+ reportEntry.keyword +'</span>'+ title;
              break;
          }
          
          var addingChildren = reportEntry.result && reportEntry.result.status == "failed";
                  
          var node = {
            attr : { 
              id : reportEntry.nodeId,
              "data-type" : type, 
              class : cssClasses
            },
            state : addingChildren && type !== "step" ? "open" : "closed",
            data : {
              attr : { 
                href : "javascript:;", 
                "data-path" : reportEntry.uri
              },
              title : title,
              icon : type
            }
          };
          
          if (addingChildren) {
            node.children = getTreeNodeChildren(reportEntry.nodeId);
          }
          
          if (reportEntry.result.error_message !== undefined) {
            node.attr["data-error"] = reportEntry.result.error_message;
          }
          
          if (reportEntry.embeddings !== undefined) {
            node.attr["data-embedding-mime-type"] = reportEntry.embeddings[0].mime_type;
            node.attr["data-embedding-data"] = reportEntry.embeddings[0].data;
          }
          
          return node;
        }
			}
1262484
function report(node, location, fixRange) {

            /*
             * Passing node is a bit dirty, because message data will contain big
             * text in `source`. But... who cares :) ?
             * One more kludge will not make worse the bloody wizardry of this
             * plugin.
             */
            context.report({
                node,
                loc: location,
                message: "Trailing spaces not allowed.",
                fix(fixer) {
                    return fixer.removeRange(fixRange);
                }
            });
        }
1085151
function fixIsSpentFlag(onDone){
	db.query(
		"SELECT outputs.unit, outputs.message_index, outputs.output_index \n\
		FROM outputs \n\
		CROSS JOIN inputs ON outputs.unit=inputs.src_unit AND outputs.message_index=inputs.src_message_index AND outputs.output_index=inputs.src_output_index \n\
		WHERE is_spent=0 AND type='transfer'",
		function(rows){
			console.log(rows.length+" previous outputs appear to be spent");
			if (rows.length === 0)
				return onDone();
			var arrQueries = [];
			rows.forEach(function(row){
				console.log('fixing is_spent for output', row);
				db.addQuery(arrQueries, 
					"UPDATE outputs SET is_spent=1 WHERE unit=? AND message_index=? AND output_index=?", [row.unit, row.message_index, row.output_index]);
			});
			async.series(arrQueries, onDone);
		}
	);
}