incu6us / goimports-reviser

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

Implement custom order for import groups. #66

Closed walkline closed 2 years ago

walkline commented 2 years ago

These changes allow customizing the order of import groups.

Now there is an optional argument - groups-order, which has default order as the value (at first std, then external (general), organisation's (local) and project packages).

In my organization, I'm using a little bit different order of imports groups than the default one. The order that I'm interested in:

import (
   // stdlib

   // current project

   // organization's (local)

   // external (general)
)

So with argument --groups-order="std,prj,org,ext", you can get the above order.

codecov[bot] commented 2 years ago

Codecov Report

Merging #66 (267cfd2) into master (0d819d0) will increase coverage by 0.21%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   93.15%   93.37%   +0.21%     
==========================================
  Files           4        5       +1     
  Lines         307      317      +10     
==========================================
+ Hits          286      296      +10     
  Misses         12       12              
  Partials        9        9              
Impacted Files Coverage Δ
pkg/grouporder/group_order.go 100.00% <100.00%> (ø)
reviser/reviser.go 93.80% <100.00%> (-0.37%) :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...267cfd2. Read the comment docs.

spikecdc commented 2 years ago

Would like to know when this pr will be merged and what alternatives are available until then

incu6us commented 2 years ago

Would like to know when this pr will be merged and what alternatives are available until then

I've put some of your changes to this branch https://github.com/incu6us/goimports-reviser/tree/v3. Additionally, I'll add few changes and it will be merged

incu6us commented 2 years ago

use v3.0.0 with group ordering feature