Sha256: a1c76df8f679bf70e730dd63c7956099b1449a927141479211ead1602b4cd5f3

Contents?: true

Size: 852 Bytes

Versions: 8

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

module Quality
  module Tools
    # Adds 'pycodestyle' tool support to quality gem
    module Pycodestyle
      private

      def pycodestyle_args
        python_files.join(' ')
      end

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

      def quality_pycodestyle
        ratchet_quality_cmd('pycodestyle',
                            args: pycodestyle_args,
                            gives_error_code_on_no_relevant_code:
                              true) do |line|
          pycodestyle_count_errors(line)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
quality-32.1.1 lib/quality/tools/pycodestyle.rb
quality-32.1.0 lib/quality/tools/pycodestyle.rb
quality-32.0.0 lib/quality/tools/pycodestyle.rb
quality-31.3.0 lib/quality/tools/pycodestyle.rb
quality-31.2.1 lib/quality/tools/pycodestyle.rb
quality-31.2.0 lib/quality/tools/pycodestyle.rb
quality-31.1.0 lib/quality/tools/pycodestyle.rb
quality-31.0.0 lib/quality/tools/pycodestyle.rb