HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/zaklada/html/node_modules/gulp-jshint/src/reporters/fail.js
var path = require('path');
var stream = require('../stream');
var PluginError = require('plugin-error');
var reduce = require('lodash/reduce');

module.exports = function (opts) {
  opts = opts || {};

  // @type false|[]paths - paths to files that failed jshint
  var fails = false;

  // @type false|[]files - files that need to be passed downstream on flush
  var buffer = opts.buffer !== false ? [] : false;

  // @type object - count of jshint error, warning and info messages
  var messages = {error: 0, warning: 0, info: 0};

  return stream(
    function through(file) {
      // count error, warning and info messages
      if (file.jshint && file.jshint.results) {
        messages = reduce(file.jshint.results, function(result, err) {
          return {
            error: result.error + Number(err.error.code[0] === 'E'),
            warning: result.warning + Number(err.error.code[0] === 'W'),
            info: result.info + Number(err.error.code[0] === 'I')
          };
        }, messages);
      }

      // check for failure
      if (file.jshint && !file.jshint.success && !file.jshint.ignored) {
        (fails = fails || []).push(path.relative(process.cwd(), file.path));
      }

      // buffer or pass downstream
      (buffer || this).push(file);
    }, function flush() {
      var failOnWarning = !opts.ignoreWarning && messages.warning;
      var failOnInfo = !opts.ignoreInfo && messages.info;
      if (fails && (messages.error || failOnWarning || failOnInfo)) {
        this.emit('error', new PluginError('gulp-jshint', {
          message: 'JSHint failed for: ' + fails.join(', '),
          showStack: false
        }));
      }

      if (buffer) {
        // send the buffered files downstream
        buffer.forEach(function (file) {
          this.push(file);
        }, this);
      }
    }
  );
};