reactioncommerce/redoc

View on GitHub

Showing 186 of 186 total issues

Function getRepoToc has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

function getRepoToc(repo, fetchBranch, path) {
  this.unblock();
  check(repo, String);
  check(fetchBranch,  Match.Optional(String, null));
  check(path,  Match.Optional(String, null));
Severity: Minor
Found in packages/redoc-core/server/methods/getRepoToc.js - About 6 hrs 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 updateTOC has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

export function updateTOC() {
  const TOC = ReDoc.Collections.TOC.find();
  const repos = ReDoc.Collections.Repos.find({}).fetch();

  if (TOC.count() > 0) {
Severity: Minor
Found in packages/redoc-core/server/methods/repoData.js - About 5 hrs 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 APIParser has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function APIParser(md) {
  function addSections(state) {
    let tokens = [];  // output
    const Token = state.Token;
    let sectionTokens = [];
Severity: Major
Found in packages/redoc-core/lib/plugins/api.js - About 4 hrs to fix

    Function render has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const dropDownClassName = classnames({
          "reaction-nav-dropdown-links": true,
          "active": this.state.showNavDropdown
        })
    Severity: Major
    Found in common/components/header.jsx - About 3 hrs to fix

      Function addSections has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function addSections(state) {
          let tokens = [];  // output
          const Token = state.Token;
          let sectionTokens = [];
      
      
      Severity: Major
      Found in packages/redoc-core/lib/plugins/api.js - About 3 hrs to fix

        Function updateRepoData has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        export function updateRepoData() {
          if (hasExistingRepoData() === false) {
            const repoData = getRepoData();
        
            if (Array.isArray(repoData.repos)) {
        Severity: Minor
        Found in packages/redoc-core/server/methods/repoData.js - About 3 hrs 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 cachePrimaryDocs has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        export function cachePrimaryDocs() {
          // Update repo data and TOC if they are empty;
          updateRepoData();
          updateTOC();
        
        
        Severity: Minor
        Found in packages/redoc-core/server/methods/repoData.js - About 2 hrs 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 getRepoToc has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getRepoToc(repo, fetchBranch, path) {
          this.unblock();
          check(repo, String);
          check(fetchBranch,  Match.Optional(String, null));
          check(path,  Match.Optional(String, null));
        Severity: Major
        Found in packages/redoc-core/server/methods/getRepoToc.js - About 2 hrs to fix

          Function _loadData has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          SearchSource.prototype._loadData = function (query, options) {
            const self = this;
            let version = 0;
            const historyKey = query + EJSON.stringify(options);
            if (this._canUseHistory(historyKey)) {
          Severity: Minor
          Found in packages/search-source/lib/client.js - About 2 hrs 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 configureDefaults has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function configureDefaults() {
            // default public settings
            if (Meteor.settings.public.redoc === undefined) {
              Meteor.settings.public.redoc = {
                title: "Reaction Docs",
          Severity: Major
          Found in packages/redoc-core/server/methods/defaults.js - About 2 hrs to fix

            Function updateRepoData has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function updateRepoData() {
              if (hasExistingRepoData() === false) {
                const repoData = getRepoData();
            
                if (Array.isArray(repoData.repos)) {
            Severity: Major
            Found in packages/redoc-core/server/methods/repoData.js - About 2 hrs to fix

              Function render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  // Render admin dashboard
                  if (Meteor.userId()) {
                    let badges = [];
              
              
              Severity: Major
              Found in packages/redoc-core/components/admin.jsx - About 2 hrs to fix

                Function updateTOC has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function updateTOC() {
                  const TOC = ReDoc.Collections.TOC.find();
                  const repos = ReDoc.Collections.Repos.find({}).fetch();
                
                  if (TOC.count() > 0) {
                Severity: Minor
                Found in packages/redoc-core/server/methods/repoData.js - About 1 hr to fix

                  Function initServiceConfiguration has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function initServiceConfiguration() {
                    // Import settinngs typically found in a Meteor settings file
                    // settings file location <app-root>/settings/settings.json
                    // or meteor --settings=path/to/settings.json
                    if (hasServices()) {
                  Severity: Minor
                  Found in packages/redoc-core/server/methods/repoData.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 renderMenu has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    renderMenu(parentPath) {
                      let items = [];
                      let parentItems = _.filter(this.props.docs, function(item) { return item.parentPath === parentPath });
                      if (parentItems.length === 0) {
                        return [];
                  Severity: Minor
                  Found in common/components/toc.jsx - About 1 hr to fix

                    Function TOCParser has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function TOCParser(md) {
                      md.core.ruler.after(
                        "inline",
                        "replace-link",
                        function (state) {
                    Severity: Minor
                    Found in packages/redoc-core/lib/plugins/toc.js - About 1 hr to fix

                      Function _loadData has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      SearchSource.prototype._loadData = function (query, options) {
                        const self = this;
                        let version = 0;
                        const historyKey = query + EJSON.stringify(options);
                        if (this._canUseHistory(historyKey)) {
                      Severity: Minor
                      Found in packages/search-source/lib/client.js - About 1 hr to fix

                        Function getData has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        SearchSource.prototype.getData = function (options, getCursor) {
                          options = options || {};
                          const self = this;
                          this._storeDep.depend();
                          let selector = {$or: []};
                        Severity: Minor
                        Found in packages/search-source/lib/client.js - About 1 hr to fix

                          Function renderNavigation has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            renderNavigation() {
                              const classes = classnames({
                                redoc: true,
                                sidebar: true,
                                visible: this.props.isMenuVisible
                          Severity: Minor
                          Found in packages/redoc-core/components/admin.jsx - About 1 hr to fix

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

                            export function initAdminUsers() {
                              if (hasServices()) {
                                if (Meteor.settings.redoc && Meteor.settings.redoc.users) {
                                  for (const user of Meteor.settings.redoc.users) {
                                    const userData = Meteor.users.findOne({
                            Severity: Minor
                            Found in packages/redoc-core/server/methods/repoData.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

                            Severity
                            Category
                            Status
                            Source
                            Language