Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactored code generator #2177

Merged
merged 1 commit into from
Jan 26, 2020
Merged

Conversation

fredbi
Copy link
Contributor

@fredbi fredbi commented Jan 13, 2020

NO BEHAVIOR CHANGE EXPECTED

  • removed some (most) redundant code (left redundancies that would introduce change in behavior to forthcoming PRs)

  • factorized spec loading/validating/flattening operations (new spec.go file)

  • regrouped state init() function calls

  • reduced the number of global vars and replaced them by functions

  • adapted template repo to initialize from language options, with adequate template FuncMap

  • made DefaultLanguage a configurable function

  • moved global golang-specific function to LangueOpts (new language.go file)

  • testability: functionalized a number of hard to test code (e.g. all funcmap entries), and introduced unit testing

  • started, but did not complete yet the rewriting of unit tests using 'require' instead of nested constructs with 'assert'

Signed-off-by: Frederic BIDON fredbi@yahoo.com

@codecov
Copy link

codecov bot commented Jan 13, 2020

Codecov Report

Merging #2177 into master will increase coverage by 0.53%.
The diff coverage is 89.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2177      +/-   ##
==========================================
+ Coverage   80.51%   81.04%   +0.53%     
==========================================
  Files          48       49       +1     
  Lines        8309     8305       -4     
==========================================
+ Hits         6690     6731      +41     
+ Misses       1103     1075      -28     
+ Partials      516      499      -17
Impacted Files Coverage Δ
generator/debug.go 100% <ø> (ø) ⬆️
generator/operation.go 93.34% <100%> (+0.84%) ⬆️
generator/types.go 91.6% <100%> (+0.03%) ⬆️
generator/client.go 79.31% <75%> (-0.51%) ⬇️
generator/spec.go 81.18% <81.18%> (ø)
generator/language.go 84.02% <84.02%> (ø)
generator/model.go 84.6% <87.5%> (+0.09%) ⬆️
generator/shared.go 88.35% <94%> (+2.84%) ⬆️
generator/support.go 88.02% <97.61%> (+6.16%) ⬆️
generator/template_repo.go 93.35% <98.75%> (+5.5%) ⬆️
... and 18 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 4e2fca4...3683004. Read the comment docs.

@fredbi fredbi marked this pull request as ready for review January 13, 2020 13:27
@fredbi fredbi force-pushed the refactor-spec-loading branch 6 times, most recently from f7d004c to 956de91 Compare January 16, 2020 09:49
NO BEHAVIOR CHANGE EXPECTED

* removed some (most) redundant code (left redundancies that would introduce change in behavior to forthcoming PRs)
* factorized spec loading/validating/flattening operations (new spec.go file)
* regrouped state init() function calls
* reduced the number of global vars and replaced them by functions
* adapted template repo to initialize from language options, with adequate template FuncMap
* made DefaultLanguage a configurable function
* moved global golang-specific function to LangueOpts (new language.go file)
* testability: functionalized a number of hard to test code (e.g. all funcmap entries), and introduced unit testing

* started, but did not complete yet the rewriting of unit tests using 'require' instead of nested constructs with 'assert'

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>

Fixed tests on windows

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi fredbi merged commit 68f0951 into go-swagger:master Jan 26, 2020
@fredbi fredbi deleted the refactor-spec-loading branch January 26, 2020 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants