Checks the config file for invalid settings.
 @todo Refactor this.
 - Checks that paths are not absolute or use `../` or `~/`.
167872
def validate_config
      message = 'bad path in config'

      # Checks the option in the asset key.
      def validate_asset_options(opts)
        opts.each do |k, v|
          fail 'bad option in config' if k == :sprockets_options
          fail message if k == :output && !Utils.safe_path?(v)
        end
      end

      @config[:excludes].each do |v|
        fail message unless Utils.safe_path? v
      end unless @config[:excludes].nil?

      @config[:external].each do |k, v|
        next if k == :server

        v.each do |repo|
          fail message unless Utils.safe_path? repo[1]
        end unless v.nil?
      end unless @config[:external].nil?

      @config[:components].each do |k, v|
        # process @config[:components][:base] then go to the next option
        if k == :base
          fail message unless Utils.safe_path? v
          next
        end unless v.nil?

        # process @config[:components][:paths]
        if k == :paths
          v.each do |path|
            fail message unless Utils.safe_path? path[0]
            fail message unless Utils.safe_path? path[1]
          end
        end
      end unless @config[:components].nil?

      @config[:assets].each do |k, v|
        # process @config[:assets][:options] then go to the next option
        if k == :options
          validate_asset_options v
          next
        end unless v.nil?

        # process @config[:assets][:sources] then go to the next option
        if k == :sources
          v.each_with_index do |source, _|
            fail message unless Utils.safe_path? source
          end
          next
        end

        # process each asset type in @config[:assets]
        v.each do |asset_key, asset_value|
          # process :options
          if asset_key == :options
            validate_asset_options asset_value
            next
          end unless asset_value.nil?

          # process each asset path
          asset_value.each_with_index do |path, _|
            fail message unless Utils.safe_path? path
          end if asset_key == :paths
        end
      end unless @config[:assets].nil?

      @config
    end
1216063
def isValid( self ):
        
        check = nativestring(self._filepathEdit.text()).split(os.path.pathsep)[0]
        if ( self.filepathMode() == XFilepathEdit.Mode.SaveFile ):
            check = os.path.dirname(check)
        
        return os.path.exists(check)
965923
protected function checkFileSystem() {
    $paths = [
      '%files' => 'Public files directory',
      '%private' => 'Private files directory',
      '%temp' => 'Temporary files directory',
    ];

    foreach ($paths as $key => $title) {
      if (empty($this->drushStatus['%paths'][$key])) {
        $this->logProblem(__FUNCTION__ . ":$key", "$title is not set.", 'error');

        continue;
      }

      $path = $this->drushStatus['%paths'][$key];
      if (substr($path, 0, 1) == '/') {
        $full_path = $path;
      }
      else {
        $full_path = $this->getConfigValue('docroot') . "/$path";
      }

      if (file_exists($full_path)) {
        if (!is_writable($full_path)) {
          $this->logProblem(__FUNCTION__ . ":$key", [
            "$title is not writable.",
            "",
            "Change the permissions on $full_path.",
            "Run `chmod 750 $full_path`.",
          ], 'error');
        }
      }
      else {
        $outcome = [
          "$title does not exist.",
          "",
          "Create $full_path.",
        ];

        if (in_array($key, ['%files', '%private'])) {
          $outcome[] = "Installing Drupal will create this directory for you.";
          $outcome[] = "Run `blt drupal:install` to install Drupal, or run `blt setup` to run the entire setup process.";
          $outcome[] = "Otherwise, run `mkdir -p $full_path`.";
          $outcome[] = "";
        }

        $this->logProblem(__FUNCTION__ . ":$key", $outcome, 'error');
      }

    }
  }
268930
public function verifySettings()
    {
        if ($this->pattern === null && $this->regex === null) {
            $this->setError("The name or regex attribute is required");
        } elseif ($this->pattern !== null && $this->regex !== null) {
            $this->setError("Only one of name and regex attribute is allowed");
        }
    }
1023193
def check_plugins(config)
      if config.key?("plugins") && config["plugins"].is_a?(String)
        Jekyll.logger.error "Configuration Error:", "You specified the" \
          " `plugins` config in your configuration file as a string, please" \
          " use an array instead. If you wanted to set the directory of your" \
          " plugins, use the config key `plugins_dir` instead."
        raise Jekyll::Errors::InvalidConfigurationError,
              "'plugins' should not be a string, but was: " \
              "#{config["plugins"].inspect}. Use 'plugins_dir' instead."
      end
    end
709314
def check_config(self, config):
        
        validation = ""
        required = ["name", "currency", "IBAN", "BIC"]

        for config_item in required:
            if config_item not in config:
                validation += config_item.upper() + "_MISSING "

        if not validation:
            return True
        else:
            raise Exception("Config file did not validate. " + validation)
