Skip to content

Commit

Permalink
Use "offense" instead of "offence"
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed May 13, 2022
1 parent 16b92a7 commit 65e6170
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -7,13 +7,13 @@ On the other hand, `rubocop` has [`--auto-correct`](https://github.com/rubocop-h
It is ideal that to remove a disabled rule from `.rubocop_todo.yml` every day, to check whether it passes test, and can be obtained consent from the team. But it requires strong persistence and time.
I call such work *Rubocop Challenge*. And the *RubocopChallenger* is a gem to support this challenge!

## The history of RubocopChallenger with decrease of offence codes
## The history of RubocopChallenger with decrease of offense codes

The following chart shows the history of RubocopChallenger and decrease of offence codes at a `.rubocop_todo.yml`. The project was released at 5 years ago, and then it was introduced the RuboCop gem for huge source code including a lots of offence codes. Before using the RubocopChallenger, it was not maintain to reduce offence codes. One day, I felt a crisis and started maintain with manual. I made a lots of Pull Requests to reduce them but it's a load for me and reviewers. So I created a script for automation the flow, which is the predecessor of Rubocop Challenger gem. It brought reducing the offence codes continuously. After 8 months, finally it has done. There is no auto-correctable offence codes.
But there are many offences which is un-auto-correctable yet. I will try to reduce it with the RubocopChallenger. The RubocopChallenger will
The following chart shows the history of RubocopChallenger and decrease of offense codes at a `.rubocop_todo.yml`. The project was released at 5 years ago, and then it was introduced the RuboCop gem for huge source code including a lots of offense codes. Before using the RubocopChallenger, it was not maintain to reduce offense codes. One day, I felt a crisis and started maintain with manual. I made a lots of Pull Requests to reduce them but it's a load for me and reviewers. So I created a script for automation the flow, which is the predecessor of Rubocop Challenger gem. It brought reducing the offense codes continuously. After 8 months, finally it has done. There is no auto-correctable offense codes.
But there are many offenses which is un-auto-correctable yet. I will try to reduce it with the RubocopChallenger. The RubocopChallenger will
be continued to evolve.

![Decrease of offence codes](images/decrease_of_offence_codes.png)
![Decrease of offense codes](images/decrease_of_offense_codes.png)

## Rubocop Challenge Flow

Expand Down
36 changes: 18 additions & 18 deletions spec/lib/rubocop_challenger/rubocop/todo_reader_spec.rb
Expand Up @@ -5,7 +5,7 @@
RSpec.describe RubocopChallenger::Rubocop::TodoReader do
let(:todo_reader) { described_class.new('spec/fixtures/.rubocop_todo.yml') }

let(:autocorrectable_rule_which_offence_count_is_1) do
let(:autocorrectable_rule_which_offense_count_is_1) do
RubocopChallenger::Rubocop::Rule.new(<<~CONTENTS)
# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
Expand All @@ -17,7 +17,7 @@
CONTENTS
end

let(:autocorrectable_rule_which_offence_count_is_2) do
let(:autocorrectable_rule_which_offense_count_is_2) do
RubocopChallenger::Rubocop::Rule.new(<<~CONTENTS)
# Offense count: 2
# This cop supports safe auto-correction (--auto-correct).
Expand All @@ -27,7 +27,7 @@
CONTENTS
end

let(:autocorrectable_rule_which_offence_count_is_13) do
let(:autocorrectable_rule_which_offense_count_is_13) do
RubocopChallenger::Rubocop::Rule.new(<<~CONTENTS)
# Offense count: 13
# This cop supports safe auto-correction (--auto-correct).
Expand All @@ -51,7 +51,7 @@
CONTENTS
end

let(:unautocorrectable_rule_which_offence_count_is_4) do
let(:unautocorrectable_rule_which_offense_count_is_4) do
RubocopChallenger::Rubocop::Rule.new(<<~CONTENTS)
# Offense count: 4
Style/Documentation:
Expand All @@ -74,10 +74,10 @@
describe '#all_rules' do
let(:rules_which_are_ordered_by_offense_count) do
[
autocorrectable_rule_which_offence_count_is_1,
autocorrectable_rule_which_offence_count_is_2,
unautocorrectable_rule_which_offence_count_is_4,
autocorrectable_rule_which_offence_count_is_13
autocorrectable_rule_which_offense_count_is_1,
autocorrectable_rule_which_offense_count_is_2,
unautocorrectable_rule_which_offense_count_is_4,
autocorrectable_rule_which_offense_count_is_13
]
end

Expand Down Expand Up @@ -107,8 +107,8 @@

it 'rejects to be ignored rules' do
expect(todo_reader.all_rules).to eq [
autocorrectable_rule_which_offence_count_is_2,
unautocorrectable_rule_which_offence_count_is_4
autocorrectable_rule_which_offense_count_is_2,
unautocorrectable_rule_which_offense_count_is_4
]
end
end
Expand All @@ -117,9 +117,9 @@
describe '#auto_correctable_rules' do
let(:rules_which_are_ordered_by_offense_count) do
[
autocorrectable_rule_which_offence_count_is_1,
autocorrectable_rule_which_offence_count_is_2,
autocorrectable_rule_which_offence_count_is_13
autocorrectable_rule_which_offense_count_is_1,
autocorrectable_rule_which_offense_count_is_2,
autocorrectable_rule_which_offense_count_is_13
]
end

Expand All @@ -132,25 +132,25 @@
describe '#least_occurrence_rule' do
it 'returns a auto correctable rule with the least count of occurrences' do
expect(todo_reader.least_occurrence_rule).to eq(
autocorrectable_rule_which_offence_count_is_1
autocorrectable_rule_which_offense_count_is_1
)
end
end

describe '#most_occurrence_rule' do
it 'returns a auto correctable rule with the most count of occurrences' do
expect(todo_reader.most_occurrence_rule).to eq(
autocorrectable_rule_which_offence_count_is_13
autocorrectable_rule_which_offense_count_is_13
)
end
end

describe '#any_rule' do
it 'returns a auto correctable rule at random' do
expect(todo_reader.any_rule)
.to eq(autocorrectable_rule_which_offence_count_is_1)
.or eq(autocorrectable_rule_which_offence_count_is_2)
.or eq(autocorrectable_rule_which_offence_count_is_13)
.to eq(autocorrectable_rule_which_offense_count_is_1)
.or eq(autocorrectable_rule_which_offense_count_is_2)
.or eq(autocorrectable_rule_which_offense_count_is_13)
end
end
end

0 comments on commit 65e6170

Please sign in to comment.