rubocop:enable Metrics/LineLength
770253
def sign
    signature_key_contents = decryption_keys[:signature]

    fail ArgumentError, 'You asked to sign your settings files but no signature key was found.  Run `chamber init --signature` to generate one.' \
      unless signature_key_contents

    signature = Files::Signature.new(to_s, read, signature_key_contents)

    signature.write
  end
1359324
def fix_long_line_physically(self, result):
        """"""
        line_index = result['line'] - 1
        target = self.source[line_index]

        previous_line = get_item(self.source, line_index - 1, default='')
        next_line = get_item(self.source, line_index + 1, default='')

        try:
            fixed = self.fix_long_line(
                target=target,
                previous_line=previous_line,
                next_line=next_line,
                original=target)
        except (SyntaxError, tokenize.TokenError):
            return []

        if fixed:
            self.source[line_index] = fixed
            return [line_index + 1]
        else:
            return []
959997
def wrap(width: 78, indent: 0, indent_after: false, segments: false)
    if segments
      text = Text.wrap_segments(@lines[@line], width: width, indent: indent, indent_after: indent_after)
    else
      text = Text.wrap(@lines[@line], width: width, indent: indent, indent_after: indent_after)
    end
    @lines.delete_at(@line)
    @line -= 1
    text.split("\n").each {|line| self.next(line) }
    return self
  end
862920
def parse_line(line)
      ruby_match = line.match(RUBY_FORMAT)

      if ruby_match
        _, file, number, method = ruby_match.to_a
        file.sub!(/\.class$/, '.rb')
        module_name = nil
      else
        java_match = line.match(JAVA_FORMAT)
        _, module_name, method, file, number = java_match.to_a
      end

      [file, number, method, module_name]
    end
413867
def syntax_error!(message, args = {})
      args[:orig_line] ||= @orig_line
      args[:line] ||= @line
      args[:lineno] ||= @lineno
      args[:column] ||= args[:orig_line] && args[:line] ?
                        args[:orig_line].size - args[:line].size : 0
      raise SyntaxError.new(message, options[:file],
                            args[:orig_line], args[:lineno], args[:column])
    end
1186587
function wrap(str, lineLength) {
    str = (str || '').toString();
    lineLength = lineLength || 76;

    if (str.length <= lineLength) {
        return str;
    }

    let result = [];
    let pos = 0;
    let chunkLength = lineLength * 1024;
    while (pos < str.length) {
        let wrappedLines = str
            .substr(pos, chunkLength)
            .replace(new RegExp('.{' + lineLength + '}', 'g'), '$&\r\n')
            .trim();
        result.push(wrappedLines);
        pos += chunkLength;
    }

    return result.join('\r\n').trim();
}
817400
def run(self, indent_size=DEFAULT_INDENT_SIZE):
        
        if indent_size < 1:
            return self.input_text

        try:
            stats = _reindent_stats(tokenize.generate_tokens(self.getline))
        except (SyntaxError, tokenize.TokenError):
            return self.input_text
        # Remove trailing empty lines.
        lines = self.lines
        # Sentinel.
        stats.append((len(lines), 0))
        # Map count of leading spaces to # we want.
        have2want = {}
        # Program after transformation.
        after = []
        # Copy over initial empty lines -- there's nothing to do until
        # we see a line with *something* on it.
        i = stats[0][0]
        after.extend(lines[1:i])
        for i in range(len(stats) - 1):
            thisstmt, thislevel = stats[i]
            nextstmt = stats[i + 1][0]
            have = _leading_space_count(lines[thisstmt])
            want = thislevel * indent_size
            if want < 0:
                # A comment line.
                if have:
                    # An indented comment line. If we saw the same
                    # indentation before, reuse what it most recently
                    # mapped to.
                    want = have2want.get(have, -1)
                    if want < 0:
                        # Then it probably belongs to the next real stmt.
                        for j in range(i + 1, len(stats) - 1):
                            jline, jlevel = stats[j]
                            if jlevel >= 0:
                                if have == _leading_space_count(lines[jline]):
                                    want = jlevel * indent_size
                                break
                    # Maybe it's a hanging comment like this one,
                    if want < 0:
                        # in which case we should shift it like its base
                        # line got shifted.
                        for j in range(i - 1, -1, -1):
                            jline, jlevel = stats[j]
                            if jlevel >= 0:
                                want = (have + _leading_space_count(
                                        after[jline - 1]) -
                                        _leading_space_count(lines[jline]))
                                break
                    if want < 0:
                        # Still no luck -- leave it alone.
                        want = have
                else:
                    want = 0
            assert want >= 0
            have2want[have] = want
            diff = want - have
            if diff == 0 or have == 0:
                after.extend(lines[thisstmt:nextstmt])
            else:
                for line_number, line in enumerate(lines[thisstmt:nextstmt],
                                                   start=thisstmt):
                    if line_number in self.string_content_line_numbers:
                        after.append(line)
                    elif diff > 0:
                        if line == '\n':
                            after.append(line)
                        else:
                            after.append(' ' * diff + line)
                    else:
                        remove = min(_leading_space_count(line), -diff)
                        after.append(line[remove:])

        return ''.join(after)
