Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codespell support (config) and make it fix few typos #107

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,*.lock,.codespellrc,paper.bib
check-hidden = true
# ignore-regex =
# ignore-words-list =
2 changes: 1 addition & 1 deletion app/lib/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Defaults

# Default value for needed env settings.
# Can be overriden from the config/settings YAML file.
# Can be overridden from the config/settings YAML file.
def default_settings
@defaults ||= Sinatra::IndifferentHash[
bot_github_user: ENV['BUFFY_BOT_GH_USER'],
Expand Down
8 changes: 4 additions & 4 deletions app/lib/responder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,14 @@ def process_reverse_labeling

# Finds the value of the url of the target-repository in the body of the issue
# by default reads the field called "target-repository"
# unless a diferent name is set using param :url_field
# unless a different name is set using param :url_field
def target_repo_value
@target_repo_url ||= value_of_or_default(params[:url_field], "target-repository")
end

# Finds the name of the branch in the body of the issue
# by default reads the field called "branch"
# unless a diferent name is set using param :branch_field
# unless a different name is set using param :branch_field
# or if it comes in the match_data in the specified position
def branch_name_value(branch_index=1)
if @match_data.nil? || @match_data[branch_index].nil?
Expand All @@ -317,12 +317,12 @@ def hidden?
params[:hidden] == true
end

# Default description can be overriden by config param
# Default description can be overridden by config param
def description
params[:description] || default_description
end

# Default example_invocation can be overriden by config param
# Default example_invocation can be overridden by config param
def example_invocation
params[:example_invocation] || default_example_invocation
end
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ The _env_ section is used to declare general key/value settings. For security re
<dd>This setting is used to impose conditions on the responder. It can include several options:

```eval_rst
:title: *<String>* or *<Regular Expresion>* Responder will run only if issue' title matches this.
:body: *<String>* or *<Regular Expresion>* Responder will run only if the body of the issue matches this.
:title: *<String>* or *<Regular Expression>* Responder will run only if issue' title matches this.
:body: *<String>* or *<Regular Expression>* Responder will run only if the body of the issue matches this.
:value_exists: *<String>* Responder will run only if there is a not empty value for this in the issue (marked with HTML comments).
:value_matches: *<Hash>* Responder will run only if the param values (marked with HTML comments) in the body of the issue matches the ones specified here.
:role_assigned: *<String>* Responder will be run only if there is a username assigned for the specified value.
Expand Down
2 changes: 1 addition & 1 deletion docs/custom_responder.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ When an event is sent from the reviews repository to Buffy, only responders that
#### Event regex
The _@event_regex_ variable is where the syntax of every specific command is declared. If it is `nil` the responder will respond to every event that matches _@event_action_.

Inside this method you have available the name of the bot in the `@botname` instace variable and all the parameters for this responder from the config file in the `@params` instance variable.
Inside this method you have available the name of the bot in the `@botname` instance variable and all the parameters for this responder from the config file in the `@params` instance variable.

For our example, we will be listening to comments and we want the command to be "what time is it?":
```ruby
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This will be the "user" responding to the commands issued from a reviews reposit
Some applications and services must be available to use by Buffy:

- **[Redis](https://redis.io/)**: To process background jobs Buffy needs `redis` installed.
- **[cloc](https://github.com/AlDanial/cloc)**: The *Respository Checks Responder* can analyze source code, to run this check `cloc` is used.
- **[cloc](https://github.com/AlDanial/cloc)**: The *Repository Checks Responder* can analyze source code, to run this check `cloc` is used.

#### Deployment

Expand Down
2 changes: 1 addition & 1 deletion docs/labeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Responders allowing labeling will accept in their settings two keys:
- pending-review
...
```
If the example responder is successfull the `review-finished` and `recommend publication` labels will be added and the `pending-review` label will be removed from the issue.
If the example responder is successful the `review-finished` and `recommend publication` labels will be added and the `pending-review` label will be removed from the issue.

## Responders listening to Add/Remove actions

Expand Down
2 changes: 1 addition & 1 deletion docs/responders/external_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Later, a POST request will be sent to https://dummy-external-service.herokuapp.c
"secret": "A1234567890Z", # declared in the query_params setting
"target-repo":"...", # the value is extracted from the body of the issue
"id":"...", # the value corresponds to issue_id, it has been mapped to id
"repo":"...", # the origin repo where the invocation happend
"repo":"...", # the origin repo where the invocation happenedd
"sender":"...", # the user invoking the command
"bot_name":"...", # the bot user name that will be responding
}
Expand Down
4 changes: 2 additions & 2 deletions docs/responders/goodbye.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To reply with a template file:

Calling an external service:
```eval_rst
:external_service: All the configuration for the service is nested under this param. Posible options are:
:external_service: All the configuration for the service is nested under this param. Possible options are:

:name: *Required*. The name for this service.
:url: *Required*. The url to call.
Expand Down Expand Up @@ -105,7 +105,7 @@ When a new issue is closed the responder will send a POST request to https://dum
"secret": "A1234567890Z", # declared in the query_params setting
"target-repo":"...", # the value is extracted from the body of the issue
"id":"...", # the value corresponds to issue_id, it has been mapped to id
"repo":"...", # the origin repo where the invocation happend
"repo":"...", # the origin repo where the invocation happenedd
"sender":"...", # the user invoking the command
"bot_name":"...", # the bot user name that will be responding
}
Expand Down
4 changes: 2 additions & 2 deletions docs/responders/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ To reply with a template file:

Calling an external service:
```eval_rst
:external_service: All the configuration for the service is nested under this param. Posible options are:
:external_service: All the configuration for the service is nested under this param. Possible options are:

:name: *Required*. The name for this service.
:url: *Required*. The url to call.
Expand Down Expand Up @@ -163,7 +163,7 @@ When a new issue is created the responder will send a POST request to https://du
"secret": "A1234567890Z", # declared in the query_params setting
"target-repo":"...", # the value is extracted from the body of the issue
"id":"...", # the value corresponds to issue_id, it has been mapped to id
"repo":"...", # the origin repo where the invocation happend
"repo":"...", # the origin repo where the invocation happenedd
"sender":"...", # the user invoking the command
"bot_name":"...", # the bot user name that will be responding
}
Expand Down
8 changes: 4 additions & 4 deletions spec/responder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
expect(subject.authorized?(@context)).to be_truthy
end

it "should be true if sender is listed in an autorized role in the issue" do
it "should be true if sender is listed in an authorized role in the issue" do
subject.params = { authorized_roles_in_issue: 'reviewers' }
@context[:issue_body] = "<!--reviewers-->@rev1, @sender<!--end-reviewers-->"
subject.context = @context
Expand All @@ -70,7 +70,7 @@
expect(subject.authorized?(@context)).to be_truthy
end

it "should be true if sender is not in an autorized role but is in authorized team" do
it "should be true if sender is not in an authorized role but is in authorized team" do
@context[:issue_body] = "<!--reviewers-->@rev1, @rev2<!--end-reviewers-->"
subject.params = { only: 'editors', authorized_roles_in_issue: 'reviewers'}
subject.context = @context
Expand All @@ -79,7 +79,7 @@
expect(subject.authorized?(@context)).to be_truthy
end

it "should be true if sender is not in an autorized team but is in authorized role" do
it "should be true if sender is not in an authorized team but is in authorized role" do
@context[:issue_body] = "<!--reviewers-->@rev1, @sender<!--end-reviewers-->"
subject.params = { only: 'editors', authorized_roles_in_issue: 'reviewers'}
subject.context = @context
Expand All @@ -88,7 +88,7 @@
expect(subject.authorized?(@context)).to be_truthy
end

it "should be true if sender is in an autorized team and in authorized role" do
it "should be true if sender is in an authorized team and in authorized role" do
@context[:issue_body] = "<!--reviewers-->@rev1, @sender<!--end-reviewers-->"
subject.params = { only: 'editors', authorized_roles_in_issue: 'reviewers'}
subject.context = @context
Expand Down
2 changes: 1 addition & 1 deletion spec/responders/add_and_remove_assignee_responder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@responder.match_data = @responder.event_regex.match(@msg)
end

it "should add user as assignee if posible" do
it "should add user as assignee if possible" do
expect_any_instance_of(Octokit::Client).to receive(:check_assignee).once.and_return(true)
expect(@responder).to_not receive(:remove_assignee)
expect(@responder).to receive(:add_assignee).with("@arfon")
Expand Down
2 changes: 1 addition & 1 deletion spec/utilities_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestingUtilities
end

describe "#clone_repo" do
it "should return true when succesfully cloned a repo to a local path" do
it "should return true when successfully cloned a repo to a local path" do
expect(Open3).to receive(:capture3).
with("git clone http:/repository-url.com ./local/folder").
and_return(["OK", "", OpenStruct.new(success?: true)])
Expand Down