Showing 16 of 21 total issues
File prettify.js
has 902 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// Copyright (C) 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Function combinePrefixPatterns
has 186 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function combinePrefixPatterns(regexs) {
var capturedGroupIndex = 0;
var needToFoldCase = false;
var ignoreCase = false;
Function numberLines
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function numberLines(node, opt_startLineNum) {
var nocode = /(?:^|\s)nocode(?:\s|$)/;
var lineBreak = /\r\n?|\n/;
var document = node.ownerDocument;
Function createSimpleLexer
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) {
var shortcuts = {};
var tokenizer;
(function () {
var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns);
Function sourceDecorator
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function sourceDecorator(options) {
var shortcutStylePatterns = [], fallthroughStylePatterns = [];
if (options['tripleQuotedStrings']) {
// '''multi-line-string''', 'single-line-string', and double-quoted
shortcutStylePatterns.push(
Function recombineTagsAndDecorations
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function recombineTagsAndDecorations(job) {
var isIE = /\bMSIE\b/.test(navigator.userAgent);
var newlineRe = /\n/g;
var source = job.sourceCode;
Function decorate
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var decorate = function (job) {
var sourceCode = job.sourceCode, basePos = job.basePos;
/** Even entries are positions in source in ascending order. Odd enties
* are style markers (e.g., PR_COMMENT) that run from that position until
* the end.
Function allowAnywhereFoldCaseAndRenumberGroups
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function allowAnywhereFoldCaseAndRenumberGroups(regex) {
// Split into character sets, escape sequences, punctuation strings
// like ('(', '(?:', ')', '^'), and runs of characters that do not
// include any of the above.
var parts = regex.source.match(
Function prettyPrint
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function prettyPrint(opt_whenDone) {
function byTagName(tn) { return document.getElementsByTagName(tn); }
// fetch a list of nodes to rewrite
var codeSegments = [byTagName('pre'), byTagName('code'), byTagName('xmp')];
var elements = [];
Function caseFoldCharset
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function caseFoldCharset(charSet) {
var charsetParts = charSet.substring(1, charSet.length - 1).match(
new RegExp(
'\\\\u[0-9A-Fa-f]{4}'
+ '|\\\\x[0-9A-Fa-f]{2}'
Function extractSourceSpans
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function extractSourceSpans(node) {
var nocode = /(?:^|\s)nocode(?:\s|$)/;
var chunks = [];
var length = 0;
Function doWork
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function doWork() {
var endTime = (window['PR_SHOULD_USE_CONTINUATION'] ?
clock['now']() + 250 /* ms */ :
Infinity);
for (; k < elements.length && clock['now']() < endTime; k++) {
Function walk
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function walk(node) {
switch (node.nodeType) {
case 1: // Element
if (nocode.test(node.className)) { break; }
if ('BR' === node.nodeName) {
Function walk
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function walk(node) {
switch (node.nodeType) {
case 1: // Element
if (nocode.test(node.className)) { return; }
for (var child = node.firstChild; child; child = child.nextSibling) {
Avoid deeply nested control flow statements. Open
Open
if (match) {
style = patternParts[0];
break;
}
Avoid too many return
statements within this function. Open
Open
return charsetPart.charCodeAt(1);