incu6us / goimports-reviser

Right imports sorting & code formatting tool (goimports alternative)
MIT License
600 stars 72 forks source link

New features: Read from stdin, new -list, -write and -set-exit-status options #65

Closed oncethor closed 2 years ago

oncethor commented 3 years ago

In order to make this utility usable as goimports is, added capabilities to:

You can now do things like: $ echo $(git diff --cached --name-only --diff-filter=ACM | grep .go) | \ xargs goimports-reviser -list -output write -file-path

or

$ git --no-pager show :"reviser/reviser.go" | goimports-reviser -list

or define a git alias like this:

goimportsrev = !echo $(git diff --cached --name-only --diff-filter=ACM | grep .go) \ | xargs goimports-reviser -list -output write -file-path \ | xargs git add

In a complex project, even though it does not have the possibility to work on an entire subtree, it can be used with a Makefile to analyse the subtree and stop on the first change needed.

codecov[bot] commented 3 years ago

Codecov Report

Merging #65 (ad570f2) into master (0d819d0) will decrease coverage by 0.85%. The diff coverage is 50.00%.

:exclamation: Current head ad570f2 differs from pull request most recent head bf5ff2e. Consider uploading reports for the commit bf5ff2e to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
- Coverage   93.15%   92.30%   -0.86%     
==========================================
  Files           4        4              
  Lines         307      312       +5     
==========================================
+ Hits          286      288       +2     
- Misses         12       13       +1     
- Partials        9       11       +2     
Impacted Files Coverage Δ
reviser/reviser.go 93.06% <50.00%> (-1.11%) :arrow_down:

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 0d819d0...bf5ff2e. Read the comment docs.

oncethor commented 2 years ago

Superseded by #67