]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't fail lint builds for "advice"; make lint/unit upload failures louder
authorepriestley <git@epriestley.com>
Thu, 25 Jun 2015 17:05:54 +0000 (10:05 -0700)
committerepriestley <git@epriestley.com>
Thu, 25 Jun 2015 17:05:54 +0000 (10:05 -0700)
Summary:
Ref T8670. Ref T8657.

  - When lint only has advice (no warnings/errors), consider it a "passing" build.
  - Be a little louder about `sendmessage` calls failing because this stuff is not totally broken and that makes T8670-related things easier to catch/fix.

Test Plan: Created this revision.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8657, T8670

Differential Revision: https://secure.phabricator.com/D13436

src/workflow/ArcanistDiffWorkflow.php

index a3117777552fdf83da354836ab1435b9fd3f2e51..6061fd460dd98499595e9f78b528d8bcf70cff65 100644 (file)
@@ -2734,12 +2734,24 @@ EOTEXT
         $lint[$key] = $this->getModernLintDictionary($message);
       }
 
+      // Consider this target to have failed if there are any unresolved
+      // errors or warnings.
+      $type = 'pass';
+      foreach ($lint as $message) {
+        switch (idx($message, 'severity')) {
+          case ArcanistLintSeverity::SEVERITY_WARNING:
+          case ArcanistLintSeverity::SEVERITY_ERROR:
+            $type = 'fail';
+            break;
+        }
+      }
+
       $futures[] = $this->getConduit()->callMethod(
         'harbormaster.sendmessage',
         array(
           'buildTargetPHID' => $lint_target,
           'lint' => array_values($lint),
-          'type' => $lint ? 'fail' : 'pass',
+          'type' => $type,
         ));
     }
 
@@ -2775,6 +2787,9 @@ EOTEXT
       }
       return true;
     } catch (Exception $ex) {
+      // TODO: Eventually, we should expect these to succeed if we get this
+      // far, but just log errors for now.
+      phlog($ex);
       return false;
     }
   }