PowerShell을 사용하여 bSpell 맞춤법 검사의 현재 잘못된 줄에 대한 Checkstyle 소스 파일 내용을 캡처합니다.
2629 단어 powershell
== ps1 ==
function go{
$gbk = [System.Text.Encoding]::GetEncoding("GBK")
$utf8 = [System.Text.Encoding]::UTF8
$result = 'spell-filter.txt'
$encoding = [System.Text.Encoding]::GetEncoding("GBK")
rm $result -ea SilentlyContinue
$xml = cat checkstyle.xml
$xml = [xml]$xml #
$xml.checkstyle.file|%{$_.error}|?{$_.source -match 'SpellCheck'}|
%{
$fileContent = cat $_.parentNode.name -total $_.line -ea SilentlyContinue # , 【 】
$word = (($_.message -replace 'The Spelling of word ', '') -replace 'may be illegal. .*', '') #
if ($fileContent -ne $Null){
$code = $gbk.GetBytes($fileContent[-1]) #
$code = $utf8.GetString($code)
' : ' + $_.parentNode.name + ' , :' + $_.line + ' , :' + $word + ' , :' + $code>> $result
}else{
' : ' + $_.parentNode.name + ' , ' + $_.line + ' , ' + $word
}
}
}
go
== checkstyle.xml ==
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="5.0">
<file name="package_zh_CN.properties">
<error line="114" column="81" severity="error" message="The Spelling of word "pageing" may be illegal. The suggestion(s) include(s): [paging, ageing, panging, pugging, pegging]" source="SpellCheck"/>
<error line="117" column="84" severity="error" message="The Spelling of word "pageing" may be illegal. The suggestion(s) include(s): [paging, ageing, panging, pugging, pegging]" source="SpellCheck"/>
</file>
<file name="addOrDel.js">
<error line="1" severity="info" message="File length is 2,373 lines (max allowed is 2,000)." source="com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck"/>
</file>
<file name="showDataDictDetail.jsp">
<error line="10" column="19" severity="error" message="The Spelling of word "stylesheet" may be illegal. The suggestion(s) include(s): [StyleSheet]" source="SpellCheck"/>
</file>
</checkstyle>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Powershell 7을 사용하여 Samba 서버로 파일을 전송하는 방법.MSSQL 덤프를 복사하여 콜드 스토리지 솔루션으로 원격 Linux Samba 서버에 저장하도록 설계한 twoScripts를 공유하고 싶습니다. 모든 서버가 Windows 서버였으며 내가 이것을 만들기로 결정한 이유...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.