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:
parent
bb7531d95c
commit
d920589507
@ -5,3 +5,16 @@ linters:
|
|||||||
enable:
|
enable:
|
||||||
- gofmt
|
- gofmt
|
||||||
- misspell
|
- 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
|
||||||
|
|||||||
@ -3,11 +3,12 @@ package config
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/alcionai/corso/cli/utils"
|
"github.com/alcionai/corso/cli/utils"
|
||||||
"github.com/alcionai/corso/pkg/account"
|
"github.com/alcionai/corso/pkg/account"
|
||||||
"github.com/alcionai/corso/pkg/credentials"
|
"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.
|
// prerequisite: readRepoConfig must have been run prior to this to populate the global viper values.
|
||||||
|
|||||||
@ -3,11 +3,12 @@ package config
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/alcionai/corso/cli/utils"
|
"github.com/alcionai/corso/cli/utils"
|
||||||
"github.com/alcionai/corso/pkg/credentials"
|
"github.com/alcionai/corso/pkg/credentials"
|
||||||
"github.com/alcionai/corso/pkg/storage"
|
"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.
|
// prerequisite: readRepoConfig must have been run prior to this to populate the global viper values.
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
package options
|
package options
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/alcionai/corso/pkg/control"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/pkg/control"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@ -5,11 +5,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/alcionai/corso/pkg/backup"
|
|
||||||
"github.com/alcionai/corso/pkg/backup/details"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/tidwall/pretty"
|
"github.com/tidwall/pretty"
|
||||||
"github.com/tomlazar/table"
|
"github.com/tomlazar/table"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/pkg/backup"
|
||||||
|
"github.com/alcionai/corso/pkg/backup/details"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@ -3,8 +3,9 @@ package exchange
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alcionai/corso/pkg/backup/details"
|
|
||||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/pkg/backup/details"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MessageInfo(msg models.Messageable) *details.ExchangeInfo {
|
func MessageInfo(msg models.Messageable) *details.ExchangeInfo {
|
||||||
|
|||||||
@ -4,9 +4,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alcionai/corso/pkg/backup/details"
|
|
||||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/pkg/backup/details"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MessageSuite struct {
|
type MessageSuite struct {
|
||||||
|
|||||||
@ -5,9 +5,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
kw "github.com/microsoft/kiota-serialization-json-go"
|
kw "github.com/microsoft/kiota-serialization-json-go"
|
||||||
"github.com/pkg/errors"
|
|
||||||
|
|
||||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var eventResponsableFields = []string{"responseType"}
|
var eventResponsableFields = []string{"responseType"}
|
||||||
|
|||||||
@ -3,9 +3,10 @@ package model_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alcionai/corso/internal/model"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/internal/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModelUnitSuite struct {
|
type ModelUnitSuite struct {
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package tester
|
package tester
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/alcionai/corso/pkg/account"
|
"github.com/alcionai/corso/pkg/account"
|
||||||
"github.com/alcionai/corso/pkg/credentials"
|
"github.com/alcionai/corso/pkg/credentials"
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var M365AcctCredEnvs = []string{
|
var M365AcctCredEnvs = []string{
|
||||||
|
|||||||
@ -5,9 +5,10 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/alcionai/corso/pkg/account"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/pkg/account"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@ -3,9 +3,10 @@ package tester
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/alcionai/corso/pkg/credentials"
|
"github.com/alcionai/corso/pkg/credentials"
|
||||||
"github.com/alcionai/corso/pkg/storage"
|
"github.com/alcionai/corso/pkg/storage"
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var AWSStorageCredEnvs = []string{
|
var AWSStorageCredEnvs = []string{
|
||||||
|
|||||||
@ -3,9 +3,10 @@ package filters_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alcionai/corso/pkg/filters"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/pkg/filters"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FiltersSuite struct {
|
type FiltersSuite struct {
|
||||||
|
|||||||
@ -4,11 +4,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alcionai/corso/internal/common"
|
|
||||||
"github.com/alcionai/corso/pkg/backup/details"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/internal/common"
|
||||||
|
"github.com/alcionai/corso/pkg/backup/details"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ExchangeSourceSuite struct {
|
type ExchangeSourceSuite struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user