Sha256: 017b61aaa8f1e41999a65d7bf64b8b5fc3a00d82bcab2363a0f106056072590c

Contents?: true

Size: 1.02 KB

Versions: 30

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Quality
  module Tools
    # Adds 'cane' tool support to quality gem
    module Cane
      private

      def cane_exclude_args
        [
          "--abc-exclude '#{source_files_exclude_glob}'",
          "--style-exclude '#{source_files_exclude_glob}'",
          "--doc-exclude '#{source_files_exclude_glob}'",
        ]
      end

      def ruby_files_glob
        "{#{ruby_files.join(',')}}"
      end

      def cane_args
        args = [
          "-f '#{ruby_files_glob}'",
        ]
        unless exclude_files.nil? || exclude_files.empty?
          args += cane_exclude_args
        end
        args.join(' ')
      end

      def quality_cane
        ratchet_quality_cmd('cane', gives_error_code_on_violations: true,
                                    args: cane_args,
                                    emacs_format: true) do |line|
          if line =~ /\(([0-9]*)\):$/
            Regexp.last_match[1].to_i
          else
            0
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
quality-32.1.1 lib/quality/tools/cane.rb
quality-32.1.0 lib/quality/tools/cane.rb
quality-32.0.0 lib/quality/tools/cane.rb
quality-31.3.0 lib/quality/tools/cane.rb
quality-31.2.1 lib/quality/tools/cane.rb
quality-31.2.0 lib/quality/tools/cane.rb
quality-31.1.0 lib/quality/tools/cane.rb
quality-31.0.0 lib/quality/tools/cane.rb
quality-30.0.1 lib/quality/tools/cane.rb
quality-30.0.0 lib/quality/tools/cane.rb
quality-29.0.0 lib/quality/tools/cane.rb
quality-28.0.0 lib/quality/tools/cane.rb
quality-27.4.0 lib/quality/tools/cane.rb
quality-27.3.1 lib/quality/tools/cane.rb
quality-27.3.0 lib/quality/tools/cane.rb
quality-27.2.0 lib/quality/tools/cane.rb
quality-27.1.1 lib/quality/tools/cane.rb
quality-27.1.0 lib/quality/tools/cane.rb
quality-27.0.0 lib/quality/tools/cane.rb
quality-26.0.0 lib/quality/tools/cane.rb