Showing 1,982 of 1,982 total issues
Function parseClassMemberWithIsStatic
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseClassMemberWithIsStatic(
classBody: N.ClassBody,
member: N.ClassMember,
state: { hadConstructor: boolean },
isStatic: boolean,
Function hoistFunctionEnvironment
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
function hoistFunctionEnvironment(
fnPath,
specCompliant = false,
allowInsertArrow = true,
) {
Function run
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run(task) {
const {
actual,
expect: expected,
exec,
Consider simplifying this complex logical expression. Open
if (
nodeType === "BlockParent" ||
"BlockStatement" === nodeType ||
"CatchClause" === nodeType ||
"DoWhileStatement" === nodeType ||
Function loadFullConfig
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default gensync<[any], ResolvedConfig | null>(function* loadFullConfig(
inputOpts: mixed,
): Handler<ResolvedConfig | null> {
const result = yield* loadPrivatePartialConfig(inputOpts);
if (!result) {
Function OptionalCallExpression|OptionalMemberExpression
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
"OptionalCallExpression|OptionalMemberExpression"(path) {
const { scope } = path;
// maybeParenthesized points to the outermost parenthesizedExpression
// or the path itself
let maybeParenthesized = path;
Function removeTypeDuplicates
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export default function removeTypeDuplicates(
nodes: Array<Object>,
): Array<Object> {
const generics = {};
const bases = {};
- 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 default
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export default function (
_: any,
{ corejs, include, exclude, polyfillTargets, debug }: InternalPluginOptions,
) {
const polyfills = filterItems(
- 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 completionRecordForSwitch
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function completionRecordForSwitch(cases, paths) {
let isLastCaseWithConsequent = true;
for (let i = cases.length - 1; i >= 0; i--) {
const switchCase = cases[i];
- 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 getBindingIdentifierPaths
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export function getBindingIdentifierPaths(
duplicates?: boolean = false,
outerOnly?: boolean = false,
): { [string]: NodePath } {
const path = this;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
export function isLoop(node: ?Object, opts?: Object): boolean {
if (!node) return false;
const nodeType = node.type;
if (
- 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 133.
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
export function isTSTypeElement(node: ?Object, opts?: Object): boolean {
if (!node) return false;
const nodeType = node.type;
if (
- 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 133.
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
File estree.js
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import { types as tt, TokenType } from "../tokenizer/types";
import type Parser from "../parser";
import type { ExpressionErrors } from "../parser/util";
Function readTmplToken
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
readTmplToken(): void {
let out = "",
chunkStart = this.state.pos,
containsInvalid = false;
for (;;) {
- 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 getBindingIdentifiers
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export default function getBindingIdentifiers(
node: Object,
duplicates?: boolean,
outerOnly?: boolean,
): { [string]: Object | Array<Object> } {
- 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 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { declare } from "@babel/helper-plugin-utils";
import { addDefault, isModule } from "@babel/helper-module-imports";
import { types as t } from "@babel/core";
import getCoreJS2Definitions from "./runtime-corejs2-definitions";
Function buildRollup
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildRollup(packages) {
const sourcemap = process.env.NODE_ENV === "production";
const minify = !!process.env.IS_PUBLISH;
return Promise.all(
packages.map(
File index.js
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { declare } from "@babel/helper-plugin-utils";
import syntaxTypeScript from "@babel/plugin-syntax-typescript";
import { types as t, template } from "@babel/core";
import { injectInitialization } from "@babel/helper-create-class-features-plugin";
Function enter
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
enter(path, state) {
if (hasJSX(path)) {
const { file } = state;
let runtime = RUNTIME_DEFAULT;
Consider simplifying this complex logical expression. Open
if (
nodeType === "Immutable" ||
"StringLiteral" === nodeType ||
"NumericLiteral" === nodeType ||
"NullLiteral" === nodeType ||