@private
JSDoc validator

@param {string} lines Doc to validate

@returns {undefined}
425092
function validateDoc(lines) {
  expect(lines.length).toBe(18);

  // First line should be overall comment with preamble
  expect(lines[0]).toBe('\t * Test object comment');

  // Second line should be a newline with preamble
  expect(lines[1]).toBe('\t * ');

  /* Third line should be first parameter definition with preamble, correct
   * type, objectName. parameter name and the description
   */
  expect(lines[2]).toBe('\t * @param {string} [objectName.string] Some '
      + 'string');
  
  // Fourth line should be an anything parameter
  expect(lines[3]).toBe('\t * @param {*} [objectName.any] Some '
      + 'variable that can be anything');

  // '\t * @param {number} objectName.requiredNumber Required number',
  // Long line should be wrapped
  expect(lines[5]).toBe('\t * @param {string} [objectName.defaultString='
      + '\'string\'] a string with a');
  
  // Line continuation should aligned with after the jsdoc word
  expect(lines[6]).toBe('\t *        default and a really long description');
  
  // Default values
  expect(lines[7]).toBe('\t * @param {number} [objectName.defaultNumber=34] '
      + 'a number with a default');
  expect(lines[8]).toBe('\t * @param {boolean} [objectName.'
      + 'defaultBoolean=true] a boolean with a');
  //'\t *        default',

  // Types
  expect(lines[11]).toBe('\t * @param {(string|number)} [objectName.types] '
      + 'a string or a number');

  // Array of strings
  expect(lines[12]).toBe('\t * @param {string[]} [objectName.arr]');
  
  // Object of numbers
  expect(lines[13]).toBe('\t * @param {number[]} [objectName.coord]');
  
  // Either Array of strings or an object of numbers
  expect(lines[14]).toBe('\t * @param {(string[]|number[])} '
      + '[objectName.arrcoord]');
  
  // A recursive schema variable
  expect(lines[15]).toBe('\t * @param {schema} [objectName.recurse] a '
      + 'recursive variable');
  
  // Forced type
  expect(lines[16]).toBe('\t * @param {potatoes} [objectName.forced] Some '
      + 'string with a forced type');
}
957460
function(doc){
    if(doc === null || typeof(doc) !== 'object'){
        return;
    }

    for(var key in doc){
        if(key[0] === '$'){
            throw new Error('Document fields can not start with "$"');
        }
        if(key.indexOf('.') !== -1){
            throw new Error('Document fields can not contain "."');
        }
        verifyDoc(doc[key]);
    }
}
477487
function validateCodeBlock (codeBlock, file) {
  var lang = codeBlock.lang;
  var code = codeBlock.code;

  if (lang === 'json') {
    try {
      JSON.parse(code);
    } catch (e) {
      console.log(e);
      console.log(code);
      return false;
    }
    return true;
  } else if (lang === 'js' || lang === 'javascript') {
    code = preprocessCode(code);
    try {
      esprima.parse(code, { tolerant: true });
    } catch (e) {

      // Get indeces from lineNumber and column
      var line   = e.lineNumber - 1;
      var column = e.column - 1;

      // Highlight error in code
      code = code.split('\n');

      code[line] = code[line].slice(0, column).magenta +
                   code[line][column].red +
                   code[line].slice(column + 1).magenta;

      code = code.join('\n');

      if (!didLogFileBreak) {
        logFileBreak(file);
        didLogFileBreak = true;
      }

      console.log(e);
      console.log(code);

      return false;
    }
    return true;
  }
}
709290
function parse(lines) {
  var i, line, key, parts, values;

  for(i = 0;i < lines.length;i++) {
    line = lines[i];
    this.lineNumber++;

    // ignore comments and whitespace lines
    if(COMMENT.test(line) || WHITESPACE.test(line)) {
      continue;
    // got something to parse
    }else{

      // strip empty entires, leading whitespace is allowed
      parts = line.split(/\s+/).filter(function(p) {
        return p;
      })

      // get the config key
      key = parts[0];

      // remaining parts to parse as values
      values = parts.slice(1);
      try {
        this.conf.add(key, values, this.lineNumber);
      }catch(e) {
        throw new ConfigError(this.lineNumber, line, this.file, e);
      }
    }
  }
}
1222365
function DocCommentParser(text) {
  this.lines = text.split(END_OF_LINE);
  this.lineNumber = 0;
  this.length = this.lines.length;
  this.line = '';

  this.match = [];
  this.tagDef = {};

  this.mode = this._extractLine;

  this.data = {};
}
792973
function validateBaseIndent(line, actualText, expectedIndent) {
                const expectedBaseIndentText = expectedIndent.baseIndentText
                if (
                    expectedBaseIndentText &&
                    (actualText.length < expectedBaseIndentText.length ||
                        !actualText.startsWith(expectedBaseIndentText))
                ) {
                    context.report({
                        loc: {
                            start: { line, column: 0 },
                            end: {
                                line,
                                column: actualText.length,
                            },
                        },
                        messageId: actualText
                            ? "unexpectedBaseIndentation"
                            : "missingBaseIndentation",
                        data: {
                            expected: JSON.stringify(expectedBaseIndentText),
                            actual: actualText
                                ? JSON.stringify(
                                      actualText.slice(
                                          0,
                                          expectedBaseIndentText.length
                                      )
                                  )
                                : "",
                        },
                        fix: defineFix(line, actualText, expectedIndent),
                    })
                    return false
                }
                return true
            }
