dappros/ethora

View on GitHub

Showing 8,855 of 8,855 total issues

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

export const showInfo = (title: string, subtitle: string) => {
  Toast.show({
    type: 'info',
    text1: title,
    text2: subtitle,
Severity: Major
Found in client-reactnative/src/components/Toast/toast.ts and 2 other locations - About 1 hr to fix
client-reactnative/src/components/Toast/toast.ts on lines 23..30
client-reactnative/src/components/Toast/toast.ts on lines 39..46

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

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

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

  if (loading) {
    return (
      <div
        className="dashboard-graph"
        style={{
Severity: Major
Found in client-web/src/pages/Dashboard/TransactionsGraph.tsx and 1 other location - About 1 hr to fix
client-web/src/pages/Dashboard/UsersGraph.tsx on lines 48..61

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

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

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

  if (loading) {
    return (
      <div
        className="dashboard-graph"
        style={{
Severity: Major
Found in client-web/src/pages/Dashboard/UsersGraph.tsx and 1 other location - About 1 hr to fix
client-web/src/pages/Dashboard/TransactionsGraph.tsx on lines 43..56

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

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

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

export const showError = (title: string, subtitle: string) => {
  Toast.show({
    type: 'error',
    text1: title,
    text2: subtitle,
Severity: Major
Found in client-reactnative/src/components/Toast/toast.ts and 2 other locations - About 1 hr to fix
client-reactnative/src/components/Toast/toast.ts on lines 31..38
client-reactnative/src/components/Toast/toast.ts on lines 39..46

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

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

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

  imageContainer: {
    width: wp('60%'),
    height: wp('40%'),
    borderRadius: 10,
    borderWidth: 1,
client-reactnative/src/Screens/Profile/NftItemHistoryScreen.tsx on lines 354..362
client-reactnative/src/components/NftMediaModal.tsx on lines 161..169

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

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

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    validate: (values) => {
      const errors: Record<string, string> = {};

      if (!values.appName) {
        errors.appName = "Required";
Severity: Major
Found in client-web/src/pages/Owner/NewAppModal.tsx and 3 other locations - About 1 hr to fix
client-web/src/pages/CreateApp/index.tsx on lines 26..34
client-web/src/pages/Owner/EditAppModal.tsx on lines 43..51
client-web/src/pages/Profile/TransferItemsModal.tsx on lines 37..45

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

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

Function startMint has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const startMint = (data) => {
    console.log('=> startMint | Message received from ', data.userJID, data.message);
    getMintItemData(data.receiverData.attrs.contractAddress).then(itemsData => {
        console.log('GET MINT ITEM DATA => ', itemsData)

Severity: Minor
Found in bots/merchantBot/handlers/startMint.js - About 1 hr 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 router has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const router = (handlerData) => {
    const roomMuteIndex = muteRoomList.indexOf(handlerData.roomJID)

    if(roomMuteIndex > -1){
        if (messageCheck(handlerData.message, 'start translate') ||
Severity: Minor
Found in bots/translateBot/router.js - About 1 hr 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 generateMessage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const generateMessage = (data, message, isSystemMessage, noName) => {
    let userName;
    let finalMessage;

    //Getting username
Severity: Minor
Found in bots/raffle/actions.js - About 1 hr 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 Visibility has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const Visibility: React.FC<VisibilityProps> = ({ handleChangeTab }) => {
  const updateUserProfilePermission = useStoreState(
    (state) => state.updateUserProfilePermission
  );
  const updateUserDocumentsPermission = useStoreState(
Severity: Minor
Found in client-web/src/pages/Privacy/VisibilityTab.tsx - About 1 hr 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 DocumentsCreateModal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function DocumentsCreateModal(props: TProps) {
  const [loading, setLoading] = React.useState(false);

  const formik = useFormik({
    initialValues: {
Severity: Minor
Found in client-web/src/pages/Profile/DocumentsCreateModal.tsx - About 1 hr 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 UserCard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function UserCard({ profile, walletAddress }: TProps) {
  const [edit, setEdit] = useState(false);
  const user = useStoreState((state) => state.user);
  const [showQrModal, setShowQrModal] = useState(false);

Severity: Minor
Found in client-web/src/pages/Profile/UserCard.tsx - About 1 hr 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 QRCodeGenerator has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const QRCodeGenerator = (props: QRCodeGeneratorProps) => {
  const svg = useRef(null);
  const {apiStore} = useStores();
  const {shareKey, close} = props;

Severity: Minor
Found in client-reactnative/src/components/QRCodeGenerator.tsx - About 1 hr 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 timerId has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    let timerId = setInterval(() => {
        const currentTime = new Date();

        let timeDifference = Math.abs(addedTime.getTime() - currentTime.getTime());
        let differenceUnMinutes = (timeDifference / 1000) / 60;
Severity: Minor
Found in bots/raffle/handlers/helpers/messagingTimeout.js - About 1 hr to fix

Function messages has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const messages = () => {
    return {
        general: {
            welcomeMessage: 'Hey! Questionnaire  Bot launched',
            botStatusOnline: 'Questionnaire bot Online',
Severity: Minor
Found in bots/questionnaire/config/messages.js - About 1 hr to fix

Function startMint has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const startMint = (data) => {
    console.log('=> startMint | Message received from ', data.userJID, data.message);
    getMintItemData(data.receiverData.attrs.contractAddress).then(itemsData => {
        console.log('GET MINT ITEM DATA => ', itemsData)

Severity: Minor
Found in bots/merchantBot/handlers/startMint.js - About 1 hr to fix

Function transferItemHandler has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const transferItemHandler = (data) => {
    logCurrentHandler('transferItemHandler', data.userJID, data.message);
    getBalance().then(result => {
        const randomItem = getRandomNFT(result)[0];
        if (randomItem) {
Severity: Minor
Found in bots/raffle/handlers/transferItemHandler.js - About 1 hr to fix

Function CustomMessageInput has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CustomMessageInput = (props: CustomMessageInputProps) => {

    const {
        onPaste,
        placeholder,
Severity: Minor
Found in client-web/src/components/Chat/Threads/CustomMessageInput.tsx - About 1 hr to fix

Function updateAcl has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const updateAcl = async () => {
    setLoading(true);
    try {
      const filteredApplication = Object.fromEntries(
        Object.entries(userAcl!.result!.application).map((item) => {
Severity: Minor
Found in client-web/src/components/EditAcl.tsx - About 1 hr to fix

Function fetchOtherUserWalletBalance has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async fetchOtherUserWalletBalance(
    walletAddress: string,
    token: string,
    linkToken?: string,
  ) {
Severity: Minor
Found in client-reactnative/src/stores/walletStore.ts - About 1 hr to fix
Severity
Category
Status
Source
Language