fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

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

    getMeta: function(meta) {

        var article = (meta.og && meta.og.article) || meta.article;

        var k = article ? article.tag : null;
Severity: Minor
Found in iframely/plugins/meta/og-article.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

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

    getLink: function(url, twitter) {

        if (twitter.card !== 'player' || !twitter.player) {

            return;
Severity: Minor
Found in iframely/plugins/domains/deezer.com.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

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

function getStreamLinks(twitter, stream, whitelistRecord) {

    var player = {
        href: stream.value || stream,
        type: stream.content_type,
Severity: Minor
Found in iframely/plugins/links/twitter-stream.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

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

    getMeta: function(oembed) {

        if (oembed.html) {

            var description = oembed.html.match(/<p>([^<>]+)<\/p>/i);
Severity: Minor
Found in iframely/plugins/domains/facebook.com/facebook.data.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

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

    getLink: function(og, urlMatch) {
        return [{
            href: "//embed.beatport.com/player/?id=" + urlMatch[2] + "&type=" + urlMatch[1],
            type: CONFIG.T.text_html,
            rel: CONFIG.R.player,
Severity: Minor
Found in iframely/plugins/domains/beatport.com.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

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

    getData: function(url, meta, cb) {

        if (meta["html-title"] === "Facebook" || meta["html-title"] === "Leaving Facebook...") {
            // the content is not public
            return cb({responseStatusCode: 403});
Severity: Minor
Found in iframely/plugins/domains/facebook.com/facebook.redirects.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

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

    getLink: function(tumblr_post, oembed, options) {

        if (!oembed.html) {
            return;
        }
Severity: Minor
Found in iframely/plugins/domains/tumblr.com/tumblr.oembed.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

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

    getData: function (urlMatch, request, cb) {

        request({
            uri: "https://api.vk.com/method/photos.getById", //?photos=-27744747_376634226
            qs: {
Severity: Minor
Found in iframely/plugins/domains/vk.com/vk.photo.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

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

    getLink: function(url, meta, cb) {

        if (meta["html-title"] == "Error | VK") {
            return cb({responseStatusCode: 403});
        }
Severity: Minor
Found in iframely/plugins/domains/vk.com/vk.video.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

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

function processPluginTests(pluginTest, plugin, count, cb) {

    var testUrlsSet, reachTestObjectFound = false;;

    log('===========================================');
Severity: Minor
Found in iframely/modules/tests-ui/tester.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

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

    getData: function(url, htmlparser, __noCachedMeta, cb) {

        var metaHandler = new HTMLMetaHandler(
            url,
            htmlparser.request.response.headers["content-type"],
Severity: Minor
Found in iframely/lib/plugins/system/meta/meta.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

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

    prepareLink: function(url, link, options, cb) {

        if (!link.href) {
            return cb();
        }
Severity: Minor
Found in iframely/lib/plugins/validators/async/22_imageSize.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

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

function iterateLinks(links, func) {

    if (links instanceof Array) {

        return links.forEach(func);
Severity: Minor
Found in iframely/lib/utils.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

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

    prepareLink: function(whitelistRecord, options, link, pluginId) {

        var plugin = plugins[pluginId];

        if (plugin.domain || plugin.custom) {
Severity: Minor
Found in iframely/lib/plugins/validators/sync/01_qa_rels.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

Avoid too many return statements within this function.
Open

      return evalTime.getDate()  + ' ' + evalMonth + ' ' + evalTime.getFullYear();
Severity: Major
Found in app/js/filters/tweetFromNow.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return prev;
    Severity: Major
    Found in app/js/components/select.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                    else return false;
      Severity: Major
      Found in app/js/components/select.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return evalMonth + ' ' + evalTime.getDate();
        Severity: Major
        Found in app/js/filters/tweetFromNow.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return;
          Severity: Major
          Found in app/js/components/select.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                          else return last;
            Severity: Major
            Found in app/js/components/select.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language