TelescopeJS/Telescope

View on GitHub

Showing 10 of 26 total issues

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

module.exports = function github(telescope) {
  // telescope
  const defaultPlugin = telescope.defaultPlugin
  return {
    condition(url) {
Severity: Minor
Found in src/core/plugins/github.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 handle has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function handle(query, req, res, next) {
  // '/pdf' | '/img'
  const {
    style,
    hlStyle,
Severity: Major
Found in src/server/route.js - About 2 hrs to fix

    Function github has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function github(telescope) {
      // telescope
      const defaultPlugin = telescope.defaultPlugin
      return {
        condition(url) {
    Severity: Minor
    Found in src/core/plugins/github.js - About 2 hrs to fix

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

      async function saveImg(url, key, options = {}) {
        const browser = await puppeteer.launch({ timeout: 100000, args: ['--no-sandbox', '--disable-setuid-sandbox'] })
        const page = await browser.newPage()
        await page.goto(url, { waitUntil: 'networkidle2', timeout: 100000 })
        // await page.waitFor('img')
      Severity: Minor
      Found in src/server/headless.js - About 1 hr to fix

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

          async see(url) {
            const matchedPlugin = this.plugins.find(plugin =>
              plugin.condition(url)
            )
        
        
        Severity: Minor
        Found in src/core/index.js - About 1 hr to fix

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

            render() {
              return (
                <div>
                  {(
                     this.local.inputVisible || this.local.styleSelectVisible
          Severity: Minor
          Found in src/client/ViewModel/App/View.js - About 1 hr to fix

            Function fetch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async fetch(url) {
                  // NOTE: parse-github-url use cache
                  const obj = { ...parseGithub(url) }
                  let response
                  // console.error(obj)
            Severity: Minor
            Found in src/core/plugins/github.js - About 1 hr to fix

              Function markdown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default async function markdown(markdown, options = {}) {
                const {
                  markdownItOptions = {},
                  fromUrl           = '',
                  transformers      = [],
              Severity: Minor
              Found in src/core/utils/markdown.js - About 1 hr to fix

                Function see has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  async see(url) {
                    const matchedPlugin = this.plugins.find(plugin =>
                      plugin.condition(url)
                    )
                
                
                Severity: Minor
                Found in src/core/index.js - About 55 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 wrappedFetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export default async function wrappedFetch(url, ...args) {
                  const response = await fetch(url, ...args)
                  // normalizeHeaders(response)
                  let type
                  let val = response.headers.get('content-type')
                Severity: Minor
                Found in src/core/utils/fetch.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

                Severity
                Category
                Status
                Source
                Language