rodrigogs/xvideos

View on GitHub

Showing 6 of 39 total issues

Identical blocks of code found in 5 locations. Consider refactoring.
Open

const parseVideo = ($, video) => {
  const $video = $(video);

  const title = $video.find('p:not(.metadata) a').attr('title');
  const path = $video.find('.thumb > a').attr('href');
Severity: Major
Found in lib/api/videos/search/parseVideo.js and 4 other locations - About 1 day to fix
lib/api/videos/best/parseVideo.js on lines 3..25
lib/api/videos/dashboard/parseVideo.js on lines 3..25
lib/api/videos/fresh/parseVideo.js on lines 3..25
lib/api/videos/verified/parseVideo.js on lines 3..25

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

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

Identical blocks of code found in 5 locations. Consider refactoring.
Open

const parseResponse = (page, { data }) => {
  const $ = cheerio.load(data);

  const videos = getVideos($);

Severity: Major
Found in lib/api/videos/search/parseResponse.js and 4 other locations - About 4 hrs to fix
lib/api/videos/best/parseResponse.js on lines 24..43
lib/api/videos/dashboard/parseResponse.js on lines 24..43
lib/api/videos/fresh/parseResponse.js on lines 24..43
lib/api/videos/verified/parseResponse.js on lines 24..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 127.

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

Identical blocks of code found in 4 locations. Consider refactoring.
Open

const getPages = ($) => {
  return $('.pagination > ul > li > a')
    .map((i, page) => $(page)
      .text())
    .filter((i, page) => !isNaN(page))
Severity: Major
Found in lib/api/videos/search/parseResponse.js and 3 other locations - About 2 hrs to fix
lib/api/videos/best/parseResponse.js on lines 15..22
lib/api/videos/dashboard/parseResponse.js on lines 15..22
lib/api/videos/verified/parseResponse.js on lines 15..22

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

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

Identical blocks of code found in 5 locations. Consider refactoring.
Open

const getVideos = ($) => {
  return $('#content > .mozaique > .thumb-block')
    .map((i, video) => parseVideo($, video))
    .get();
};
Severity: Major
Found in lib/api/videos/search/parseResponse.js and 4 other locations - About 30 mins to fix
lib/api/videos/best/parseResponse.js on lines 9..13
lib/api/videos/dashboard/parseResponse.js on lines 9..13
lib/api/videos/fresh/parseResponse.js on lines 9..13
lib/api/videos/verified/parseResponse.js on lines 9..13

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

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

Parsing error: Unexpected token =>
Open

const search = async ({ page = 1, k = '' } = {}) => {
Severity: Minor
Found in lib/api/videos/search/search.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Parsing error: Unexpected token =>
Open

  it('should list videos based on search param', async () => {
Severity: Minor
Found in lib/api/videos/search/search.spec.js by eslint

For more information visit Source: http://eslint.org/docs/rules/

Severity
Category
Status
Source
Language