Sha256: 41de75e837154006206a23fe439581767e86c9c2af6901a8d8944a1adf3f76a8

Contents?: true

Size: 789 Bytes

Versions: 22

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

module Quality
  module Tools
    # Adds 'pep8' tool support to quality gem
    module Pep8
      private

      def pep8_args
        python_files.join(' ')
      end

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

      def quality_pep8
        ratchet_quality_cmd('pep8',
                            args: pep8_args,
                            gives_error_code_on_no_relevant_code:
                              true) do |line|
          pep8_count_errors(line)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
quality-30.0.1 lib/quality/tools/pep8.rb
quality-30.0.0 lib/quality/tools/pep8.rb
quality-29.0.0 lib/quality/tools/pep8.rb
quality-28.0.0 lib/quality/tools/pep8.rb
quality-27.4.0 lib/quality/tools/pep8.rb
quality-27.3.1 lib/quality/tools/pep8.rb
quality-27.3.0 lib/quality/tools/pep8.rb
quality-27.2.0 lib/quality/tools/pep8.rb
quality-27.1.1 lib/quality/tools/pep8.rb
quality-27.1.0 lib/quality/tools/pep8.rb
quality-27.0.0 lib/quality/tools/pep8.rb
quality-26.0.0 lib/quality/tools/pep8.rb
quality-25.0.0 lib/quality/tools/pep8.rb
quality-24.0.0 lib/quality/tools/pep8.rb
quality-23.0.7 lib/quality/tools/pep8.rb
quality-23.0.6 lib/quality/tools/pep8.rb
quality-23.0.5 lib/quality/tools/pep8.rb
quality-23.0.4 lib/quality/tools/pep8.rb
quality-23.0.3 lib/quality/tools/pep8.rb
quality-23.0.2 lib/quality/tools/pep8.rb