oglimmer/linky

View on GitHub

Showing 60 of 142 total issues

Function processRefresh has a Cognitive Complexity of 7 (exceeds 5 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: Minor
Found in server/auth/authHelper.js - About 35 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 ensureFilesOnCacheAndSecurity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  async ensureFilesOnCacheAndSecurity() {
    if (ensureArchiveDomain(this.req.headers.host)) {
      this.res.status(403).send(`Forbidden. Must use ${properties.server.archive.domain}`);
      return;
    }
Severity: Minor
Found in server/controller/archiveController.js - About 35 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

Avoid too many return statements within this function.
Open

  return null;
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

        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 sortingByColumnOrder * b.linkUrl.localeCompare(a.linkUrl);
          Severity: Major
          Found in src/components/UILinkList.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 currentFeedData;
              Severity: Major
              Found in server/controller/rssController.js - About 30 mins to fix

                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

                  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

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

                    const processUrlAndFavicon = async (rec) => {
                      let record = rec;
                      if (!hasTag(record.tags, LOCKED) && !hasTag(record.tags, ARCHIVE)) {
                        if (!hasTag(record.tags, BROKEN)) {
                          // nothing ;)
                    Severity: Minor
                    Found in link-check-server/index.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 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 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 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 purifyLink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const purifyLink = (link) => {
                      const noTrailingSlash = str => (str.endsWith('/') ? str.substr(0, str.length - 1) : str);
                      const noHttpProtocol = str => (str.startsWith('http://') ? str.substr('http://'.length) : str);
                      const noHttpsProtocol = str => (str.startsWith('https://') ? str.substr('https://'.length) : str);
                      const noProtocol = str => noHttpsProtocol(noHttpProtocol(str));
                    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 updateObjectEndDrag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const updateObjectEndDrag = (state, action) => {
                      if (!action.target) {
                        return {
                          dragInProgress: null,
                        };
                    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

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