VSCode P3C
阿里巴巴Java编程规范 (P3C/阿里巴巴Java开发手册) VSCode 扩展
Alibaba Java Coding Guidelines VSCode implements
基于 Based on
路线图 Route Map
[x] 实现基于 PMD XML
的配置
[ ] ~~优化分析速度,基于 LSP (语言服务器)实现~~
[ ] 细节优化
- [ ] 支持中英双语
- [ ] 支持自定义 fat
p3c-pmd.jar
[ ] 支持 Quick fix
[ ] 实现基于 JSON
灵活的配置
[x] pmd
xml
configuration
[ ] ~~Optimize analysis speed, Base on VSCode LSP~~
[ ] detail optimization
- [ ] support chinese and english language
- [ ] support fat
p3c-pmd.jar
config
[ ] support Quick fix
[ ] customize json
configuration
- [ ] config: each check item error level (e.g. error warn info)
- [ ] config: ignore file or directory
- [ ] generate XML config for maven-pmd-plugin
- [ ] supper JOSN config smart suggest by pull request https://github.com/SchemaStore/schemastore pull request
Features
开箱即用的 P3C 代码规约检查,同时支持灵活配置。
Out-of-the-box P3C code protocol checking, while supporting flexible configuration.
创建配置文件 >Java P3C Checker: Create PMD RUle XML File
,这个XML文件的语法参见 https://pmd.github.io/
Create configuration file >Java P3C Checker: Create PMD Rule XML File
, the XML file syntax to see https://pmd.github.io/
Configuration
rulesets
(optional): set to override default ruleset (see "Defining your own ruleset" for more details)
runOnFileOpen
: run every time a file is opened in vscode
runOnFileSave
: run every time a file is saved
runWorkspaceOnActive
Will run once workspace checker on vscode started
priorityErrorThreshold
: Determines at what priority level 'errors' will be added. Anything less will be a warning or hint
priorityWarnThreshold
: Determines at what priority level 'warnings' will be added. Anything less will be a hint
showErrors
: Show errors in output window
showStdOut
: Show showStdOut in output window
enableCache
: Creates a cache file for PMD to run faster. Will create a .pmdCache file in your workspace
additionalClassPaths
(optional): set of paths to be appended to classpath. Used to find jar files containing custom rule definitions. Can be absolute or relative to workspace.
commandBufferSize
Size of buffer used to collect PMD command output (MB), may need to be increased for very large projects
Developing/Contributing
Setup & Run
git clone
npm install
- debug -> "launch extension"
Legal Stuff
Copyright (c) 2003-2009, InfoEther, LLC
All rights reserved.
This product includes software developed in part by support from
the Defense Advanced Research Project Agency (DARPA)
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The full license (BSD-style) can be found in the PMD repo