Sha256: c0ca275dd8d7f0d7ebb36ba612878b66de6287bc4937b9f19789b6c2869ea337

Contents?: true

Size: 798 Bytes

Versions: 20

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

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

20 entries across 20 versions & 1 rubygems

Version Path
quality-40.0.1 lib/quality/tools/flake8.rb
quality-40.0.0 lib/quality/tools/flake8.rb
quality-39.0.1 lib/quality/tools/flake8.rb
quality-38.0.1 lib/quality/tools/flake8.rb
quality-38.0.0 lib/quality/tools/flake8.rb
quality-37.1.1 lib/quality/tools/flake8.rb
quality-37.1.0 lib/quality/tools/flake8.rb
quality-37.0.1 lib/quality/tools/flake8.rb
quality-37.0.0 lib/quality/tools/flake8.rb
quality-36.1.0 lib/quality/tools/flake8.rb
quality-36.0.0 lib/quality/tools/flake8.rb
quality-35.2.1 lib/quality/tools/flake8.rb
quality-35.2.0 lib/quality/tools/flake8.rb
quality-35.1.1 lib/quality/tools/flake8.rb
quality-35.0.1 lib/quality/tools/flake8.rb
quality-35.0.0 lib/quality/tools/flake8.rb
quality-34.0.2 lib/quality/tools/flake8.rb
quality-34.0.1 lib/quality/tools/flake8.rb
quality-34.0.0 lib/quality/tools/flake8.rb
quality-33.0.0 lib/quality/tools/flake8.rb