Showing 1,401 of 1,401 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
export async function forDeployedArtifact(
artifact: Artifact,
settings: DecoderSettings
): Promise<ContractInstanceDecoder> {
let contractDecoder = await forArtifact(artifact, settings);
- 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 74.
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 async function forDeployedArtifact(
artifact: Artifact,
settings: EncoderSettings
): Promise<ContractInstanceEncoder> {
let contractEncoder = await forArtifact(artifact, settings);
- 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 74.
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 const { UnsupportedConstantError } = createCodecComponent(
"UnsupportedConstantError",
({ kind, definition }: Format.Errors.UnsupportedConstantError) => (
<CodecError kind={kind}>{definition.name}</CodecError>
)
- 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 74.
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
Function decodeLog
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function* decodeLog() {
const userDefinedTypes = yield select(data.views.userDefinedTypes);
const state = yield select(data.current.state); //note: this includes the data to be decoded!
const allocations = yield select(data.info.allocations);
const contexts = yield select(data.views.contexts);
Function fromBuildInfo
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fromBuildInfo = (
buildInfo: Hardhat.BuildInfo
): CompiledContract[] => {
const contracts = [];
for (const [sourcePath, sourceContracts] of Object.entries(
Function Layout
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Layout(): JSX.Element {
const {
state: { notice, analyticsConfig },
operations: { updateAnalyticsConfig }
} = useDash()!;
Function processDeploymentError
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async processDeploymentError(data) {
const error = data.estimateError || data.error;
data.reason = data.error ? data.error.reason : 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"
Further reading
Function exports
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
module.exports = fn => {
// Add our static methods
// Add something here about excluding send, privately defined methods
Object.keys(fn._constructorMethods).forEach(function (key) {
fn[key] = fn._constructorMethods[key].bind(fn);
- 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 start
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
start: async function (context, web3Error) {
const constructor = this;
let currentBlock = override.defaultMaxBlocks;
// Reject after attempting to get reason string if we shouldn't be waiting.
- 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 printVariables
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async printVariables(sectionOuts = this.sectionPrintouts) {
const values = await this.session.variables();
const sections = this.session.view(data.current.identifiers.sections);
const sectionNames = {
- 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 printInstruction
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
printInstruction(locations = this.locationPrintouts) {
const instruction = this.session.view(sourcemapping.current.instruction);
const instructions = this.session.view(sourcemapping.current.instructions);
const step = this.session.view(trace.step);
const traceIndex = this.session.view(trace.index);
- 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 scopes
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function scopes(state = DEFAULT_SCOPES, action) {
switch (action.type) {
case actions.SCOPE: {
const { sourceId, id, sourceIndex, parentId, pointer } = action;
const astRef = id !== undefined ? id : makePath(sourceIndex, pointer);
Function flattedEvents
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
flattedEvents: createLeaf(["./transactionLog"], log => {
const returnStatus = node => {
switch (node.returnKind) {
case "revert":
return false;
Function rejectHijacker
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function rejectHijacker(e) {
debug("hijacking!");
debug("hash: %s", this.txHash);
let getSolidityStackTrace;
if (bugger && this.txHash) {
Function exports
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = async function (options) {
const Config = require("@truffle/config");
const OS = require("os");
const log = options.logger
Function printState
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
printState(
contextBefore = 2,
contextAfter = 0,
location = this.session.view(controller.current.location)
) {
Function process
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function* process<
Network extends Pick<Resource<"networks">, "id" | keyof Input<"networks">>
>(options: { network: IdObject<"networks"> }): Process<Network | undefined> {
const {
network: { id }
Similar blocks of code found in 2 locations. Consider refactoring. Open
module.exports = {
moduleFileExtensions: ["ts", "js", "json", "node"],
testEnvironment: "node",
transform: {
"^.+\\.ts$": "ts-jest"
- 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 72.
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
module.exports = {
moduleFileExtensions: ["ts", "js", "json", "node"],
testEnvironment: "node",
transform: {
"^.+\\.ts$": "ts-jest"
- 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 72.
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 5 locations. Consider refactoring. Open
nameRecord: {
resolve: async ({ nameRecord: { id } }, _, { workspace }) => {
debug("Resolving ProjectName.nameRecord...");
const result = await workspace.get("nameRecords", id);
- 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 72.
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