lib/rordan_gramsay/lint/cookbook_comments_checker.rb
# Detects if there is a date (e.g., copyright date or date of authorship) included
Detects if there is a date  included
Detects if there is a date included
def date?
          @date ||= @lines.any? do |line|
            break true if line =~ %r{(?:/|-|\(| |^)(?:20|19)[0-9]{2}(?:/|-|\)| |$)}i 
            break true if line =~ %r{(?<year>(?:20|19)[0-9]{2})[/-](?<month>0?[1-9]|1[0-2])[/-](?<day>0?[1-9]|[1,2][0-9]|3[01])}i
            break true if line =~ /\b(?:20|19)[0-9]{2}\b/i
            false
          end
        end
def date? @date ||= @lines . any? do | line | break true if line =~ %r{ (?:/|-| \( | |^)(?:20|19)[0-9]{2}(?:/|-| \) | |$) }i break true if line =~ %r{ (?<year>(?:20|19)[0-9]{2})[/-](?<month>0?[1-9]|1[0-2])[/-](?<day>0?[1-9]|[1,2][0-9]|3[01]) }i break true if line =~ / \b (?:20|19)[0-9]{2} \b /i false end end
Detects if there is a date (e.g., copyright date or date of authorship) included
Detects if there is a date ( e . g . copyright date or date of authorship ) included
# some year between 1900 and 2099 # Similar to ISO date format (e.g., 2017-03-14, 2010/11/19, 2001/9/3) # Just a given year