diff --git a/bin/cookstyle b/bin/cookstyle index 93b5ebc4..cb2d9585 100755 --- a/bin/cookstyle +++ b/bin/cookstyle @@ -1,17 +1,15 @@ #!/usr/bin/env ruby # frozen_string_literal: true +$LOAD_PATH.unshift File.join(__dir__, %w(.. lib)) + if ARGV.include?('--chefstyle') ARGV.delete('--chefstyle') - module Cookstyle - CHEFSTYLE_CONFIG = true - end + require 'cookstyle/chefstyle' +else + require 'cookstyle' end -$LOAD_PATH.unshift File.join(__dir__, %w(.. lib)) - -require 'cookstyle' - # force the fail level to :convention so that we can set all our new rules to # the lowest level of :refactor without failing everyone's CI jobs unless ARGV.include?('--fail-level') diff --git a/lib/cookstyle/chefstyle.rb b/lib/cookstyle/chefstyle.rb new file mode 100644 index 00000000..e819604d --- /dev/null +++ b/lib/cookstyle/chefstyle.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true +module Cookstyle + CHEFSTYLE_CONFIG = true +end +require_relative '../cookstyle'