Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95751331
ClangFormatLinter.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
Wed, Dec 18, 21:58
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Dec 20, 21:58 (2 d)
Engine
blob
Format
Raw Data
Handle
23047730
Attached To
rAKA akantu
ClangFormatLinter.php
View Options
<?php
/**
* Uses the clang format to format C/C++/Obj-C code
*/
final
class
ClangFormatLinter
extends
ArcanistExternalLinter
{
public
function
getInfoName
()
{
return
'clang-format'
;
}
public
function
getInfoURI
()
{
return
''
;
}
public
function
getInfoDescription
()
{
return
pht
(
'Use clang-format for processing specified files.'
);
}
public
function
getLinterName
()
{
return
'clang-format'
;
}
public
function
getLinterConfigurationName
()
{
return
'clang-format'
;
}
public
function
getLinterConfigurationOptions
()
{
$options
=
array
(
);
return
$options
+
parent
::
getLinterConfigurationOptions
();
}
public
function
getDefaultBinary
()
{
return
'clang-format'
;
}
public
function
getInstallInstructions
()
{
return
pht
(
'Make sure clang-format is in directory specified by $PATH'
);
}
public
function
shouldExpectCommandErrors
()
{
return
false
;
}
protected
function
getMandatoryFlags
()
{
return
array
(
);
}
protected
function
parseLinterOutput
(
$path
,
$err
,
$stdout
,
$stderr
)
{
$ok
=
(
$err
==
0
);
if
(!
$ok
)
{
return
false
;
}
$orig
=
file_get_contents
(
$path
);
if
(
$orig
==
$stdout
)
{
return
array
();
}
$message
=
id
(
new
ArcanistLintMessage
())
->
setPath
(
$path
)
->
setLine
(
1
)
->
setChar
(
1
)
->
setGranularity
(
ArcanistLinter
::
GRANULARITY_FILE
)
->
setCode
(
'CFMT'
)
->
setSeverity
(
ArcanistLintSeverity
::
SEVERITY_AUTOFIX
)
->
setName
(
'Code style violation'
)
->
setDescription
(
"'$path' has code style errors."
)
->
setOriginalText
(
$orig
)
->
setReplacementText
(
$stdout
);
return
array
(
$message
);
}
}
Event Timeline
Log In to Comment