pylint插件为用户编程的语音工具包卡斯特
voicelint的Python项目详细描述
绒布
voicelint
是一个pylint
插件/扩展,旨在帮助Caster(一个基于dragonfly的语音编程工具包)的用户在编写自己的语法时捕捉一些常见或恼人的错误。在
目录
入门
如果您以前从未听说过,pylint是一种流行的静态分析工具,它可以帮助您捕获各种错误和/或帮助您提高代码质量。您可以使用pip
安装它
python3-mpipinstallpylint
并且可以通过可用的扩展与许多编辑器集成。例如,对于VSCode,您可以遵循here的说明,对于sublime,您可以将SublimeLinter与SublimeLinter-pylint结合使用
完成后,您需要通过类似的执行来安装voicelint
并配置pylint
为我们的语法使用这个插件!在
现在配置pylint
的最简单方法是通过.pylintrc
文件,您应该将其放在感兴趣的根目录中。对于我们的用例,这是caster用户目录的rules文件夹,因此它应该类似于
C:\Users\%USERNAME%\AppData\Local\caster\rules
如果你在最新版本的卡斯特。为了告诉pylint
加载插件,我们需要设置load-plugins
设置,这样我们的文件应该类似于
[MASTER]load-plugins=voicelint
现在我们已经很蠢了,我们现在面对的是一个不同的技术问题,这与我们的插件无关,而是与一般的linting caster语法有关。特别是,python允许在运行时操纵它搜索模块导入的目录集,这给静态分析工具带来了麻烦,因为它们无法预先知道将添加或删除哪些目录。Caster非常依赖这些特性,因此pylint会抱怨找不到castervoice
模块。在
为了避免这个问题,我们需要通知pylint Castor添加到路径中的目录,我们可以通过添加以下行来完成(调整计算机中使用的路径)
[MASTER]
init-hook='import sys; sys.path.append("C:\\Users\\%USERNAME%\\AppData\\Local\\caster\\rules"); sys.path.append("C:\\Users\\%USERNAME%\\Documents\\Github\\Caster")'
load-plugins=voicelint
现在你应该开始行动了!!!在
当前识别的错误/错误
暂时没有那么多,但我希望他们能帮上忙!在
模拟错误
Mimic(["hello","world"])# wrongMimic("hello world")# wrongvsMimic("hello","world")# `,` separated single wordsMimic(keyword_name_other_than_extra="something")# only allowed keyword is `extra`
暂停错误
Pause(10)vsPause("10")# must be a string instead of integer
忘记条件导入
导入支持文件时,99%的时间都应该使用try except块来允许从用户目录重写
fromcastervoice.rules.apps.editor.eclipse_rules.eclipse_supportimportec_convstry:# Try first loading from caster user directoryfromeclipse_supportimportec_conexceptImportError:fromcastervoice.rules.apps.editor.eclipse_rules.eclipse_supportimportec_con
各种规则详细信息错误
例如
classExampleRule(MergeRule):blah,blah,blahdefget_rule():returnExampleRule,RuleDetails(ccrtype=CCRType.GLOBAL,executable="chrome")vsreturnExampleRule,RuleDetails(ccrtype=CCRType.APP,executable="chrome")
以及当前版本Caster的许多其他版本(2020年7月28日)
键文本鼠标分隔字符串错误
所有按键都应该在一个字符串中
Key("c-a","c-c")Text("nice","day")Mouse("[12,100]","(4,5)")vsKey("c-a,c-c")Text("nice day")Mouse("[12,100],(4,5)")
BringApp和StartApp没有动态字符串
BringApp("program","%(data)s")vsFunction(lambdadata:BringApp('program',data.format()).execute())
许可证
voicelint根据2条BSD授权
BSD 2-Clause License
Copyright (c) 2020, Kitsios Panagiotis
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
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 HOLDER 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.
- 项目
标签: