class Licensee::Project::LicenseFile
Constants
- ANY_EXT_REGEX
Regex to match any extension
- CC_FALSE_POSITIVE_REGEX
CC-NC and CC-ND are not open source licenses and should not be detected as CC-BY or CC-BY-SA which are 98%+ similar
- COPYING_REGEX
Regex to match COPYING, COPYRIGHT, etc.
- FILENAME_REGEXES
Hash of Regex => score with which to score potential license files
- LICENSE_REGEX
Regex to match, LICENSE, LICENCE, unlicense, etc.
- OFL_REGEX
Regex to match OFL.
- PREFERRED_EXT
List of extensions to give preference to
- PREFERRED_EXT_REGEX
Public Class Methods
lesser_gpl_score(filename)
click to toggle source
case-insensitive block to determine if the given file is LICENSE.lesser
# File lib/licensee/project_files/license_file.rb, line 66 def self.lesser_gpl_score(filename) filename.casecmp('copying.lesser').zero? ? 1 : 0 end
name_score(filename)
click to toggle source
# File lib/licensee/project_files/license_file.rb, line 61 def self.name_score(filename) FILENAME_REGEXES.find { |regex, _| filename =~ regex }[1] end
Public Instance Methods
attribution()
click to toggle source
# File lib/licensee/project_files/license_file.rb, line 48 def attribution @attribution ||= begin matches = Matchers::Copyright::REGEX .match(content_without_title_and_version) matches[0] if matches end end
possible_matchers()
click to toggle source
# File lib/licensee/project_files/license_file.rb, line 44 def possible_matchers [Matchers::Copyright, Matchers::Exact, Matchers::Dice] end
potential_false_positive?()
click to toggle source
Is this file likely to result in a creative commons false positive?
# File lib/licensee/project_files/license_file.rb, line 57 def potential_false_positive? content.strip =~ CC_FALSE_POSITIVE_REGEX end