Showing 207 of 546 total issues
Function runVMware
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func runVMware(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name, diskOutput string) error {
if !vmware.Allocator.IsAvailable() {
return errors.New("vmware is not installed on your system")
}
Function runVirtualBox
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func runVirtualBox(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name, diskOutput string) error {
if !virtualbox.Allocator.IsAvailable() {
return errors.New("virtualbox not found installed on system")
}
// Create base folder to store virtualbox vms so the socket can be grouped
Method compiler.buildBitmap
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *compiler) buildBitmap() {
c.allocGroupFreeBlocks = make([]int64, c.allocGroups)
c.allocGroupFreeInodes = make([]int64, c.allocGroups)
for i := int64(0); i < c.allocGroups; i++ {
Function runQEMU
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func runQEMU(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name string, diskOutput string) error {
if !qemu.Allocator.IsAvailable() {
return errors.New("qemu not installed on system")
}
Function InitializeCommands
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func InitializeCommands() {
// Here we attack VCFG modification flags to relevant commands. Because of
// the order Go runs init functions this is the safest place to do this.
addModifyFlags(buildCmd.Flags())
Method CLIRemoteManager.updateList
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (mgr *CLIRemoteManager) updateList(ctx context.Context) (List, error) {
var list List
list = mgr.cache
// request remote manifest
Function copyImageFileFromVPartition
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
Open
func copyImageFileFromVPartition(vorteilImage *vdecompiler.IO, imageFilePath string, destFilePath string) error {
var err error
var r io.Reader
var f *os.File
if imageFilePath != "" && imageFilePath != "/" && imageFilePath != "." {
- 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 importSharedObjectsOperation.loadLDPathsFromLinkerConfig
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
Open
func (isoOp *importSharedObjectsOperation) loadLDPathsFromLinkerConfig(path string) error {
if strings.Contains(path, "*") {
return nil
}
data, err := ioutil.ReadFile(path)
- 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
Function generateHashDirectoryData
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func generateHashDirectoryData(node *node) []byte {
n := node.node
entries := make(hashDirEntriesMetdata, len(n.Children))
for i, child := range n.Children {
Method super.init
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (s *super) init(totalBlocks, inodesPerGroup int64, nodes *[]node) {
s.timestamp = time.Now()
s.layout.inodesPerGroup = inodesPerGroup
s.layout.totalBlocks = totalBlocks
s.layout.totalGroupDescriptors = totalGroupsAllowingForGrowth(divide(totalBlocks, BlocksPerGroup))
Function LookForIP
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func LookForIP(l *logger.Logger, routes []virtualizers.NetworkInterface) []virtualizers.NetworkInterface {
sub := l.Subscribe()
inbox := sub.Inbox()
var msg string
Function main
has 12 return statements (exceeds 4 allowed). Open
Open
func main() {
defer cli.HandleErrors()
// Init FOSS COMMANDS
Function LazyOpen
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func LazyOpen(path string) (File, error) {
fi, err := os.Lstat(path)
if err != nil {
return nil, err
Method Virtualizer.Start
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (v *Virtualizer) Start() error {
v.logger.Debugf("Starting VM")
v.command = exec.Command(v.command.Args[0], v.command.Args[1:]...)
v.command.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
Method DynamicWriter.Seek
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (w *DynamicWriter) Seek(offset int64, whence int) (int64, error) {
var abs int64
switch whence {
case io.SeekStart:
Function runFirecracker
has 11 return statements (exceeds 4 allowed). Open
Open
func runFirecracker(pkgReader vpkg.Reader, cfg *vcfg.VCFG, name, diskOutput string) error {
var err error
if runtime.GOOS != "linux" {
return errors.New("firecracker is only available on linux")
}
Method StreamOptimizedWriter.flushGrain
has 11 return statements (exceeds 4 allowed). Open
Open
func (w *StreamOptimizedWriter) flushGrain() error {
var err error
defer func() {
w.grainNo++
w.cursor = w.grainNo * GrainSize
Method CalVer.Less
has 11 return statements (exceeds 4 allowed). Open
Open
func (v CalVer) Less(version CalVer) bool {
if v.Major() < version.Major() {
return true
}
Method CLIRemoteManager.Get
has 11 return statements (exceeds 4 allowed). Open
Open
func (mgr *CLIRemoteManager) Get(ctx context.Context, version CalVer) (*ManagedBundle, error) {
list, err := mgr.List(ctx)
if err != nil {
return nil, err
Method RemoteManager.remoteList
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (mgr *RemoteManager) remoteList(ctx context.Context) (List, error) {
var list List
// request remote manifest