oglimmer/linky

View on GitHub

Showing 142 of 142 total issues

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

export default {

  createLink: (req, res, next) => {
    const crp = new CreateLinkProcessor(req, res, next);
    crp.doProcess();
Severity: Major
Found in server/controller/linkController.js and 1 other location - About 7 hrs to fix
server/controller/userController.js on lines 178..205

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

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

  authenticate: (req, res, next) => {
    const ap = new AuthenticateProcessor(req, res, next);
    ap.doProcess();
Severity: Major
Found in server/controller/userController.js and 1 other location - About 7 hrs to fix
server/controller/linkController.js on lines 245..272

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

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

const init = (req, res) => {
  const type = req.params.type;
  if (properties.server.auth[type].oauth === 1) {
    oauth1a.init(req, res);
  } else if (properties.server.auth[type].oauth === 2) {
Severity: Major
Found in server/httpRoutes/auth.js and 1 other location - About 6 hrs to fix
server/httpRoutes/auth.js on lines 22..33

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

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

const back = (req, res) => {
  const type = req.params.type;
  if (properties.server.auth[type].oauth === 1) {
    oauth1a.back(req, res);
  } else if (properties.server.auth[type].oauth === 2) {
Severity: Major
Found in server/httpRoutes/auth.js and 1 other location - About 6 hrs to fix
server/httpRoutes/auth.js on lines 9..20

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

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

  getSiblings(tagName) {
    let nodes = this.siblings.get(tagName);
    if (typeof nodes === 'undefined') {
      const targetNode = this.getNodeByName(tagName);
      if (targetNode) {
Severity: Major
Found in src/util/Hierarchy.js and 1 other location - About 6 hrs to fix
src/util/Hierarchy.js on lines 44..57

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

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

  getChildren(tagName) {
    let nodes = this.children.get(tagName);
    if (typeof nodes === 'undefined') {
      const targetNode = this.getNodeByName(tagName);
      if (targetNode) {
Severity: Major
Found in src/util/Hierarchy.js and 1 other location - About 6 hrs to fix
src/util/Hierarchy.js on lines 29..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 156.

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

            <span><i className={labels[0]} />{' '}{ parents.map(tag => (
              <span key={`parents-${tag.name}`}>
                <span
                  role="link"
                  tabIndex="0"
Severity: Major
Found in src/components/TagListHierarchy.js and 1 other location - About 5 hrs to fix
src/components/TagListHierarchy.js on lines 82..94

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

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

          { siblings.map(tag => (
            <span key={`siblings-${tag.name}`}>
              <span
                role="link"
                tabIndex="0"
Severity: Major
Found in src/components/TagListHierarchy.js and 1 other location - About 5 hrs to fix
src/components/TagListHierarchy.js on lines 66..77

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

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

  import: (req, res, next) => {
    const glp = new ImportProcessor(req, res, next);
    glp.doProcess();
Severity: Major
Found in server/controller/importExportController.js and 1 other location - About 3 hrs to fix
server/controller/tagController.js on lines 153..170

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

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

  getTagHierarchy: (req, res, next) => {
    const glp = new GetTagHierarchyProcessor(req, res, next);
    glp.doProcess();
Severity: Major
Found in server/controller/tagController.js and 1 other location - About 3 hrs to fix
server/controller/importExportController.js on lines 162..179

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

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

export default function mainData(state = initialStateMainData, action) {
  switch (action.type) {
    case RESET:
      return initialStateMainData;
    case ADD_LINK:
Severity: Major
Found in src/redux/reducers/mainData.js - About 3 hrs to fix

    Function render has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        if (!this.props.selectedTag || this.props.tagHierarchy.size === 0) {
          return null;
        }
        const cachedTagHierarchy = new CachedTagHierarchy(this.props.tagHierarchy);
    Severity: Major
    Found in src/components/TagListHierarchy.js - About 3 hrs to fix

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

          if (type === 'reddit') {
            headers.authorization = `Basic ${new Buffer(
              `${properties.server.auth[type].clientId}:${properties.server.auth[type].clientSecret}`,
            ).toString('base64')}`;
          }
      Severity: Major
      Found in server/auth/authHelper.js and 1 other location - About 2 hrs to fix
      server/auth/oauth2.js on lines 44..46

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

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

        if (type === 'reddit') {
          headers.authorization = `Basic ${new Buffer(`${properties.server.auth[type].clientId}:${properties.server.auth[type].clientSecret}`).toString('base64')}`;
        }
      Severity: Major
      Found in server/auth/oauth2.js and 1 other location - About 2 hrs to fix
      server/auth/authHelper.js on lines 121..125

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

      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

      File links.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      
      import { actions } from 'react-redux-form';
      import { push } from 'react-router-redux';
      import assert from 'assert';
      import BlueBirdPromise from 'bluebird';
      Severity: Minor
      Found in src/redux/actions/links.js - About 2 hrs to fix

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

          static async leave(req, res) {
            if (req.cookies.authToken) {
              const { target } = req.query;
              const { authToken } = req.cookies;
              try {
        Severity: Minor
        Found in server/controller/leaveController.js - 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 process has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          async process() {
            try {
              const rec = await linkDao.getById(this.data.linkId);
              if (!rec || !rec.rssUrl) {
                this.res.send('ERROR. No rssUrl for this link.');
        Severity: Minor
        Found in server/controller/rssController.js - 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 process has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async process() {
            try {
              const file = `${properties.server.favicon.cachePath}/${this.data.linkid}`;
              try {
                await fs.stat(file);
        Severity: Major
        Found in server/controller/imageController.js - About 2 hrs to fix

          Function updateAfterPersistLink has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          const updateAfterPersistLink = (responseUpdates, linkList, selectedTag, dispatch, successMsg) => {
            if (responseUpdates.message) {
              dispatch(setErrorMessage(responseUpdates.message));
            } else {
              const updateLink = (link) => {
          Severity: Minor
          Found in src/redux/actions/links.js - 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 processRefresh has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const processRefresh = async (req, res, refreshToken, type) => {
            if (properties.server.auth[type].oauth === 1) {
              return undefined;
            } else if (properties.server.auth[type].oauth === 2) {
              if (!properties.server.auth[type].refreshUri) {
          Severity: Major
          Found in server/auth/authHelper.js - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language