auth0-extensions/auth0-sso-dashboard-extension

View on GitHub

Showing 60 of 60 total issues

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

export const clients = createReducer(fromJS(initialState), { // eslint-disable-line import/prefer-default-export
  [constants.FETCH_CLIENTS_PENDING]: (state) =>
    state.merge({
      loading: true,
      error: null
Severity: Major
Found in client/reducers/clients.js and 3 other locations - About 5 hrs to fix
client/reducers/applications.js on lines 13..30
client/reducers/connections.js on lines 12..29
client/reducers/groups.js on lines 13..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 150.

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

export const groups = createReducer(fromJS(initialState), { // eslint-disable-line import/prefer-default-export
  [constants.FETCH_GROUPS_PENDING]: (state) =>
    state.merge({
      loading: true,
      error: null
Severity: Major
Found in client/reducers/groups.js and 3 other locations - About 5 hrs to fix
client/reducers/applications.js on lines 13..30
client/reducers/clients.js on lines 12..29
client/reducers/connections.js on lines 12..29

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

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

export const applications = createReducer(fromJS(initialState), { // eslint-disable-line import/prefer-default-export
  [constants.FETCH_APPLICATIONS_PENDING]: (state) =>
    state.merge({
      loading: true,
      error: null
Severity: Major
Found in client/reducers/applications.js and 3 other locations - About 5 hrs to fix
client/reducers/clients.js on lines 12..29
client/reducers/connections.js on lines 12..29
client/reducers/groups.js on lines 13..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 150.

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

export const connections = createReducer(fromJS(initialState), { // eslint-disable-line import/prefer-default-export
  [constants.FETCH_CONNECTIONS_PENDING]: (state) =>
    state.merge({
      loading: true,
      error: null
Severity: Major
Found in client/reducers/connections.js and 3 other locations - About 5 hrs to fix
client/reducers/applications.js on lines 13..30
client/reducers/clients.js on lines 12..29
client/reducers/groups.js on lines 13..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 150.

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

  render() {
    const { application, loading, error, clients, connections } = this.props;
    const applicationJSON = application.toJSON();
    const initialValues = {
      name: this.props.currentName || applicationJSON.name || applicationJSON.client,
Severity: Major
Found in client/containers/Applications/Application.jsx - About 3 hrs to fix

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

      onChangeSearch = (query) => {
        if (query) {
          const apps = _.filter(this.props.applications, (app) => app.name.toLowerCase().indexOf(query) > -1);
          this.setState({ apps });
        } else {
    Severity: Major
    Found in client/containers/Applications/Applications.jsx and 1 other location - About 3 hrs to fix
    client/containers/Applications/UserApplications.jsx on lines 20..27

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

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

      onChangeSearch = (query) => {
        if (query) {
          const apps = _.filter(this.props.applications, (app) => app.name.toLowerCase().indexOf(query) > -1);
          this.setState({ apps });
        } else {
    Severity: Major
    Found in client/containers/Applications/UserApplications.jsx and 1 other location - About 3 hrs to fix
    client/containers/Applications/Applications.jsx on lines 30..37

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

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

      render() {
        const { applications, appId } = this.props;
        const rowsTotal = Object.keys(applications).length;
        let rowIndex = 0;
        return (
    Severity: Major
    Found in client/components/Applications/ApplicationsTable.jsx - About 3 hrs to fix

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

          getResourceServer(req, 'urn:auth0-sso-dashboard')
            .then((resourceServer) => {
              if (!resourceServer) {
                return createResourceServer(req);
              }
      Severity: Major
      Found in server/routes/hooks.js and 1 other location - About 3 hrs to fix
      server/routes/hooks.js on lines 24..44

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

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

          getResourceServer(req, 'urn:auth0-sso-dashboard')
            .then((resourceServer) => {
              if (!resourceServer) {
                return createResourceServer(req);
              }
      Severity: Major
      Found in server/routes/hooks.js and 1 other location - About 3 hrs to fix
      server/routes/hooks.js on lines 48..67

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

      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

        api.delete('/', auth0, requireScope('manage:authorization'), (req, res, next) => {
          if (!config('ALLOW_AUTHZ')) {
            return next();
          }
      
      
      Severity: Major
      Found in server/routes/authorization.js and 1 other location - About 2 hrs to fix
      server/routes/authorization.js on lines 20..28

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

      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

        api.post('/', auth0, requireScope('manage:authorization'), (req, res, next) => {
          if (!config('ALLOW_AUTHZ')) {
            return next();
          }
      
      
      Severity: Major
      Found in server/routes/authorization.js and 1 other location - About 2 hrs to fix
      server/routes/authorization.js on lines 30..38

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

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

        render() {
          if (this.props.loading) {
            return <div />;
          }
          const types = [
      Severity: Major
      Found in client/components/Applications/ApplicationForm.jsx - About 2 hrs to fix

        Function makeRequest has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const makeRequest = (req, path, method, payload) =>
          new Promise((resolve, reject) => getToken(req).then((token) => {
            request(method, `https://${config('AUTH0_DOMAIN')}/api/v2/${path}`)
              .query(method === 'GET' ? payload : {})
              .send(method === 'GET' ? null : payload || {})
        Severity: Minor
        Found in server/lib/queries.js - About 2 hrs 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 render has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            const { loading, error, clients, applications, showModalCreate, showModalDelete, appId, createError } = this.props;
            const apps = this.state.apps.length != 0 ? this.state.apps : applications;
        
            return (
        Severity: Major
        Found in client/containers/Applications/Applications.jsx - About 2 hrs to fix

          Function render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const { user, issuer, onLogout, isAdmin } = this.props;
              const allowAuthz = window.config.ALLOW_AUTHZ;
              return (
                <header className="dashboard-header">
          Severity: Major
          Found in client/components/Header.jsx - About 2 hrs to fix

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

            InputText.propTypes = {
              field: React.PropTypes.object.isRequired,
              fieldName: React.PropTypes.string.isRequired,
              label: React.PropTypes.string.isRequired,
              validationErrors: React.PropTypes.object
            Severity: Major
            Found in client/components/Dashboard/InputText.jsx and 1 other location - About 2 hrs to fix
            client/components/Dashboard/InputCheckBox.jsx on lines 20..25

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

            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

            InputCheckBox.propTypes = {
              field: React.PropTypes.object.isRequired,
              fieldName: React.PropTypes.string.isRequired,
              label: React.PropTypes.string.isRequired,
              validationErrors: React.PropTypes.object
            Severity: Major
            Found in client/components/Dashboard/InputCheckBox.jsx and 1 other location - About 2 hrs to fix
            client/components/Dashboard/InputText.jsx on lines 20..25

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

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

            export function loadCredentials() {
              return (dispatch) => {
                const credentials = loadForAdmin() || loadForUser();
            
                if (credentials) {
            Severity: Minor
            Found in client/actions/auth.js - About 2 hrs to fix

              Function render has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  const { loading, clients, connections, error, showModal } = this.props;
              
                  if (loading || error) {
                    return <div />;
              Severity: Minor
              Found in client/components/Applications/CreateApplicationDialog.jsx - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language