1220793
function validateSingleLineMemberExpression(node) {
         if (node.object.loc.start.line !== node.property.loc.start.line) {
            context.report({
               node: node.property,
               message: 'Identifier "{{ identifier }}" should be on a new line',
               data: {
                  identifier: node.property.name,
               },
               fix: function(fixer) {
                  var firstLineIndent = helper.lineIndent(node.object.loc.end.line),
                      fixString = '\n' + helper.indentChar.repeat(firstLineIndent) + '.';

                  return fixer.replaceTextRange([ node.object.end, node.property.start ], fixString);
               },
            });
         }
      }
201125
def validate(string_or_document, rules: nil, context: nil)
      doc = if string_or_document.is_a?(String)
        GraphQL.parse(string_or_document)
      else
        string_or_document
      end
      query = GraphQL::Query.new(self, document: doc, context: context)
      validator_opts = { schema: self }
      rules && (validator_opts[:rules] = rules)
      validator = GraphQL::StaticValidation::Validator.new(validator_opts)
      res = validator.validate(query)
      res[:errors]
    end
1368294
private void validateTypeAnnotations(Node n, JSDocInfo info) {
    if (info != null && info.hasType()) {
      boolean valid = false;
      switch (n.getToken()) {
        // Function declarations are valid
        case FUNCTION:
          valid = NodeUtil.isFunctionDeclaration(n);
          break;
        // Object literal properties, catch declarations and variable
        // initializers are valid.
        case NAME:
          valid = isTypeAnnotationAllowedForName(n);
          break;
        case ARRAY_PATTERN:
        case OBJECT_PATTERN:
          // allow JSDoc like
          //   function f(/** !Object */ {x}) {}
          //   function f(/** !Array */ [x]) {}
          valid = n.getParent().isParamList();
          break;
        // Casts, exports, and Object literal properties are valid.
        case CAST:
        case EXPORT:
        case STRING_KEY:
        case GETTER_DEF:
        case SETTER_DEF:
          valid = true;
          break;
        // Declarations are valid iff they only contain simple names
        //   /** @type {number} */ var x = 3; // ok
        //   /** @type {number} */ var {x} = obj; // forbidden
        case VAR:
        case LET:
        case CONST:
          valid = !NodeUtil.isDestructuringDeclaration(n);
          break;
        // Property assignments are valid, if at the root of an expression.
        case ASSIGN: {
          Node lvalue = n.getFirstChild();
          valid = n.getParent().isExprResult()
              && (lvalue.isGetProp()
                  || lvalue.isGetElem()
                  || lvalue.matchesQualifiedName("exports"));
          break;
        }
        case GETPROP:
          valid = n.getParent().isExprResult() && n.isQualifiedName();
          break;
        case CALL:
          valid = info.isDefine();
          break;
        default:
          break;
      }

      if (!valid) {
        reportMisplaced(n, "type", "Type annotations are not allowed here. "
            + "Are you missing parentheses?");
      }
    }
  }
