lib/licensee/project_files/license_file.rb in licensee-9.2.0 vs lib/licensee/project_files/license_file.rb in licensee-9.2.1

- old
+ new

@@ -17,25 +17,30 @@ COPYING_REGEX = /copy(ing|right)/i # Regex to match OFL. OFL_REGEX = /ofl/i + # BSD + PATENTS patent file + PATENTS_REGEX = /patents/i + # Hash of Regex => score with which to score potential license files FILENAME_REGEXES = { - /\A#{LICENSE_REGEX}\z/ => 1.0, # LICENSE - /\A#{LICENSE_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.9, # LICENSE.md - /\A#{COPYING_REGEX}\z/ => 0.8, # COPYING - /\A#{COPYING_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.7, # COPYING.md - /\A#{LICENSE_REGEX}#{ANY_EXT_REGEX}\z/ => 0.6, # LICENSE.textile - /\A#{COPYING_REGEX}#{ANY_EXT_REGEX}\z/ => 0.5, # COPYING.textile - /#{LICENSE_REGEX}-/ => 0.4, # LICENSE-MIT - /#{COPYING_REGEX}-/ => 0.35, # COPYING-MIT - /-#{LICENSE_REGEX}/ => 0.3, # MIT-LICENSE-MIT - /-#{COPYING_REGEX}/ => 0.25, # MIT-COPYING - /\A#{OFL_REGEX}#{PREFERRED_EXT_REGEX}/ => 0.2, # OFL.md - /\A#{OFL_REGEX}#{ANY_EXT_REGEX}/ => 0.1, # OFL.textile - /\A#{OFL_REGEX}\z/ => 0.05, # OFL - // => 0.0 # Catch all + /\A#{LICENSE_REGEX}\z/ => 1.00, # LICENSE + /\A#{LICENSE_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.95, # LICENSE.md + /\A#{COPYING_REGEX}\z/ => 0.90, # COPYING + /\A#{COPYING_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.85, # COPYING.md + /\A#{LICENSE_REGEX}#{ANY_EXT_REGEX}\z/ => 0.80, # LICENSE.textile + /\A#{COPYING_REGEX}#{ANY_EXT_REGEX}\z/ => 0.75, # COPYING.textile + /#{LICENSE_REGEX}-/ => 0.70, # LICENSE-MIT + /#{COPYING_REGEX}-/ => 0.65, # COPYING-MIT + /-#{LICENSE_REGEX}/ => 0.60, # MIT-LICENSE-MIT + /-#{COPYING_REGEX}/ => 0.55, # MIT-COPYING + /\A#{OFL_REGEX}#{PREFERRED_EXT_REGEX}/ => 0.50, # OFL.md + /\A#{OFL_REGEX}#{ANY_EXT_REGEX}/ => 0.45, # OFL.textile + /\A#{OFL_REGEX}\z/ => 0.40, # OFL + /\A#{PATENTS_REGEX}\z/ => 0.35, # PATENTS + /\A#{PATENTS_REGEX}#{ANY_EXT_REGEX}\z/ => 0.30, # PATENTS.txt + // => 0.00 # Catch all }.freeze # 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 CC_FALSE_POSITIVE_REGEX = /