bem-site/gorshochek

View on GitHub

Showing 43 of 43 total issues

Function merge has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    merge(previousModel, currentModel) {
        const modifiedPages = [];
        const nonModifiedPages = [];

        /*
Severity: Minor
Found in src/model.js - About 1 hr to fix

    Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = (model, options) => {
        options = options || {};
    
        const GITHUB_URL_REGEXP = /^https?:\/\/(.+?)\/(.+?)\/(.+?)\/(tree|blob)\/(.+?)\/(.+)/;
        const githubOptions = {token: options.token};
    Severity: Minor
    Found in src/tasks/docs/load-from-github.js - 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 processPage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function processPage(model, page) {
            debug(`load local file page with url: => ${page.url}`);
    
            const filePath = page.source; // относительный путь к файлу
            const fileName = path.basename(filePath); // имя файла (с расширением)
    Severity: Minor
    Found in src/tasks/docs/load-from-file.js - About 1 hr to fix

      Function processPage has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function processPage(model, page) {
              debug(`load source viw http(s) for page with url: => ${page.url}`);
      
              const filePath = page.source; // относительный путь к файлу
              const fileName = path.basename(filePath); // имя файла (с расширением)
      Severity: Minor
      Found in src/tasks/docs/load-from-http.js - About 1 hr to fix

        Function exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = (model, options) => {
            options = options || {};
        
            options.concurrency = options.concurrency || 20;
            options.imageFolder = options.imageFolder || '/static';
        Severity: Minor
        Found in src/tasks/override/process-doc-images.js - 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

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

                return _(tagPages)
                    .thru(generateTagPagesMap)
                    .thru(replaceTagsOnLinksForPages.bind(null, model))
                    .thru(replaceTagsOnLinksForTagPages.bind(null, tagPages))
                    .map(saveTagPageSource)
        Severity: Major
        Found in src/tasks/meta/tags.js and 1 other location - About 1 hr to fix
        src/tasks/template/full-bem.js on lines 137..142

        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 60.

        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

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

                    return Q(page)
                        .then(getPageContent)
                        .then(compoundPage.bind(null, page))
                        .then(createBEMJSON.bind(null, pages))
                        .then(_bemhtml)
        Severity: Major
        Found in src/tasks/template/full-bem.js and 1 other location - About 1 hr to fix
        src/tasks/meta/tags.js on lines 166..171

        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 60.

        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

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

        module.exports = (model, options) => {
            options = options || {};
        
            // option host is required parameter
            if(!options.host) {
        Severity: Minor
        Found in src/tasks/sitemap/sitemap-xml.js - About 1 hr to fix

          Function findLinkHrefReplacement has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function findLinkHrefReplacement(linkHref, page, sourceUrlsMap, existedUrls) {
                  const _linkHref = linkHref;
          
                  // If URL starts with `https://${lang}.bem.info` replace it with `root`
                  if(params && params.host && linkHref.indexOf(params.host) === 0) {
          Severity: Minor
          Found in src/tasks/override/override-doc-links.js - About 1 hr to fix

            Function executeAPIMethod has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                executeAPIMethod(method, options, headers, callback) {
                    // максимальное число допустимых повторных обращений к github в случае возникновения ошибки
                    const ATTEMPTS = 5;
            
                    debug(`github API call for ${method} with options:`);
            Severity: Minor
            Found in src/tasks/docs/github/index.js - About 1 hr to fix

              Function processPage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function processPage(model, page) {
                      debug(`Load doc file for page with url: => ${page.url}`);
                      const repoInfo = parseSourceUrl(page.source);
                      return readMetaFromCache(page)
                          .then(cache => Q.all([
              Severity: Minor
              Found in src/tasks/docs/load-from-github.js - About 1 hr to fix

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

                                } else {
                                    debug('Doc modified: %s %s %s', page.url, page.title);
                                    model.pushChangeToModifiedGroup({type: 'doc', url: page.url, title: page.title});
                                }
                Severity: Major
                Found in src/tasks/docs/load-from-github.js and 1 other location - About 1 hr to fix
                src/tasks/docs/load-from-github.js on lines 237..240

                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 55.

                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

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

                                } else if(!cache.sha) {
                                    debug('Doc added: %s %s', page.url, page.title);
                                    model.pushChangeToAddedGroup({type: 'doc', url: page.url, title: page.title});
                                } else {
                Severity: Major
                Found in src/tasks/docs/load-from-github.js and 1 other location - About 1 hr to fix
                src/tasks/docs/load-from-github.js on lines 240..243

                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 55.

                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

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

                exports.readJSONFile = (filePath, fallbackValue) => {
                    debug(`read JSON file from: ${filePath}`);
                    return _readFile(fsExtra.readJSON, filePath, fallbackValue);
                };
                Severity: Minor
                Found in src/util.js and 1 other location - About 50 mins to fix
                src/util.js on lines 66..69

                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 51.

                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

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

                exports.readFile = (filePath, fallbackValue) => {
                    debug(`read file from: ${filePath}`);
                    return _readFile(fs.readFile, filePath, fallbackValue);
                };
                Severity: Minor
                Found in src/util.js and 1 other location - About 50 mins to fix
                src/util.js on lines 77..80

                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 51.

                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

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

                    constructor(level, block) {
                        super();
                
                        /**
                         * Level data object
                Severity: Minor
                Found in src/tasks/libraries/model/block.js and 1 other location - About 45 mins to fix
                src/tasks/libraries/model/document.js on lines 23..37

                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 50.

                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

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

                    constructor(version, document) {
                        super();
                
                        /**
                         * Library version data object
                Severity: Minor
                Found in src/tasks/libraries/model/document.js and 1 other location - About 45 mins to fix
                src/tasks/libraries/model/block.js on lines 21..35

                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 50.

                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

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

                        return repoInfo ? {
                            host: repoInfo[1],
                            user: repoInfo[2],
                            repo: repoInfo[3],
                            ref: repoInfo[5],
                Severity: Minor
                Found in src/tasks/override/override-doc-links.js and 1 other location - About 35 mins to fix
                src/tasks/docs/load-from-github.js on lines 81..87

                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 47.

                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

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

                    function hasLocalSource(page) {
                        const source = page.source;
                        return !!source && !!source.match(/^https?/);
                    }
                Severity: Minor
                Found in src/tasks/docs/load-from-http.js and 1 other location - About 35 mins to fix
                src/tasks/docs/load-from-file.js on lines 34..37

                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 47.

                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

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

                        return Q(sourceFilePath)
                            .then(baseUtil.readFileFromCache.bind(baseUtil))
                            .then(override.bind(null, page))
                            .then(baseUtil.writeFileToCache.bind(baseUtil, sourceFilePath))
                Severity: Minor
                Found in src/tasks/override/process-doc-images.js and 1 other location - About 35 mins to fix
                src/tasks/docs/transform-md-html.js on lines 99..102

                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 47.

                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

                Severity
                Category
                Status
                Source
                Language