1195225
function(filedata, callback) {
        var lines;
        lines = filedata.toString().split(/(?:\r\n|\r|\n)/gm);
        if (module.exports.verify(lines)) {
            return callback(undefined, lines);
        }
        return callback('INVALID_SRT_FORMAT');
    }
76215
function parseLines(lines) {
        var propertyMap = {};
        lines.forEach(function (line) {
            var parsed = parseLine(line);
            if (!parsed) {
                throw new Error('Cannot parse line: ', line);
            }
            propertyMap[parsed[1]] = parsed[2];
        });
        return propertyMap;
    }
32796
function prettyLines(lines, theme) {
  if (!lines || !Array.isArray(lines)) throw new Error('Please supply an array of lines');
  if (!theme) throw new Error('Please supply a theme');

  function prettify(line) {
    if (!line) return null;
    return exports.line(line, theme);
  }

  return lines.map(prettify);
}
1255431
private void validateDeprecatedJsDoc(Node n, JSDocInfo info) {
    if (info != null && info.isExpose()) {
      report(n, ANNOTATION_DEPRECATED, "@expose",
              "Use @nocollapse or @export instead.");
    }
  }
895911
function check(node) {
            const elements = node.elements;
            const normalizedOptions = normalizeOptions(context.options[0]);
            const options = normalizedOptions[node.type];

            let elementBreak = false;

            /*
             * MULTILINE: true
             * loop through every element and check
             * if at least one element has linebreaks inside
             * this ensures that following is not valid (due to elements are on the same line):
             *
             * [
             *      1,
             *      2,
             *      3
             * ]
             */
            if (options.multiline) {
                elementBreak = elements
                    .filter(element => element !== null)
                    .some(element => element.loc.start.line !== element.loc.end.line);
            }

            const linebreaksCount = node.elements.map((element, i) => {
                const previousElement = elements[i - 1];

                if (i === 0 || element === null || previousElement === null) {
                    return false;
                }

                const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken);
                const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken);
                const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken);

                return !astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement);
            }).filter(isBreak => isBreak === true).length;

            const needsLinebreaks = (
                elements.length >= options.minItems ||
                (
                    options.multiline &&
                    elementBreak
                ) ||
                (
                    options.consistent &&
                    linebreaksCount > 0 &&
                    linebreaksCount < node.elements.length
                )
            );

            elements.forEach((element, i) => {
                const previousElement = elements[i - 1];

                if (i === 0 || element === null || previousElement === null) {
                    return;
                }

                const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken);
                const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken);
                const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken);

                if (needsLinebreaks) {
                    if (astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) {
                        reportRequiredLineBreak(firstTokenOfCurrentElement);
                    }
                } else {
                    if (!astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) {
                        reportNoLineBreak(firstTokenOfCurrentElement);
                    }
                }
            });
        }
1019304
function (line) {
    var pieces = line.split(' ')

    // Header string pieces
    var output = {
      version: pieces.shift(),
      status: parseFloat(pieces.shift()),
      statusText: pieces.join(' ')
    }

    return output
  }
