class LicenseLinter

Constants

VALID_FILE

Public Class Methods

parse_file(file, learn_error) click to toggle source
# File lib/learn_linter/license_linter.rb, line 6
def self.parse_file(file, learn_error)
  directory_file = File.open(file).read
  # valid_file = VALID_FILE.read
  if sanitize_whitespace(directory_file) == self.valid_license
    learn_error.license_error[:valid_license] = true
    learn_error.valid_license = {message: "valid license", color: :green}
  end
end
sanitize_whitespace(file) click to toggle source
# File lib/learn_linter/license_linter.rb, line 15
def self.sanitize_whitespace(file)
  file.split.delete_if {|char| char.empty? || char == "\n"}
end
valid_license() click to toggle source
# File lib/learn_linter/license_linter.rb, line 19
def self.valid_license
  ["#Learn.co",
 "Educational",
 "Content",
 "License",
 "Copyright",
 "(c)",
 "2015",
 "Flatiron",
 "School,",
 "Inc",
 "The",
 "Flatiron",
 "School,",
 "Inc.",
 "owns",
 "this",
 "Educational",
 "Content.",
 "However,",
 "the",
 "Flatiron",
 "School",
 "supports",
 "the",
 "development",
 "and",
 "availability",
 "of",
 "educational",
 "materials",
 "in",
 "the",
 "public",
 "domain.",
 "Therefore,",
 "the",
 "Flatiron",
 "School",
 "grants",
 "Users",
 "of",
 "the",
 "Flatiron",
 "Educational",
 "Content",
 "set",
 "forth",
 "in",
 "this",
 "repository",
 "certain",
 "rights",
 "to",
 "reuse,",
 "build",
 "upon",
 "and",
 "share",
 "such",
 "Educational",
 "Content",
 "subject",
 "to",
 "the",
 "terms",
 "of",
 "the",
 "Educational",
 "Content",
 "License",
 "set",
 "forth",
 "[here](http://learn.co/content-license)",
 "(http://learn.co/content-license).",
 "You",
 "must",
 "read",
 "carefully",
 "the",
 "terms",
 "and",
 "conditions",
 "contained",
 "in",
 "the",
 "Educational",
 "Content",
 "License",
 "as",
 "such",
 "terms",
 "govern",
 "access",
 "to",
 "and",
 "use",
 "of",
 "the",
 "Educational",
 "Content.",
 "Flatiron",
 "School",
 "is",
 "willing",
 "to",
 "allow",
 "you",
 "access",
 "to",
 "and",
 "use",
 "of",
 "the",
 "Educational",
 "Content",
 "only",
 "on",
 "the",
 "condition",
 "that",
 "you",
 "accept",
 "all",
 "of",
 "the",
 "terms",
 "and",
 "conditions",
 "contained",
 "in",
 "the",
 "Educational",
 "Content",
 "License",
 "set",
 "forth",
 "[here](http://learn.co/content-license)",
 "(http://learn.co/content-license).",
 "By",
 "accessing",
 "and/or",
 "using",
 "the",
 "Educational",
 "Content,",
 "you",
 "are",
 "agreeing",
 "to",
 "all",
 "of",
 "the",
 "terms",
 "and",
 "conditions",
 "contained",
 "in",
 "the",
 "Educational",
 "Content",
 "License.",
 "If",
 "you",
 "do",
 "not",
 "agree",
 "to",
 "any",
 "or",
 "all",
 "of",
 "the",
 "terms",
 "of",
 "the",
 "Educational",
 "Content",
 "License,",
 "you",
 "are",
 "prohibited",
 "from",
 "accessing,",
 "reviewing",
 "or",
 "using",
 "in",
 "any",
 "way",
 "the",
 "Educational",
 "Content."]
end