gregoryv/draw

View on GitHub

Showing 8 of 22 total issues

Function NewProjectArticle has 141 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func NewProjectArticle() *Element {
    nav := Nav(H4("Table of contents"))
    article := Article(
        H1("Draw - programming software design diagrams"),

Severity: Major
Found in docs/package.go - About 4 hrs to fix

    Method SequenceDiagram.WriteSVG has 104 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (d *SequenceDiagram) WriteSVG(w io.Writer) error {
        var (
            colWidth = d.ColWidth
    
            top = d.top()
    Severity: Major
    Found in design/seqdia.go - About 3 hrs to fix

      Function Theme has 68 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func Theme() *CSS {
          css := NewCSS()
          css.Import("https://fonts.googleapis.com/css2?family=Inconsolata&family=Source+Sans+Pro&family=Source+Serif+Pro:wght@600")
          css.Import("https://fonts.googleapis.com/css2?family=Inconsolata&family=Lancelot&family=Open+Sans")
          css.Style("html, body",
      Severity: Minor
      Found in docs/theme.go - About 1 hr to fix

        Method ClassDiagram.HideRealizations has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
        Open

        func (d *ClassDiagram) HideRealizations() {
            for _, struct_ := range d.structs {
                for _, iface := range d.interfaces {
                    if reflect.PtrTo(struct_.t).Implements(iface.t) {
                        // Hide interface methods as they are visible
        Severity: Minor
        Found in design/classdia.go - About 1 hr 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 ExampleDiagram has 51 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func ExampleDiagram() *design.Diagram {
            var (
                record     = shape.NewRecord("Record")
                x, y       = 130, 80
                q1arrow    = shape.NewArrow(x, y, x+50, y-10)
        Severity: Minor
        Found in docs/example_diagrams.go - About 1 hr to fix

          Method GanttChart.addHeader has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
          Open

          func (d *GanttChart) addHeader() []*shape.Label {
              now := d.start
              year := shape.NewLabel(fmt.Sprintf("%v", now.Year()))
              d.Diagram.Place(year).At(d.padLeft, d.padTop)
              offset := d.padLeft + d.taskWidth()
          Severity: Minor
          Found in design/ganttchart.go - About 55 mins 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

          Method Line.angle has 5 return statements (exceeds 4 allowed).
          Open

          func (a *Line) angle() int {
              var (
                  start = a.Start
                  end   = a.End
                  // straight arrows
          Severity: Major
          Found in shape/line.go - About 35 mins to fix

            Method GanttChart.WriteSVG has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
            Open

            func (d *GanttChart) WriteSVG(w io.Writer) error {
                columns := d.addHeader()
                bars := make([]*shape.Rect, len(d.tasks))
                start := d.padLeft + d.taskWidth()
                lineHeight := d.Diagram.Font.LineHeight
            Severity: Minor
            Found in design/ganttchart.go - About 25 mins 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