Changeset 244

Show
Ignore:
Timestamp:
10/07/07 18:59:52 (9 months ago)
Author:
mrook
Message:

Various improvements to jslint and phplint tasks (patch by Miracle)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.3/classes/phing/tasks/ext/JslLintTask.php

    r200 r244  
    11<?php 
    22/* 
    3  *  $Id: ZipTask.php 116 2006-09-12 09:32:50Z mrook
     3 *  $Id
    44 * 
    55 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     
    3636    protected $haltOnFailure = false; 
    3737    protected $hasErrors = false; 
     38    private $badFiles = array(); 
    3839 
    3940    /** 
     
    8586      } 
    8687   
    87       if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in PHP files'); 
     88      if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in JS files:' .implode(', ',$this->badFiles)); 
    8889    } 
    8990   
     
    106107        { 
    107108          $message = array(); 
    108           exec($command.$file, $message); 
     109          exec($command.'"'.$file.'"', $message); 
    109110 
    110111          $summary = $message[sizeof($message) - 1]; 
     
    124125          { 
    125126            $this->log($file . ': ' . $errors . ' errors detected', Project::MSG_ERR); 
     127            $this->badFiles[] = $file; 
    126128            $this->hasErrors = true; 
    127129          } else { 
  • branches/2.3/classes/phing/tasks/ext/PhpLintTask.php

    r226 r244  
    3737        protected $haltOnFailure = false; 
    3838        protected $hasErrors = false; 
     39    private $badFiles = array(); 
    3940 
    4041        /** 
     
    9596                } 
    9697 
    97                 if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in PHP files'); 
     98                if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in PHP files: '.implode(', ',$this->badFiles)); 
    9899        } 
    99100 
     
    109110                        if(is_readable($file)) { 
    110111                                $messages = array(); 
    111                                 exec($command.$file, $messages); 
     112                                exec($command.'"'.$file.'"', $messages); 
    112113                                if(!preg_match('/^No syntax errors detected/', $messages[0])) { 
    113114                                        if (count($messages) > 1) { 
     
    119120                                                $this->log("Could not parse file", Project::MSG_ERR); 
    120121                                        } 
    121                                                
     122                                        $this->badFiles[] = $file;     
    122123                                        $this->hasErrors = true; 
    123124                                         
  • trunk/classes/phing/tasks/ext/JslLintTask.php

    r200 r244  
    11<?php 
    22/* 
    3  *  $Id: ZipTask.php 116 2006-09-12 09:32:50Z mrook
     3 *  $Id
    44 * 
    55 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     
    3636    protected $haltOnFailure = false; 
    3737    protected $hasErrors = false; 
     38    private $badFiles = array(); 
    3839 
    3940    /** 
     
    8586      } 
    8687   
    87       if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in PHP files'); 
     88      if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in JS files:' .implode(', ',$this->badFiles)); 
    8889    } 
    8990   
     
    106107        { 
    107108          $message = array(); 
    108           exec($command.$file, $message); 
     109          exec($command.'"'.$file.'"', $message); 
    109110 
    110111          $summary = $message[sizeof($message) - 1]; 
     
    124125          { 
    125126            $this->log($file . ': ' . $errors . ' errors detected', Project::MSG_ERR); 
     127            $this->badFiles[] = $file; 
    126128            $this->hasErrors = true; 
    127129          } else { 
  • trunk/classes/phing/tasks/ext/PhpLintTask.php

    r226 r244  
    3737        protected $haltOnFailure = false; 
    3838        protected $hasErrors = false; 
     39    private $badFiles = array(); 
    3940 
    4041        /** 
     
    9596                } 
    9697 
    97                 if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in PHP files'); 
     98                if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in PHP files: '.implode(', ',$this->badFiles)); 
    9899        } 
    99100 
     
    109110                        if(is_readable($file)) { 
    110111                                $messages = array(); 
    111                                 exec($command.$file, $messages); 
     112                                exec($command.'"'.$file.'"', $messages); 
    112113                                if(!preg_match('/^No syntax errors detected/', $messages[0])) { 
    113114                                        if (count($messages) > 1) { 
     
    119120                                                $this->log("Could not parse file", Project::MSG_ERR); 
    120121                                        } 
    121                                                
     122                                        $this->badFiles[] = $file;     
    122123                                        $this->hasErrors = true; 
    123124