Skip to content
项目

rubocop/rubocop-performance

在 GitHub 查看

关于

RuboCop 的扩展,专注于检查代码性能。

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
-2
15天
-2
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

RuboCop Performance

Gem Version CI Discord

Performance optimization analysis for your projects, as an extension to RuboCop.

Installation

Just install the rubocop-performance gem

$ gem install rubocop-performance

or if you use bundler put this in your Gemfile

gem 'rubocop-performance', require: false

Usage

You need to tell RuboCop to load the Performance extension. There are three ways to do this:

RuboCop configuration file

Put this into your .rubocop.yml.

plugins: rubocop-performance

Alternatively, use the following array notation when specifying multiple extensions.

plugins:
  - rubocop-other-extension
  - rubocop-performance

Now you can run rubocop and it will automatically load the RuboCop Performance cops together with the standard cops.

[!NOTE] The plugin system is supported in RuboCop 1.72+. In earlier versions, use require instead of plugins.

Command line

$ rubocop --plugin rubocop-performance

Rake task

require 'rubocop/rake_task'

RuboCop::RakeTask.new do |task|
  task.plugins << 'rubocop-performance'
end

The Cops

All cops are located under lib/rubocop/cop/performance, and contain examples/documentation.

In your .rubocop.yml, you may treat the Performance cops just like any other cop. For example:

Performance/Size:
  Exclude:
    - lib/example.rb

Documentation

You can read a lot more about RuboCop Performance in its official docs.

Compatibility

RuboCop Performance is compatible with RuboCop core.

See the compatibility documentation for further details.

Note: Performance cops are all MRI focused and are highly dependent of the version of MRI you're using.

Contributing

Checkout the contribution guidelines.

License

rubocop-performance is MIT licensed. See the accompanying file for the full text.

探索相关项目

加载中…