thestrukture/IDE

View on GitHub
api/templates/logger.go

Summary

Maintainability
D
2 days
Test Coverage
F
0%

Function DebugTemplate has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func DebugTemplate(w http.ResponseWriter, r *http.Request, tmpl string) {
    lastline := 0
    linestring := ""
    defer func() {
        if n := recover(); n != nil {
Severity: Minor
Found in api/templates/logger.go - About 5 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 DebugTemplatePath has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
Open

func DebugTemplatePath(tmpl string, intrf interface{}) {
    lastline := 0
    linestring := ""
    defer func() {
        if n := recover(); n != nil {
Severity: Minor
Found in api/templates/logger.go - About 5 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 DebugTemplate has 85 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func DebugTemplate(w http.ResponseWriter, r *http.Request, tmpl string) {
    lastline := 0
    linestring := ""
    defer func() {
        if n := recover(); n != nil {
Severity: Major
Found in api/templates/logger.go - About 2 hrs to fix

    Function DebugTemplatePath has 78 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func DebugTemplatePath(tmpl string, intrf interface{}) {
        lastline := 0
        linestring := ""
        defer func() {
            if n := recover(); n != nil {
    Severity: Major
    Found in api/templates/logger.go - About 2 hrs to fix

      comment on exported function DebugTemplatePath should be of the form "DebugTemplatePath ..."
      Open

      // Gets template string from assets package, and
      Severity: Minor
      Found in api/templates/logger.go by golint

      comment on exported function DebugTemplate should be of the form "DebugTemplate ..."
      Open

      // Scans template string and uses data provided from request
      Severity: Minor
      Found in api/templates/logger.go by golint

      package comment should be of the form "Package templates ..."
      Open

      // File generated by Gopher Sauce
      Severity: Minor
      Found in api/templates/logger.go by golint

      exported var Prod should have comment or be unexported
      Open

      var Prod = true
      Severity: Minor
      Found in api/templates/logger.go by golint

      There are no issues that match your filters.

      Category
      Status