WeTransfer/wt-js-sdk

View on GitHub

Showing 232 of 232 total issues

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

  addFiles(...files) {
    const remoteFiles = files.map((file) => {
      const remoteFile = new RemoteFile(file);
      remoteFile.board = this;

Severity: Major
Found in src/boards/models/remote-board.js and 1 other location - About 1 hr to fix
src/boards/models/remote-board.js on lines 22..31

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

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

  addLinks(...links) {
    const remoteLinks = links.map((link) => {
      const remoteLink = new RemoteLink(link);
      remoteLink.board = this;

Severity: Major
Found in src/boards/models/remote-board.js and 1 other location - About 1 hr to fix
src/boards/models/remote-board.js on lines 33..42

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

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

module.exports = async function createWTClient(apiKey, options = {}) {
  if (!apiKey) {
    throw new WTError('No API Key provided');
  }

Severity: Minor
Found in src/index.js - About 1 hr to fix

    Function createMultipartChunksForFile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function createMultipartChunksForFile(transferOrBoard, file, content) {
        const totalParts = file.multipart.part_numbers;
        logger.debug(
          `[${
            file.name
    Severity: Minor
    Found in src/actions/upload-file.js - About 1 hr to fix

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

          uploadComplete(transfer, file) {
            return {
              url: `${prefix}/transfers/${transfer.id}/files/${
                file.id
              }/upload-complete`,
      Severity: Minor
      Found in src/config/routes.js and 1 other location - About 40 mins to fix
      src/config/routes.js on lines 32..37

      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

          uploadComplete(board, file) {
            return {
              url: `${prefix}/boards/${board.id}/files/${file.id}/upload-complete`,
              method: 'put',
            };
      Severity: Minor
      Found in src/config/routes.js and 1 other location - About 40 mins to fix
      src/config/routes.js on lines 57..64

      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

      Line length
      Open

      We aim to keep all project discussion inside GitHub issues. This is to make sure valuable discussion is accessible via search. If you have questions about how to use the library, or how the project is running - GitHub issues are the goto tool for this project.
      Severity: Info
      Found in .github/CONTRIBUTING.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Blank line inside blockquote
      Open

      
      
      Severity: Info
      Found in .github/CONTRIBUTING.md by markdownlint

      MD028 - Blank line inside blockquote

      Tags: blockquote, whitespace

      Aliases: no-blanks-blockquote

      This rule is triggered when two blockquote blocks are separated by nothing except for a blank line:

      > This is a blockquote
      > which is immediately followed by
      
      > this blockquote. Unfortunately
      > In some parsers, these are treated as the same blockquote.

      To fix this, ensure that any blockquotes that are right next to each other have some text in between:

      > This is a blockquote.
      
      And Jimmy also said:
      
      > This too is a blockquote.

      Alternatively, if they are supposed to be the same quote, then add the blockquote symbol at the beginning of the blank line:

      > This is a blockquote.
      >
      > This is the same blockquote.

      Rationale: Some markdown parsers will treat two blockquotes separated by one or more blank lines as the same blockquote, while others will treat them as separate blockquotes.

      Ordered list item prefix
      Open

      6. Push your topic branch up to your fork:
      Severity: Info
      Found in .github/CONTRIBUTING.md by markdownlint

      MD029 - Ordered list item prefix

      Tags: ol

      Aliases: ol-prefix

      Parameters: style ("one", "ordered"; default "one")

      This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

      Example valid list if the style is configured as 'one':

      1. Do this.
      1. Do that.
      1. Done.

      Example valid list if the style is configured as 'ordered':

      1. Do this.
      2. Do that.
      3. Done.

      Trailing spaces
      Open

      MD009 - Trailing spaces

      Tags: whitespace

      Aliases: no-trailing-spaces

      Parameters: br_spaces (number; default: 0)

      This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

      The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

      Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

      Trailing spaces
      Open

      **Describe the bug**

      MD009 - Trailing spaces

      Tags: whitespace

      Aliases: no-trailing-spaces

      Parameters: br_spaces (number; default: 0)

      This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

      The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

      Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

      Trailing spaces
      Open

      MD009 - Trailing spaces

      Tags: whitespace

      Aliases: no-trailing-spaces

      Parameters: br_spaces (number; default: 0)

      This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

      The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

      Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

      Header levels should only increment by one level at a time
      Open

      ### Bug Fixes
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD001 - Header levels should only increment by one level at a time

      Tags: headers

      Aliases: header-increment

      This rule is triggered when you skip header levels in a markdown document, for example:

      # Header 1
      
      ### Header 3
      
      We skipped out a 2nd level header in this document

      When using multiple header levels, nested headers should increase by only one level at a time:

      # Header 1
      
      ## Header 2
      
      ### Header 3
      
      #### Header 4
      
      ## Another Header 2
      
      ### Another Header 3

      Multiple consecutive blank lines
      Open

      
      
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD012 - Multiple consecutive blank lines

      Tags: whitespace, blank_lines

      Aliases: no-multiple-blanks

      This rule is triggered when there are multiple consecutive blank lines in the document:

      Some text here
      
      
      Some more text here

      To fix this, delete the offending lines:

      Some text here
      
      Some more text here

      Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

      Line length
      Open

      * **deps:** update dependency async to v3.0.1 ([#208](https://github.com/WeTransfer/wt-js-sdk/issues/208)) ([b8ac392](https://github.com/WeTransfer/wt-js-sdk/commit/b8ac392))
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      * **deps:** update dependency lodash to v4.17.11 ([#122](https://github.com/WeTransfer/wt-js-sdk/issues/122)) ([5cea200](https://github.com/WeTransfer/wt-js-sdk/commit/5cea200))
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      * remove JSON circular dependencies [#55](https://github.com/WeTransfer/wetransfer-js-sdk/issues/55) [f948630](https://github.com/WeTransfer/wetransfer-js-sdk/commit/f948630)
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Multiple top level headers in the same document
      Open

      # [0.2.0](https://github.com/WeTransfer/wetransfer-js-sdk/compare/v0.1.0...v0.2.0) (2018-04-19)
      Severity: Info
      Found in CHANGELOG.md by markdownlint

      MD025 - Multiple top level headers in the same document

      Tags: headers

      Aliases: single-h1

      Parameters: level (number; default 1)

      This rule is triggered when a top level header is in use (the first line of the file is a h1 header), and more than one h1 header is in use in the document:

      # Top level header
      
      # Another top level header

      To fix, structure your document so that there is a single h1 header that is the title for the document, and all later headers are h2 or lower level headers:

      # Title
      
      ## Header
      
      ## Another header

      Rationale: A top level header is a h1 on the first line of the file, and serves as the title for the document. If this convention is in use, then there can not be more than one title for the document, and the entire document should be contained within this header.

      Note: The level parameter can be used to change the top level (ex: to h2) in cases where an h1 is added externally.

      Inconsistent indentation for list items at the same level
      Open

      * Generate release notes
      Severity: Info
      Found in README.md by markdownlint

      MD005 - Inconsistent indentation for list items at the same level

      Tags: bullet, ul, indentation

      Aliases: list-indent

      This rule is triggered when list items are parsed as being at the same level, but don't have the same indentation:

      * Item 1
          * Nested Item 1
          * Nested Item 2
         * A misaligned item

      Usually this rule will be triggered because of a typo. Correct the indentation for the list to fix it:

      * Item 1
        * Nested Item 1
        * Nested Item 2
        * Nested Item 3

      Line length
      Open

      As you can see, boards are created without items, but you can already access the public URL. It's time to add some items!
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Severity
      Category
      Status
      Source
      Language