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-25.0.0 lib/quality/tools/flake8.rb
quality-24.0.0 lib/quality/tools/flake8.rb
quality-23.0.7 lib/quality/tools/flake8.rb
quality-23.0.6 lib/quality/tools/flake8.rb
quality-23.0.5 lib/quality/tools/flake8.rb
quality-23.0.4 lib/quality/tools/flake8.rb
quality-23.0.3 lib/quality/tools/flake8.rb
quality-23.0.2 lib/quality/tools/flake8.rb
quality-23.0.1 lib/quality/tools/flake8.rb
quality-23.0.0 lib/quality/tools/flake8.rb