Godzil/Crunchy

View on GitHub

Showing 14 of 52 total issues

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

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

                  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

                    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

                    Avoid too many return statements within this function.
                    Open

                      return false;
                    Severity: Major
                    Found in src/batch.ts - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language