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

Refer to default branch as main instead of master #425

Open
wants to merge 1 commit into
base: master
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pronto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Pronto

on:
pull_request:
branches: [master]
branches: [main]

jobs:
pronto:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Specs

on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ do so.

* Check that the issue has not already been reported.
* Check that the issue has not already been fixed in the latest code
(a.k.a. `master`).
(a.k.a. `main`).
* Be clear, concise and precise in your description of the problem.
* Open an issue with a descriptive title and a summary in grammatically correct,
complete sentences.
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ gem 'pronto-flay', require: false

## Usage

Pronto runs the checks on a diff between the current HEAD and the provided commit-ish (default is master).
Pronto runs the checks on a diff between the current HEAD and the provided commit-ish (default is main).

### Local Changes

Expand All @@ -62,13 +62,13 @@ Navigate to the repository you want to run Pronto on, and:
```sh
git checkout feature/branch

# Analyze diff of committed changes on current branch and master:
# Analyze diff of committed changes on current branch and main:
pronto run

# Analyze changes in git staging area
pronto run --staged

# Analyze diff of uncommitted changes and master:
# Analyze diff of uncommitted changes and main:
pronto run --unstaged

# Analyze *all* changes since the *initial* commit (may take some time):
Expand Down Expand Up @@ -101,19 +101,19 @@ Set the PRONTO_GITHUB_ACCESS_TOKEN environment variable or value in `.pronto.yml
Then just run it:

```sh
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github -c origin/master
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github -c origin/main
```

If you want comments to appear on pull request diff, instead of commit:

```sh
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr -c origin/master
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr -c origin/main
```

If you want review to appear on pull request diff, instead of separate comments:

```sh
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr_review -c origin/master
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr_review -c origin/main
```

All the **N** pending comments will be now separated into **X** number of PR reviews.
Expand All @@ -129,26 +129,26 @@ Note: In case no environment variable or config setting is specified in `.pronto
a default value of `30` will be used.

```sh
$ PRONTO_WARNINGS_PER_REVIEW=30 PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr_review -c origin/master
$ PRONTO_WARNINGS_PER_REVIEW=30 PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_pr_review -c origin/main
```

Use `GithubStatusFormatter` to submit [commit status](https://github.com/blog/1227-commit-status-api):

```sh
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_status -c origin/master
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_status -c origin/main
```

If you want to show a one single status for all runners, instead of status per runner:

```sh
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_combined_status -c origin/master
$ PRONTO_GITHUB_ACCESS_TOKEN=token pronto run -f github_combined_status -c origin/main
```

It's possible to combine multiple formatters.
To get both pull request comments and commit status summary use:

```sh
$ PRONTO_GITHUB_ACCESS_TOKEN=token PRONTO_PULL_REQUEST_ID=id pronto run -f github_status github_pr -c origin/master
$ PRONTO_GITHUB_ACCESS_TOKEN=token PRONTO_PULL_REQUEST_ID=id pronto run -f github_status github_pr -c origin/main
```

As an alternative, you can also set up a rake task:
Expand All @@ -159,7 +159,7 @@ Pronto::GemNames.new.to_a.each { |gem_name| require "pronto/#{gem_name}" }
formatter = Pronto::Formatter::GithubFormatter.new # also possible: GithubPullRequestFormatter, GithubPullRequestReviewFormatter
status_formatter = Pronto::Formatter::GithubStatusFormatter.new
formatters = [formatter, status_formatter]
Pronto.run('origin/master', '.', formatters)
Pronto.run('origin/main', '.', formatters)
```

#### GitHub Actions Integration
Expand Down Expand Up @@ -211,15 +211,15 @@ to your Gitlab private token which you can find in your account settings.
Then just run it:

```sh
$ PRONTO_GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
$ PRONTO_GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/main
```

**note: this requires at least Gitlab 11.6+**

Merge request integration:

```sh
$ PRONTO_GITLAB_API_PRIVATE_TOKEN=token PRONTO_PULL_REQUEST_ID=id pronto run -f gitlab_mr -c origin/master
$ PRONTO_GITLAB_API_PRIVATE_TOKEN=token PRONTO_PULL_REQUEST_ID=id pronto run -f gitlab_mr -c origin/main
```

On GitLabCI, make sure to run Pronto in a [merge request pipeline](https://docs.gitlab.com/ce/ci/merge_request_pipelines/):
Expand Down Expand Up @@ -249,13 +249,13 @@ Set the PRONTO_BITBUCKET_USERNAME and PRONTO_BITBUCKET_PASSWORD environment vari
Then just run it:

```sh
$ PRONTO_BITBUCKET_USERNAME=user PRONTO_BITBUCKET_PASSWORD=pass pronto run -f bitbucket -c origin/master
$ PRONTO_BITBUCKET_USERNAME=user PRONTO_BITBUCKET_PASSWORD=pass pronto run -f bitbucket -c origin/main
```

or, if you want comments to appear on pull request diff, instead of commit:

```sh
$ PRONTO_BITBUCKET_USERNAME=user PRONTO_BITBUCKET_PASSWORD=pass pronto run -f bitbucket_pr -c origin/master
$ PRONTO_BITBUCKET_USERNAME=user PRONTO_BITBUCKET_PASSWORD=pass pronto run -f bitbucket_pr -c origin/main
```

## Configuration
Expand Down
2 changes: 1 addition & 1 deletion lib/pronto/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(config_hash = ConfigFile.new.to_h)
def default_commit
default_commit =
ENV['PRONTO_DEFAULT_COMMIT'] ||
@config_hash.fetch('default_commit', 'master')
@config_hash.fetch('default_commit', 'main')
default_commit
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pronto/config_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ConfigFile
'text' => {
'format' => '%{color_location} %{color_level}: %{msg}'
},
'default_commit' => 'master',
'default_commit' => 'main',
'runners' => [],
'formatters' => [],
'max_warnings' => nil,
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/renamed-file.git/logs/HEAD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0000000000000000000000000000000000000000 81d7ad66f39011d0eedaa70e33bae27b67c3c519 Alessio Signorini <asignorini@evidation.com> 1546113502 +0000 commit (initial): first commit
81d7ad66f39011d0eedaa70e33bae27b67c3c519 81d7ad66f39011d0eedaa70e33bae27b67c3c519 Alessio Signorini <asignorini@evidation.com> 1546113610 +0000 checkout: moving from master to new_branch
81d7ad66f39011d0eedaa70e33bae27b67c3c519 81d7ad66f39011d0eedaa70e33bae27b67c3c519 Alessio Signorini <asignorini@evidation.com> 1546113610 +0000 checkout: moving from main to new_branch
81d7ad66f39011d0eedaa70e33bae27b67c3c519 3e2cbd49d2d9d33b6c9eea4371eb67c947920f71 Alessio Signorini <asignorini@evidation.com> 1546113694 +0000 commit: added second file with no errors
3e2cbd49d2d9d33b6c9eea4371eb67c947920f71 93657bccfddbce46b58c23960fea84103d90d37d Alessio Signorini <asignorini@evidation.com> 1546113701 +0000 commit: renamed original-file
2 changes: 1 addition & 1 deletion spec/fixtures/test.git/HEAD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ref: refs/heads/master
ref: refs/heads/main
2 changes: 1 addition & 1 deletion spec/pronto/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Pronto
end

context 'from default value' do
it { should == 'master' }
it { should == 'main' }
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/pronto/git/repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Git

describe '#branch' do
subject { repo.branch }
it { should == 'master' }
it { should == 'main' }
end

describe '#remote_urls' do
Expand Down
4 changes: 2 additions & 2 deletions spec/pronto_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module Pronto
it { should be_empty }
end

context 'master' do
let(:commit) { 'master' }
context 'main' do
let(:commit) { 'main' }
it { should be_empty }
end

Expand Down