851261
private static void checkFile(File file) {
		if (false == file.exists()) {
			throw new UtilException("File [{}] not exist !", file.getAbsolutePath());
		}
		if (false == file.isFile()) {
			throw new UtilException("Path [{}] is not a file !", file.getAbsolutePath());
		}
	}
788480
protected function validateConfig()
    {
        $this->validateUrls();
        $this->validateRefreshInterval();
        $this->validateCacheFile();
        $this->validateFilePath();
        $this->validateParser();

        return true;
    }
449310
def _path_is_valid(self, path):
        
        VALIDATORS = [
            (os.path.isabs, self._ERROR_PATH_NOT_ABSOLUTE),
            (os.path.exists, self._ERROR_PATH_DOESNT_EXISTS),
            (os.path.isdir, self._ERROR_PATH_NOT_A_DIR),
        ]

        for validator in VALIDATORS:
            func, str_err = validator
            if not func(path):
                self._print(str_err.format(path), 'red')
                return
        return True
25754
public function isValidAbsolutePath()
    {
        if (!Path::isAbsolute($this->string)) {
            return false;
        }

        if (!is_dir($this->string)) {
            return false;
        }

        return true;
    }
1197293
def _assert_dirs_exist(self, setting_name):
        
        v = self._get_setting(setting_name)
        if (not os.path.isdir(os.path.split(v)[0])) or os.path.isdir(v):
            self.raise_config_error(
                setting_name,
                v,
                str,
                'a file path in an existing directory',
                is_none_allowed=False,
            )
828256
function set_path($config_path)
	{
		if (!empty($config_path)) {
			if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) {
				$this->_trigger_error_msg("Bad config file path '$config_path'");
				return;
			}
			if(substr($config_path, -1) != DIRECTORY_SEPARATOR) {
				$config_path .= DIRECTORY_SEPARATOR;
			}

			$this->_config_path = $config_path;
		}
	}
270535
def _check_config(self):
        
        current_path = os.path.relpath(os.getcwd())

        accepted_files = ["orator.yml", "orator.py"]
        for accepted_file in accepted_files:
            config_file = os.path.join(current_path, accepted_file)
            if os.path.exists(config_file):
                if self._handle_config(config_file):
                    return True

        return False
704006
def validate(config):
    '''
    
    '''

    VALID_MASK = [
        'access',
        'attrib',
        'close_nowrite',
        'close_write',
        'create',
        'delete',
        'delete_self',
        'excl_unlink',
        'ignored',
        'modify',
        'moved_from',
        'moved_to',
        'move_self',
        'oneshot',
        'onlydir',
        'open',
        'unmount'
    ]

    # Configuration for inotify beacon should be a dict of dicts
    if not isinstance(config, list):
        return False, 'Configuration for inotify beacon must be a list.'
    else:
        _config = {}
        list(map(_config.update, config))

        if 'files' not in _config:
            return False, 'Configuration for inotify beacon must include files.'
        else:
            for path in _config.get('files'):

                if not isinstance(_config['files'][path], dict):
                    return False, ('Configuration for inotify beacon must '
                                   'be a list of dictionaries.')
                else:
                    if not any(j in ['mask',
                                     'recurse',
                                     'auto_add'] for j in _config['files'][path]):
                        return False, ('Configuration for inotify beacon must '
                                       'contain mask, recurse or auto_add items.')

                    if 'auto_add' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['auto_add'], bool):
                            return False, ('Configuration for inotify beacon '
                                           'auto_add must be boolean.')

                    if 'recurse' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['recurse'], bool):
                            return False, ('Configuration for inotify beacon '
                                           'recurse must be boolean.')

                    if 'mask' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['mask'], list):
                            return False, ('Configuration for inotify beacon '
                                           'mask must be list.')
                        for mask in _config['files'][path]['mask']:
                            if mask not in VALID_MASK:
                                return False, ('Configuration for inotify beacon '
                                               'invalid mask option {0}.'.format(mask))
    return True, 'Valid beacon configuration'
1176679
private static void checkPaths(Configuration conf, List<Path> paths) throws
  IOException {
    for (Path p : paths) {
      FileSystem fs = p.getFileSystem(conf);
      if (!fs.exists(p)) {
        throw new FileNotFoundException("Source " + p + " does not exist.");
      }
    }
  }
86430
function shouldBeIncluded(file) {

  if (!showAllFiles && file[0] === '.') {
    return false
  }
  if (hasExcludePattern) {
    return !excludePattern.test(file)
  }
  if (hasIncludePattern) {
    return includePattern.test(file)
  }
  return true
}
812823
protected function validateSettings()
    {
        if (isset($this->attributes[SectionParser::ERROR_INI])) {
            CmsException::mask($this, 200);
            Ini::parse($this->attributes[SectionParser::ERROR_INI]);
            CmsException::unmask();
        }
    }