lib/rordan_gramsay/lint/cookbook_comments_checker.rb
def license?
          @license ||= @lines.any? do |line|
            break true if line =~ /licen[sc]e/i # "License" or "Licence"
            break true if line =~ /all rights(?: reserved)?/i # "All rights reserved"

            # Popular licenses
            break true if line =~ /(?:^|\W)\(?BSD(?:v?3)\)?(?:$|\W)/ # "BSD", "BSD3", "BSDv3" or wrapping any of those in parentheses
            break true if line =~ /(?:^|\W)\(?MIT\)?(?:$|\W)/ # "MIT" or "(MIT)"
            break true if line =~ /(?:^|\W)Apache(?:$|\W)/i # "Apache"
            break true if line =~ /(?:^|\W)Creative Commons(?:$|\W)/i
            break true if line =~ /(?:^|\W)GNU Public Licen[sc]e(?:$|\W)/i # "GNU Public License"
            break true if line =~ /(?:^|\W)\(?[AL]?GPL\)?(?:$|\W)/ # GPL, AGPL, LGPL licenses

            false
          end
        end
# Detects if references to a license are included (even if "all rights reserved")
Detects if references to a license are included (even if "all rights reserved")
Detects if references to a license are included ( even if " all rights reserved " )
def license?
          @license ||= @lines.any? do |line|
            break true if line =~ /licen[sc]e/i 
            break true if line =~ /all rights(?: reserved)?/i 
            break true if line =~ /(?:^|\W)\(?BSD(?:v?3)\)?(?:$|\W)/ 
            break true if line =~ /(?:^|\W)\(?MIT\)?(?:$|\W)/ 
            break true if line =~ /(?:^|\W)Apache(?:$|\W)/i 
            break true if line =~ /(?:^|\W)Creative Commons(?:$|\W)/i
            break true if line =~ /(?:^|\W)GNU Public Licen[sc]e(?:$|\W)/i 
            break true if line =~ /(?:^|\W)\(?[AL]?GPL\)?(?:$|\W)/ 
            false
          end
        end
def license? @license ||= @lines . any? do | line | break true if line =~ / licen[sc]e /i break true if line =~ / all rights(?: reserved)? /i break true if line =~ / (?:^| \W ) \( ?BSD(?:v?3) \) ?(?:$| \W ) / break true if line =~ / (?:^| \W ) \( ?MIT \) ?(?:$| \W ) / break true if line =~ / (?:^| \W )Apache(?:$| \W ) /i break true if line =~ / (?:^| \W )Creative Commons(?:$| \W ) /i break true if line =~ / (?:^| \W )GNU Public Licen[sc]e(?:$| \W ) /i break true if line =~ / (?:^| \W ) \( ?[AL]?GPL \) ?(?:$| \W ) / false end end
Detects if references to a license are included (even if "all rights reserved")
Detects if references to a license are included ( even if " all rights reserved " )
# "License" or "Licence" # "All rights reserved" # Popular licenses # "BSD", "BSD3", "BSDv3" or wrapping any of those in parentheses # "MIT" or "(MIT)" # "Apache" # "GNU Public License" # GPL, AGPL, LGPL licenses