# frozen_string_literal: true require "net/http" require "json" require "yaml" require "set" module NeetoCompliance class Base def process return true if app_is_exception? # preload the path NeetoCompliance::NeetoCommons.path success, errors = audit unless success errors.each do |error| puts error end else print "[PASS]\n".green end success end def verifier_name self.class.to_s end def print_description print "%-80s" % [verifier_name] end def auto_correct! return true if app_is_exception? unless valid? puts autofix_command system autofix_command end end def autofix_suggestion "To fix run: #{autofix_command.yellow}" end def error_message "[FAIL]".red end def audit print_description errors = [] unless valid? errors << [error_message, autofix_suggestion, "\n"].join("\n") end [errors.length == 0, errors] end def app_is_exception? apps_exception_list.include?(app_name) end def app_name @_app_name ||= `git config --get remote.origin.url`.split("/").last.strip.split(".git").first end def apps_exception_list [] end end end