Sha256: d9d328eac0b7a94d0ee29273adb98378e9957153696e2e6a3a5338caa591575f

Contents?: true

Size: 1.19 KB

Versions: 10

Compression:

Stored size: 1.19 KB

Contents

require 'face_control/comment'

module FaceControl
  module Checkers
    class Example
      # @optional
      # Define only if you use @options in the following methods
      attr_writer :options

      # @optional
      # @return [Array<String>] Shell globs to filter only files relevant to this checker
      #                         out of all files with added lines in the pull request
      def relevant_globs
        %w(bin/*)
      end

      # @param filenames [String] Files with added lines in the pull request
      #                           only relevant to this checker (filtered by globs above)
      # @return [String] Command line to check the files
      def command(filenames)
        "ls -l #{filenames}"
      end

      # @param command_output [String] Stdout of the command above
      # @return Array<FaceControl::Comment> Comments to post to the pull request
      def parse(command_output)
        command_output.split("\n").map do |line|
          fields = line.split

          mode = fields.first
          file = fields.last

          unless mode == '-rwxr-xr-x'
            Comment.new(file: file, line: 1, text: 'Invalid file mode')
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
face_control-1.0.0 lib/face_control/checkers/_example.rb
face_control-0.9.1 lib/face_control/checkers/_example.rb
face_control-0.8.6 lib/face_control/checkers/_example.rb
face_control-0.9.0 lib/face_control/checkers/_example.rb
face_control-0.8.5 lib/face_control/checkers/_example.rb
face_control-0.8.4 lib/face_control/checkers/_example.rb
face_control-0.8.3 lib/face_control/checkers/_example.rb
face_control-0.8.2 lib/face_control/checkers/_example.rb
face_control-0.8.1 lib/face_control/checkers/_example.rb
face_control-0.8.0 lib/face_control/checkers/_example.rb