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
- 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 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) {
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()) {
- 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 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)
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")
}
- 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 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)
- 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
MetadataProcessorSuite
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
type MetadataProcessorSuite struct {
suite.Suite
utils.TestDBManager
tx boil.Transactor
}
File models.go
has 561 lines of code (exceeds 500 allowed). Consider refactoring. Open
package api
import (
"encoding/hex"
"fmt"
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
}
- 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 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")
}
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)
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
}
- 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 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)
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,
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")
}
- 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 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)
- 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 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 {
- 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 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)
- 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 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 {
- 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 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
- 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"