Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Delete multiple file specification and dir-mode #161

Merged
merged 5 commits into from
Jul 31, 2018
Merged

Conversation

bufdev
Copy link
Contributor

@bufdev bufdev commented Jul 30, 2018

Fixes #16. The majority of the diff is splitting up files used in integration testing into individual directories so that the tests still work. Since all prototool builds now operate on directories, this is required.

@bufdev bufdev requested review from peats-bond and amckinney July 30, 2018 10:36
@codecov-io
Copy link

codecov-io commented Jul 30, 2018

Codecov Report

Merging #161 into dev will increase coverage by 0.28%.
The diff coverage is 79.48%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #161      +/-   ##
==========================================
+ Coverage   67.64%   67.93%   +0.28%     
==========================================
  Files          73       73              
  Lines        3799     3739      -60     
==========================================
- Hits         2570     2540      -30     
+ Misses        891      868      -23     
+ Partials      338      331       -7
Impacted Files Coverage Δ
internal/exec/exec.go 52.63% <ø> (+7.17%) ⬆️
internal/cmd/flags.go 100% <ø> (ø) ⬆️
internal/cmd/templates.go 75% <ø> (-0.7%) ⬇️
internal/exec/runner.go 47.8% <79.48%> (+2.04%) ⬆️
internal/file/proto_set_provider.go 61.08% <0%> (-2.71%) ⬇️
internal/protoc/compiler.go 46.38% <0%> (-1.61%) ⬇️
internal/lint/check_file_options_unset.go 100% <0%> (+33.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a02c0d6...29c8176. Read the comment docs.

Copy link
Contributor

@amckinney amckinney left a comment

Choose a reason for hiding this comment

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

Sweet! A few outstanding questions for my own understanding.

@@ -895,7 +893,7 @@ func testDoInternal(stdin io.Reader, args ...string) (string, int) {
}
buffer := bytes.NewBuffer(nil)
// develMode is on, so we have access to all commands
exitCode := do(true, args, stdin, buffer, os.Stderr)
exitCode := do(true, args, stdin, buffer, buffer)
Copy link
Contributor

Choose a reason for hiding this comment

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

We want to use the same buffer for both stdout and stderr? Seems fine in a test - just want to make sure that's what you intend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I took this out before, but as the tests operate on the output, I want to check that ALL output is as I expect (which is generally that stderr has no output)

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, thanks for clarifying!

flags.bindDryRun(flagSet)
},
}

grpcCmdTemplate = &cmdTemplate{
Use: "grpc dirOrProtoFiles...",
Use: "grpc [dirOrFile]",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add cobra.MaximumNArgs(1) here, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's already there, it's below the Long documentation

Copy link
Contributor

Choose a reason for hiding this comment

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

Doh! Sorry for missing that earlier.

if len(args) == 0 {
// TODO: does not fit in with workDirPath paradigm
args = []string{"."}
func (r *runner) getMeta(args []string, lenOfArgsIfSpecified int) (*meta, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

lenOfArgsIfSpecified might be better represented as maxArgsLength (or something similar). I think this would make the following conditional(s) more clear. What are your thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the length of the args if a file or dir was specified, it’s not max args per se. It says “if args are length 3, then we have a dir or file, otherwise use pwd”. A comment could help, I’ll add one

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, that sounds good. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@peats-bond peats-bond left a comment

Choose a reason for hiding this comment

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

LGTM, same nit as @amckinney lenOfArgsIfSpecified took me a bit to understand, comment/rename would be great.

CHANGELOG.md Outdated
@@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- No changes yet.
- Delete the ability to explicitly specify multiple files, and have the effect
Copy link
Contributor

Choose a reason for hiding this comment

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

should be under a ### Removed header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's really Changed, since it's remove multiple files, have single file be old dir mode.

@bufdev
Copy link
Contributor Author

bufdev commented Jul 31, 2018

All comments addressed @AlexAPB @amckinney

flags.bindDryRun(flagSet)
},
}

grpcCmdTemplate = &cmdTemplate{
Use: "grpc dirOrProtoFiles...",
Use: "grpc [dirOrFile]",
Copy link
Contributor

Choose a reason for hiding this comment

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

Doh! Sorry for missing that earlier.

// contains the dirOrFile parameter as it's first argument." For example, for
// "prototool compile [dirOrFile]", lenOfArgsIfSpecified is 1, saying that if
// we have 1 argument, the first argument is dirOrFile, if we have zero arguments,
// we do not and assume the current directory is the dirOrFile.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the additional note!

@bufdev bufdev merged commit 73aae87 into dev Jul 31, 2018
@amckinney amckinney deleted the dir-mode-delete branch July 31, 2018 18:31
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