fkanout/medium-read-cli

View on GitHub

Showing 4 of 4 total issues

Function mediumModule has 142 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const mediumModule = (() => {
  const postsList = []
  const postsListContent = []
  let spinner
  let topic
Severity: Major
Found in lib/index.js - About 5 hrs to fix

    Function mediumModule has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    const mediumModule = (() => {
      const postsList = []
      const postsListContent = []
      let spinner
      let topic
    Severity: Minor
    Found in lib/index.js - About 3 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 print has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const print = async (msg, type) => {
        switch (type) {
          case 8:
            log(chalk.bgRgb(100, 100, 100).inverse(msg))
            break
    Severity: Minor
    Found in lib/index.js - About 1 hr to fix

      Function getMoreArticles has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const getMoreArticles = async () => {
          log()
          spinner = ora(chalk.blueBright(constants.TEXT.MSG_LOADING_ARTICLES)).start()
          page += 1
          const dirtyResponse = await request({
      Severity: Minor
      Found in lib/index.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language