Class: PolishGeeks::DevTools::Commands::EmptyMethods
- Defined in:
- lib/polish_geeks/dev_tools/commands/empty_methods.rb,
lib/polish_geeks/dev_tools/commands/empty_methods/file_parser.rb,
lib/polish_geeks/dev_tools/commands/empty_methods/string_refinements.rb
Overview
Validator used to check if all ‘.rb’ files don’t have empty methods
Defined Under Namespace
Modules: StringRefinements Classes: FileParser
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 ).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
empty methods.
-
#execute ⇒ Object
Executes this command and set output and counter variables.
-
#label ⇒ String
Default label for this command.
-
#valid? ⇒ Boolean
True if none of the files include any empty methods.
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/empty_methods.rb', line 8 def counter @counter end |
Instance Method Details
#error_message ⇒ String
empty methods
46 47 48 |
# File 'lib/polish_geeks/dev_tools/commands/empty_methods.rb', line 46 def "Following files contains blank methods: \n#{output.join("\n")}\n" end |
#execute ⇒ Object
Executes this command and set output and counter variables
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/polish_geeks/dev_tools/commands/empty_methods.rb', line 23 def execute @output = [] @counter = 0 files_to_analyze.each do |file| @counter += 1 empty_methods = FileParser.new(file).find_empty_methods @output << sanitize(file) + " lines #{empty_methods}" unless empty_methods.empty? end end |
#label ⇒ String
Returns default label for this command.
40 41 42 |
# File 'lib/polish_geeks/dev_tools/commands/empty_methods.rb', line 40 def label "Empty methods: #{counter} files checked" end |
#valid? ⇒ Boolean
Returns true if none of the files include any empty methods.
35 36 37 |
# File 'lib/polish_geeks/dev_tools/commands/empty_methods.rb', line 35 def valid? output.empty? end |