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)
{
- Read upRead up
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('-');
- Read upRead up
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) {
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
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)
{
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');
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('-');
Function getOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getOptions(config: IConfig, form: any)
{
if (!optionsSet)
{
currentOptions = {};
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() {
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)
{
- Read upRead up
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);
}
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)
Function getOptions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getOptions(config: IConfig, form: any)
{
if (!optionsSet)
{
currentOptions = {};
- Read upRead up
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;