Showing 1,982 of 1,982 total issues
Function readToken_lt_gt
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
readToken_lt_gt(code: number): void {
// '<>'
const next = this.input.charCodeAt(this.state.pos + 1);
let size = 1;
Function frame
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((line, index) => {
const number = start + 1 + index;
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
const gutter = ` ${paddedNumber} | `;
const hasMarker = markerLines[number];
Function isScopable
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function isScopable(node: ?Object, opts?: Object): boolean {
if (!node) return false;
const nodeType = node.type;
if (
Function mark
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
mark(
generatedLine: number,
generatedColumn: number,
line: number,
column: number,
Function normalizeBabelParseConfig
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function normalizeBabelParseConfig(options) {
const parseOptions = {
sourceType: options.sourceType,
filename: options.filePath,
...options.babelOptions,
Function parse
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parse(input: string, options?: Options): File {
if (options?.sourceType === "unambiguous") {
options = {
...options,
};
Function readToken_numberSign
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
readToken_numberSign(): void {
if (this.state.pos === 0 && this.readToken_interpreter()) {
return;
}
Function result
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const result = this.tsTryParseAndCatch(() => {
if (!noCalls && this.atPossibleAsyncArrow(base)) {
// Almost certainly this is a generic async function `async <T>() => ...
// But it might be a call with a type argument `async<T>();`
const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(
Function parseObjectProperty
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseObjectProperty(
prop: N.ObjectProperty,
startPos: ?number,
startLoc: ?Position,
isPattern: boolean,
Function parseAwait
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseAwait(): N.AwaitExpression {
const node = this.startNode();
this.next();
Function parseExportDefaultExpression
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseExportDefaultExpression(): N.Expression | N.Declaration {
const expr = this.startNode();
const isAsync = this.isAsyncFunction();
Function buildExportInitializationStatements
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildExportInitializationStatements(
programPath: NodePath,
metadata: ModuleMetadata,
loose: boolean = false,
) {
Function extractComputedKeys
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function extractComputedKeys(ref, path, computedPaths, file) {
const declarations = [];
const state = {
classBinding: path.node.id && path.scope.getBinding(path.node.id.name),
file,
Function Binary
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Binary(node: Object, parent: Object): boolean {
if (
node.operator === "**" &&
t.isBinaryExpression(parent, { operator: "**" })
) {
Function registerBinding
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerBinding(kind: string, path: NodePath, bindingPath = path) {
if (!kind) throw new ReferenceError("no `kind`");
if (path.isVariableDeclaration()) {
const declarators: Array<NodePath> = path.get("declarations");
Function buildRuntimeRewritePlugin
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildRuntimeRewritePlugin(runtimeName, relativePath, helperName) {
function adjustImportPath(node, relativePath) {
node.value =
helpers.list.indexOf(node.value) !== -1
? `./${node.value}`
Function ReferencedIdentifier
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
ReferencedIdentifier(path, state) {
// Don't hoist regular JSX identifiers ('div', 'span', etc).
// We do have to consider member expressions for hoisting (e.g. `this.component`)
if (
path.isJSXIdentifier() &&
Function compile
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compile(code, filename) {
// merge in base options and resolve all the plugins and presets relative to this file
const opts = new OptionManager().init(
// sourceRoot can be overwritten
{
Identical blocks of code found in 2 locations. Consider refactoring. Open
return () => {
return id
.split(".")
.map(name => t.identifier(name))
.reduce((object, property) => t.memberExpression(object, property));
- 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 59.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
const createIdentifierParser = (id: string) => () => {
return id
.split(".")
.map(name => t.identifier(name))
.reduce((object, property) => t.memberExpression(object, property));
- 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 59.
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