Sha256: 21f2d2c0b91b912d8dc8303460de54cb138f82597bb7c36eecf305f6a8f8c046

Contents?: true

Size: 807 Bytes

Versions: 30

Compression:

Stored size: 807 Bytes

Contents

# frozen_string_literal: true

module Quality
  module Tools
    # Adds 'flake8' tool support to quality gem
    module Flake8
      private

      def flake8_args
        python_files.join(' ')
      end

      def flake8_count_errors(line)
        if line =~ /^Usage:/
          # no files specified
          0
        elsif line =~ /^flake8: /
          # no files specified
          0
        elsif line =~ /^$/
          # no files specified
          0
        else
          1
        end
      end

      def quality_flake8
        ratchet_quality_cmd('flake8',
                            args: flake8_args,
                            gives_error_code_on_no_relevant_code:
                              true) do |line|
          flake8_count_errors(line)
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

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