UNPKG

jscpd

Version:

Copy/paste detector for programming code, support JavaScript, CoffeeScript, PHP, Ruby, Python, Less, Go, Java, Yaml, C#, C++, C languages

33 lines (25 loc) 764 B
// Generated by CoffeeScript 1.10.0 (function() { var fs, logger, path, readConfig, yaml; yaml = require('js-yaml'); logger = require('winston'); fs = require('fs'); path = require('path'); readConfig = function(file) { var doc, error, error1; file = path.normalize(file); try { doc = yaml.safeLoad(fs.readFileSync(file, 'utf8')); logger.info("Used config from " + file); return doc; } catch (error1) { error = error1; console.log(error); logger.warn("File " + file + " not found in current directory, or it is broken"); return false; } }; module.exports = function(jscpd) { return jscpd.options = readConfig('.cpd.yaml' || readConfig('.cpd.yml' || {})); }; }).call(this);