Godzil/Crunchy

View on GitHub

Showing 21 of 52 total issues

Function get_min_filter has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function get_min_filter(filter: string): IEpisodeNumber
{
  if (filter !== undefined)
  {
    const tok = filter.split('-');
Severity: Minor
Found in src/batch.ts - 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 downloadSubtitle has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function downloadSubtitle(config: IConfig, page: IEpisodePage, player: IEpisodePlayer,
                          filePath: string, done: (err?: Error | string) => void)
{
  if (page.media !== null)
  {
Severity: Minor
Found in src/episode.ts - 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 getMedia has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getMedia(vlosScript: string, seasonTitle: string, seasonNumber: string): IEpisodePage
{
  let vlosMedia: IVlosScript;

  function f(script: string) {
Severity: Minor
Found in src/vlos.ts - About 1 hr to fix

    Function save has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function save(config: IConfig)
    {
      const tmp = JSON.parse(JSON.stringify(config));
    
      // Things added by the command line parser
    Severity: Minor
    Found in src/config.ts - About 1 hr to fix

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

      export function get_epregexp(config: IConfig): RegExp
      {
        let ret = episodes_regexp.en;
      
        if (config.crlang in episodes_regexp)
      Severity: Major
      Found in src/languages.ts and 1 other location - About 1 hr to fix
      src/languages.ts on lines 33..43

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

      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

      export function get_diregexp(config: IConfig): RegExp
      {
        let ret = dubignore_regexp.en;
      
        if (config.crlang in dubignore_regexp)
      Severity: Major
      Found in src/languages.ts and 1 other location - About 1 hr to fix
      src/languages.ts on lines 56..66

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

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

      function authUsingForm(config: IConfig, done: (err: any) => void)
      {
        /* So if we are here now, that mean we are not authenticated so do as usual */
        if (!config.pass || !config.user)
        {
      Severity: Minor
      Found in src/my_request.ts - About 1 hr to fix

        Function authUsingApi has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function authUsingApi(config: IConfig, done: (err: any) => void)
        {
          if (!config.pass || !config.user)
          {
            log.error('You need to give login/password to use Crunchy');
        Severity: Minor
        Found in src/my_request.ts - About 1 hr to fix

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

          function get_min_filter(filter: string): IEpisodeNumber
          {
            if (filter !== undefined)
            {
              const tok = filter.split('-');
          Severity: Minor
          Found in src/batch.ts - About 1 hr to fix

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

              function f(script: string) {
                /* We need to scope things */
            
                /* This is what will give us the medias */
                function VilosPlayer() {
            Severity: Minor
            Found in src/vlos.ts - About 1 hr to fix

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

              function getOptions(config: IConfig, form: any)
              {
                if (!optionsSet)
                {
                  currentOptions = {};
              Severity: Minor
              Found in src/my_request.ts - About 1 hr to fix

                Function downloadVideo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function downloadVideo(config: IConfig,  page: IEpisodePage, player: IEpisodePlayer,
                                       filePath: string, done: (err: any) => void)
                {
                  if (player == null)
                  {
                Severity: Minor
                Found in src/episode.ts - About 55 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 deeply nested control flow statements.
                Open

                            if (err)
                            {
                              log.error('An error occured while fetching subtitles...');
                              return done(err);
                            }
                Severity: Major
                Found in src/episode.ts - About 45 mins to fix

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

                        if ($('.availability-notes-high').length)
                        {
                          log.warnMore('This serie probably have georestriction and will miss some episodes' +
                                       ' [Message: ' +  $('.availability-notes-high').text() + '].');
                        }
                  Severity: Minor
                  Found in src/series.ts and 1 other location - About 40 mins to fix
                  src/series.ts on lines 223..227

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

                  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

                        if ($('.availability-notes-low').length)
                        {
                          log.warn('This serie may have georestriction and some missings episode (like some dubs)' +
                                   ' [Message: ' +  $('.availability-notes-low').text() + '].');
                        }
                  Severity: Minor
                  Found in src/series.ts and 1 other location - About 40 mins to fix
                  src/series.ts on lines 229..233

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

                  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 downloadSubtitle has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function downloadSubtitle(config: IConfig, page: IEpisodePage, player: IEpisodePlayer,
                                            filePath: string, done: (err?: Error | string) => void)
                  Severity: Minor
                  Found in src/episode.ts - About 35 mins to fix

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

                        if (tok.length > 2)
                        {
                          log.error('Invalid episode filter \'' + filter + '\'');
                          process.exit(-1);
                        }
                    Severity: Minor
                    Found in src/batch.ts and 2 other locations - About 35 mins to fix
                    src/batch.ts on lines 237..241
                    src/batch.ts on lines 270..274

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

                        if (tok.length > 2)
                        {
                          log.error('Invalid episode filter \'' + filter + '\'');
                          process.exit(-1);
                        }
                    Severity: Minor
                    Found in src/batch.ts and 2 other locations - About 35 mins to fix
                    src/batch.ts on lines 222..226
                    src/batch.ts on lines 237..241

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

                            if (tok2.length > 2)
                            {
                              log.error('Invalid episode filter \'' + filter + '\'');
                              process.exit(-1);
                            }
                    Severity: Minor
                    Found in src/batch.ts and 2 other locations - About 35 mins to fix
                    src/batch.ts on lines 222..226
                    src/batch.ts on lines 270..274

                    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

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

                    function getOptions(config: IConfig, form: any)
                    {
                      if (!optionsSet)
                      {
                        currentOptions = {};
                    Severity: Minor
                    Found in src/my_request.ts - 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