oglimmer/linky

View on GitHub

Showing 142 of 142 total issues

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

  const form = {
    code,
    client_id: properties.server.auth[type].clientId,
    client_secret: properties.server.auth[type].clientSecret,
    grant_type: 'authorization_code',
Severity: Major
Found in server/auth/oauth2.js and 1 other location - About 2 hrs to fix
server/auth/openid.js on lines 36..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 78.

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

  const form = {
    code,
    client_id: properties.server.auth[type].clientId,
    client_secret: properties.server.auth[type].clientSecret,
    grant_type: 'authorization_code',
Severity: Major
Found in server/auth/openid.js and 1 other location - About 2 hrs to fix
server/auth/oauth2.js on lines 33..39

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

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 process has 53 lines of code (exceeds 25 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: Major
Found in server/controller/rssController.js - About 2 hrs to fix

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

        try {
          const bodyUrlEncoded = await request.post({
            url: reqData.url,
            headers,
            form,
    Severity: Major
    Found in server/auth/oauth1a.js and 2 other locations - About 1 hr to fix
    server/auth/oauth2.js on lines 63..72
    server/auth/openid.js on lines 78..87

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

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

        try {
          await authHelper.verifyState(req, res, state);
          const authTokenResponse = await getAuthToken(code, type);
          const user = await authHelper.getRemoteUserJson(type, authTokenResponse);
          await authHelper.forward(req, res, type, user, authTokenResponse);
    Severity: Major
    Found in server/auth/oauth2.js and 2 other locations - About 1 hr to fix
    server/auth/oauth1a.js on lines 77..96
    server/auth/openid.js on lines 78..87

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

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

        try {
          await authHelper.verifyState(req, res, state);
          const tokenResponse = await getIdToken(code, type);
          const data = await decodeIdToken(type, tokenResponse);
          await authHelper.forward(req, res, type, data.user, data.tokenResponse);
    Severity: Major
    Found in server/auth/openid.js and 2 other locations - About 1 hr to fix
    server/auth/oauth1a.js on lines 77..96
    server/auth/oauth2.js on lines 63..72

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

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

      patch: function patch(url, obj, authToken) {
        return fetch(baseUrl + url, {
          method: 'PATCH',
          body: JSON.stringify(obj),
          headers: {
    Severity: Major
    Found in src/util/fetch.js and 2 other locations - About 1 hr to fix
    src/util/fetch.js on lines 42..51
    src/util/fetch.js on lines 53..62

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

    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 process has 45 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: Minor
    Found in server/controller/imageController.js - About 1 hr to fix

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

        post: function post(url, obj, authToken) {
          return fetch(baseUrl + url, {
            method: 'POST',
            body: JSON.stringify(obj),
            headers: {
      Severity: Major
      Found in src/util/fetch.js and 2 other locations - About 1 hr to fix
      src/util/fetch.js on lines 53..62
      src/util/fetch.js on lines 64..73

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

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

        put: function put(url, obj, authToken) {
          return fetch(baseUrl + url, {
            method: 'PUT',
            body: JSON.stringify(obj),
            headers: {
      Severity: Major
      Found in src/util/fetch.js and 2 other locations - About 1 hr to fix
      src/util/fetch.js on lines 42..51
      src/util/fetch.js on lines 64..73

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

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

      export default function tagHierarchyData(state = initialStateTagData, action) {
        switch (action.type) {
          case RESET:
            return initialStateTagData;
          case SET_TAG_HIERARCHY:
      Severity: Minor
      Found in src/redux/reducers/tagHierarchyData.js - About 1 hr to fix

        Function process has 43 lines of code (exceeds 25 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 1 hr to fix

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

          export const ensureNotArchiveDomain = (host) => {
            if (properties.server.archive && properties.server.archive.domain) {
              return host === properties.server.archive.domain;
            }
            return false;
          Severity: Major
          Found in server/logic/Archive.js and 1 other location - About 1 hr to fix
          server/logic/Archive.js on lines 11..16

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

          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 const ensureArchiveDomain = (host) => {
            if (properties.server.archive && properties.server.archive.domain) {
              return host !== properties.server.archive.domain;
            }
            return false;
          Severity: Major
          Found in server/logic/Archive.js and 1 other location - About 1 hr to fix
          server/logic/Archive.js on lines 18..23

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

          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 leave has 41 lines of code (exceeds 25 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 1 hr to fix

            Function visitorToken has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            const visitorToken = async (req, res) => {
              if (req.cookies.vistorToken) {
                const { vistorToken } = req.cookies;
                winston.loggers.get('application').debug(`FetchComponentData::vistorToken = ${vistorToken}`);
                const vistorRec = await visitorDao.getByVisitorId(vistorToken);
            Severity: Minor
            Found in server/util/fetchComponentData.js - About 1 hr 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 back has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const back = async (req, res) => {
              const { denied } = req.query;
              if (denied) {
                winston.loggers.get('application').debug('error: %j', req.query);
                res.redirect('/');
            Severity: Minor
            Found in server/auth/oauth1a.js - About 1 hr to fix

              Function updateUrl has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const updateUrl = rec => new Promise((resolve, reject) => {
                const url = rec.linkUrl;
                const httpGetCall = request.get({
                  url,
                  followAllRedirects: true,
              Severity: Minor
              Found in link-check-server/index.js - About 1 hr to fix

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

                export function setInfoMessage(infoMessage) {
                  const action = { type: SET_INFO_MESSAGE, infoMessage };
                  if (typeof infoMessage !== 'string') {
                    action.infoMessage = JSON.stringify(infoMessage);
                  }
                Severity: Major
                Found in src/redux/actions/feedback.js and 1 other location - About 1 hr to fix
                src/redux/actions/feedback.js on lines 24..30

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

                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 function setTempMessage(tempMessage) {
                  const action = { type: SET_TEMP_MESSAGE, tempMessage };
                  if (typeof tempMessage !== 'string') {
                    action.tempMessage = JSON.stringify(tempMessage);
                  }
                Severity: Major
                Found in src/redux/actions/feedback.js and 1 other location - About 1 hr to fix
                src/redux/actions/feedback.js on lines 16..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 65.

                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

                Severity
                Category
                Status
                Source
                Language