Gottwik/Enduro

View on GitHub
libs/admin_api/get_globalizer_options.js

Summary

Maintainability
A
2 hrs
Test Coverage

Function call has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

api_call.prototype.call = function (req, res, enduro_server) {

    // gets query parameters
    const sid = req.query.sid
    const globalizer_string = req.query.globalizer_string
Severity: Minor
Found in libs/admin_api/get_globalizer_options.js - About 1 hr to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        admin_sessions.get_user_by_session(sid)
            .then((user) => {
                if (page_path && globalizer_chain[0] != 'global') {
                    return flat.load(page_path)
                } else {
    Severity: Major
    Found in libs/admin_api/get_globalizer_options.js and 1 other location - About 1 hr to fix
    libs/admin_api/get_globalized_context.js on lines 37..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Trailing spaces not allowed.
    Open

    // *        

    Disallow trailing spaces at the end of lines (no-trailing-spaces)

    (fixable) The --fix option on the [command line](../user-guide/command-line-interface#fix) automatically fixes problems reported by this rule.

    Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before checkin.

    Rule Details

    The following patterns are considered problems:

    /*eslint no-trailing-spaces: "error"*/
    
    // spaces, tabs and unicode whitespaces
    // are not allowed at the end of lines
    var foo = 0;//•••••
    var baz = 5;//••

    The following patterns are not considered problems:

    /*eslint no-trailing-spaces: "error"*/
    
    var foo = 0;
    
    var baz = 5;

    Options

    There is one option for this rule, skipBlankLines. When set to true, the rule will not flag any lines that are made up purely of whitespace. In short, if a line is zero-length after being trimmed of whitespace, then the rule will not flag that line when skipBlankLines is enabled.

    You can enable this option in your config like this:

    {
        "no-trailing-spaces": ["error", { "skipBlankLines": true }]
    }

    With this option enabled, The following patterns are not considered problems:

    /*eslint no-trailing-spaces: ["error", { "skipBlankLines": true }]*/
    
    var foo = 0;
    //••••
    var baz = 5;

    Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status