Bnei-Baruch/mdb

View on GitHub

Showing 704 of 1,135 total issues

Function importFileAsset has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
Open

func importFileAsset(exec boil.Executor, fileAsset *kmodels.FileAsset, unit *models.ContentUnit,
    operation *models.Operation) (*models.File, error) {

    // Get or Create MDB file by SHA1
    var hash string
Severity: Minor
Found in importer/kmedia/common.go - About 3 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 init has 121 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func init() {
    command := &cobra.Command{
        Use:   "kmedia-lessons",
        Short: "Import kmedia VirtualLessons to MDB",
        Run: func(cmd *cobra.Command, args []string) {
Severity: Major
Found in cmd/kmedia.go - About 3 hrs to fix

    Method Hebcal.Load has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
    Open

    func (h *Hebcal) Load() error {
        allItems := make([]HebcalItems, 0)
        re := regexp.MustCompile("^hebcal_\\d{4}\\.json$")
        err := filepath.Walk("hebcal/data", func(path string, info os.FileInfo, err error) error {
            if re.MatchString(info.Name()) {
    Severity: Minor
    Found in hebcal/hebcal.go - About 3 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 doProcess has 43 return statements (exceeds 4 allowed).
    Open

    func doProcess(exec boil.Executor, metadata CITMetadata, original, proxy, source *models.File, cu *models.ContentUnit) ([]events.Event, error) {
        isUpdate := cu != nil
        log.Infof("Processing CITMetadata, isUpdate: %t", isUpdate)
    
        // Update properties for original and proxy (film_date, capture_date)
    Severity: Major
    Found in api/metadata_processor.go - About 3 hrs to fix

      Function compareWithMDB has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
      Open

      func compareWithMDB(ffpData map[string]*FFPData) error {
          fCount, err := models.Files().Count(mdb)
          if err != nil {
              return errors.Wrapf(err, "Load files count")
          }
      Severity: Minor
      Found in importer/ffprobe/analyze.go - About 3 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 worker has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
      Open

      func worker(jobs <-chan *kmodels.VirtualLesson, wg *sync.WaitGroup) {
          for vl := range jobs {
              log.Infof("Processing virtual_lesson %d", vl.ID)
              stats.LessonsProcessed.Inc(1)
      
      
      Severity: Minor
      Found in importer/kmedia/virtual_lessons.go - About 3 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

      MetadataProcessorSuite has 29 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type MetadataProcessorSuite struct {
          suite.Suite
          utils.TestDBManager
          tx boil.Transactor
      }
      Severity: Minor
      Found in api/metadata_processor_test.go - About 3 hrs to fix

        File models.go has 561 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package api
        
        import (
            "encoding/hex"
            "fmt"
        Severity: Minor
        Found in api/models.go - About 3 hrs to fix

          Function makeNodeRelativeLinks has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
          Open

          func makeNodeRelativeLinks(node *html.Node) {
              if node.DataAtom != atom.A {
                  return
              }
          
          
          Severity: Minor
          Found in importer/blog/import.go - About 3 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 handleTopics has 110 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func handleTopics(db *sql.DB) error {
              records, err := utils.ReadCSV(TAGS_FILE)
              if err != nil {
                  return errors.Wrap(err, "Read topics")
              }
          Severity: Major
          Found in importer/tags/tags.go - About 3 hrs to fix

            Function doAnalyze has 107 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func doAnalyze() error {
                cssClasses := make(map[string]int64)
                linkHosts := make(map[string]int64)
                tagCounts := make(map[string]int64)
                titleGroups := make(map[string][]string)
            Severity: Major
            Found in importer/blog/analyze.go - About 3 hrs to fix

              Function SourcesHierarchyHandler has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
              Open

              func SourcesHierarchyHandler(c *gin.Context) {
                  var r SourcesHierarchyRequest
                  if c.Bind(&r) != nil {
                      return
                  }
              Severity: Minor
              Found in api/hierarchy.go - About 3 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 doImportAlert has 104 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func doImportAlert(cu *CUAnalysis, clipsCollection *models.Collection) error {
                  // group clip files by name stripped from language and extension
                  fileGroups := make(map[string][]*models.File)
                  for i := range cu.clipFiles {
                      k := importer.NormalizedFileName(cu.clipFiles[i].Name)
              Severity: Major
              Found in importer/cleanup/analyze.go - About 3 hrs to fix

                Function compareIdxDir has 104 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func compareIdxDir(
                    d *IdxDirectory,
                    mdbFiles map[string]*models.File,
                    kmFiles map[string]*MiniKMFile,
                    cudMap map[int64]int64,
                Severity: Major
                Found in importer/roza/cu_analysis.go - About 3 hrs to fix

                  Function importNewCongresses has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func importNewCongresses(congresses map[int]*Congress) error {
                      tx, err := mdb.Begin()
                      if err != nil {
                          return errors.Wrap(err, "Start transaction")
                      }
                  Severity: Minor
                  Found in importer/kmedia/congresses.go - About 3 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 doImportAlert has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func doImportAlert(cu *CUAnalysis, clipsCollection *models.Collection) error {
                      // group clip files by name stripped from language and extension
                      fileGroups := make(map[string][]*models.File)
                      for i := range cu.clipFiles {
                          k := importer.NormalizedFileName(cu.clipFiles[i].Name)
                  Severity: Minor
                  Found in importer/cleanup/analyze.go - About 3 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 lessonReconciler has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func lessonReconciler(jobs <-chan *kmodels.Container, wg *sync.WaitGroup) {
                      containers := make([]*kmodels.Container, 0)
                  
                      skipped := 0
                      for cn := range jobs {
                  Severity: Minor
                  Found in importer/kmedia/mixed_lessons.go - About 3 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 fileMappingsWorker has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func fileMappingsWorker(jobs <-chan *kmodels.Container, results chan []*FileMappings, wg *sync.WaitGroup) {
                      for container := range jobs {
                          stats.ContainersProcessed.Inc(1)
                  
                          err := container.L.LoadFileAssets(kmdb, true, container)
                  Severity: Minor
                  Found in importer/kmedia/unit_mappings.go - About 3 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 doImportTitles has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func doImportTitles(path string) error {
                      log.Infof("Processing %s", path)
                  
                      xlFile, err := excelize.OpenFile(path)
                      if err != nil {
                  Severity: Minor
                  Found in importer/kabcoil/titles.go - About 3 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 FileLeftUnitImpact has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func FileLeftUnitImpact(exec boil.Executor, fileIsPublished bool, cuID int64) (*PublishedChangeImpact, error) {
                      impact := new(PublishedChangeImpact)
                  
                      if !fileIsPublished {
                          return impact, nil
                  Severity: Minor
                  Found in api/repo.go - About 3 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

                  Severity
                  Category
                  Status
                  Source
                  Language