Skip to content
This repository has been 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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcioj
Copy link
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
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
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
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
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.

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"

Copy link
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
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
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
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
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
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
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
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
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]

@@ -3,60 +3,60 @@
require "octokit"

module AssistedWorkflow::Addons

Copy link
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
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.

@@ -2,18 +2,18 @@
require "assisted_workflow/addons/base"

module AssistedWorkflow::Addons

Copy link
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.

@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"
Copy link
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
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
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 {.

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
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
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]

@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
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]

# 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."
Copy link
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.

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
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.

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
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.

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
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
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
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
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
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
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.

@@ -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)
Copy link
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
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
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
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.

@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"
Copy link
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
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
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
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
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
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
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
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
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
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
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
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
Member

@flaviogranero can you review this, please?

@marcioj
Copy link
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
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