Class: HomeWorkChecker::ArchiveResult::RubyCodeQuality
- Inherits:
-
CodeQuality
- Object
- CodeQuality
- HomeWorkChecker::ArchiveResult::RubyCodeQuality
- Defined in:
- lib/hw_checker/ruby_code_quality.rb
Instance Method Summary collapse
-
#initialize(tmp_path, dirname) ⇒ RubyCodeQuality
constructor
A new instance of RubyCodeQuality.
- #perform ⇒ Object
Constructor Details
#initialize(tmp_path, dirname) ⇒ RubyCodeQuality
Returns a new instance of RubyCodeQuality.
4 5 6 7 8 |
# File 'lib/hw_checker/ruby_code_quality.rb', line 4 def initialize(tmp_path, dirname) @work_path = "#{tmp_path}/#{dirname}" raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path) @lines_all = @lines_failed = 0 end |
Instance Method Details
#perform ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/hw_checker/ruby_code_quality.rb', line 10 def perform Dir.foreach(@work_path) do |p| next unless File::file?("#{@work_path}/#{p}") && File.extname(p) == '.rb' `rubocop #{@work_path}/#{p} > #{@work_path}/#{p}.tmp` count_lines_failed("#{@work_path}/#{p}.tmp") count_lines_all("#{@work_path}/#{p}") end calc_percent_quality end |