pesto-students/batch-11-relayer

View on GitHub

Showing 49 of 49 total issues

Function TaskHistory has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TaskHistory = () => {
  const [taskHistory, setTaskHistory] = useState([]);
  const [relays, setRelays] = useState([]);

  const getTaskHistory = async () => {
Severity: Minor
Found in client/src/components/Dashboard/TaskHistory/TaskHistory.js - About 1 hr to fix

    Function SlackActionPerformer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    const SlackActionPerformer = async (relayId, action, triggerEvent) => {
      for (const slackEvent of IntegrationConfig.Slack.Events) {
        if (slackEvent.EventName === action.event) {
          const authDetails = await getCredentialsFromAuthedApps(action.authentication);
          const token = authDetails.authToken;
    Severity: Minor
    Found in server/thirdparty/controller/SlackActionPerformer.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 Form has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Form = (props) => {
      const refs = [];
      const onSubmit = (event) => {
        props.onClick(event, ...refs);
        props.history.push('/dashboard');
    Severity: Minor
    Found in client/src/components/common/Form.js - About 1 hr to fix

      Function SlackActionPerformer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const SlackActionPerformer = async (relayId, action, triggerEvent) => {
        for (const slackEvent of IntegrationConfig.Slack.Events) {
          if (slackEvent.EventName === action.event) {
            const authDetails = await getCredentialsFromAuthedApps(action.authentication);
            const token = authDetails.authToken;
      Severity: Minor
      Found in server/thirdparty/controller/SlackActionPerformer.js - About 1 hr to fix

        Function createPages has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const createPages = (...args) => {
          const [handlePageNav, pagesPerList, pageList, currentPage, pages] = args;
          const items = [];
          const children = '...';
          [1, 2, 3].forEach((number) => {
        Severity: Minor
        Found in client/src/components/common/Pagination/pageUtils.js - About 1 hr to fix

          Function HeaderRigth has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const HeaderRigth = () => {
              if (auth.isAuthenticated) {
                return (
                  <UncontrolledDropdown>
                    <DropdownToggle caret color="primary" className="mr-5">
          Severity: Minor
          Found in client/src/components/common/Header.js - About 1 hr to fix

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

                  request(app)
                    .post('/user/signup')
                    .set('Content-Type', 'application/json')
                    .send({ email: 'sourav@pesto.tech', password: '12345678' })
                    .expect(200)
            Severity: Major
            Found in server/__test__/user.test.js and 4 other locations - About 55 mins to fix
            server/__test__/apps.test.js on lines 8..17
            server/__test__/user.test.js on lines 15..28
            server/__test__/user.test.js on lines 65..76
            server/__test__/user.test.js on lines 79..88

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

            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

            module.exports.hashPassword = (plainText) => new Promise((resolve, reject) => {
              bcrypt.hash(plainText, SALT_ROUND, (err, hash) => {
                if (err) reject(err);
                resolve(hash);
              });
            Severity: Minor
            Found in server/lib/passwordLib.js and 1 other location - About 55 mins to fix
            server/lib/authTokenLib.js on lines 18..23

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

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

                        request(app)
                            .get('/user/signin')
                            .set('Content-Type', 'application/json')
                            .send({ email: 'sourav@pesto.tech',password:'12345678'})
                            .expect(200)
            Severity: Major
            Found in server/__test__/user.test.js and 4 other locations - About 55 mins to fix
            server/__test__/apps.test.js on lines 8..17
            server/__test__/user.test.js on lines 15..28
            server/__test__/user.test.js on lines 31..46
            server/__test__/user.test.js on lines 65..76

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

            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

            const verifyAuthToken = (authToken) => new Promise((resolve, reject) => {
              jwt.verify(authToken, JWT_SECRET, (err, decoded) => {
                if (err) reject(err);
                resolve(decoded);
              });
            Severity: Minor
            Found in server/lib/authTokenLib.js and 1 other location - About 55 mins to fix
            server/lib/passwordLib.js on lines 4..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 54.

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

                request(app)
                  .post('/user/signup')
                  .set('Content-Type', 'application/json')
                  .send({ email: 'parthiban.rakesh95@gmail.com', password: '12345678' })
                  .expect(200)
            Severity: Major
            Found in server/__test__/apps.test.js and 4 other locations - About 55 mins to fix
            server/__test__/user.test.js on lines 15..28
            server/__test__/user.test.js on lines 31..46
            server/__test__/user.test.js on lines 65..76
            server/__test__/user.test.js on lines 79..88

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

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

                  request(app)
                    .post('/user/signup')
                    .set('Content-Type', 'application/json')
                    .send({ email: 'sourav@pesto.tech', password: '12345678' })
                    .expect(200)
            Severity: Major
            Found in server/__test__/user.test.js and 4 other locations - About 55 mins to fix
            server/__test__/apps.test.js on lines 8..17
            server/__test__/user.test.js on lines 31..46
            server/__test__/user.test.js on lines 65..76
            server/__test__/user.test.js on lines 79..88

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

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

                        request(app)
                            .post('/user/signin')
                            .set('Content-Type', 'application/json')
                            .send({ email: 'sourav@pesto.tech',password:'password'})
                            .expect(200)
            Severity: Major
            Found in server/__test__/user.test.js and 4 other locations - About 55 mins to fix
            server/__test__/apps.test.js on lines 8..17
            server/__test__/user.test.js on lines 15..28
            server/__test__/user.test.js on lines 31..46
            server/__test__/user.test.js on lines 79..88

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

            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

                  <Col sm={12} md={2} lg={2}>
                    <img src="https://via.placeholder.com/160x140" alt="placeholder" />
                  </Col>
            Severity: Minor
            Found in client/src/components/Dashboard/TaskHistory/RelayHistoryList.js and 1 other location - About 50 mins to fix
            client/src/components/common/Image.js on lines 6..8

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

            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

                <Col sm={12} md={2} lg={2}>
                  <img src="https://via.placeholder.com/160x140" alt="placeholder" />
                </Col>
            Severity: Minor
            Found in client/src/components/common/Image.js and 1 other location - About 50 mins to fix
            client/src/components/Dashboard/TaskHistory/RelayHistoryList.js on lines 8..10

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

            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

                          <CardText>
                            Last Modified:
                            {' '}
                            {new Date(relay.updatedAt).toLocaleDateString().split('/').join('-')}
                          </CardText>
            Severity: Minor
            Found in client/src/components/Dashboard/ShowAllRelays/ShowAllRelays.js and 1 other location - About 50 mins to fix
            client/src/components/Dashboard/ShowAllRelays/ShowAllRelays.js on lines 37..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 51.

            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

                          <CardText>
                            Created On:
                            {' '}
                            {new Date(relay.createdAt).toLocaleDateString().split('/').join('-')}
                          </CardText>
            Severity: Minor
            Found in client/src/components/Dashboard/ShowAllRelays/ShowAllRelays.js and 1 other location - About 50 mins to fix
            client/src/components/Dashboard/ShowAllRelays/ShowAllRelays.js on lines 32..36

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

            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

            Avoid deeply nested control flow statements.
            Open

                      if (inputMatch) {
                        ActionPerformer.ActionPerformer(relay, event);
                      }
            Severity: Major
            Found in server/thirdparty/controller/SlackTriggerDispatcher.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        for (const [inputName, inputValue] of participantApp.inputs) {
                          if (event[inputName] !== inputValue) {
                            inputMatch = false;
                          }
                        }
              Severity: Major
              Found in server/thirdparty/controller/SlackTriggerDispatcher.js - About 45 mins to fix

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

                RelayProvider.propTypes = {
                  children: PropTypes.oneOfType([
                    PropTypes.arrayOf(PropTypes.node),
                    PropTypes.node,
                  ]).isRequired,
                Severity: Minor
                Found in client/src/shared/RelayProvider.js and 1 other location - About 40 mins to fix
                client/src/shared/PageProvider.js on lines 25..30

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

                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