215465
function validateIndent() {
            /**
             * Check whether the line start is in template tag.
             * @param {number} line The line.
             * @returns {boolean} `true` if the line start is in template tag.
             */
            function inTemplateTag(line) {
                if (line <= 1) {
                    return false
                }
                const lineStartIndex = sourceCode.getIndexFromLoc({
                    line,
                    column: 0,
                })
                return microTemplateService.inTemplateTag(lineStartIndex - 1)
            }

            /**
             * Define the function which fixes the problem.
             * @param {number} line The number of line.
             * @param {string} actualText The actual indentation text.
             * @param {ExpectedIndent} expectedIndent The expected indentation info.
             * @returns {function} The defined function.
             */
            function defineFix(line, actualText, expectedIndent) {
                return fixer => {
                    const start = sourceCode.getIndexFromLoc({
                        line,
                        column: 0,
                    })
                    const indent = expectedIndent.indentText
                    return fixer.replaceTextRange(
                        [start, start + actualText.length],
                        indent
                    )
                }
            }

            /**
             * Validate base point indentation.
             * @param {number} line The number of line.
             * @param {string} actualText The actual indentation text.
             * @param {ExpectedIndent} expectedIndent The expected indent.
             * @returns {void}
             */
            function validateBaseIndent(line, actualText, expectedIndent) {
                const expectedBaseIndentText = expectedIndent.baseIndentText
                if (
                    expectedBaseIndentText &&
                    (actualText.length < expectedBaseIndentText.length ||
                        !actualText.startsWith(expectedBaseIndentText))
                ) {
                    context.report({
                        loc: {
                            start: { line, column: 0 },
                            end: {
                                line,
                                column: actualText.length,
                            },
                        },
                        messageId: actualText
                            ? "unexpectedBaseIndentation"
                            : "missingBaseIndentation",
                        data: {
                            expected: JSON.stringify(expectedBaseIndentText),
                            actual: actualText
                                ? JSON.stringify(
                                      actualText.slice(
                                          0,
                                          expectedBaseIndentText.length
                                      )
                                  )
                                : "",
                        },
                        fix: defineFix(line, actualText, expectedIndent),
                    })
                    return false
                }
                return true
            }

            offsets.forEach((value, line) => {
                if (!inTemplateTag(line)) {
                    return
                }
                if (!getLineText(line).trim()) {
                    // empty line
                    return
                }
                const actualText = value.actualText
                const expectedIndent = getExpectedIndent(line)
                if (!expectedIndent) {
                    return
                }
                if (!validateBaseIndent(line, actualText, expectedIndent)) {
                    return
                }
                const expectedBaseIndent = expectedIndent.baseIndentText.length

                const actualRelativeText = actualText.slice(expectedBaseIndent)

                for (let i = 0; i < actualRelativeText.length; ++i) {
                    if (actualRelativeText[i] !== options.indentChar) {
                        context.report({
                            loc: {
                                start: { line, column: expectedBaseIndent + i },
                                end: {
                                    line,
                                    column: expectedBaseIndent + i + 1,
                                },
                            },
                            messageId: "unexpectedIndentationCharacter",
                            data: {
                                expected: JSON.stringify(options.indentChar),
                                actual: JSON.stringify(actualRelativeText[i]),
                            },
                            fix: defineFix(line, actualText, expectedIndent),
                        })
                        return
                    }
                }

                const actualRelativeIndent = actualRelativeText.length

                if (actualRelativeIndent !== expectedIndent.indent) {
                    context.report({
                        loc: {
                            start: { line, column: expectedBaseIndent },
                            end: { line, column: actualText.length },
                        },
                        messageId: expectedBaseIndent
                            ? "unexpectedRelativeIndentation"
                            : "unexpectedIndentation",
                        data: {
                            expectedIndent: expectedIndent.indent,
                            actualIndent: actualRelativeIndent,
                            unit,
                            expectedIndentPlural:
                                expectedIndent.indent === 1 ? "" : "s",
                            actualIndentPlural:
                                actualRelativeIndent === 1 ? "" : "s",
                        },
                        fix: defineFix(line, actualText, expectedIndent),
                    })
                }
            })
        }
297539
function(str){
    var lines = str.match(/\n/g)
      , idx = str.lastIndexOf('\n');

    if (lines) this.lineno += lines.length;
    this.column = ~idx
      ? str.length - idx
      : this.column + str.length;
  }