Sha256: 2c1cee9032d9f5ab71b3871f44da55e2a11555a2f6c1f945b56914b7d1ea535e
Contents?: true
Size: 1.37 KB
Versions: 16
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module RuboCop class CLI module Command # Generate a .rubocop.yml file in the current directory. class InitDotfile < Base DOTFILE = ConfigLoader::DOTFILE self.command_name = :init def run path = File.expand_path(DOTFILE) if File.exist?(DOTFILE) warn Rainbow("#{DOTFILE} already exists at #{path}").red STATUS_ERROR else description = <<~DESC # The behavior of RuboCop can be controlled via the .rubocop.yml # configuration file. It makes it possible to enable/disable # certain cops (checks) and to alter their behavior if they accept # any parameters. The file can be placed either in your home # directory or in some project directory. # # RuboCop will start looking for the configuration file in the directory # where the inspected file is and continue its way up to the root directory. # # See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md DESC File.open(DOTFILE, 'w') do |f| f.write(description) end puts "Writing new #{DOTFILE} to #{path}" STATUS_SUCCESS end end end end end end
Version data entries
16 entries across 15 versions & 4 rubygems