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

fix: better config package to enhance test and restructuring #223

Merged
merged 11 commits into from
Sep 20, 2020

Conversation

profclems
Copy link
Owner

@profclems profclems commented Sep 14, 2020

  • use yaml for configuration instead of .env
  • better config reading, caching and writing
  • supports writing and reading local configs (configuration in working directory)
  • supports reading and writing host-level configuration which over-rides global config but can be overridden by local configs
  • preserves glabs's config read format (Environmental variables -> Local Config -> Global Config)
  • supports writing an updated config, preserving comments
  • supports mostly lazy evaluation of yaml

Related Issue

#170

Motivation and Context

This PR seeks to resolve #170 while making it easier to work on #157

How Has This Been Tested?

This has been manually tested by building and running the binary and I have added tests to cover my changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

TODO (Available for discussion)

  • Migrate the old .env to config.yml
  • Properly format old aliases.yml

profclems and others added 4 commits September 14, 2020 10:39
* fix: repo clone requires authentication

Closes #198

* feat: add ability to set git protocol

* Format code with gofmt

This commit fixes the style issues introduced in 73ee693 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/1a6879e9-070f-4a9f-a42c-ae4469dfc95d/

* fix: bug risks

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
@pull-assistant
Copy link

pull-assistant bot commented Sep 14, 2020

Score: 0.87

Best reviewed: commit by commit


Optimal code review plan (1 warning)

fix: better config package

internal/config/config_new.go 40% changes removed in finalize config pack...

     fix: replace config.getRepo() with git.getRepo

     feat: add ability to set git protocol (#221)

     fix: replace config.getRepo() with git.getRepo

     Format code with gofmt

     Merge branch 'trunk' into fix-better-config

     Write aliases to file 🔥

     add local config support

     fix tests 🔨

     Format code with gofmt

     finalize config package

Powered by Pull Assistant. Last update 4358287 ... 2705c06. Read the comment docs.

@profclems profclems marked this pull request as draft September 14, 2020 11:07
@profclems profclems added this to the v1.11.0 milestone Sep 14, 2020
This commit fixes the style issues introduced in fb011e3 according to the output
from gofmt.

Details: https://deepsource.io/gh/profclems/glab/transform/c6f8a52f-9c41-4b6f-a15a-9d77e43ff6b8/
@codecov
Copy link

codecov bot commented Sep 20, 2020

Codecov Report

Merging #223 into trunk will increase coverage by 1.89%.
The diff coverage is 55.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##            trunk     #223      +/-   ##
==========================================
+ Coverage   24.56%   26.46%   +1.89%     
==========================================
  Files          76       83       +7     
  Lines        3985     4206     +221     
==========================================
+ Hits          979     1113     +134     
- Misses       2928     2990      +62     
- Partials       78      103      +25     
Impacted Files Coverage Δ
cmd/glab/main.go 36.66% <0.00%> (-19.79%) ⬇️
commands/pipeline_status.go 3.52% <0.00%> (-1.02%) ⬇️
commands/repo_archive.go 7.50% <0.00%> (-2.26%) ⬇️
internal/config/config_migration.go 0.00% <0.00%> (ø)
internal/config/config.go 31.75% <10.52%> (-20.38%) ⬇️
internal/config/local_config.go 18.42% <18.42%> (ø)
internal/config/config_file.go 32.55% <32.55%> (ø)
internal/config/alias_config.go 39.28% <39.28%> (ø)
internal/config/host_config.go 66.66% <66.66%> (ø)
internal/config/config_type.go 71.11% <71.11%> (ø)
... and 84 more

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 dba5765...2705c06. Read the comment docs.

@profclems profclems marked this pull request as ready for review September 20, 2020 19:58
@profclems profclems merged commit ef3709d into trunk Sep 20, 2020
@profclems profclems deleted the fix-better-config branch September 20, 2020 20:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overhaul Configuration
1 participant