-
Notifications
You must be signed in to change notification settings - Fork 2
Add --force flag to submit command in order to create a PR from a bra… #16
base: master
Are you sure you want to change the base?
Conversation
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 { |
There was a problem hiding this comment.
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/ |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
it "returns false if current branch is not merged into master" do | ||
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" | ||
|
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
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" } |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line detected.
|
||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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]
@@ -3,60 +3,60 @@ | |||
require "octokit" | |||
|
|||
module AssistedWorkflow::Addons | |||
|
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
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.
@@ -2,18 +2,18 @@ | |||
require "assisted_workflow/addons/base" | |||
|
|||
module AssistedWorkflow::Addons | |||
|
There was a problem hiding this comment.
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.
eb26d7b
to
a1e060f
Compare
@github.create_pull_request( | ||
"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" |
There was a problem hiding this comment.
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/) |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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 {.
AssistedWorkflow::Addons::Github.new(nil, {}) | ||
}.must_raise AssistedWorkflow::Error, "github missing configuration:[token,repository]" | ||
end.must_raise AssistedWorkflow::Error, "github missing configuration:[token,repository]" |
There was a problem hiding this comment.
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" } |
There was a problem hiding this comment.
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]
@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" |
There was a problem hiding this comment.
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]
# loads all configuration, merging global and local values | ||
def configuration | ||
@configuration ||= begin | ||
ConfigFile.new(GLOBAL_CONFIG).merge_file(LOCAL_CONFIG) | ||
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." |
There was a problem hiding this comment.
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.
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 "\ |
There was a problem hiding this comment.
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.
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" |
There was a problem hiding this comment.
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.
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" |
There was a problem hiding this comment.
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" } } | ||
} | ||
) |
There was a problem hiding this comment.
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" } } | ||
} |
There was a problem hiding this comment.
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" } } |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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, { |
There was a problem hiding this comment.
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.
@@ -89,27 +105,31 @@ def story | |||
stub(klass).tasks { [] } | |||
end | |||
@story ||= TrackerApi::Resources::Story.new(:id => "1234", :name => "New Feature", | |||
:description => "Feature description", :client => @client) | |||
:description => "Feature description", :client => @client) |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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) } |
There was a problem hiding this comment.
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.
@github.create_pull_request( | ||
"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" |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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" } | ||
} | ||
}) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) } |
There was a problem hiding this comment.
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]" |
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
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" } |
There was a problem hiding this comment.
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.
b778338
to
a1e060f
Compare
@flaviogranero can you review this, please? |
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. |
@marcioj could you please update the Readme to give instructions about the -f flag? |
…nch without task