Skip to content
This repository was archived by the owner on Jul 4, 2018. It is now read-only.

Add --force flag to submit command in order to create a PR from a bra…#16

Open
marcioj wants to merge 1 commit intomasterfrom
marcioj.force-submit
Open

Add --force flag to submit command in order to create a PR from a bra…#16
marcioj wants to merge 1 commit intomasterfrom
marcioj.force-submit

Conversation

@marcioj
Copy link
Copy Markdown
Member

@marcioj marcioj commented Jan 10, 2017

…nch without task

it "raises on creating an invalid pull request" do
mock(@client).create_pull_request("fakeuser/fakerepo", "master", "fakeuser.1234.new_feature", "[#1234] New Feature", "Feature description"){ nil }
proc {
proc {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using {...} for multi-line blocks.

mock(@client).create_pull_request("fakeuser/fakerepo", "master", "fakeuser.1234.new_feature", "My awesome feature", nil){ pull_request }
@github.create_pull_request(
"fakeuser.1234.new_feature", OpenStruct.new(name: "My awesome feature")
).must_match /fakeuser\/fakerepo\/pull\/1/
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
Use %r around regular expression.



it "creates a new valid pull request from a story without id" do
mock(@client).create_pull_request("fakeuser/fakerepo", "master", "fakeuser.1234.new_feature", "My awesome feature", nil){ pull_request }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [140/80]
Space missing to the left of {.


it "requires token and repository configuration" do
proc {
proc {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using {...} for multi-line blocks.

mock(@git).system("git branch --merged"){ "flavio.1234.other_feature" }
proc { @git.check_merged! }.must_raise AssistedWorkflow::Error, "this branch is not merged into master"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at block body end.


describe "#check_merged!" do

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at block body beginning.



it "returns the feature name" do
stub(@git).system("git rev-parse --abbrev-ref HEAD"){ "marcioj.some-amazing_feature.that.i-did" }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing to the left of {.
Line is too long. [101/80]

it "raises when rebasing if there are not commited changes" do
mock(@git).system("git status --porcelain"){ "changed_file.rb" }
proc {
proc {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using {...} for multi-line blocks.



Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line detected.



Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line detected.

pr_url = github.create_pull_request(git.current_branch, pr_story)

if story
tracker.finish_story(story, :note => pr_url)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new Ruby 1.9 hash syntax.

unless story = tracker.find_story(story_id)
raise AssistedWorkflow::Error, "story not found, make sure a feature branch in active"
unless options[:force]
raise AssistedWorkflow::Error, "story not found, make sure a feature branch is active or use --force to ignore it altogether"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [135/80]


desc "submit", "Submits the current story creating a new pull request"
method_option :force, :type => :boolean, :default => false, :aliases => "-f", :desc => "Create the pull request regardless of the current having an associated task or not"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new Ruby 1.9 hash syntax.
Line is too long. [175/80]

Comment thread lib/assisted_workflow/addons/github.rb Outdated

module AssistedWorkflow::Addons

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at module body beginning.


class Git < Base

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at class body beginning.


module AssistedWorkflow::Addons

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at module body beginning.

@marcioj marcioj force-pushed the marcioj.force-submit branch from eb26d7b to a1e060f Compare January 10, 2017 18:07
"fakeuser.1234.new_feature", story
)
}.must_raise AssistedWorkflow::Error, "error on submiting the pull request"
end.must_raise AssistedWorkflow::Error, "error on submiting the pull request"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [81/80]

"fakeuser.1234.new_feature", "My awesome feature", nil){ pull_request }
@github.create_pull_request(
"fakeuser.1234.new_feature", OpenStruct.new(name: "My awesome feature")
).must_match(/fakeuser\/fakerepo\/pull\/1/)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use %r around regular expression.


it "creates a new valid pull request from a story without id" do
mock(@client).create_pull_request("fakeuser/fakerepo", "master",
"fakeuser.1234.new_feature", "My awesome feature", nil){ pull_request }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.
Space missing to the left of {.

proc do
AssistedWorkflow::Addons::Github.new(nil, {})
}.must_raise AssistedWorkflow::Error, "github missing configuration:[token,repository]"
end.must_raise AssistedWorkflow::Error, "github missing configuration:[token,repository]"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [93/80]



it "returns the feature name" do
stub(@git).system("git rev-parse --abbrev-ref HEAD") { "marcioj.some-amazing_feature.that.i-did" }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [102/80]

proc do
@git.rebase_and_push
}.must_raise AssistedWorkflow::Error, "git: there are not commited changes"
end.must_raise AssistedWorkflow::Error, "git: there are not commited changes"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [81/80]

Comment thread lib/assisted_workflow/cli.rb Outdated
rescue TypeError
raise AssistedWorkflow::Error, "Error on loading .awconfig files. Please check the content format."
raise AssistedWorkflow::Error,
"Error on loading .awconfig files. Please check the content format."
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

Comment thread lib/assisted_workflow/cli.rb Outdated

desc "submit", "Submits the current story creating a new pull request"
method_option :force, type: :boolean, default: false, aliases: "-f",
desc: "Create the pull request regardless of the "\
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the elements of a hash literal if they span more than one line.

Comment thread lib/assisted_workflow/cli.rb Outdated
method_option :all, type: :boolean, default: false, aliases: "-a",
desc: "Show started and pending stories when no story_id is provided"
method_option :estimate, type: :numeric, aliases: "-e",
desc: "Sets the story estimate when starting"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the elements of a hash literal if they span more than one line.

Comment thread lib/assisted_workflow/cli.rb Outdated
desc "start [STORY_ID]", "Start the pivotal story and create a new branch"\
" to receive the changes"
method_option :all, type: :boolean, default: false, aliases: "-a",
desc: "Show started and pending stories when no story_id is provided"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the elements of a hash literal if they span more than one line.

_links: {
html: { href: "https://github.com/fakeuser/fakerepo/pull/1" } }
}
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align ) with (.
Closing method call brace must be on the same line as the last argument when opening brace is on the same line as the first argument.

Sawyer::Resource.new(agent_stub, {
_links: {
html: { href: "https://github.com/fakeuser/fakerepo/pull/1" } }
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent the right brace the same as the first position after the preceding left parenthesis.

Sawyer::Resource.new(agent_stub, {_links: {html: {href: "https://github.com/fakeuser/fakerepo/pull/1"}}})
Sawyer::Resource.new(agent_stub, {
_links: {
html: { href: "https://github.com/fakeuser/fakerepo/pull/1" } }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing hash brace must be on the line after the last hash element when opening brace is on a separate line from the first hash element.

def pull_request
Sawyer::Resource.new(agent_stub, {_links: {html: {href: "https://github.com/fakeuser/fakerepo/pull/1"}}})
Sawyer::Resource.new(agent_stub, {
_links: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a hash, relative to the first position after the preceding left parenthesis.


def pull_request
Sawyer::Resource.new(agent_stub, {_links: {html: {href: "https://github.com/fakeuser/fakerepo/pull/1"}}})
Sawyer::Resource.new(agent_stub, {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant curly braces around a hash parameter.

end
@story ||= TrackerApi::Resources::Story.new(:id => "1234", :name => "New Feature",
:description => "Feature description", :client => @client)
:description => "Feature description", :client => @client)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the elements of a hash literal if they span more than one line.
Use the new Ruby 1.9 hash syntax.

it "finishes a story" do
mock(@client).reopen_issue(@configuration["repository"], gh_issue.number, :assignee => "fakeuser", :labels => ["bug","finished"]){ true }
mock(@client).reopen_issue(@configuration["repository"], gh_issue.number,
:assignee => "fakeuser", :labels => ["bug","finished"]){ true }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.
Use the new Ruby 1.9 hash syntax.
Use %w or %W for an array of words.
Space missing after comma.
Space missing to the left of {.

it "starts a story" do
mock(@client).reopen_issue(@configuration["repository"], gh_issue.number, :assignee => "fakeuser", :labels => ["bug","started"]){ true }
mock(@client).reopen_issue(@configuration["repository"], gh_issue.number,
:assignee => "fakeuser", :labels => ["bug","started"]){ true }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.
Use the new Ruby 1.9 hash syntax.
Use %w or %W for an array of words.
Space missing after comma.
Space missing to the left of {.

end

mock(@client).issue(@configuration["repository"],
"10") { |repo, issue_number| gh_issue(:number => issue_number) }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.
Unused block argument - repo. If it's necessary, use _ or _repo as an argument name to indicate that it won't be used.
Use the new Ruby 1.9 hash syntax.

)
}.must_raise AssistedWorkflow::Error, "error on submiting the pull request"
end.must_raise AssistedWorkflow::Error,
"error on submiting the pull request"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

proc {
mock(@client).create_pull_request("fakeuser/fakerepo", "master",
"fakeuser.1234.new_feature", "[#1234] New Feature",
"Feature description"){ nil }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.
Space missing to the left of {.

mock(@client).create_pull_request("fakeuser/fakerepo", "master", "fakeuser.1234.new_feature", "[#1234] New Feature", "Feature description"){ nil }
proc {
mock(@client).create_pull_request("fakeuser/fakerepo", "master",
"fakeuser.1234.new_feature", "[#1234] New Feature",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

it "creates a new valid pull request from a github story" do
mock(@client).create_pull_request_for_issue("fakeuser/fakerepo", "master", "fakeuser.1234.new_feature", 10){ pull_request }
mock(@client).create_pull_request_for_issue("fakeuser/fakerepo", "master",
"fakeuser.1234.new_feature", 10){ pull_request }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.
Space missing to the left of {.

mock(@client).create_pull_request("fakeuser/fakerepo", "master", "fakeuser.1234.new_feature", "[#1234] New Feature", "Feature description"){ pull_request }
mock(@client).create_pull_request("fakeuser/fakerepo", "master",
"fakeuser.1234.new_feature", "[#1234] New Feature",
"Feature description"){ pull_request }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.
Space missing to the left of {.

it "creates a new valid pull request from a pivotal story" do
mock(@client).create_pull_request("fakeuser/fakerepo", "master", "fakeuser.1234.new_feature", "[#1234] New Feature", "Feature description"){ pull_request }
mock(@client).create_pull_request("fakeuser/fakerepo", "master",
"fakeuser.1234.new_feature", "[#1234] New Feature",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

_links: {
html: { href: "https://github.com/fakeuser/fakerepo/pull/1" }
}
})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent the right brace the same as the first position after the preceding left parenthesis.

@story ||= TrackerApi::Resources::Story.new(:id => "1234", :name => "New Feature",
:description => "Feature description", :client => @client)
@story ||= TrackerApi::Resources::Story.new(id: "1234", name: "New Feature",
description: "Feature description", client: @client)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the elements of a hash literal if they span more than one line.

mock(@client).issue(
@configuration["repository"],
"10"
) { |repo, issue_number| gh_issue(number: issue_number) }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused block argument - repo. If it's necessary, use _ or _repo as an argument name to indicate that it won't be used.

AssistedWorkflow::Addons::Github.new(nil, {})
}.must_raise AssistedWorkflow::Error, "github missing configuration:[token,repository]"
end.must_raise AssistedWorkflow::Error,
"github missing configuration:[token,repository]"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the parameters of a method call if they span more than one line.

mock(@client).reopen_issue(@configuration["repository"], gh_issue.number, :assignee => "fakeuser", :labels => ["bug","finished"]){ true }
mock(@client).reopen_issue(
@configuration["repository"], gh_issue.number,
assignee: "fakeuser", labels: ["bug","finished"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use %w or %W for an array of words.
Space missing after comma.

stories = @github.pending_stories(:include_started => false)
mock(@client).issues(
@configuration["repository"],
{ state: "open", assignee: "fakeuser" }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant curly braces around a hash parameter.

@elbrujohalcon
Copy link
Copy Markdown
Member

@flaviogranero can you review this, please?

@marcioj
Copy link
Copy Markdown
Member Author

marcioj commented Jan 10, 2017

There are dozens of style fixes here. I think hound was not being used in this project and was included recently. I tried to fix them but I believe that doing two things in this PR will lead to more confusion.
Not sure why travis is failing ...

@flaviogranero
Copy link
Copy Markdown
Member

@marcioj could you please update the Readme to give instructions about the -f flag?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants