waiterio/api

View on GitHub
common/databaseRepository.js

Summary

Maintainability
A
1 hr
Test Coverage

Function getRepo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports.getRepo = function(db) {
    return {
        addRecord: function(queryOptions, dbData, callback) {
            const preparedOptions = dbHelpers.prepareQueryOptions(queryOptions);
            const dbQuery = `INSERT INTO ${preparedOptions.table} ${dbData.fieldQuery} VALUES ${dbData.valueQuery}`.trim();
Severity: Minor
Found in common/databaseRepository.js - About 1 hr to fix

    Unexpected tab character.
    Open

                db.run(dbQuery, id, callback);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            }
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

        return {
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const dbQuery = `INSERT INTO ${preparedOptions.table} ${dbData.fieldQuery} VALUES ${dbData.valueQuery}`.trim();
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const preparedOptions = dbHelpers.prepareQueryOptions(queryOptions);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                db.run(dbQuery, dbData.vars, callback);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                db.run(dbQuery, dbData.vars, callback);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            updateRecord: function(queryOptions, dbData, id, callback) {
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const dbQuery = `SELECT ${preparedOptions.fields} FROM ${preparedOptions.table} WHERE id = ${id}`.trim();
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                log.data('select record %s from %s', id, preparedOptions.table, { query: dbQuery });
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                db.get(dbQuery, callback);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            addRecord: function(queryOptions, dbData, callback) {
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const dbQuery = `UPDATE ${preparedOptions.table} SET ${dbData.updateQuery} WHERE id = ${id}`.trim();
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            },
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                log.data('insert data into %s', preparedOptions.table, { query: dbQuery, variables: dbData.vars });
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                log.data('select all records from %s', preparedOptions.table, { query: dbQuery });
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const preparedOptions = dbHelpers.prepareQueryOptions(queryOptions);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const preparedOptions = dbHelpers.prepareQueryOptions(queryOptions);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                log.data('update record %s from %s', id, preparedOptions.table, { query: dbQuery, variables: dbData.vars });
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            deleteRecord: function(queryOptions, id, callback) {
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const preparedOptions = dbHelpers.prepareQueryOptions(queryOptions);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            },
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                log.data('deleting record %s from %s', id, queryOptions.table, { query: dbQuery });
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            getRecords: function(queryOptions, callback) {
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

        };
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const dbQuery = `DELETE FROM ${queryOptions.table} WHERE id = ?`.trim();
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            },
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                const dbQuery = `SELECT ${preparedOptions.fields} FROM ${preparedOptions.table} ${preparedOptions.orderBy} ${preparedOptions.limit}`.trim();
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                db.all(dbQuery, callback);
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            },
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            getRecord: function(queryOptions, id, callback) {
    Severity: Minor
    Found in common/databaseRepository.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    There are no issues that match your filters.

    Category
    Status