Showing 207 of 546 total issues
Method Provisioner.init
has 6 return statements (exceeds 4 allowed). Open
Open
func (p *Provisioner) init() error {
var (
err error
oauthToken *jwt.Config
Function handleFile
has 6 return statements (exceeds 4 allowed). Open
Open
func handleFile(args *handleFileArgs) (*tar.Header, error) {
header, err := tar.FileInfoHeader(vio.Info(args.f), args.link)
if err != nil {
return nil, err
Function TarFromPackage
has 6 return statements (exceeds 4 allowed). Open
Open
func TarFromPackage(w io.Writer, pkg vpkg.Reader) error {
// Create tar writer
tw := tar.NewWriter(w)
defer tw.Close()
Function getRestoreAsset
has 6 return statements (exceeds 4 allowed). Open
Open
func getRestoreAsset(dir, name string) error {
data, err := getAsset(name)
if err != nil {
return err
}
Method Provisioner.Validate
has 6 return statements (exceeds 4 allowed). Open
Open
func (p *Provisioner) Validate() error {
loginURL, err := url.Parse(p.cfg.Address + "/sdk")
if err != nil {
return err
}
Function NewBundle
has 6 return statements (exceeds 4 allowed). Open
Open
func NewBundle(rs io.ReadSeeker) (*Bundle, error) {
var err error
var gz *gzip.Reader
var tr *tar.Reader
Method Provisioner.init
has 6 return statements (exceeds 4 allowed). Open
Open
func (p *Provisioner) init() error {
ctx := context.Background()
// TODO test connection
loginURL, err := url.Parse(p.cfg.Address + "/sdk")
Function handleIcon
has 6 return statements (exceeds 4 allowed). Open
Open
func handleIcon(iconName string, ico vio.File, tw *tar.Writer, iconFile *os.File) error {
if ico.Size() == 0 {
return nil
}
_, err := iconFile.Seek(0, 0)
Function Parse
has 6 return statements (exceeds 4 allowed). Open
Open
func Parse(s string) (CalVer, error) {
k := strings.Count(s, ".")
if k < 1 || k > 2 {
return CalVer(""), ErrInvalidCalVer
Function createArgs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func createArgs(cpus uint, memory int, headless bool, diskpath string, diskformat string) string {
Method Format.Build
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (x *Format) Build(ctx context.Context, log elog.View, w io.WriteSeeker, b *vimg.Builder, cfg *vcfg.VCFG) error {
Function RegisterNewDiskFormat
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func RegisterNewDiskFormat(format Format, extention string, alignment int64, mtu uint, builderFunc BuildWriterInstantiator) error {
Function Create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func Create(mgr *virtualizers.Manager, name string, headless bool, ntype string, ndevice string) error {
Function DUImageFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func DUImageFile(vorteilImage *vdecompiler.IO, imageFilePath string, calcFreeSpace bool, maxDepth int, all bool) (DUImageReport, error) {
Function findBinary
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func findBinary(name string, env []string, cwd string, targetDir string, log elog.View) (string, error) {
Method IO.exploreExtentsTree
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (iio *IO) exploreExtentsTree(hdr *ext4ExtentHeader, blockSize int64, data []byte, blockAddrs *[]int, c *int) error {
Function walkFilesystem
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func walkFilesystem(pkg vpkg.Reader, files []string, tw *tar.Writer, vprjIncluded bool, vprj ProjectData) error {
Method ContainerConverter.createVCFG
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func (cc *ContainerConverter) createVCFG(config v1.Config, targetDir string) error {
if _, err := os.Stat(targetDir); err != nil {
return fmt.Errorf("directory %s does not exist", targetDir)
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ContainerConverter.downloadInformationContainerd
has 5 return statements (exceeds 4 allowed). Open
Open
func (cc *ContainerConverter) downloadInformationContainerd(image, tag string) error {
cc.logger.Infof("getting local containerd image %s (%s)", image, tag)
if len(image) == 0 || len(tag) == 0 {
Method Compiler.setPrecompileConstants
has 5 return statements (exceeds 4 allowed). Open
Open
func (c *Compiler) setPrecompileConstants(size, minDataBlocks, minInodes, minInodesPer64 int64) error {
c.size = size
blocks := c.size / BlockSize
groups := divide(blocks, BlocksPerGroup)