-
Notifications
You must be signed in to change notification settings - Fork 3
排版风格
让您的文本编辑器负责格式,可以在验收过程中省去麻烦。 大多数Metasploit贡献者使用vim和gvim作为默认的文本编辑器,如果您有其他文本编辑器的配置,我们很乐意看到它!
将以下设置添加到您的 .vimrc 文件,将使其符合 CONTRIBUTING.md 和 msftidy.rb 指南要容易得多。
Incidentally, if you install the Janus Distribution of vim plugins, this is all done for you, and more, automatically. But, if you are a special snowflake, here's how to limp your way to code formatting excellence. 顺便说一句,如果您安装了vim插件的 [Janus发行版](https://github.com/carlhuda/janus),这一切都将为您自动完成。但下面也提供了简单轻量的编码格式方法。
set shiftwidth=2 tabstop=2 softtabstop=2
" textwidth 影响 `gq` which is handy for formatting comments
set textwidth=78
" Metasploit 应使用空格代替制表符
set expandtab
" 突出显示EOL处的空格以及混合的制表符和空格
hi BogusWhitespace ctermbg=darkgreen guibg=darkgreen
match BogusWhitespace /\s\+$\|^\t\+ \+\|^ \+\t\+/
如果您希望这些设置仅适用于ruby文件,则可以使用 augroup 和 au_loaded 实现。
if !exists("au_loaded")
let au_loaded = 1
augroup rb
au FileType ruby set shiftwidth=2 tabstop=2 softtabstop=2 textwidth=78
au FileType ruby set expandtab
au FileType ruby hi BogusWhitespace ctermbg=darkgreen guibg=darkgreen
au FileType ruby match BogusWhitespace /\s\+$\|^\t\+ \+\|^ \+\t\+/
augroup END
endif
你也可以使用 :set list 把制表符显示为 ^I, 区别出制表符和空格。
Rubymine 默认就是标准的两个空格为缩进的,不再需要对其进行配置。
尽管我们了解到世界上会阅读许多种语言,但Metasploit主要是用美国英语开发的。 因此,模块中的描述应遵循美国英语惯例。这样做不仅可以确保大多数Metasploit用户的易用性,而且还可以帮助自动(和手动)翻译其他语言。
模块标题应参照英文大写规则: http://owl.english.purdue.edu/owl/resource/592/01/
唯一的例外是函数名称 (如 'thisFunc()') 和特定的文件名 (如 thisfile.ocx).