lib/rules/indent.js
function report(node, needed, gotten, loc, isLastNodeCheck) {
		var msgContext = {
			needed: needed,
			type: indentType,
			characters: needed === 1 ? "character" : "characters",
			gotten: gotten
		};
		var indentChar = indentType === "space" ? " " : "\t";

		/**
		 * Responsible for fixing the indentation issue fix
		 * @returns {Function} function to be executed by the fixer
		 * @private
		 */
		function getFixerFunction() {
			var rangeToFix = [];

			if (needed > gotten) {
				var spaces = "" + new Array(needed - gotten + 1).join(indentChar);  // replace with repeat in future

				if (isLastNodeCheck === true) {
					rangeToFix = [
						node.range[1] - 1,
						node.range[1] - 1
					];
				} else {
					rangeToFix = [
						node.range[0],
						node.range[0]
					];
				}

				return function(fixer) {
					return fixer.insertTextBeforeRange(rangeToFix, spaces);
				};
			} else {
				if (isLastNodeCheck === true) {
					rangeToFix = [
						node.range[1] - (gotten - needed) - 1,
						node.range[1] - 1
					];
				} else {
					rangeToFix = [
						node.range[0] - (gotten - needed),
						node.range[0]
					];
				}

				return function(fixer) {
					return fixer.removeRange(rangeToFix);
				};
			}
		}

		if (loc) {
			context.report({
				node: node,
				loc: loc,
				message: MESSAGE,
				data: msgContext,
				fix: getFixerFunction()
			});
		} else {
			context.report({
				node: node,
				message: MESSAGE,
				data: msgContext,
				fix: getFixerFunction()
			});
		}
	}
function report(node, needed, gotten, loc, isLastNodeCheck) {
		var msgContext = {
			needed: needed,
			type: indentType,
			characters: needed === 1 ? "character" : "characters",
			gotten: gotten
		};
		var indentChar = indentType === "space" ? " " : "\t";

		/**
		 * Responsible for fixing the indentation issue fix
		 * @returns {Function} function to be executed by the fixer
		 * @private
		 */
		function getFixerFunction() {
			var rangeToFix = [];

			if (needed > gotten) {
				var spaces = "" + new Array(needed - gotten + 1).join(indentChar);  // replace with repeat in future

				if (isLastNodeCheck === true) {
					rangeToFix = [
						node.range[1] - 1,
						node.range[1] - 1
					];
				} else {
					rangeToFix = [
						node.range[0],
						node.range[0]
					];
				}

				return function(fixer) {
					return fixer.insertTextBeforeRange(rangeToFix, spaces);
				};
			} else {
				if (isLastNodeCheck === true) {
					rangeToFix = [
						node.range[1] - (gotten - needed) - 1,
						node.range[1] - 1
					];
				} else {
					rangeToFix = [
						node.range[0] - (gotten - needed),
						node.range[0]
					];
				}

				return function(fixer) {
					return fixer.removeRange(rangeToFix);
				};
			}
		}

		if (loc) {
			context.report({
				node: node,
				loc: loc,
				message: MESSAGE,
				data: msgContext,
				fix: getFixerFunction()
			});
		} else {
			context.report({
				node: node,
				message: MESSAGE,
				data: msgContext,
				fix: getFixerFunction()
			});
		}
	}
function report ( node , needed , gotten , loc , isLastNodeCheck ) { var msgContext = { needed : needed , type : indentType , characters : needed === 1 ? "character" : "characters" , gotten : gotten } ; var indentChar = indentType === "space" ? " " : "\t" ; /**
		 * Responsible for fixing the indentation issue fix
		 * @returns {Function} function to be executed by the fixer
		 * @private
		 */ function getFixerFunction ( ) { var rangeToFix = [ ] ; if ( needed > gotten ) { var spaces = "" + new Array ( needed - gotten + 1 ) . join ( indentChar ) ; // replace with repeat in future if ( isLastNodeCheck === true ) { rangeToFix = [ node . range [ 1 ] - 1 , node . range [ 1 ] - 1 ] ; } else { rangeToFix = [ node . range [ 0 ] , node . range [ 0 ] ] ; } return function ( fixer ) { return fixer . insertTextBeforeRange ( rangeToFix , spaces ) ; } ; } else { if ( isLastNodeCheck === true ) { rangeToFix = [ node . range [ 1 ] - ( gotten - needed ) - 1 , node . range [ 1 ] - 1 ] ; } else { rangeToFix = [ node . range [ 0 ] - ( gotten - needed ) , node . range [ 0 ] ] ; } return function ( fixer ) { return fixer . removeRange ( rangeToFix ) ; } ; } } if ( loc ) { context . report ( { node : node , loc : loc , message : MESSAGE , data : msgContext , fix : getFixerFunction ( ) } ) ; } else { context . report ( { node : node , message : MESSAGE , data : msgContext , fix : getFixerFunction ( ) } ) ; } }
Reports a given indent violation and properly pluralizes the message
@param {ASTNode} node Node violating the indent rule
@param {int} needed Expected indentation character count
@param {int} gotten Indentation character count in the actual node/code
@param {Object=} loc Error line and column location
@param {boolean} isLastNodeCheck Is the error for last node check
@returns {void}
Reports a given indent violation and properly pluralizes the message