Showing 21 of 57 total issues
File __helpers.js
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
const figlet = require('figlet');
const chalk = require('chalk');
const path = require('path');
const fs = require('fs');
const handlebars = require('handlebars');
Function askQuestions
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function askQuestions() {
const questions = [
{
name: 'filename',
type: 'input',
Function mergeObjects
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export function mergeObjects(...args) {
const dst = {};
let src;
let p;
const aargs = [].splice.call(args, 0);
- 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 webpack
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
webpack: (config, { dev, isServer }) => {
const prod = !dev;
config.plugins.push(new Dotenv({ path: './public.env' }));
config.plugins.push(new IgnorePlugin(/^\.\/locale$/, /moment$/));
- 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 askQuestions
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function askQuestions() {
const questions = [
{
name: 'filename',
type: 'input',
Function askQuestions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function askQuestions() {
const questions = [
{
name: 'filename',
type: 'input',
- 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 askQuestions
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function askQuestions() {
const questions = [
{
name: 'filename',
type: 'list',
Function AuthFields
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AuthFields = (props: Props) => {
const {
selectFields,
fields,
handleTouch,
Function getInitialProps
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async getInitialProps(ctx: Context) {
let apolloState = {};
let serverState = {};
const headers = ctx.req ? ctx.req.headers : {};
Function handleSubmit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSubmit(e: SyntheticEvent<HTMLButtonElement>, valuesPack) {
e.preventDefault();
// reset state
this.setState({
Function askQuestions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function askQuestions() {
const questions = [
{
name: 'filename',
type: 'input',
- 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 render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const fields = this.formFields;
// Packing all the necessary auth field states
const valuesPack = {};
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const fields = this.formFields;
// Packing all the necessary auth field states
const valuesPack = {};
Function afterPageCreation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function afterPageCreation(filename, prettyurl = null) {
process.stdout.write('\n');
process.stdout.write(`New Page ${filename} is created and ready!`);
process.stdout.write('\n');
if (prettyurl) {
Function askQuestions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function askQuestions() {
const questions = [
{
name: 'filename',
type: 'input',
Function getFilesOnDir
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
modules.getFilesOnDir = function getFilesOnDir(startPath) {
if (!fs.existsSync(startPath)) {
return [];
}
- 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 askQuestions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function askQuestions() {
const questions = [
{
name: 'filename',
type: 'input',
- 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
Avoid deeply nested control flow statements. Open
if (toString.call(src[p]) === '[object Object]') {
dst[p] = mergeObjects(dst[p] || {}, src[p]);
} else {
dst[p] = src[p];
}
Function addTexttoFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
filePath,
from,
text,
cb,
before = true
Function PostList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const PostList = ({ data, loadMorePosts }: Props) => {
if (data.allPosts && data.allPosts.length) {
const areMorePosts = data.allPosts.length < data._allPostsMeta.count;
return (
<Main>
- 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"