public function setLinterConfigurationValue($key, $value)
 {
     switch ($key) {
         case 'workspace':
             $this->setWorkspace($value);
             return;
         case 'scheme':
             $this->setScheme($value);
             return;
         case 'destination':
             $this->setDestination($value);
             return;
     }
     return parent::setLinterConfigurationValue($key, $value);
 }
Exemplo n.º 2
0
 public function setLinterConfigurationValue($key, $value)
 {
     switch ($key) {
         case 'interpreter':
             $root = $this->getProjectRoot();
             foreach ((array) $value as $path) {
                 if (Filesystem::binaryExists($path)) {
                     $this->setInterpreter($path);
                     return;
                 }
                 $path = Filesystem::resolvePath($path, $root);
                 if (Filesystem::binaryExists($path)) {
                     $this->setInterpreter($path);
                     return;
                 }
             }
             throw new Exception(pht('None of the configured interpreters can be located.'));
         case 'bin':
             $is_script = $this->shouldUseInterpreter();
             $root = $this->getProjectRoot();
             foreach ((array) $value as $path) {
                 if (!$is_script && Filesystem::binaryExists($path)) {
                     $this->setBinary($path);
                     return;
                 }
                 $path = Filesystem::resolvePath($path, $root);
                 if (!$is_script && Filesystem::binaryExists($path) || $is_script && Filesystem::pathExists($path)) {
                     $this->setBinary($path);
                     return;
                 }
             }
             throw new Exception(pht('None of the configured binaries can be located.'));
         case 'flags':
             $this->setFlags($value);
             return;
         case 'version':
             $this->setVersionRequirement($value);
             return;
     }
     return parent::setLinterConfigurationValue($key, $value);
 }
 public function setLinterConfigurationValue($key, $value)
 {
     switch ($key) {
         case 'interpreter':
             $working_copy = $this->getEngine()->getWorkingCopy();
             $root = $working_copy->getProjectRoot();
             foreach ((array) $value as $path) {
                 if (Filesystem::binaryExists($path)) {
                     $this->setInterpreter($path);
                     return;
                 }
                 $path = Filesystem::resolvePath($path, $root);
                 if (Filesystem::binaryExists($path)) {
                     $this->setInterpreter($path);
                     return;
                 }
             }
             throw new Exception(pht('None of the configured interpreters can be located.'));
         case 'bin':
             $is_script = $this->shouldUseInterpreter();
             $working_copy = $this->getEngine()->getWorkingCopy();
             $root = $working_copy->getProjectRoot();
             foreach ((array) $value as $path) {
                 if (!$is_script && Filesystem::binaryExists($path)) {
                     $this->setBinary($path);
                     return;
                 }
                 $path = Filesystem::resolvePath($path, $root);
                 if (!$is_script && Filesystem::binaryExists($path) || $is_script && Filesystem::pathExists($path)) {
                     $this->setBinary($path);
                     return;
                 }
             }
             throw new Exception(pht('None of the configured binaries can be located.'));
         case 'flags':
             if (!is_array($value)) {
                 phutil_deprecated('String support for flags.', 'You should use list<string> instead.');
                 $value = (array) $value;
             }
             $this->setFlags($value);
             return;
     }
     return parent::setLinterConfigurationValue($key, $value);
 }