oglimmer/linky

View on GitHub

Showing 142 of 142 total issues

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

    const reqData = {
      url: properties.server.auth[type].tokenUri,
      method: 'POST',
      data: {
        oauth_token: oauthToken,
Severity: Minor
Found in server/auth/oauth1a.js and 1 other location - About 30 mins to fix
server/auth/oauth1a.js on lines 27..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 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

Avoid too many return statements within this function.
Open

  return currentFeedData;
Severity: Major
Found in server/controller/rssController.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return 'No valid RSS found';
    Severity: Major
    Found in server/controller/rssController.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return null;
      Severity: Major
      Found in src/components/UILinkList.js - About 30 mins to fix

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

          const sortedRootElements = state.tagHierarchy
            .filter(e => e.parent === parentTagName)
            .sort((a, b) => (a.index < b.index ? 1 : (a.index === b.index ? 0 : -1)));
        Severity: Minor
        Found in src/redux/reducers/tagHierarchyData.js and 1 other location - About 30 mins to fix
        server/logic/Link.js on lines 171..173

        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

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

              children: element.children
                .map(childName => parentToElementMap[element.name].find(e => e.name === childName))
                .sort((a, b) => (a.index < b.index ? -1 : (a.index === b.index ? 0 : 1)))
        Severity: Minor
        Found in src/util/Hierarchy.js and 1 other location - About 30 mins to fix
        src/redux/reducers/tagHierarchyData.js on lines 110..112

        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

        Avoid too many return statements within this function.
        Open

            return obj.linkUrl;
        Severity: Major
        Found in src/components/UILinkList.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return 0;
          Severity: Major
          Found in src/components/UILinkList.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return currentFeedData;
            Severity: Major
            Found in server/controller/rssController.js - About 30 mins to fix

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

                const sortedRootElements = tagHierarchy
                  .filter(e => e.parent === parent)
                  .sort((a, b) => (a.index < b.index ? 1 : (a.index === b.index ? 0 : -1)));
              Severity: Minor
              Found in server/logic/Link.js and 1 other location - About 30 mins to fix
              src/redux/reducers/tagHierarchyData.js on lines 17..19

              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

              Avoid too many return statements within this function.
              Open

                return `${daysAgo} days ago`;
              Severity: Major
              Found in src/util/DateFormat.js - About 30 mins to fix

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

                  const reqData = {
                    url: properties.server.auth[type].requestUri,
                    method: 'GET',
                    data: {
                      oauth_callback: redirectUri,
                Severity: Minor
                Found in server/auth/oauth1a.js and 1 other location - About 30 mins to fix
                server/auth/oauth1a.js on lines 68..74

                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

                Avoid too many return statements within this function.
                Open

                        return sortingByColumnOrder * b.linkUrl.localeCompare(a.linkUrl);
                Severity: Major
                Found in src/components/UILinkList.js - About 30 mins to fix

                  Function process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    async process() {
                      const asyncWaitId = await this.loadAsyncWaitId();
                      try {
                        this.validate();
                        const $ = cheerio.load(this.data.bookmarks);
                  Severity: Minor
                  Found in server/controller/importExportController.js - About 25 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

                  Function process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    async process() {
                      try {
                        const user = await userDao.getByEmail(this.data.email);
                        if (user == null) {
                          ResponseUtil.sendErrorResponse(401, 'Wrong user or password!', this.res);
                  Severity: Minor
                  Found in server/controller/userController.js - About 25 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

                  Function getNextIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const getNextIndex = (tagHierarchy, parent = 'root') => {
                    const sortedRootElements = tagHierarchy
                      .filter(e => e.parent === parent)
                      .sort((a, b) => (a.index < b.index ? 1 : (a.index === b.index ? 0 : -1)));
                    // Immutable classes don't have length. We expect a POJO [] here.
                  Severity: Minor
                  Found in server/logic/Link.js - About 25 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

                  Function makeDateHumanreadble has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const makeDateHumanreadble = (date) => {
                    let d = date;
                    if (typeof d === 'string') {
                      d = new Date(d);
                    }
                  Severity: Minor
                  Found in src/util/DateFormat.js - About 25 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

                  Function updateTagHierarchy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export async function updateTagHierarchy(userid, tags, parent = 'root') {
                    /* eslint-disable no-constant-condition */
                    while (true) {
                      try {
                        /* eslint-disable no-await-in-loop */
                  Severity: Minor
                  Found in server/logic/Link.js - About 25 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

                  Function purifyUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const purifyUrl = (userInput) => {
                    let userUrl = userInput.substr(4);
                    if (userUrl.startsWith('*')) {
                      userUrl = userUrl.substr(1);
                    }
                  Severity: Minor
                  Found in server/controller/searchController.js - About 25 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

                  Function getNextIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const getNextIndex = (state, parentTagName = 'root') => {
                    const sortedRootElements = state.tagHierarchy
                      .filter(e => e.parent === parentTagName)
                      .sort((a, b) => (a.index < b.index ? 1 : (a.index === b.index ? 0 : -1)));
                    if (sortedRootElements.size > 0) {
                  Severity: Minor
                  Found in src/redux/reducers/tagHierarchyData.js - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language