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 .swp .swo ).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
49 50 51 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 49 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
27 28 29 30 31 32 33 34 35 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 27 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.
43 44 45 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 43 def label "Final blank line: #{counter} files checked" end |
#valid? ⇒ Boolean
Returns true if all files have final blank line.
38 39 40 |
# File 'lib/polish_geeks/dev_tools/commands/final_blank_line.rb', line 38 def valid? output.empty? end |