class LearnLinter
Public Class Methods
new(filepath)
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 2 def initialize(filepath) @learn_error = LearnError.new @filepath = filepath end
Public Instance Methods
contributing_lint()
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 48 def contributing_lint if self.has_file?("CONTRIBUTING.md") @learn_error.contributing_error[:present_contributing] = true @learn_error.present_contributing = {message: "present CONTRIBUTING.md", color: :green} ContributingLinter.parse_file("#{@filepath}/CONTRIBUTING.md", @learn_error) end end
has_file?(file)
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 11 def has_file?(file) Dir.entries(@filepath).include?(file) || Dir.entries(@filepath).include?(file.upcase) || Dir.entries(@filepath).include?(file.downcase) end
license_lint()
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 32 def license_lint if self.has_file?("LICENSE.md") @learn_error.license_error[:present_license] = true @learn_error.present_license = {message: "present LICENSE.md", color: :green} LicenseLinter.parse_file("#{@filepath}/LICENSE.md", @learn_error) end end
lint_directory()
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 15 def lint_directory self.yaml_lint self.license_lint self.readme_lint self.contributing_lint @learn_error.result_output @learn_error.total_errors end
readme_lint()
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 40 def readme_lint if self.has_file?("README.md") @learn_error.readme_error[:present_readme] = true @learn_error.present_readme = {message: "present README.md", color: :green} ReadmeLinter.parse_file("#{@filepath}/README.md", @learn_error) end end
result_message()
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 7 def result_message @learn_error.result_message end
yaml_lint()
click to toggle source
# File lib/learn-tool/learn-lint.rb, line 24 def yaml_lint if self.has_file?(".learn") @learn_error.yaml_error[:present_dotlearn] = true @learn_error.present_learn = {message: "present .learn file", color: :green} YamlLint.parse_file("#{@filepath}/.learn", @learn_error) end end