dappros/ethora

View on GitHub

Showing 8,855 of 8,855 total issues

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

            <input
            type="file"
            name="file"
            id="file"
            onChange={(event) => sendFile(event.target.files[0], true)}
client-web/src/pages/ChatInRoom/Chat.tsx on lines 793..800

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

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

                  {differenceInHours(new Date(), new Date(message.date)) > 5
                    ? format(new Date(message.date), "h:mm a")
                    : formatDistance(
                        subDays(new Date(message.date), 0),
                        new Date(),
Severity: Major
Found in client-web/src/components/Chat/Messages/Message.tsx and 1 other location - About 1 hr to fix
client-web/src/components/Chat/Messages/MessageDefault.tsx on lines 103..105

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

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 router has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const router = (handlerData) => {
    handlerData.userStep = userSteps('getStep', handlerData.userJID);

    if (messageCheck(handlerData.message, 'close') || messageCheck(handlerData.message, 'leave')) {
        return leaveHandler(handlerData);
Severity: Minor
Found in bots/gptBot/router.js - About 1 hr to fix

Function sendMessage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const sendMessage = (button: any) => {
    if (myMessage.trim().length > 0) {
      let userAvatar = "";
      if (profile?.profileImage) {
        userAvatar = profile?.profileImage;
Severity: Minor
Found in client-web/src/pages/ChatInRoom/Chat.tsx - About 1 hr to fix

Function ChangeBackground has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ChangeBackground: React.FC<IChangeBackground> = ({}) => {
  const { roomJID } = useParams<{ roomJID: string }>();
  const [selectedIndex, setSelectedIndex] = useState(0);
  const {showSnackbar} = useSnackbar()
  const currentRoom = useStoreState((state) =>
Severity: Minor
Found in client-web/src/pages/ChatRoomDetails/ChangeBackground.tsx - About 1 hr to fix

Function registerUser has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const registerUser = async () => {
    const body = regularLoginEmail
      ? {
          firstName: firstname,
          lastName: lastname,
Severity: Minor
Found in client-reactnative/src/Screens/Login/RegisterScreen.tsx - About 1 hr to fix

Function replyComponent has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const replyComponent = () => {
    return currentMessage.isReply ? (
      <TouchableOpacity onPress={() => scrollToParentMessage(currentMessage)}>
        <HStack
          style={styles[position].replyWrapper}
Severity: Minor
Found in client-reactnative/src/components/Chat/MessageBubble.tsx - About 1 hr to fix

Function sendAttachment has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const sendAttachment = async () => {
    try {
      const res = await DocumentPicker.pick({
        type: [DocumentPicker.types.allFiles],
        copyTo: 'cachesDirectory',
Severity: Minor
Found in client-reactnative/src/Screens/Chat/ChatExperimental.tsx - About 1 hr to fix

Function InviteFriendsScreen has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const InviteFriendsScreen = observer(({}) => {
  const [index, setIndex] = useState(0);
  const layout = useWindowDimensions();

  const {loginStore} = useStores();
Severity: Minor
Found in client-reactnative/src/Screens/Account/InviteFriendsScreen.tsx - About 1 hr to fix

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

export const leaveHandler = (data) => {
    console.log('=> leaveHandler | Message received from ', data.receiver, data.message);
    userSteps('setStep', data.receiver, 1);
    return sendMessage(
        data,
Severity: Major
Found in bots/questionnaire/handlers/leave.js and 7 other locations - About 1 hr to fix
bots/autoResponder/handlers/leave.js on lines 4..15
bots/botTemplate/handlers/leave.js on lines 4..15
bots/gptBot/handlers/leave.js on lines 4..15
bots/huthut/handlers/frontTurnMe.js on lines 4..14
bots/huthut/handlers/leave.js on lines 4..14
bots/raffle/handlers/leave.js on lines 4..15
bots/translateBot/handlers/leave.js on lines 4..15

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

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

export const leaveHandler = (data) => {
    console.log('=> leaveHandler | Message received from ', data.userJID, data.message);
    userSteps('setStep', data.userJID, 1);

    return sendMessage(
Severity: Major
Found in bots/botTemplate/handlers/leave.js and 7 other locations - About 1 hr to fix
bots/autoResponder/handlers/leave.js on lines 4..15
bots/gptBot/handlers/leave.js on lines 4..15
bots/huthut/handlers/frontTurnMe.js on lines 4..14
bots/huthut/handlers/leave.js on lines 4..14
bots/questionnaire/handlers/leave.js on lines 4..14
bots/raffle/handlers/leave.js on lines 4..15
bots/translateBot/handlers/leave.js on lines 4..15

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

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 Rooms = new Schema({
    address: {type: String, required: true, index: true, unique: true},
    bot_name : {type: String},
    date_added: { type: Date, default: Date.now}
});
Severity: Major
Found in bots/raffle/database/models/rooms.js and 5 other locations - About 1 hr to fix
bots/autoResponder/database/models/rooms.js on lines 5..9
bots/botTemplate/database/models/rooms.js on lines 5..9
bots/gptBot/database/models/rooms.js on lines 5..9
bots/merchantBot/models/rooms.js on lines 5..9
bots/translateBot/database/models/rooms.js on lines 5..9

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

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 Rooms = new Schema({
    address: {type: String, required: true, index: true, unique: true},
    bot_name : {type: String},
    date_added: { type: Date, default: Date.now}
});
Severity: Major
Found in bots/autoResponder/database/models/rooms.js and 5 other locations - About 1 hr to fix
bots/botTemplate/database/models/rooms.js on lines 5..9
bots/gptBot/database/models/rooms.js on lines 5..9
bots/merchantBot/models/rooms.js on lines 5..9
bots/raffle/database/models/rooms.js on lines 5..9
bots/translateBot/database/models/rooms.js on lines 5..9

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

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

export const leaveHandler = (data) => {
    console.log('=> leaveHandler | Message received from ', data.userJID, data.message);
    userSteps('setStep', data.userJID, 1);

    return sendMessage(
Severity: Major
Found in bots/gptBot/handlers/leave.js and 7 other locations - About 1 hr to fix
bots/autoResponder/handlers/leave.js on lines 4..15
bots/botTemplate/handlers/leave.js on lines 4..15
bots/huthut/handlers/frontTurnMe.js on lines 4..14
bots/huthut/handlers/leave.js on lines 4..14
bots/questionnaire/handlers/leave.js on lines 4..14
bots/raffle/handlers/leave.js on lines 4..15
bots/translateBot/handlers/leave.js on lines 4..15

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

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

export const leaveHandler = (data) => {
    console.log('=> leaveHandler | Message received from ', data.userJID, data.message);
    userSteps('setStep', data.userJID, 1);

    return sendMessage(
Severity: Major
Found in bots/translateBot/handlers/leave.js and 7 other locations - About 1 hr to fix
bots/autoResponder/handlers/leave.js on lines 4..15
bots/botTemplate/handlers/leave.js on lines 4..15
bots/gptBot/handlers/leave.js on lines 4..15
bots/huthut/handlers/frontTurnMe.js on lines 4..14
bots/huthut/handlers/leave.js on lines 4..14
bots/questionnaire/handlers/leave.js on lines 4..14
bots/raffle/handlers/leave.js on lines 4..15

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

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 Rooms = new Schema({
    address: {type: String, required: true, index: true, unique: true},
    bot_name : {type: String},
    date_added: { type: Date, default: Date.now}
});
Severity: Major
Found in bots/gptBot/database/models/rooms.js and 5 other locations - About 1 hr to fix
bots/autoResponder/database/models/rooms.js on lines 5..9
bots/botTemplate/database/models/rooms.js on lines 5..9
bots/merchantBot/models/rooms.js on lines 5..9
bots/raffle/database/models/rooms.js on lines 5..9
bots/translateBot/database/models/rooms.js on lines 5..9

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

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 Rooms = new Schema({
    address: {type: String, required: true, index: true, unique: true},
    bot_name : {type: String},
    date_added: { type: Date, default: Date.now}
});
Severity: Major
Found in bots/merchantBot/models/rooms.js and 5 other locations - About 1 hr to fix
bots/autoResponder/database/models/rooms.js on lines 5..9
bots/botTemplate/database/models/rooms.js on lines 5..9
bots/gptBot/database/models/rooms.js on lines 5..9
bots/raffle/database/models/rooms.js on lines 5..9
bots/translateBot/database/models/rooms.js on lines 5..9

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

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

export const leaveHandler = (data) => {
    console.log('=> leaveHandler | Message received from ', data.userJID, data.message);
    userSteps('setStep', data.userJID, 1);

    return sendMessage(
Severity: Major
Found in bots/raffle/handlers/leave.js and 7 other locations - About 1 hr to fix
bots/autoResponder/handlers/leave.js on lines 4..15
bots/botTemplate/handlers/leave.js on lines 4..15
bots/gptBot/handlers/leave.js on lines 4..15
bots/huthut/handlers/frontTurnMe.js on lines 4..14
bots/huthut/handlers/leave.js on lines 4..14
bots/questionnaire/handlers/leave.js on lines 4..14
bots/translateBot/handlers/leave.js on lines 4..15

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

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

export const leaveHandler = (data) => {
    console.log('=> leaveHandler | Message received from ', data.userJID, data.message);
    userSteps('setStep', data.userJID, 1);

    return sendMessage(
Severity: Major
Found in bots/autoResponder/handlers/leave.js and 7 other locations - About 1 hr to fix
bots/botTemplate/handlers/leave.js on lines 4..15
bots/gptBot/handlers/leave.js on lines 4..15
bots/huthut/handlers/frontTurnMe.js on lines 4..14
bots/huthut/handlers/leave.js on lines 4..14
bots/questionnaire/handlers/leave.js on lines 4..14
bots/raffle/handlers/leave.js on lines 4..15
bots/translateBot/handlers/leave.js on lines 4..15

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

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

export const leaveHandler = (data) => {
    console.log('=> leaveHandler | Message received from ', data.receiver, data.message);
    userSteps('setStep', data.receiver, 1);
    return sendMessage(
        data,
Severity: Major
Found in bots/huthut/handlers/leave.js and 7 other locations - About 1 hr to fix
bots/autoResponder/handlers/leave.js on lines 4..15
bots/botTemplate/handlers/leave.js on lines 4..15
bots/gptBot/handlers/leave.js on lines 4..15
bots/huthut/handlers/frontTurnMe.js on lines 4..14
bots/questionnaire/handlers/leave.js on lines 4..14
bots/raffle/handlers/leave.js on lines 4..15
bots/translateBot/handlers/leave.js on lines 4..15

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

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