584437
def to_s
      msg = super
      @file = nil if (@file.is_a?(String) && @file.empty?)
      msg += Puppet::Util::Errors.error_location_with_space(@file, @line, @pos)
      msg
    end
1315896
def length
      (@client.redis.multi do
        %w[ locks work scheduled depends ].each do |suffix|
          @client.redis.zcard("ql:q:#{@name}-#{suffix}")
        end
      end).inject(0, :+)
    end
1273043
def stringify_comment_array comments
      ctxt = ''
      num = nil
      started = false
      last_line = nil
      comments.each { |l|
        # Trim the comment and minimum leading whitespace
        p = l.text.gsub(/^#+/, '')
        if num.nil? and !p.strip.empty?
          num = p.index(/[^ ]/)
          started = true
        elsif started and !p.strip.empty?
          cur = p.index(/[^ ]/)
          num = cur if cur < num
        end
        # Include blank lines between comments
        ctxt += ("\n" * (l.loc.first_line - last_line - 1)) unless last_line.nil? || l.loc.first_line - last_line <= 0
        ctxt += "#{p[num..-1]}\n" if started
        last_line = l.loc.last_line if last_line.nil? || l.loc.last_line > last_line
      }
      ctxt
    end
643866
private void newLine() {
    numBlocks = 0;
    perms = username = group = path = linkTarget = replication = hardlinkId = "";
    filesize = 0l;
    type = INode.INodeType.REGULAR_INODE.toString();
    inInode = true;
  }
1182586
def parse_result_line(cls, columns, line, metrics):
        
        line = IORMetricsExtractor.RE_MULTIPLE_SPACES.sub(' ', line)
        line = line.split(' ')
        operation = line[0]
        assert len(line) == len(columns)
        for i, col in enumerate(line):
            col = columns[i]
            if col in cls.METAS_IGNORED:
                continue
            desc = cls.METAS.get(col)
            if desc is None:
                LOGGER.warn('Unrecognized column: %s', col)
            meta = cls.get_meta_name(operation, desc.get('name') or col)
            value = desc['metric'].type(line[i])
            metrics[meta] = value
1077569
def maximum_length(text)
      lines = text.split(/\n/, -1)
      display_width(lines.max_by { |line| display_width(line) } || '')
    end
604083
def parse_line(match)
        raise InvalidFormat.new "Couldn't parse plugin" if match.nil?
        Derelict::Plugin.new *match.captures[0..1]
      end
496540
function parseLine(line, lineno, options) {
	let command = null;
	const lineContinuationRegex = (options && options.lineContinuationRegex
		|| TOKEN_LINE_CONTINUATION);

	line = line.trim();

	if (!line) {
		// Ignore empty lines
		return { command: null, remainder: '' };
	}

	if (isComment(line)) {
		// Handle comment lines.
		command = { name: 'COMMENT', args: line, lineno: lineno };
		return { command: command, remainder: '' };
	}

	if (line.match(lineContinuationRegex)) {
		// Line continues on next line.
		const remainder = line.replace(lineContinuationRegex, '', 'g');
		return { command: null, remainder: remainder };
	}

	command = splitCommand(line);
	command.lineno = lineno;

	let commandParserFn = commandParsers[command.name];
	if (!commandParserFn) {
		// Invalid Dockerfile instruction, but allow it and move on.
		// log.debug('Invalid Dockerfile command:', command.name);
		commandParserFn = parseString;
	}

	if (commandParserFn(command)) {
		// Successfully converted the arguments.
		command.raw = line;
		delete command.rest;
	}

	return { command: command, remainder: '' };
}
45508
def error(msg, line = nil)
      error = ::Opal::SyntaxError.new(msg)
      error.location = Opal::OpalBacktraceLocation.new(file, line)
      raise error
    end
909900
def output(data = {}, indent = 0)
      case @options['format']
      when 'json'
        puts JSON.pretty_generate(data)
      when 'yaml'
        puts data.to_yaml
      else
        # rubocop:disable Metrics/BlockNesting
        if data.class == Hash
          data.each do |k, v|
            if v.class == Hash || v.class == Array
              puts "#{' ' * indent}#{k.nil? ? 'nil' : k}:"
              output(v, indent + 2)
            else
              puts "#{' ' * indent}#{k.nil? ? 'nil' : k}: #{v.nil? ? 'nil' : v}"
            end
          end
        elsif data.class == Array
          data.each do |d|
            if d.class == Hash || d.class == Array
              output(d, indent + 2)
            else
              puts "#{' ' * indent}#{d.nil? ? 'nil' : d}"
            end
          end
          puts "\nTotal: #{data.size}" if indent < 1
        else
          puts "#{' ' * indent}#{data.nil? ? 'nil' : data}"
        end
        # rubocop:enable Metrics/BlockNesting
      end
    end