Showing 1,982 of 1,982 total issues
File index.js
has 4141 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
/*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
File flow.js
has 2874 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
/*:: declare var invariant; */
import type Parser from "../parser";
File index.js
has 2147 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
/*:: declare var invariant; */
import type { TokenType } from "../../tokenizer/types";
File expression.js
has 1967 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
// A recursive descent parser operates by defining functions for all
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence
Function helper
has a Cognitive Complexity of 244 (exceeds 5 allowed). Consider refactoring. Open
export function helper(babel, options) {
const FILE_NAME_VAR = "_jsxFileName";
const JSX_SOURCE_ANNOTATION_REGEX = /\*?\s*@jsxImportSource\s+([^\s]+)/;
const JSX_RUNTIME_ANNOTATION_REGEX = /\*?\s*@jsxRuntime\s+([^\s]+)/;
- 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
File statement.js
has 1765 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import * as N from "../types";
import { types as tt, type TokenType } from "../tokenizer/types";
import ExpressionParser from "./expression";
File helpers.js
has 1587 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import template from "@babel/template";
const helpers = Object.create(null);
Function helper
has 662 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function helper(babel, options) {
const FILE_NAME_VAR = "_jsxFileName";
const JSX_SOURCE_ANNOTATION_REGEX = /\*?\s*@jsxImportSource\s+([^\s]+)/;
const JSX_RUNTIME_ANNOTATION_REGEX = /\*?\s*@jsxRuntime\s+([^\s]+)/;
Function transformClass
has a Cognitive Complexity of 160 (exceeds 5 allowed). Consider refactoring. Open
export default function transformClass(
path: NodePath,
file: any,
builtinClasses: ReadonlySet<string>,
isLoose: boolean,
- 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
File index.js
has 1242 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
/*:: declare var invariant; */
import type { Options } from "../options";
File index.js
has 1223 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
/*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
File types.js
has 1100 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import type { SourceType } from "./options";
import type { Token } from "./tokenizer";
import type { SourceLocation } from "./util/location";
Function transformClass
has 532 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function transformClass(
path: NodePath,
file: any,
builtinClasses: ReadonlySet<string>,
isLoose: boolean,
File index.js
has 1053 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
/*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
Function _evaluate
has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring. Open
function _evaluate(path, state) {
if (!state.confident) return;
const { node } = path;
- 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
File core.js
has 1046 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import is from "../validators/is";
import isValidIdentifier from "../validators/isValidIdentifier";
import { isKeyword, isReservedWord } from "@babel/helper-validator-identifier";
Similar blocks of code found in 2 locations. Consider refactoring. Open
nodeType === "Flow" ||
"AnyTypeAnnotation" === nodeType ||
"ArrayTypeAnnotation" === nodeType ||
"BooleanTypeAnnotation" === nodeType ||
"BooleanLiteralTypeAnnotation" === nodeType ||
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 382.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
nodeType === "Statement" ||
"BlockStatement" === nodeType ||
"BreakStatement" === nodeType ||
"ContinueStatement" === nodeType ||
"DebuggerStatement" === nodeType ||
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 382.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Consider simplifying this complex logical expression. Open
if (
nodeType === "Flow" ||
"AnyTypeAnnotation" === nodeType ||
"ArrayTypeAnnotation" === nodeType ||
"BooleanTypeAnnotation" === nodeType ||
Function _generateImport
has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring. Open
_generateImport(opts, importName) {
const isDefault = importName === "default";
const isNamed = !!importName && !isDefault;
const isNamespace = importName === null;
- 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"