incu6us / goimports-reviser

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

New features: Read from stdin, new -list, -write and -set-exit-status options (2) #67

Closed oncethor closed 2 years ago

oncethor commented 2 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 2 years ago

Codecov Report

Merging #67 (bf5ff2e) into master (0d819d0) will increase coverage by 1.39%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   93.15%   94.55%   +1.39%     
==========================================
  Files           4        4              
  Lines         307      312       +5     
==========================================
+ Hits          286      295       +9     
+ Misses         12       10       -2     
+ Partials        9        7       -2     
Impacted Files Coverage Δ
reviser/reviser.go 95.91% <100.00%> (+1.75%) :arrow_up:

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.