dappros/ethora

View on GitHub

Showing 8,855 of 8,855 total issues

Function userSteps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const userSteps = (type, jid, step, newData) => {
    //Get the index of the user in the array by his jid
    const userIndex = userStepsList.findIndex(user => user.name === jid);

    //If the user with the specified jid is not found, create a new data object for him.
Severity: Minor
Found in bots/raffle/actions.js - About 35 mins to fix

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 userSteps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const userSteps = (type, jid, step, newData) => {
    //Get the index of the user in the array by his jid
    const userIndex = userStepsList.findIndex(user => user.name === jid);

    //If the user with the specified jid is not found, create a new data object for him.
Severity: Minor
Found in bots/botTemplate/actions.js - About 35 mins to fix

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 sendMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const sendMessage = (data, message, type, isSystemMessage, tokenAmount) => {
    data.xmpp.send(xml('message', {
        to: data.stanzaId ? data.stanzaId.attrs.by : data.receiver,
        type: data.receiverData ? 'groupchat' : type,
        id: "sendMessage"
Severity: Minor
Found in bots/huthut/actions.js - About 35 mins to fix

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 helloMessageHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const helloMessageHandler = (data) => {
    console.log('=> helloMessageHandler || Message received from ', data.userJID, data.message);
    userData('setData', data.userJID, '', 'deleteItem');

    getUserData(data.userJID).then(userData => {
Severity: Minor
Found in bots/merchantBot/handlers/helloMessage.js - About 35 mins to fix

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 errorHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const errorHandler = (data) => {
    console.log('=> errorHandler | Message received from ', data.receiver, data.message);
    if (data.userStep === 2) {
        if(data.receiverData.attrs.isSystemMessage){
            return sendMessage(
Severity: Minor
Found in bots/huthut/handlers/error.js - About 35 mins to fix

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 userSteps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const userSteps = (type, jid, step, newData) => {
    //Get the index of the user in the array by his jid
    const userIndex = userStepsList.findIndex(user => user.name === jid);

    //If the user with the specified jid is not found, create a new data object for him.
Severity: Minor
Found in bots/autoResponder/actions.js - About 35 mins to fix

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 userSteps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const userSteps = (type, jid, step, newData) => {
    //Get the index of the user in the array by his jid
    const userIndex = userStepsList.findIndex(user => user.name === jid);

    //If the user with the specified jid is not found, create a new data object for him.
Severity: Minor
Found in bots/translateBot/actions.js - About 35 mins to fix

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 UsernameSignUpForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function UsernameSignUpForm(props: TProps) {
  const history = useHistory();
  const setUser = useStoreState((state) => state.setUser);

  const [showPassword, setShowPassword] = useState(false);
Severity: Minor
Found in client-web/src/pages/Signon/UsernameSignUpForm.tsx - About 35 mins to fix

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 Referrals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Referrals: React.FC<IReferrals> = ({}) => {
  const link = useStoreState((state) => state.user._id);
  const walletAddress = useStoreState((state) => state.user.walletAddress);

  const setBalance = useStoreState((state) => state.setBalance);
Severity: Minor
Found in client-web/src/pages/Referrals/Referrals.tsx - About 35 mins to fix

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 EmailSingInForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function EmailSingInForm(props: TProps) {
  const history = useHistory();
  const setUser = useStoreState((state) => state.setUser);
  const [disable, setDisable] = useState(false);
  const [showPassword, setShowPassword] = useState(false);
Severity: Minor
Found in client-web/src/pages/Signon/EmailSignInForm.tsx - About 35 mins to fix

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 EmailSignUpForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function EmailSignUpForm(props: TProps) {
  const [showPassword, setShowPassword] = useState(false);
  const [openSnack, setOpenSnack] = useState(false);
  const [errorMsg, setErrorMsg] = useState("");
  const history = useHistory();
Severity: Minor
Found in client-web/src/pages/Signon/EmailSignUpForm.tsx - About 35 mins to fix

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 UsernameSignInForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function UsernameSignInForm(props: TProps) {
  const setUser = useStoreState((state) => state.setUser);
  const history = useHistory();
  const formik = useFormik({
    initialValues: {
Severity: Minor
Found in client-web/src/pages/Signon/UsernameSignInForm.tsx - About 35 mins to fix

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 TransactionsList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  ({transactions, walletAddress, onEndReached}: TransactionListProps) => {
    const [activeFilter, setActiveFilter] = useState(FILTERS.all);
    const getFilteredTransactions = () => {
      if (activeFilter === FILTERS.all) {
        return transactions;
Severity: Minor
Found in client-reactnative/src/components/Transactions/TransactionsList.tsx - About 35 mins to fix

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 OtherUserProfileScreen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const OtherUserProfileScreen = observer(({route}: ScreenProps) => {
  const {loginStore, walletStore, apiStore, chatStore, otherUserStore} =
    useStores();
  const navigation = useNavigation<HomeStackNavigationProp>();

Severity: Minor
Found in client-reactnative/src/Screens/Profile/OtherUserProfileScreen.tsx - About 35 mins to fix

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 loginOrRegisterSocialUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const loginOrRegisterSocialUser = async (
  user: any,

  defaultToken: string,
  loginUser: any,
Severity: Minor
Found in client-reactnative/src/helpers/login/socialLoginHandle.ts - About 35 mins to fix

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 ProfileModal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const ProfileModal = (props: ProfileModalProps) => {
  const {
    isVisible,
    onBackdropPress,
    modalType,
Severity: Minor
Found in client-reactnative/src/components/Modals/Profile/ProfileModal.tsx - About 35 mins to fix

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 DocumentHistoryScreen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const DocumentHistoryScreen = ({route, navigation}: ScreenProps) => {
  const {item, userWalletAddress} = route.params;

  const {loginStore, walletStore} = useStores();

Severity: Minor
Found in client-reactnative/src/Screens/Profile/DocumentHistoryScreen.tsx - About 35 mins to fix

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

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

        return botOptions.botData.firstName + ' ' + botOptions.botData.lastName + ' -> ' + amount + ' ' + itemName + ' -> ' + " " + victoryUserName;
Severity: Minor
Found in bots/raffle/handlers/helpers/messagingTimeout.js and 1 other location - About 35 mins to fix
bots/raffle/handlers/transferItemHandler.js on lines 39..39

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

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 8 locations. Consider refactoring.
Open

const buildRegEx = (str, keywords) => {
    return new RegExp("(?=.*?\\b" +
        keywords
            .split(" ")
            .join(")(?=.*?\\b") +
Severity: Major
Found in bots/gptBot/actions.js and 7 other locations - About 35 mins to fix
bots/autoResponder/actions.js on lines 127..135
bots/botTemplate/actions.js on lines 127..135
bots/huthut/actions.js on lines 50..58
bots/merchantBot/actions.js on lines 119..127
bots/questionnaire/actions.js on lines 48..56
bots/raffle/actions.js on lines 127..135
bots/translateBot/actions.js on lines 127..135

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

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 8 locations. Consider refactoring.
Open

const buildRegEx = (str, keywords) => {
    return new RegExp("(?=.*?\\b" +
        keywords
            .split(" ")
            .join(")(?=.*?\\b") +
Severity: Major
Found in bots/merchantBot/actions.js and 7 other locations - About 35 mins to fix
bots/autoResponder/actions.js on lines 127..135
bots/botTemplate/actions.js on lines 127..135
bots/gptBot/actions.js on lines 127..135
bots/huthut/actions.js on lines 50..58
bots/questionnaire/actions.js on lines 48..56
bots/raffle/actions.js on lines 127..135
bots/translateBot/actions.js on lines 127..135

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

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

Severity
Category
Status
Source
Language