ashleygwilliams/ashleygwilliams.github.io

View on GitHub

Showing 4 of 21 total issues

Function seed has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.seed = function(knex, Promise) {
    return Promise.join(
        // Deletes ALL existing entries
        knex('presentations').del(), 

Severity: Major
Found in seeds/presentations.js - About 2 hrs to fix

    Function seed has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.seed = function(knex, Promise) {
        return Promise.join(
            // Deletes ALL existing entries
            knex('community').del(), 
    
    
    Severity: Minor
    Found in seeds/community.js - About 2 hrs to fix

      Function up has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.up = function (knex) {
        return knex.schema.
          createTable('users', function(t){
            t.increments('id');
            t.text('name').notNullable().unique();
      Severity: Minor
      Found in migrations/portfolio.js - About 1 hr to fix

        Function makeReq has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        var makeReq = function(e) {  
          
          if (e) {
            e.preventDefault();  
          }
        Severity: Minor
        Found in public/js/api-browser.js - About 35 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