dappros/ethora

View on GitHub
bots/raffle/api.js

Summary

Maintainability
F
5 days
Test Coverage

Identical blocks of code found in 6 locations. Consider refactoring.
Open

http.interceptors.response.use(undefined, error => {
    if (!error.response || error.response.status !== 401) {
        return Promise.reject(error)
    }

Severity: Major
Found in bots/raffle/api.js and 5 other locations - About 1 day to fix
bots/autoResponder/api.js on lines 43..66
bots/botTemplate/api.js on lines 43..66
bots/gptBot/api.js on lines 43..66
bots/merchantBot/api.js on lines 43..66
bots/translateBot/api.js on lines 43..66

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 204.

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

Further Reading

Identical blocks of code found in 6 locations. Consider refactoring.
Open

const refresh = () => {
    return new Promise((resolve, reject) => {
        http.post('/users/login/refresh', {}, {headers: {'Authorization': loginData.refreshToken}})
            .then(response => {
                loginData.token = response.data.token;
Severity: Major
Found in bots/raffle/api.js and 5 other locations - About 5 hrs to fix
bots/autoResponder/api.js on lines 29..41
bots/botTemplate/api.js on lines 29..41
bots/gptBot/api.js on lines 29..41
bots/merchantBot/api.js on lines 29..41
bots/translateBot/api.js on lines 29..41

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 136.

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

Further Reading

Identical blocks of code found in 6 locations. Consider refactoring.
Open

export const transferToken = async (tokenId, tokenName, amount, wallet) => {
    try {
        let test = await http.post('tokens/transfer', {
            tokenId: tokenId,
            tokenName: botOptions.botData.sendTokenName,
Severity: Major
Found in bots/raffle/api.js and 5 other locations - About 5 hrs to fix
bots/autoResponder/api.js on lines 68..88
bots/botTemplate/api.js on lines 68..87
bots/gptBot/api.js on lines 68..88
bots/merchantBot/api.js on lines 68..88
bots/translateBot/api.js on lines 68..87

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 135.

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

Further Reading

Identical blocks of code found in 6 locations. Consider refactoring.
Open

export const botLogin = async (username, password) => {
    try {
        const request = await http.post('users/login', {
            username: username,
            password: password
Severity: Major
Found in bots/raffle/api.js and 5 other locations - About 4 hrs to fix
bots/autoResponder/api.js on lines 10..27
bots/botTemplate/api.js on lines 10..27
bots/gptBot/api.js on lines 10..27
bots/merchantBot/api.js on lines 10..27
bots/translateBot/api.js on lines 10..27

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 131.

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

Further Reading

Identical blocks of code found in 6 locations. Consider refactoring.
Open

export const mintNft = async (contractAddress, slot, amount, walletAddress) => {
    try {
        let test = await http.post('tokens/items/nfmt/mint', {
            contractAddress: contractAddress,
            slot: slot,
Severity: Major
Found in bots/raffle/api.js and 5 other locations - About 4 hrs to fix
bots/autoResponder/api.js on lines 90..109
bots/botTemplate/api.js on lines 89..108
bots/gptBot/api.js on lines 90..109
bots/merchantBot/api.js on lines 90..109
bots/translateBot/api.js on lines 89..108

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 127.

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

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

export const saveApiData = async (data) => {
    try {
        let result = await http.post('data', data, {
            headers: {
                'Content-Type': 'application/json',
Severity: Major
Found in bots/raffle/api.js and 2 other locations - About 3 hrs to fix
bots/botTemplate/api.js on lines 119..133
bots/translateBot/api.js on lines 119..133

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 103.

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

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

export const getFilteredApiData = async (params) => {
    try {
        let result = await http.get('data', {params}, {
            headers: {
                'Content-Type': 'application/json',
Severity: Major
Found in bots/raffle/api.js and 2 other locations - About 3 hrs to fix
bots/botTemplate/api.js on lines 135..148
bots/translateBot/api.js on lines 135..148

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 97.

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

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

export const updateApiData = async (id, data) => {
    try {
        let result = await http.patch('data/' + id, data, {
            headers: {
                'Content-Type': 'application/json',
Severity: Major
Found in bots/raffle/api.js and 2 other locations - About 3 hrs to fix
bots/botTemplate/api.js on lines 165..178
bots/translateBot/api.js on lines 165..178

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 96.

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

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

export const deleteApiData = async (id) => {
    try {
        let result = await http.delete('data/' + id, {
            headers: {
                'Content-Type': 'application/json',
Severity: Major
Found in bots/raffle/api.js and 2 other locations - About 2 hrs to fix
bots/botTemplate/api.js on lines 150..163
bots/translateBot/api.js on lines 150..163

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 94.

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

Further Reading

Identical blocks of code found in 6 locations. Consider refactoring.
Open

export const getMintItemData = async (walletAddress) => {
    try {
        let itemData = await http.get('tokens/get/' + walletAddress);
        return itemData.data.results;
    } catch (error) {
Severity: Major
Found in bots/raffle/api.js and 5 other locations - About 1 hr to fix
bots/autoResponder/api.js on lines 111..118
bots/botTemplate/api.js on lines 110..117
bots/gptBot/api.js on lines 111..118
bots/merchantBot/api.js on lines 111..118
bots/translateBot/api.js on lines 110..117

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

Further Reading

There are no issues that match your filters.

Category
Status