Add linter for import groups and group order (#477)

* Add import order linter

Error messages aren't the most clear/helpful, but they will point you to
the lines that need modifying.

* Adjust max errors reported

* Fix lint errors
This commit is contained in:
ashmrtn 2022-08-03 16:21:38 -07:00 committed by GitHub
parent bb7531d95c
commit d920589507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 42 additions and 18 deletions

View File

@ -5,3 +5,16 @@ linters:
enable:
- gofmt
- misspell
- gci
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/alcionai/corso)
skip-generated: true
issues:
# Limit on number of errors with identical text reported.
max-same-issues: 50

View File

@ -3,11 +3,12 @@ package config
import (
"os"
"github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/alcionai/corso/cli/utils"
"github.com/alcionai/corso/pkg/account"
"github.com/alcionai/corso/pkg/credentials"
"github.com/pkg/errors"
"github.com/spf13/viper"
)
// prerequisite: readRepoConfig must have been run prior to this to populate the global viper values.

View File

@ -3,11 +3,12 @@ package config
import (
"os"
"github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/alcionai/corso/cli/utils"
"github.com/alcionai/corso/pkg/credentials"
"github.com/alcionai/corso/pkg/storage"
"github.com/pkg/errors"
"github.com/spf13/viper"
)
// prerequisite: readRepoConfig must have been run prior to this to populate the global viper values.

View File

@ -1,8 +1,9 @@
package options
import (
"github.com/alcionai/corso/pkg/control"
"github.com/spf13/cobra"
"github.com/alcionai/corso/pkg/control"
)
var (

View File

@ -5,11 +5,12 @@ import (
"fmt"
"io"
"github.com/alcionai/corso/pkg/backup"
"github.com/alcionai/corso/pkg/backup/details"
"github.com/spf13/cobra"
"github.com/tidwall/pretty"
"github.com/tomlazar/table"
"github.com/alcionai/corso/pkg/backup"
"github.com/alcionai/corso/pkg/backup/details"
)
var (

View File

@ -3,8 +3,9 @@ package exchange
import (
"time"
"github.com/alcionai/corso/pkg/backup/details"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/alcionai/corso/pkg/backup/details"
)
func MessageInfo(msg models.Messageable) *details.ExchangeInfo {

View File

@ -4,9 +4,10 @@ import (
"testing"
"time"
"github.com/alcionai/corso/pkg/backup/details"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/pkg/backup/details"
)
type MessageSuite struct {

View File

@ -5,9 +5,8 @@ import (
"strconv"
kw "github.com/microsoft/kiota-serialization-json-go"
"github.com/pkg/errors"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/pkg/errors"
)
var eventResponsableFields = []string{"responseType"}

View File

@ -3,9 +3,10 @@ package model_test
import (
"testing"
"github.com/alcionai/corso/internal/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/internal/model"
)
type ModelUnitSuite struct {

View File

@ -1,9 +1,10 @@
package tester
import (
"github.com/pkg/errors"
"github.com/alcionai/corso/pkg/account"
"github.com/alcionai/corso/pkg/credentials"
"github.com/pkg/errors"
)
var M365AcctCredEnvs = []string{

View File

@ -5,9 +5,10 @@ import (
"path"
"strings"
"github.com/alcionai/corso/pkg/account"
"github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/alcionai/corso/pkg/account"
)
const (

View File

@ -3,9 +3,10 @@ package tester
import (
"testing"
"github.com/pkg/errors"
"github.com/alcionai/corso/pkg/credentials"
"github.com/alcionai/corso/pkg/storage"
"github.com/pkg/errors"
)
var AWSStorageCredEnvs = []string{

View File

@ -3,9 +3,10 @@ package filters_test
import (
"testing"
"github.com/alcionai/corso/pkg/filters"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/pkg/filters"
)
type FiltersSuite struct {

View File

@ -4,11 +4,12 @@ import (
"testing"
"time"
"github.com/alcionai/corso/internal/common"
"github.com/alcionai/corso/pkg/backup/details"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/internal/common"
"github.com/alcionai/corso/pkg/backup/details"
)
type ExchangeSourceSuite struct {