Bnei-Baruch/mdb

View on GitHub

Showing 704 of 1,135 total issues

File file_types.go has 648 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Code generated by SQLBoiler (https://github.com/volatiletech/sqlboiler). DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.

package kmodels

Severity: Minor
Found in importer/kmedia/kmodels/file_types.go - About 5 hrs to fix

    Function getImportSettings has 160 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func getImportSettings(idx int) *ImportSettings {
        i := idx
        if idx > 395 {
            i--
        }
    Severity: Major
    Found in importer/kmedia/custom.go - About 5 hrs to fix

      Method HandlersSuite.TestHandleConvert has 158 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (suite *HandlersSuite) TestHandleConvert() {
          // Create dummy input file
          fi := File{
              FileName:  "dummy input file",
              CreatedAt: &Timestamp{time.Now()},
      Severity: Major
      Found in api/handlers_test.go - About 5 hrs to fix

        Function importContainer has 156 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func importContainer(exec boil.Executor,
            container *kmodels.Container,
            collection *models.Collection,
            contentType string,
            ccuName string,
        Severity: Major
        Found in importer/kmedia/common.go - About 5 hrs to fix

          Function doEventsSubcollections has 150 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func doEventsSubcollections(cIDs []int64) error {
              for _, cID := range cIDs {
          
                  c, err := models.Collections(
                      qm.Where("id=?", cID),
          Severity: Major
          Found in batch/events_subcollections.go - About 5 hrs to fix

            Method MetadataProcessorSuite.TestEventPartLesson has 145 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (suite *MetadataProcessorSuite) TestEventPartLesson() {
                chain := suite.simulateLessonChain()
            
                eventType := common.CT_CONGRESS
                eventCollection, err := CreateCollection(suite.tx, eventType, nil)
            Severity: Major
            Found in api/metadata_processor_test.go - About 4 hrs to fix

              ContainerDescription has 36 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type ContainerDescription struct {
                  ID            int         `boil:"id" json:"id" toml:"id" yaml:"id"`
                  ContainerID   int         `boil:"container_id" json:"container_id" toml:"container_id" yaml:"container_id"`
                  ContainerDesc null.String `boil:"container_desc" json:"container_desc,omitempty" toml:"container_desc" yaml:"container_desc,omitempty"`
                  LangID        null.String `boil:"lang_id" json:"lang_id,omitempty" toml:"lang_id" yaml:"lang_id,omitempty"`
              Severity: Minor
              Found in importer/kmedia/kmodels/container_descriptions.go - About 4 hrs to fix

                CatalogDescription has 36 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type CatalogDescription struct {
                    ID        int         `boil:"id" json:"id" toml:"id" yaml:"id"`
                    CatalogID int         `boil:"catalog_id" json:"catalog_id" toml:"catalog_id" yaml:"catalog_id"`
                    Name      null.String `boil:"name" json:"name,omitempty" toml:"name" yaml:"name,omitempty"`
                    LangID    null.String `boil:"lang_id" json:"lang_id,omitempty" toml:"lang_id" yaml:"lang_id,omitempty"`
                Severity: Minor
                Found in importer/kmedia/kmodels/catalog_descriptions.go - About 4 hrs to fix

                  Function fixUnitMappings has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func fixUnitMappings(mappings []*FileMappings) error {
                      unitMap := make(map[int]map[int64]bool, stats.ContainersProcessed.Get())
                      for _, fm := range mappings {
                          cm, ok := unitMap[fm.KMediaContainerID]
                          if !ok {
                  Severity: Minor
                  Found in importer/kmedia/unit_mappings.go - About 4 hrs to fix

                  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 importClipsContainers has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func importClipsContainers(csMap map[int]*models.Collection) error {
                      cnMap, cuMap, err := loadContainersByTypeAndCUs(2)
                      if err != nil {
                          return errors.Wrap(err, "Load containers")
                      }
                  Severity: Minor
                  Found in importer/kmedia/clips.go - About 4 hrs to fix

                  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

                  ContentType has 34 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type ContentType struct {
                      ID      int         `boil:"id" json:"id" toml:"id" yaml:"id"`
                      Name    null.String `boil:"name" json:"name,omitempty" toml:"name" yaml:"name,omitempty"`
                      Pattern null.String `boil:"pattern" json:"pattern,omitempty" toml:"pattern" yaml:"pattern,omitempty"`
                      Secure  null.Int    `boil:"secure" json:"secure,omitempty" toml:"secure" yaml:"secure,omitempty"`
                  Severity: Minor
                  Found in importer/kmedia/kmodels/content_types.go - About 4 hrs to fix

                    Label has 34 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    type Label struct {
                        ID           int         `boil:"id" json:"id" toml:"id" yaml:"id"`
                        DictionaryID null.Int    `boil:"dictionary_id" json:"dictionary_id,omitempty" toml:"dictionary_id" yaml:"dictionary_id,omitempty"`
                        Suid         null.String `boil:"suid" json:"suid,omitempty" toml:"suid" yaml:"suid,omitempty"`
                        CreatedAt    time.Time   `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
                    Severity: Minor
                    Found in importer/kmedia/kmodels/labels.go - About 4 hrs to fix

                      ContainerDescriptionPattern has 34 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      type ContainerDescriptionPattern struct {
                          ID          int         `boil:"id" json:"id" toml:"id" yaml:"id"`
                          Pattern     null.String `boil:"pattern" json:"pattern,omitempty" toml:"pattern" yaml:"pattern,omitempty"`
                          Description null.String `boil:"description" json:"description,omitempty" toml:"description" yaml:"description,omitempty"`
                          Lang        null.String `boil:"lang" json:"lang,omitempty" toml:"lang" yaml:"lang,omitempty"`
                      Severity: Minor
                      Found in importer/kmedia/kmodels/container_description_patterns.go - About 4 hrs to fix

                        Server has 34 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type Server struct {
                            Servername string      `boil:"servername" json:"servername" toml:"servername" yaml:"servername"`
                            Httpurl    null.String `boil:"httpurl" json:"httpurl,omitempty" toml:"httpurl" yaml:"httpurl,omitempty"`
                            Created    null.Time   `boil:"created" json:"created,omitempty" toml:"created" yaml:"created,omitempty"`
                            Updated    null.Time   `boil:"updated" json:"updated,omitempty" toml:"updated" yaml:"updated,omitempty"`
                        Severity: Minor
                        Found in importer/kmedia/kmodels/servers.go - About 4 hrs to fix

                          VirtualLesson has 34 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          type VirtualLesson struct {
                              ID        int       `boil:"id" json:"id" toml:"id" yaml:"id"`
                              FilmDate  null.Time `boil:"film_date" json:"film_date,omitempty" toml:"film_date" yaml:"film_date,omitempty"`
                              CreatedAt time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
                              UpdatedAt time.Time `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`
                          Severity: Minor
                          Found in importer/kmedia/kmodels/virtual_lessons.go - About 4 hrs to fix

                            Function missingContainers has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func missingContainers() (map[string][]*kmodels.Container, error) {
                                cuMap := make(map[int]bool)
                            
                                log.Info("Loading all content units with kmedia_id")
                                units, err := models.ContentUnits(
                            Severity: Minor
                            Found in importer/kmedia/compare.go - About 4 hrs to fix

                            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 importMissingContainers has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func importMissingContainers(missing map[string][]*kmodels.Container) error {
                            
                                // clips
                                cns := missing["2"]
                                for i := range cns {
                            Severity: Minor
                            Found in importer/kmedia/compare.go - About 4 hrs to fix

                            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 importVLsContainers has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func importVLsContainers(csMap map[int]*models.Collection) error {
                                cnMap, cuMap, err := loadContainersInCatalogsAndCUs(8154)
                                if err != nil {
                                    return errors.Wrap(err, "Load containers")
                                }
                            Severity: Minor
                            Found in importer/kmedia/vls.go - About 4 hrs to fix

                            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 compareCollection has 127 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func compareCollection(c *models.Collection) error {
                                var props map[string]interface{}
                                if err := json.Unmarshal(c.Properties.JSON, &props); err != nil {
                                    return errors.Wrap(err, "json.Unmarshal properties")
                                }
                            Severity: Major
                            Found in importer/kmedia/compare.go - About 4 hrs to fix

                              Method MetadataProcessorSuite.TestDoubleTrimFromOneStart has 124 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (suite *MetadataProcessorSuite) TestDoubleTrimFromOneStart() {
                                  CS_SHA1 := utils.RandomSHA1()
                                  DMX_SHA1 := utils.RandomSHA1()
                                  TRM_1_SHA1 := utils.RandomSHA1()
                                  TRM_2_SHA1 := utils.RandomSHA1()
                              Severity: Major
                              Found in api/metadata_processor_test.go - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language