Class: FaceControl::Checkers::Example
- Inherits:
-
Object
- Object
- FaceControl::Checkers::Example
- Defined in:
- lib/face_control/checkers/_example.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
writeonly
Define only if you use @options in the following methods.
Instance Method Summary collapse
-
#command(filenames) ⇒ String
Command line to check the files.
- #parse(command_output) ⇒ Object
-
#relevant_globs ⇒ Array<String>
Shell globs to filter only files relevant to this checker out of all files with added lines in the pull request.
Instance Attribute Details
#options=(value) ⇒ Object (writeonly)
Define only if you use @options in the following methods
8 9 10 |
# File 'lib/face_control/checkers/_example.rb', line 8 def (value) @options = value end |
Instance Method Details
#command(filenames) ⇒ String
Returns Command line to check the files.
20 21 22 |
# File 'lib/face_control/checkers/_example.rb', line 20 def command(filenames) "ls -l #{filenames}" end |
#parse(command_output) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/face_control/checkers/_example.rb', line 26 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 |
#relevant_globs ⇒ Array<String>
Returns Shell globs to filter only files relevant to this checker out of all files with added lines in the pull request.
13 14 15 |
# File 'lib/face_control/checkers/_example.rb', line 13 def relevant_globs %w(bin/*) end |