Sha256: ba9e40288480bc7599dd9d1d2f711ce4a18b9310e556194104772a6947179c9b

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
quality-22.0.0 lib/quality/tools/flake8.rb