Sha256: 2537dcf06b3a7aa47accc2f2be507e5a0caec4b4ad5de4cd3a7452757bda44a4

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Quality
  module Tools
    # Adds 'cane' tool support to quality gem
    class Cane < Tool
      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

15 entries across 15 versions & 1 rubygems

Version Path
quality-37.1.1 lib/quality/tools/cane.rb
quality-37.1.0 lib/quality/tools/cane.rb
quality-37.0.1 lib/quality/tools/cane.rb
quality-37.0.0 lib/quality/tools/cane.rb
quality-36.1.0 lib/quality/tools/cane.rb
quality-36.0.0 lib/quality/tools/cane.rb
quality-35.2.1 lib/quality/tools/cane.rb
quality-35.2.0 lib/quality/tools/cane.rb
quality-35.1.1 lib/quality/tools/cane.rb
quality-35.0.1 lib/quality/tools/cane.rb
quality-35.0.0 lib/quality/tools/cane.rb
quality-34.0.2 lib/quality/tools/cane.rb
quality-34.0.1 lib/quality/tools/cane.rb
quality-34.0.0 lib/quality/tools/cane.rb
quality-33.0.0 lib/quality/tools/cane.rb