RobDWaller/fableau

View on GitHub

Showing 15 of 15 total issues

Function getColumns has 225 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getColumns () {
    return [{
      id: 'page_id',
      alias: 'Page ID',
      dataType: this.tableauDataTypeObject.int
Severity: Major
Found in src/js/tableau/columns/page-metric-columns.js - About 1 day to fix

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

      getPages (pageIds) {
        let data = []
    
        return Promise.all(pageIds.map((page) => {
          return this.facebookRequests.getPage(page).then((result) => {
    Severity: Major
    Found in src/js/service/facebook/helper/page-loop.js and 2 other locations - About 3 hrs to fix
    src/js/service/facebook/helper/page-loop.js on lines 42..52
    src/js/service/facebook/helper/page-loop.js on lines 60..70

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

    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 3 locations. Consider refactoring.
    Open

      getPosts (pageIds) {
        let data = []
    
        return Promise.all(pageIds.map((page) => {
          return this.facebookRequests.getPosts(page).then((result) => {
    Severity: Major
    Found in src/js/service/facebook/helper/page-loop.js and 2 other locations - About 3 hrs to fix
    src/js/service/facebook/helper/page-loop.js on lines 24..34
    src/js/service/facebook/helper/page-loop.js on lines 42..52

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

    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 3 locations. Consider refactoring.
    Open

      getPageMetrics (pageIds) {
        let data = []
    
        return Promise.all(pageIds.map((page) => {
          return this.facebookRequests.getPageMetrics(page).then((result) => {
    Severity: Major
    Found in src/js/service/facebook/helper/page-loop.js and 2 other locations - About 3 hrs to fix
    src/js/service/facebook/helper/page-loop.js on lines 24..34
    src/js/service/facebook/helper/page-loop.js on lines 60..70

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

    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 3 locations. Consider refactoring.
    Open

          if (table.tableInfo.id === 'page_metrics') {
            facebookLoop.getPageMetrics(pageIds)
              .then((result) => {
                return result.map((page) => {
                  table.appendRows(page.getTableauData())
    Severity: Major
    Found in src/js/tableau/builder.js and 2 other locations - About 3 hrs to fix
    src/js/tableau/builder.js on lines 92..100
    src/js/tableau/builder.js on lines 102..110

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

    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 3 locations. Consider refactoring.
    Open

          if (table.tableInfo.id === 'pages') {
            facebookLoop.getPages(pageIds)
              .then((result) => {
                return result.map((page) => {
                  table.appendRows(page.getTableauData())
    Severity: Major
    Found in src/js/tableau/builder.js and 2 other locations - About 3 hrs to fix
    src/js/tableau/builder.js on lines 102..110
    src/js/tableau/builder.js on lines 112..120

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

    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 3 locations. Consider refactoring.
    Open

          if (table.tableInfo.id === 'post_metrics') {
            facebookLoop.getPostMetrics(pageIds)
              .then((result) => {
                return result.map((post) => {
                  table.appendRows(post.getTableauData())
    Severity: Major
    Found in src/js/tableau/builder.js and 2 other locations - About 3 hrs to fix
    src/js/tableau/builder.js on lines 92..100
    src/js/tableau/builder.js on lines 112..120

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

    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

      getPostMetrics (page) {
        return this.facebookData.getDataPaginate(
          `${this.urlPrepend}/${page.id}/posts?fields=insights.metric(post_impressions,post_impressions_unique,post_impressions_paid,post_impressions_paid_unique,post_reactions_like_total,post_reactions_love_total,post_reactions_wow_total,post_reactions_haha_total,post_reactions_sorry_total,post_reactions_anger_total)&access_token=${page.access_token}`
        ).then((result) => {
          return new PostMetrics(result)
    Severity: Major
    Found in src/js/service/facebook/requests.js and 1 other location - About 2 hrs to fix
    src/js/service/facebook/requests.js on lines 33..38

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

    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

      getPosts (page) {
        return this.facebookData.getDataPaginate(`${this.urlPrepend}/${page.id}/posts?fields=created_time,message,id,link,type&access_token=${page.access_token}`)
          .then((result) => {
            return new PostMeta(result)
          })
    Severity: Major
    Found in src/js/service/facebook/requests.js and 1 other location - About 2 hrs to fix
    src/js/service/facebook/requests.js on lines 46..52

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

    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 getColumns has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getColumns () {
        return [{
          id: 'page_id',
          alias: 'Page Id',
          dataType: this.tableauDataTypeObject.int
    Severity: Major
    Found in src/js/tableau/columns/post-metric-columns.js - About 2 hrs to fix

      Function onload has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      window.onload = function () {
        /**
         * Load Facebook
         */
        window.fbAsyncInit = function () {
      Severity: Minor
      Found in src/js/init.js - About 1 hr to fix

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

          getData (tableauConnector) {
            tableauConnector.getData = (table, doneCallback) => {
              let facebook = new FacebookRequests(new FacebookData(new Ajax()))
        
              let facebookLoop = new FacebookPageLoop(facebook)
        Severity: Minor
        Found in src/js/tableau/builder.js - About 1 hr to fix

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

              tableauConnector.getData = (table, doneCallback) => {
                let facebook = new FacebookRequests(new FacebookData(new Ajax()))
          
                let facebookLoop = new FacebookPageLoop(facebook)
          
          
          Severity: Minor
          Found in src/js/tableau/builder.js - About 1 hr to fix

            Function getData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              getData (tableauConnector) {
                tableauConnector.getData = (table, doneCallback) => {
                  let facebook = new FacebookRequests(new FacebookData(new Ajax()))
            
                  let facebookLoop = new FacebookPageLoop(facebook)
            Severity: Minor
            Found in src/js/tableau/builder.js - About 45 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

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

              getData (url) {
                let data = new Promise((resolve, reject) => {
                  /* global XMLHttpRequest */
                  var request = new XMLHttpRequest()
            
            
            Severity: Minor
            Found in src/js/helper/ajax.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