當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArcanistLintMessage::getOtherLocations方法代碼示例

本文整理匯總了PHP中ArcanistLintMessage::getOtherLocations方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArcanistLintMessage::getOtherLocations方法的具體用法?PHP ArcanistLintMessage::getOtherLocations怎麽用?PHP ArcanistLintMessage::getOtherLocations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ArcanistLintMessage的用法示例。


在下文中一共展示了ArcanistLintMessage::getOtherLocations方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isRelevantMessage

 private final function isRelevantMessage(ArcanistLintMessage $message)
 {
     // When a user runs "arc lint", we default to raising only warnings on
     // lines they have changed (errors are still raised anywhere in the
     // file). The list of $changed lines may be null, to indicate that the
     // path is a directory or a binary file so we should not exclude
     // warnings.
     if (!$this->changedLines || $message->isError() || $message->shouldBypassChangedLineFiltering()) {
         return true;
     }
     $locations = $message->getOtherLocations();
     $locations[] = $message->toDictionary();
     foreach ($locations as $location) {
         $path = idx($location, 'path', $message->getPath());
         if (!array_key_exists($path, $this->changedLines)) {
             continue;
         }
         $changed = $this->getPathChangedLines($path);
         if ($changed === null || !$location['line']) {
             return true;
         }
         $last_line = $location['line'];
         if (isset($location['original'])) {
             $last_line += substr_count($location['original'], "\n");
         }
         for ($l = $location['line']; $l <= $last_line; $l++) {
             if (!empty($changed[$l])) {
                 return true;
             }
         }
     }
     return false;
 }
開發者ID:fengshao0907,項目名稱:arcanist,代碼行數:33,代碼來源:ArcanistLintEngine.php

示例2: isRelevantMessage

 private final function isRelevantMessage(ArcanistLintMessage $message)
 {
     // When a user runs "arc lint", we default to raising only warnings on
     // lines they have changed (errors are still raised anywhere in the
     // file). The list of $changed lines may be null, to indicate that the
     // path is a directory or a binary file so we should not exclude
     // warnings.
     if (!$this->changedLines || $message->isError() || $message->shouldBypassChangedLineFiltering()) {
         return true;
     }
     $locations = $message->getOtherLocations();
     $locations[] = $message->toDictionary();
     foreach ($locations as $location) {
         $path = idx($location, 'path', $message->getPath());
         if (!array_key_exists($path, $this->changedLines)) {
             if (phutil_is_windows()) {
                 // We try checking the UNIX path form as well, on Windows.  Linters
                 // store noramlized paths, which use the Windows-style "\" as a
                 // delimiter; as such, they don't match the UNIX-style paths stored
                 // in changedLines, which come from the VCS.
                 $path = str_replace('\\', '/', $path);
                 if (!array_key_exists($path, $this->changedLines)) {
                     continue;
                 }
             } else {
                 continue;
             }
         }
         $changed = $this->getPathChangedLines($path);
         if ($changed === null || !$location['line']) {
             return true;
         }
         $last_line = $location['line'];
         if (isset($location['original'])) {
             $last_line += substr_count($location['original'], "\n");
         }
         for ($l = $location['line']; $l <= $last_line; $l++) {
             if (!empty($changed[$l])) {
                 return true;
             }
         }
     }
     return false;
 }
開發者ID:endlessm,項目名稱:arcanist,代碼行數:44,代碼來源:ArcanistLintEngine.php


注:本文中的ArcanistLintMessage::getOtherLocations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。