Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93173733
ConduitAPI_diffusion_getlintmessages_Method.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 26, 18:41
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 28, 18:41 (2 d)
Engine
blob
Format
Raw Data
Handle
22577437
Attached To
rPH Phabricator
ConduitAPI_diffusion_getlintmessages_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_diffusion_getlintmessages_Method
extends
ConduitAPI_diffusion_Method
{
public
function
getMethodStatus
()
{
return
self
::
METHOD_STATUS_UNSTABLE
;
}
public
function
getMethodDescription
()
{
return
"Get lint messages for existing code."
;
}
public
function
defineParamTypes
()
{
return
array
(
'arcanistProject'
=>
'required string'
,
'branch'
=>
'optional string'
,
'commit'
=>
'optional string'
,
'files'
=>
'required list<string>'
,
);
}
public
function
defineReturnType
()
{
return
'list<dict>'
;
}
public
function
defineErrorTypes
()
{
return
array
(
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$project
=
id
(
new
PhabricatorRepositoryArcanistProject
())->
loadOneWhere
(
'name = %s'
,
$request
->
getValue
(
'arcanistProject'
));
if
(!
$project
||
!
$project
->
getRepositoryID
())
{
return
array
();
}
$branch_name
=
$request
->
getValue
(
'branch'
);
if
(
$branch_name
==
''
)
{
$repository
=
id
(
new
PhabricatorRepositoryQuery
())
->
setViewer
(
$request
->
getUser
())
->
withIDs
(
array
(
$project
->
getRepositoryID
()))
->
executeOne
();
$branch_name
=
$repository
->
getDefaultArcanistBranch
();
}
$branch
=
id
(
new
PhabricatorRepositoryBranch
())->
loadOneWhere
(
'repositoryID = %d AND name = %s'
,
$project
->
getRepositoryID
(),
$branch_name
);
if
(!
$branch
||
!
$branch
->
getLintCommit
())
{
return
array
();
}
$lint_messages
=
queryfx_all
(
$branch
->
establishConnection
(
'r'
),
'SELECT path, line, code FROM %T WHERE branchID = %d AND path IN (%Ls)'
,
PhabricatorRepository
::
TABLE_LINTMESSAGE
,
$branch
->
getID
(),
$request
->
getValue
(
'files'
));
// TODO: Compare commit identifiers of individual files like in
// DiffusionBrowseFileController::loadLintMessages().
return
$lint_messages
;
}
}
Event Timeline
Log In to Comment