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

Simplify external configuration settings #162

Merged
merged 12 commits into from
Jul 31, 2018
Merged

Simplify external configuration settings #162

merged 12 commits into from
Jul 31, 2018

Conversation

amckinney
Copy link
Contributor

@amckinney amckinney commented Jul 30, 2018

This un-registers and renames the external configuration settings according to the following:

  • Remove no_default_excludes (true by default)
  • Remove include_well_known_types (true by default)
  • Remove gen.go_options.no_default_modifiers (error if set)
  • Remove lint.group (error if set)
  • Rename create.dir_to_base_package to create.dir_to_package

Note that this PR is currently branched off of #161. Many of the testdata file directories are updated there, so this PR can be more-easily merged in afterwards.

@codecov-io
Copy link

codecov-io commented Jul 30, 2018

Codecov Report

Merging #162 into dev will increase coverage by 0.04%.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #162      +/-   ##
==========================================
+ Coverage   67.93%   67.97%   +0.04%     
==========================================
  Files          73       73              
  Lines        3739     3747       +8     
==========================================
+ Hits         2540     2547       +7     
- Misses        868      869       +1     
  Partials      331      331
Impacted Files Coverage Δ
internal/cmd/templates.go 75% <ø> (ø) ⬆️
internal/cfginit/cfginit.go 77.77% <ø> (ø) ⬆️
internal/settings/settings.go 75% <100%> (+8.33%) ⬆️
internal/settings/config_provider.go 72.15% <40%> (-0.83%) ⬇️
internal/lint/lint.go 73.14% <0%> (+0.92%) ⬆️

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 73aae87...dee437c. Read the comment docs.

CHANGELOG.md Outdated
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Delete the ability to explicitly specify multiple files, and have the effect
of one file being specified be the same as the former `--dir-mode`. See
[#16](https://github.com/uber/prototool/issues/16) for more details.
- Remove protoc_include_wkt setting. This is always set to true.
Copy link
Contributor

Choose a reason for hiding this comment

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

Stupid things:

  • s/Remove/Delete/ to be consistent with above
  • Put tickmarks around each option name ie protoc_include_wkt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, sounds good!

@@ -1,3 +1,14 @@
protoc_include_wkt: true
lint:
group: all
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah shoot, this is why I had it be a soft failure if lint.group is specified - this test tests if all linters are turned on. I'm not sure what to do here - we could have all these options be an error if not in devel mode? But then you have to propagate development mode all the way down, which I don't like...I don't know ugh.

I'm moderately confused as to how tests are passing if you remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed the test by adding all of the missing linters under include_ids. This way, we mimic the all setting because it's essentially: Default + (All - Default) == All

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah got it...well not optimal but hey, works for now.

// - Lint.Group
// - Gen.GoOptions.NoDefaultModifiers
func (e ExternalConfig) Validate() error {
if e.NoDefaultExcludes {
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, we're going to want to make this the new default, and make this true, or alternatively remove anything from the list of default excludes in https://github.com/uber/prototool/blob/dev/internal/settings/settings.go#L49

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yea good point. Nice catch, I'll update.

@amckinney
Copy link
Contributor Author

@peter-edge All comments addressed.

CHANGELOG.md Outdated
- Delete `no_default_excludes` setting. This is always set to true.
- Delete `gen.go_options.no_default_modifiers` setting.
- Delete `lint.group` setting.
- Delete `create.dir_to_base_package` -> `create.dir_to_package`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this is really more renamed, I can clean it up before release though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yea, that was a bad update on my end. I'll update before rebasing / merging into dev.

@@ -1,3 +1,14 @@
protoc_include_wkt: true
lint:
group: all
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah got it...well not optimal but hey, works for now.

@amckinney amckinney changed the base branch from dir-mode-delete to dev July 31, 2018 18:15
@amckinney amckinney merged commit 50b7e7e into dev Jul 31, 2018
@amckinney amckinney deleted the settings branch July 31, 2018 18:31
@mickeyreiss
Copy link
Contributor

Wanted to provide some feedback that this breaks our working v0.4.0 configuration. I understand the project is in pre-1.0, but it would be helpful if breaking changes in the external API along with migration notes, for example, in the readme or changelog. 😄

@bufdev
Copy link
Contributor

bufdev commented Aug 18, 2018

All changes have been noted in the changelog.

We plan to release v1.0 soon, but before v1.0, use is at your own risk and we take no responsibility for breaking changes.

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.

5 participants