Bnei-Baruch/mdb

View on GitHub

Showing 1,135 of 1,135 total issues

File servers.go has 869 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: Major
Found in importer/kmedia/kmodels/servers.go - About 1 day to fix

    Function compareIdxDir has a Cognitive Complexity of 83 (exceeds 20 allowed). Consider refactoring.
    Open

    func compareIdxDir(
        d *IdxDirectory,
        mdbFiles map[string]*models.File,
        kmFiles map[string]*MiniKMFile,
        cudMap map[int64]int64,
    Severity: Minor
    Found in importer/roza/cu_analysis.go - About 1 day 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

    File content_types.go has 860 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: Major
    Found in importer/kmedia/kmodels/content_types.go - About 1 day to fix

      Method MetadataProcessorSuite.simulateLessonChain has 288 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (suite *MetadataProcessorSuite) simulateLessonChain() map[string]TrimFiles {
          CS_SHA1 := [5]string{}
          DMX_O_SHA1 := [5]string{}
          DMX_P_SHA1 := [5]string{}
          TRM_O_SHA1 := [7]string{}
      Severity: Major
      Found in api/metadata_processor_test.go - About 1 day to fix

        Method MetadataProcessorSuite.simulateSpecialLessonChain has 285 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (suite *MetadataProcessorSuite) simulateSpecialLessonChain() map[string]TrimFiles {
            CS_SHA1 := [2]string{}
            DMX_O_SHA1 := [2]string{}
            DMX_P_SHA1 := [2]string{}
            TRM_O_SHA1 := [13]string{}
        Severity: Major
        Found in api/metadata_processor_test.go - About 1 day to fix

          FileAsset has 70 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type FileAsset struct {
              ID           int         `boil:"id" json:"id" toml:"id" yaml:"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"`
              AssetType    null.String `boil:"asset_type" json:"asset_type,omitempty" toml:"asset_type" yaml:"asset_type,omitempty"`
          Severity: Major
          Found in importer/kmedia/kmodels/file_assets.go - About 1 day to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (containerDescriptionPatternL) LoadCatalogs(e boil.Executor, singular bool, maybeContainerDescriptionPattern interface{}) error {
                var slice []*ContainerDescriptionPattern
                var object *ContainerDescriptionPattern
            
                count := 1
            Severity: Major
            Found in importer/kmedia/kmodels/container_description_patterns.go and 1 other location - About 1 day to fix
            importer/kmedia/kmodels/containers.go on lines 620..697

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 683.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (containerL) LoadCatalogs(e boil.Executor, singular bool, maybeContainer interface{}) error {
                var slice []*Container
                var object *Container
            
                count := 1
            Severity: Major
            Found in importer/kmedia/kmodels/containers.go and 1 other location - About 1 day to fix
            importer/kmedia/kmodels/container_description_patterns.go on lines 228..305

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 683.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function handleInsert has 258 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func handleInsert(exec boil.Executor, input interface{}) (*models.Operation, []events.Event, error) {
                r := input.(InsertRequest)
            
                log.Infof("Lookup file by SHA1")
                file, _, err := FindFileBySHA1(exec, r.File.Sha1)
            Severity: Major
            Found in api/handlers.go - About 1 day to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func loadAndImportMissingArticlesCollections() (map[int]*models.Collection, error) {
              
                  cs, err := models.Collections(
                      qm4.Where("type_id = ?", common.CONTENT_TYPE_REGISTRY.ByName[common.CT_ARTICLES].ID)).
                      All(mdb)
              Severity: Major
              Found in importer/kmedia/articles.go and 1 other location - About 1 day to fix
              importer/kmedia/clips.go on lines 167..234

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 621.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func loadAndImportMissingClipsCollections() (map[int]*models.Collection, error) {
              
                  cs, err := models.Collections(
                      qm4.Where("type_id = ?", common.CONTENT_TYPE_REGISTRY.ByName[common.CT_CLIPS].ID)).
                      All(mdb)
              Severity: Major
              Found in importer/kmedia/clips.go and 1 other location - About 1 day to fix
              importer/kmedia/articles.go on lines 89..156

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 621.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              File file_asset_descriptions.go has 796 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: Major
              Found in importer/kmedia/kmodels/file_asset_descriptions.go - About 1 day to fix

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                func (o *Language) Insert(exec boil.Executor, whitelist ...string) error {
                    if o == nil {
                        return errors.New("kmodels: no languages provided for insertion")
                    }
                
                
                Severity: Major
                Found in importer/kmedia/kmodels/languages.go and 4 other locations - About 1 day to fix
                importer/kmedia/kmodels/content_types.go on lines 590..663
                importer/kmedia/kmodels/file_types.go on lines 274..347
                importer/kmedia/kmodels/roles_users.go on lines 434..507
                importer/kmedia/kmodels/servers.go on lines 599..672

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 610.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                func (o *Server) Insert(exec boil.Executor, whitelist ...string) error {
                    if o == nil {
                        return errors.New("kmodels: no servers provided for insertion")
                    }
                
                
                Severity: Major
                Found in importer/kmedia/kmodels/servers.go and 4 other locations - About 1 day to fix
                importer/kmedia/kmodels/content_types.go on lines 590..663
                importer/kmedia/kmodels/file_types.go on lines 274..347
                importer/kmedia/kmodels/languages.go on lines 1529..1602
                importer/kmedia/kmodels/roles_users.go on lines 434..507

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 610.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                func (o *RolesUser) Insert(exec boil.Executor, whitelist ...string) error {
                    if o == nil {
                        return errors.New("kmodels: no roles_users provided for insertion")
                    }
                
                
                Severity: Major
                Found in importer/kmedia/kmodels/roles_users.go and 4 other locations - About 1 day to fix
                importer/kmedia/kmodels/content_types.go on lines 590..663
                importer/kmedia/kmodels/file_types.go on lines 274..347
                importer/kmedia/kmodels/languages.go on lines 1529..1602
                importer/kmedia/kmodels/servers.go on lines 599..672

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 610.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                func (o *ContentType) Insert(exec boil.Executor, whitelist ...string) error {
                    if o == nil {
                        return errors.New("kmodels: no content_types provided for insertion")
                    }
                
                
                Severity: Major
                Found in importer/kmedia/kmodels/content_types.go and 4 other locations - About 1 day to fix
                importer/kmedia/kmodels/file_types.go on lines 274..347
                importer/kmedia/kmodels/languages.go on lines 1529..1602
                importer/kmedia/kmodels/roles_users.go on lines 434..507
                importer/kmedia/kmodels/servers.go on lines 599..672

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 610.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                func (o *FileType) Insert(exec boil.Executor, whitelist ...string) error {
                    if o == nil {
                        return errors.New("kmodels: no file_types provided for insertion")
                    }
                
                
                Severity: Major
                Found in importer/kmedia/kmodels/file_types.go and 4 other locations - About 1 day to fix
                importer/kmedia/kmodels/content_types.go on lines 590..663
                importer/kmedia/kmodels/languages.go on lines 1529..1602
                importer/kmedia/kmodels/roles_users.go on lines 434..507
                importer/kmedia/kmodels/servers.go on lines 599..672

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 610.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                func (suite *RestSuite) TestCollectionsList() {
                    cp := new(DummyAuthProvider)
                
                    req := CollectionsRequest{
                        ListRequest: ListRequest{StartIndex: 1, StopIndex: 5},
                Severity: Major
                Found in api/rest_test.go and 1 other location - About 1 day to fix
                api/rest_test.go on lines 134..194

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 602.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                func (suite *RestSuite) TestContentUnitsList() {
                    cp := new(DummyAuthProvider)
                    req := ContentUnitsRequest{
                        ListRequest: ListRequest{StartIndex: 1, StopIndex: 5},
                    }
                Severity: Major
                Found in api/rest_test.go and 1 other location - About 1 day to fix
                api/rest_test.go on lines 55..116

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 602.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                File roles_users.go has 764 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: Major
                Found in importer/kmedia/kmodels/roles_users.go - About 1 day to fix
                  Severity
                  Category
                  Status
                  Source
                  Language