Class: PolishGeeks::DevTools::Commands::FinalBlankLine
- Defined in:
- lib/polish_geeks/dev_tools/commands/final_blank_line.rb
Overview
Validator used to check if all files have final blank line
Constant Summary collapse
- DEFAULT_PATHS_TO_EXCLUDE =
Default paths which we want to exclude from analyse
%w( coverage tmp doc log vendor public app/assets/images app/assets/fonts .DS_Store .gem ).freeze
Constants inherited from Base
Instance Attribute Summary collapse
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
Attributes inherited from Base
Instance Method Summary collapse
-
#error_message ⇒ String
final blank line.
-
#execute ⇒ Object
Executes this command and set output and counter variables.
-
#label ⇒ String
Default label for this command.
-
#valid? ⇒ Boolean
True if all files have final blank line.
Methods inherited from Base
Instance Attribute Details
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
8 9 10 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 8 def counter @counter end |
Instance Method Details
#error_message ⇒ String
final blank line
47 48 49 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 47 def "Following files don't have final blank line: \n#{output.join("\n")}\n" end |
#execute ⇒ Object
Executes this command and set output and counter variables
25 26 27 28 29 30 31 32 33 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 25 def execute @output = [] @counter = 0 files_to_analyze.each do |file| @counter += 1 @output << sanitize(file) unless file_valid?(file) end end |
#label ⇒ String
Returns default label for this command.
41 42 43 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 41 def label "Final blank line: #{counter} files checked" end |
#valid? ⇒ Boolean
Returns true if all files have final blank line.
36 37 38 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 36 def valid? output.empty? end |