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) {
- Read upRead up
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,
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) {
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)
)
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')
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div>
{(
this.local.inputVisible || this.local.styleSelectVisible
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)
Function markdown
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function markdown(markdown, options = {}) {
const {
markdownItOptions = {},
fromUrl = '',
transformers = [],
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)
)
- Read upRead up
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')
- Read upRead up
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"