class LearnLinter
Constants
- VERSION
Attributes
filepath[RW]
quiet[RW]
Public Class Methods
new(filepath, quiet=nil)
click to toggle source
# File lib/learn_linter.rb, line 13 def initialize(filepath, quiet=nil) @filepath = filepath @learn_error = LearnError.new @quiet = quiet end
Public Instance Methods
contributing_lint()
click to toggle source
# File lib/learn_linter.rb, line 62 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_linter.rb, line 34 def has_file?(file) Dir.entries(filepath).include?(file) end
license_lint()
click to toggle source
# File lib/learn_linter.rb, line 46 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_linter.rb, line 19 def lint_directory self.yaml_lint self.license_lint self.readme_lint self.contributing_lint unless quiet @learn_error.result_output end @learn_error.total_errors end
readme_lint()
click to toggle source
# File lib/learn_linter.rb, line 54 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_linter.rb, line 30 def result_message @learn_error.result_message end
yaml_lint()
click to toggle source
# File lib/learn_linter.rb, line 38 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